client

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2021 License: MIT Imports: 12 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(privateToken, apiVersion string) *Client

NewClient creates a new Shippo API client instance.

func (*Client) AddBatchShipmentsToBatch

func (c *Client) AddBatchShipmentsToBatch(objectID string, batchShipments []*models.BatchShipmentInput) (*models.Batch, error)

AddBatchShipmentsToBatch adds batch shipment(s) to an existing Batch.

func (*Client) CreateAddress

func (c *Client) CreateAddress(input *models.AddressInput) (*models.Address, error)

CreateAddress creates a new address object.

func (*Client) CreateCarrierAccount

func (c *Client) CreateCarrierAccount(input *models.CarrierAccountInput) (*models.CarrierAccount, error)

CreateCarrierAccount creates a new carrier account object.

func (*Client) CreateCustomsDeclaration

func (c *Client) CreateCustomsDeclaration(input *models.CustomsDeclarationInput) (*models.CustomsDeclaration, error)

CreateCustomsDeclaration creates a new customs declaration object.

func (*Client) CreateCustomsItem

func (c *Client) CreateCustomsItem(input *models.CustomsItemInput) (*models.CustomsItem, error)

CreateCustomsItem creates a new customs item object.

func (*Client) CreateManifest

func (c *Client) CreateManifest(input *models.ManifestInput) (*models.Manifest, error)

CreateManifest creates a new manifest object.

func (*Client) CreateParcel

func (c *Client) CreateParcel(input *models.ParcelInput) (*models.Parcel, error)

CreateParcel creates a new parcel object.

func (*Client) CreateRefund

func (c *Client) CreateRefund(input *models.RefundInput) (*models.Refund, error)

CreateRefund creates a new refund object.

func (*Client) CreateShipment

func (c *Client) CreateShipment(input *models.ShipmentInput) (*models.Shipment, error)

CreateShipment creates a new shipment object. To create a return label, simply pass the ObjectID of the original outbound Transaction to the ReturnOf field. If this flag is set, purchasing the generated rates will create a Scan-based return label. The advantage of using a Scan-based label is that you will only be charged if the label is used/scanned (not when the label is created). The Shippo API currently supports Scan-based returns for USPS, Fedex and UPS. When the ReturnOf flag is set, Shippo API will automatically swap the address_from and address_to fields for label creation. Please check the return service terms and condition for the carrier you intend to use.

func (*Client) GetShippingRates

func (c *Client) GetShippingRates(shipmentObjectID, currencyCode string) ([]*models.Rate, error)

GetShippingRates gets rates for a shipping object.

func (*Client) GetTrackingUpdate

func (c *Client) GetTrackingUpdate(carrier, trackingNumber string) (*models.TrackingStatus, error)

GetTrackingUpdate requests the tracking status of a shipment.

func (*Client) ListAllAddresses

func (c *Client) ListAllAddresses() ([]*models.Address, error)

ListAllAddresses lists all addresses.

func (*Client) ListAllCarrierAccounts

func (c *Client) ListAllCarrierAccounts() ([]*models.CarrierAccount, error)

ListAllCarrierAccounts lists all carrier accounts.

func (*Client) ListAllCustomsDeclaration

func (c *Client) ListAllCustomsDeclaration() ([]*models.CustomsDeclaration, error)

ListAllCustomsDeclaration lists all customs declaration objects.

func (*Client) ListAllCustomsItems

func (c *Client) ListAllCustomsItems() ([]*models.CustomsItem, error)

ListAllCustomsItems lists all customs item objects.

func (*Client) ListAllManifests

func (c *Client) ListAllManifests() ([]*models.Manifest, error)

ListAllManifests lists all manifest objects.

func (*Client) ListAllParcels

func (c *Client) ListAllParcels() ([]*models.Parcel, error)

ListAllParcels lists all parcel objects.

func (*Client) ListAllRefunds

func (c *Client) ListAllRefunds() ([]*models.Refund, error)

ListAllRefunds list all refund objects.

func (*Client) ListAllShipments

func (c *Client) ListAllShipments() ([]*models.Shipment, error)

ListAllShipments lists all shipment objects.

func (*Client) ListAllTransactions

func (c *Client) ListAllTransactions() ([]*models.Transaction, error)

ListAllTransactions lists all transaction objects.

func (*Client) PurchaseBatch

func (c *Client) PurchaseBatch(objectID string) (*models.Batch, error)

PurchaseBatch purchases an existing batch with an ObjectStatus of "VALID". Once you send invoke this function, the batch ObjectStatus will be change to PURCHASING. When all the shipments are purchased, the ObjectStatus will change to PURCHASED and you will receive a batch_purchased webhook indicating that the batch has been purchased.

func (*Client) PurchaseShippingLabel

func (c *Client) PurchaseShippingLabel(input *models.TransactionInput) (*models.Transaction, error)

PurchaseShippingLabel creates a new transaction object and purchases the shipping label for the provided rate.

func (*Client) RegisterTrackingWebhook

func (c *Client) RegisterTrackingWebhook(carrier, trackingNumber, metadata string) (*models.TrackingStatus, error)

RegisterTrackingWebhook registers a tracking webhook. TODO: documentation on this API endpoint is not clear. https://goshippo.com/docs/reference#tracks-create

func (*Client) RemoveBatchShipmentsFromBatch

func (c *Client) RemoveBatchShipmentsFromBatch(objectID string, batchShipmentIDs []string) (*models.Batch, error)

RemoveBatchShipmentsFromBatch removes batch shipment(s) from an existing Batch.

func (*Client) RetrieveAddress

func (c *Client) RetrieveAddress(objectID string) (*models.Address, error)

RetrieveAddress retrieves an existing address by object id.

func (*Client) RetrieveBatch

func (c *Client) RetrieveBatch(objectID string, page uint, objectResultsFilter string) (*models.Batch, error)

RetrieveBatch retrieves an existing batch. BatchShipments are displayed 100 at a time. You can iterate through each "page" by specifying non-zero value to page parameter. You can also filter based on BatchShipment status using objectResultsFilter parameter

func (*Client) RetrieveCarrierAccount

func (c *Client) RetrieveCarrierAccount(objectID string) (*models.CarrierAccount, error)

RetrieveCarrierAccount retrieves an existing carrier account by object id.

func (*Client) RetrieveCustomsDeclaration

func (c *Client) RetrieveCustomsDeclaration(objectID string) (*models.CustomsDeclaration, error)

RetrieveCustomsDeclaration retrieves an existing customs declaration by object id.

func (*Client) RetrieveCustomsItem

func (c *Client) RetrieveCustomsItem(objectID string) (*models.CustomsItem, error)

RetrieveCustomsItem retrieves an existing customs item by object id.

func (*Client) RetrieveManifest

func (c *Client) RetrieveManifest(objectID string) (*models.Manifest, error)

RetrieveManifest retrieves an existing manifest by object id.

func (*Client) RetrieveParcel

func (c *Client) RetrieveParcel(objectID string) (*models.Parcel, error)

RetrieveParcel retrieves an existing parcel by object id.

func (*Client) RetrieveRate

func (c *Client) RetrieveRate(objectID string) (*models.Rate, error)

RetrieveRate retrieves an existing rate by object id.

func (*Client) RetrieveRefund

func (c *Client) RetrieveRefund(objectID string) (*models.Refund, error)

RetrieveRefund retrieves an existing refund by object id.

func (*Client) RetrieveShipment

func (c *Client) RetrieveShipment(objectID string) (*models.Shipment, error)

RetrieveShipment retrieves an existing shipment by object id.

func (*Client) RetrieveTransaction

func (c *Client) RetrieveTransaction(objectID string) (*models.Transaction, error)

RetrieveTransaction retrieves an existing transaction by object id.

func (*Client) SetTraceLogger

func (c *Client) SetTraceLogger(logger *log.Logger) *log.Logger

SetTraceLogger sets a new trace logger and returns the old logger. If logger is not nil, Client will output all internal messages to the logger.

func (*Client) UpdateCarrierAccount

func (c *Client) UpdateCarrierAccount(objectID string, input *models.CarrierAccountInput) (*models.CarrierAccount, error)

UpdateCarrierAccount updates an existing carrier account. AccountID and Carrier cannot be updated because they form the unique identifier together.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL