Documentation
¶
Index ¶
- Constants
- func BoolPtr(b bool) *bool
- func StringPtr(s string) *string
- func UnmarshalJSONObject(data []byte) (interface{}, error)
- type APIError
- type APIKey
- type APIKeys
- type Address
- type AddressVerification
- type AddressVerificationDetails
- type AddressVerificationFieldError
- type AddressVerifications
- type Batch
- type BatchStatus
- type CarrierAccount
- type CarrierField
- type CarrierFields
- type CarrierMessage
- type CarrierType
- type Client
- func (c *Client) AddShipmentsToBatch(batchID string, in ...*Shipment) (out *Batch, err error)
- func (c *Client) AddShipmentsToBatchWithContext(ctx context.Context, batchID string, in ...*Shipment) (out *Batch, err error)
- func (c *Client) BuyBatch(batchID string) (out *Batch, err error)
- func (c *Client) BuyBatchWithContext(ctx context.Context, batchID string) (out *Batch, err error)
- func (c *Client) BuyOrder(orderID, carrier, service string) (out *Order, err error)
- func (c *Client) BuyOrderWithContext(ctx context.Context, orderID, carrier, service string) (out *Order, err error)
- func (c *Client) BuyPickup(pickupID string, rate *PickupRate) (out *Pickup, err error)
- func (c *Client) BuyPickupWithContext(ctx context.Context, pickupID string, rate *PickupRate) (out *Pickup, err error)
- func (c *Client) BuyShipment(shipmentID string, rate *Rate, insurance string) (out *Shipment, err error)
- func (c *Client) BuyShipmentWithContext(ctx context.Context, shipmentID string, rate *Rate, insurance string) (out *Shipment, err error)
- func (c *Client) CancelPickup(pickupID string) (out *Pickup, err error)
- func (c *Client) CancelPickupWithContext(ctx context.Context, pickupID string) (out *Pickup, err error)
- func (c *Client) CreateAddress(in *Address, opts *CreateAddressOptions) (out *Address, err error)
- func (c *Client) CreateAddressWithContext(ctx context.Context, in *Address, opts *CreateAddressOptions) (out *Address, err error)
- func (c *Client) CreateAndBuyBatch(in ...*Shipment) (out *Batch, err error)
- func (c *Client) CreateAndBuyBatchWithContext(ctx context.Context, in ...*Shipment) (out *Batch, err error)
- func (c *Client) CreateBatch(in ...*Shipment) (out *Batch, err error)
- func (c *Client) CreateBatchScanForms(batchID, format string) (out *Batch, err error)
- func (c *Client) CreateBatchScanFormsWithContext(ctx context.Context, batchID, format string) (out *Batch, err error)
- func (c *Client) CreateBatchWithContext(ctx context.Context, in ...*Shipment) (out *Batch, err error)
- func (c *Client) CreateCarrierAccount(in *CarrierAccount) (out *CarrierAccount, err error)
- func (c *Client) CreateCarrierAccountWithContext(ctx context.Context, in *CarrierAccount) (out *CarrierAccount, err error)
- func (c *Client) CreateCustomsInfo(in *CustomsInfo) (out *CustomsInfo, err error)
- func (c *Client) CreateCustomsInfoWithContext(ctx context.Context, in *CustomsInfo) (out *CustomsInfo, err error)
- func (c *Client) CreateCustomsItem(in *CustomsItem) (out *CustomsItem, err error)
- func (c *Client) CreateCustomsItemWithContext(ctx context.Context, in *CustomsItem) (out *CustomsItem, err error)
- func (c *Client) CreateInsurance(in *Insurance) (out *Insurance, err error)
- func (c *Client) CreateInsuranceWithContext(ctx context.Context, in *Insurance) (out *Insurance, err error)
- func (c *Client) CreateOrder(in *Order, accounts ...*CarrierAccount) (out *Order, err error)
- func (c *Client) CreateOrderWithContext(ctx context.Context, in *Order, accounts ...*CarrierAccount) (out *Order, err error)
- func (c *Client) CreateParcel(in *Parcel) (out *Parcel, err error)
- func (c *Client) CreateParcelWithContext(ctx context.Context, in *Parcel) (out *Parcel, err error)
- func (c *Client) CreatePickup(in *Pickup) (out *Pickup, err error)
- func (c *Client) CreatePickupWithContext(ctx context.Context, in *Pickup) (out *Pickup, err error)
- func (c *Client) CreateReport(typ string, in *Report) (out *Report, err error)
- func (c *Client) CreateReportWithContext(ctx context.Context, typ string, in *Report) (out *Report, err error)
- func (c *Client) CreateScanForm(shipmentIDs ...string) (out *ScanForm, err error)
- func (c *Client) CreateScanFormWithContext(ctx context.Context, shipmentIDs ...string) (out *ScanForm, err error)
- func (c *Client) CreateShipment(in *Shipment) (out *Shipment, err error)
- func (c *Client) CreateShipmentWithContext(ctx context.Context, in *Shipment) (out *Shipment, err error)
- func (c *Client) CreateTracker(opts *CreateTrackerOptions) (out *Tracker, err error)
- func (c *Client) CreateTrackerList(opts ...*CreateTrackerOptions) error
- func (c *Client) CreateTrackerListWithContext(ctx context.Context, opts ...*CreateTrackerOptions) error
- func (c *Client) CreateTrackerWithContext(ctx context.Context, opts *CreateTrackerOptions) (out *Tracker, err error)
- func (c *Client) CreateUser(in *UserOptions) (out *User, err error)
- func (c *Client) CreateUserWithContext(ctx context.Context, in *UserOptions) (out *User, err error)
- func (c *Client) CreateWebhook(u string) (out *Webhook, err error)
- func (c *Client) CreateWebhookWithContext(ctx context.Context, u string) (out *Webhook, err error)
- func (c *Client) DeleteCarrierAccount(carrierAccountID string) error
- func (c *Client) DeleteCarrierAccountWithContext(ctx context.Context, carrierAccountID string) error
- func (c *Client) DeleteUser(userID string) error
- func (c *Client) DeleteUserWithContext(ctx context.Context, userID string) error
- func (c *Client) DeleteWebhook(webhookID string) error
- func (c *Client) DeleteWebhookWithContext(ctx context.Context, webhookID string) error
- func (c *Client) EnableWebhook(webhookID string) (out *Webhook, err error)
- func (c *Client) EnableWebhookWithContext(ctx context.Context, webhookID string) (out *Webhook, err error)
- func (c *Client) GetAPIKeys() (out *APIKeys, err error)
- func (c *Client) GetAPIKeysWithContext(ctx context.Context) (out *APIKeys, err error)
- func (c *Client) GetAddress(addressID string) (out *Address, err error)
- func (c *Client) GetAddressWithContext(ctx context.Context, addressID string) (out *Address, err error)
- func (c *Client) GetBatch(batchID string) (out *Batch, err error)
- func (c *Client) GetBatchLabels(batchID, format string) (out *Batch, err error)
- func (c *Client) GetBatchLabelsWithContext(ctx context.Context, batchID, format string) (out *Batch, err error)
- func (c *Client) GetBatchWithContext(ctx context.Context, batchID string) (out *Batch, err error)
- func (c *Client) GetCarrierAccount(carrierAccountID string) (out *CarrierAccount, err error)
- func (c *Client) GetCarrierAccountWithContext(ctx context.Context, carrierAccountID string) (out *CarrierAccount, err error)
- func (c *Client) GetCarrierTypes() (out []*CarrierType, err error)
- func (c *Client) GetCarrierTypesWithContext(ctx context.Context) (out []*CarrierType, err error)
- func (c *Client) GetCustomsInfo(customsInfoID string) (out *CustomsInfo, err error)
- func (c *Client) GetCustomsInfoWithContext(ctx context.Context, customsInfoID string) (out *CustomsInfo, err error)
- func (c *Client) GetCustomsItem(customsItemID string) (out *CustomsItem, err error)
- func (c *Client) GetCustomsItemWithContext(ctx context.Context, customsItemID string) (out *CustomsItem, err error)
- func (c *Client) GetEvent(eventID string) (out *Event, err error)
- func (c *Client) GetEventWithContext(ctx context.Context, eventID string) (out *Event, err error)
- func (c *Client) GetInsurance(insuranceID string) (out *Insurance, err error)
- func (c *Client) GetInsuranceWithContext(ctx context.Context, insuranceID string) (out *Insurance, err error)
- func (c *Client) GetOrder(orderID string) (out *Order, err error)
- func (c *Client) GetOrderRates(orderID string) (out *Order, err error)
- func (c *Client) GetOrderRatesWithContext(ctx context.Context, orderID string) (out *Order, err error)
- func (c *Client) GetOrderWithContext(ctx context.Context, orderID string) (out *Order, err error)
- func (c *Client) GetParcel(parcelID string) (out *Parcel, err error)
- func (c *Client) GetParcelWithContext(ctx context.Context, parcelID string) (out *Parcel, err error)
- func (c *Client) GetPickup(pickupID string) (out *Pickup, err error)
- func (c *Client) GetPickupWithContext(ctx context.Context, pickupID string) (out *Pickup, err error)
- func (c *Client) GetRate(rateID string) (out *Rate, err error)
- func (c *Client) GetRateWithContext(ctx context.Context, rateID string) (out *Rate, err error)
- func (c *Client) GetReport(typ, reportID string) (out *Report, err error)
- func (c *Client) GetReportWithContext(ctx context.Context, typ, reportID string) (out *Report, err error)
- func (c *Client) GetScanForm(scanFormID string) (out *ScanForm, err error)
- func (c *Client) GetScanFormWithContext(ctx context.Context, scanFormID string) (out *ScanForm, err error)
- func (c *Client) GetShipment(shipmentID string) (out *Shipment, err error)
- func (c *Client) GetShipmentLabel(shipmentID, format string) (out *Shipment, err error)
- func (c *Client) GetShipmentLabelWithContext(ctx context.Context, shipmentID, format string) (out *Shipment, err error)
- func (c *Client) GetShipmentRates(shipmentID string) (out []*Rate, err error)
- func (c *Client) GetShipmentRatesWithContext(ctx context.Context, shipmentID string) (out []*Rate, err error)
- func (c *Client) GetShipmentSmartrates(shipmentID string) (out []*Rate, err error)
- func (c *Client) GetShipmentSmartratesWithContext(ctx context.Context, shipmentID string) (out []*Rate, err error)
- func (c *Client) GetShipmentWithContext(ctx context.Context, shipmentID string) (out *Shipment, err error)
- func (c *Client) GetTracker(trackerID string) (out *Tracker, err error)
- func (c *Client) GetTrackerWithContext(ctx context.Context, trackerID string) (out *Tracker, err error)
- func (c *Client) GetUser(userID string) (out *User, err error)
- func (c *Client) GetUserWithContext(ctx context.Context, userID string) (out *User, err error)
- func (c *Client) GetWebhook(webhookID string) (out *Webhook, err error)
- func (c *Client) GetWebhookWithContext(ctx context.Context, webhookID string) (out *Webhook, err error)
- func (c *Client) InsureShipment(shipmentID, amount string) (out *Shipment, err error)
- func (c *Client) InsureShipmentWithContext(ctx context.Context, shipmentID, amount string) (out *Shipment, err error)
- func (c *Client) ListAddresses(opts *ListOptions) (out *ListAddressResult, err error)
- func (c *Client) ListAddressesWithContext(ctx context.Context, opts *ListOptions) (out *ListAddressResult, err error)
- func (c *Client) ListBatches(opts *ListOptions) (out *ListBatchesResult, err error)
- func (c *Client) ListBatchesWithContext(ctx context.Context, opts *ListOptions) (out *ListBatchesResult, err error)
- func (c *Client) ListCarrierAccounts() (out []*CarrierAccount, err error)
- func (c *Client) ListCarrierAccountsWithContext(ctx context.Context) (out []*CarrierAccount, err error)
- func (c *Client) ListEventPayloads(eventID string) (out []*EventPayload, err error)
- func (c *Client) ListEventPayloadsWithContext(ctx context.Context, eventID string) (out []*EventPayload, err error)
- func (c *Client) ListEvents(opts *ListOptions) (out *ListEventsResult, err error)
- func (c *Client) ListEventsWithContext(ctx context.Context, opts *ListOptions) (out *ListEventsResult, err error)
- func (c *Client) ListInsurances(opts *ListOptions) (out *ListInsurancesResult, err error)
- func (c *Client) ListInsurancesWithContext(ctx context.Context, opts *ListOptions) (out *ListInsurancesResult, err error)
- func (c *Client) ListReports(typ string, opts *ListReportsOptions) (out *ListReportsResult, err error)
- func (c *Client) ListReportsWithContext(ctx context.Context, typ string, opts *ListReportsOptions) (out *ListReportsResult, err error)
- func (c *Client) ListScanForms(opts *ListOptions) (out *ListScanFormsResult, err error)
- func (c *Client) ListScanFormsWithContext(ctx context.Context, opts *ListOptions) (out *ListScanFormsResult, err error)
- func (c *Client) ListShipments(opts *ListShipmentsOptions) (out *ListShipmentsResult, err error)
- func (c *Client) ListShipmentsWithContext(ctx context.Context, opts *ListShipmentsOptions) (out *ListShipmentsResult, err error)
- func (c *Client) ListTrackers(opts *ListTrackersOptions) (out *ListTrackersResult, err error)
- func (c *Client) ListTrackersWithContext(ctx context.Context, opts *ListTrackersOptions) (out *ListTrackersResult, err error)
- func (c *Client) ListWebhooks() (out []*Webhook, err error)
- func (c *Client) ListWebhooksWithContext(ctx context.Context) (out []*Webhook, err error)
- func (c *Client) RefundShipment(shipmentID string) (out *Shipment, err error)
- func (c *Client) RefundShipmentWithContext(ctx context.Context, shipmentID string) (out *Shipment, err error)
- func (c *Client) RemoveShipmentsFromBatch(batchID string, shipmentIDs ...string) (out *Batch, err error)
- func (c *Client) RemoveShipmentsFromBatchWithContext(ctx context.Context, batchID string, shipmentIDs ...string) (out *Batch, err error)
- func (c *Client) UpdateCarrierAccount(in *CarrierAccount) (out *CarrierAccount, err error)
- func (c *Client) UpdateCarrierAccountWithContext(ctx context.Context, in *CarrierAccount) (out *CarrierAccount, err error)
- func (c *Client) UpdateUser(in *UserOptions) (out *User, err error)
- func (c *Client) UpdateUserWithContext(ctx context.Context, in *UserOptions) (out *User, err error)
- func (c *Client) VerifyAddress(addressID string) (out *Address, err error)
- func (c *Client) VerifyAddressWithContext(ctx context.Context, addressID string) (out *Address, err error)
- type CreateAddressOptions
- type CreateTrackerOptions
- type CustomsInfo
- type CustomsItem
- type Event
- type EventPayload
- type Fee
- type Form
- type Insurance
- type ListAddressResult
- type ListBatchesResult
- type ListEventsResult
- type ListInsurancesResult
- type ListOptions
- type ListReportsOptions
- type ListReportsResult
- type ListScanFormsResult
- type ListShipmentsOptions
- type ListShipmentsResult
- type ListTrackersOptions
- type ListTrackersResult
- type ListTrackersUpdatedOptions
- type Order
- type Parcel
- type Payment
- type PaymentLog
- type Pickup
- type PickupRate
- type PostageLabel
- type Rate
- type Refund
- type Report
- type ScanForm
- type Shipment
- type ShipmentOptions
- type TaxIdentifier
- type TimeInTransit
- type Tracker
- type TrackingCarrierDetail
- type TrackingDetail
- type TrackingLocation
- type User
- type UserOptions
- type Webhook
Constants ¶
const Version = "1.4.0"
Variables ¶
This section is empty.
Functions ¶
func UnmarshalJSONObject ¶ added in v1.1.0
UnmarshalJSONObject attempts to unmarshal an easypost object from JSON data. An error is only returned if data is non-zero length and JSON decoding fails. If data contains a valid JSON object with an "object" key/value that matches a known object type, it will return a pointer to the corresponding object type from this package, e.g. *Address, *Batch, *Refund, etc. If the decoded JSON doesn't match, the return value will be the default type stored by json.Unmarshal.
Types ¶
type APIError ¶
type APIError struct { // Status is the HTTP text status of the response. Status string // StatusCode is the HTTP numerical status code of the response. StatusCode int // Code is an error code returned by the API. It may be empty. Code string `json:"code,omitempty"` // Message is a human-readable error code returned by the API. It may be // empty. Message string `json:"message,omitempty"` // Field may be provided when the error relates to a specific field. Field string `json:"field,omitempty"` // Suggestion may be provided if the API can provide a suggestion to fix // the error. Suggestion string `json:"suggestion,omitempty"` // Errors may be provided if there are multiple errors, for example if // multiple fields have invalid values. Errors []*APIError `json:"errors,omitempty"` }
APIError provides data on why an API request failed. It will be the type returned by Client methods when the HTTP API returns an HTTP error code. It will not be returned on network, parsing or context errors.
c := easypost.New(BadEasyPostAPIKey) out, err := c.GetAPIKeys() if err, ok := err.(*easypost.APIError); ok { fmt.Println("EasyPost error code", err.Code) }
type APIKey ¶
type APIKey struct { Object string `json:"object,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` Key string `json:"key,omitempty"` }
APIKey represents a single API key.
type APIKeys ¶
type APIKeys struct { ID string `json:"id,omitempty"` Children []*APIKeys `json:"children,omitempty"` Keys []*APIKey `json:"keys,omitempty"` }
APIKeys contains information about a list of API keys for the given user and any child users.
type Address ¶
type Address struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Reference string `json:"reference,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Street1 string `json:"street1,omitempty"` Street2 string `json:"street2,omitempty"` City string `json:"city,omitempty"` State string `json:"state,omitempty"` Zip string `json:"zip,omitempty"` Country string `json:"country,omitempty"` Name string `json:"name,omitempty"` Company string `json:"company,omitempty"` Phone string `json:"phone,omitempty"` Email string `json:"email,omitempty"` Residential bool `json:"residential,omitempty"` CarrierFacility string `json:"carrier_facility,omitempty"` FederalTaxID string `json:"federal_tax_id,omitempty"` StateTaxID string `json:"state_tax_id,omitempty"` Verifications *AddressVerifications `json:"verifications,omitempty"` }
Address objects are used to represent people, places, and organizations in a number of contexts.
type AddressVerification ¶
type AddressVerification struct { Success bool `json:"success"` Errors []*AddressVerificationFieldError `json:"errors"` Details *AddressVerificationDetails `json:"details"` }
AddressVerification holds data relating to addres verification status.
type AddressVerificationDetails ¶
type AddressVerificationDetails struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` TimeZone string `json:"time_zone"` }
AddressVerificationDetails contains extra information related to address verification.
type AddressVerificationFieldError ¶
type AddressVerificationFieldError struct { Code string `json:"code,omitempty"` Field string `json:"field,omitempty"` Message string `json:"message,omitempty"` Suggestion string `json:"suggestion,omitempty"` }
AddressVerificationFieldError provides additional information on address validation errors.
type AddressVerifications ¶
type AddressVerifications struct { ZIP4 *AddressVerification `json:"zip4"` Delivery *AddressVerification `json:"delivery"` }
AddressVerifications contains the result of the requested address verifications.
type Batch ¶
type Batch struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Reference string `json:"reference,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` State string `json:"state,omitempty"` NumShipments int `json:"num_shipments,omitempty"` Shipments []*Shipment `json:"shipments,omitempty"` Status *BatchStatus `json:"status,omitempty"` LabelURL string `json:"label_url,omitempty"` ScanForm *ScanForm `json:"scan_form,omitempty"` Pickup *Pickup `json:"pickup,omitempty"` }
Batch represents a batch of shipments.
type BatchStatus ¶
type BatchStatus struct { PostagePurchased int `json:"postage_purchased,omitempty"` PostagePurchaseFailed int `json:"postage_purchase_failed,omitempty"` QueuedForPurchase int `json:"queued_for_purchase,omitempty"` CreationFailed int `json:"creation_failed,omitempty"` }
BatchStatus contains counts of statuses for the shipments in a batch.
type CarrierAccount ¶
type CarrierAccount struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Reference string `json:"reference,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Type string `json:"type,omitempty"` Fields *CarrierFields `json:"fields,omitempty"` Clone bool `json:"clone,omitempty"` Description string `json:"description,omitempty"` Readable string `json:"readable,omitempty"` Credentials map[string]string `json:"credentials"` TestCredentials map[string]string `json:"test_credentials"` }
CarrierAccount encapsulates credentials and other information related to a carrier account.
type CarrierField ¶
type CarrierField struct { Visibility string `json:"visibility,omitempty"` Label string `json:"label,omitempty"` Value string `json:"value,omitempty"` }
CarrierField provides data for a single field in a carrier account.
type CarrierFields ¶
type CarrierFields struct { Credentials map[string]*CarrierField `json:"credentials,omitempty"` TestCredentials map[string]*CarrierField `json:"test_credentials,omitempty"` AutoLink bool `json:"auto_link,omitempty"` CustomWorkflow bool `json:"custom_workflow,omitempty"` }
CarrierFields contains the data for carrier account fields for production and/or test credentials.
type CarrierMessage ¶
type CarrierMessage struct { Carrier string `json:"carrier,omitempty"` Type string `json:"type,omitempty"` Message string `json:"message,omitempty"` CarrierAccountID string `json:"carrier_account_id,omitempty"` }
CarrierMessage contains additional status data that is provided by some carriers for certain operations.
type CarrierType ¶
type CarrierType struct { Object string `json:"object,omitempty"` Type string `json:"type,omitempty"` Fields *CarrierFields `json:"fields,omitempty"` }
CarrierType contains information on a supported carrier. It can be used to determine the valid fields for a carrier account.
type Client ¶
type Client struct { // BaseURL specifies the location of the API. It is used with // ResolveReference to create request URLs. (If 'Path' is specified, it // should end with a trailing slash.) If nil, the default will be used. BaseURL *url.URL // Client is an HTTP client used to make API requests. If nil, // http.DefaultClient will be used. Client *http.Client // APIKey is the user's API key. It is required. // Note: Treat your API Keys as passwords—keep them secret. API Keys give // full read/write access to your account, so they should not be included in // public repositories, emails, client side code, etc. APIKey string // UserAgent is a User-Agent to be sent with API HTTP requests. If empty, // a default will be used. UserAgent string }
A Client provides an HTTP client for EasyPost API operations.
func (*Client) AddShipmentsToBatch ¶
AddShipmentsToBatch adds shipments to an existing batch, and returns the updated batch object.
func (*Client) AddShipmentsToBatchWithContext ¶
func (c *Client) AddShipmentsToBatchWithContext(ctx context.Context, batchID string, in ...*Shipment) (out *Batch, err error)
AddShipmentsToBatchWithContext performs the same operation as AddShipmentsToBatch, but allows specifying a context that can interrupt the request.
func (*Client) BuyBatch ¶
BuyBatch initializes purchases for the shipments in the batch. The updated batch object is returned.
func (*Client) BuyBatchWithContext ¶
BuyBatchWithContext performs the same operation as BuyBatch, but allows specifying a context that can interrupt the request.
func (*Client) BuyOrder ¶
BuyOrder purchases an order. This operation populates the TrackingCode and PostageLabel attributes of each Shipment.
c := easypost.New(MyEasyPostAPIKey) out, err := c.Buy("order_1", "FedEx", "FEDEX_GROUND")
func (*Client) BuyOrderWithContext ¶
func (c *Client) BuyOrderWithContext(ctx context.Context, orderID, carrier, service string) (out *Order, err error)
BuyOrderWithContext performs the same operation as GBuyOrder, but allows specifying a context that can interrupt the request.
func (*Client) BuyPickup ¶
func (c *Client) BuyPickup(pickupID string, rate *PickupRate) (out *Pickup, err error)
BuyPickup purchases and schedules a pickup.
c := easypost.New(MyEasyPostAPIKey) rate := &PickupRate{Carrier: "UPS", Service: "Same-Day Pickup"} out, err := c.BuyPickup("pck_1", rate)
func (*Client) BuyPickupWithContext ¶
func (c *Client) BuyPickupWithContext(ctx context.Context, pickupID string, rate *PickupRate) (out *Pickup, err error)
BuyPickupWithContext performs the same operation as BuyPickup, but allows specifying a context that can interrupt the request.
func (*Client) BuyShipment ¶
func (c *Client) BuyShipment(shipmentID string, rate *Rate, insurance string) (out *Shipment, err error)
BuyShipment purchases a shipment. If successful, the returned Shipment will have the PostageLabel attribute populated.
c := easypost.New(MyEasyPostAPIKey) out, err := c.Buy("shp_100", &easypost.Rate{ID: "rate_1001"}, "249.99")
func (*Client) BuyShipmentWithContext ¶
func (c *Client) BuyShipmentWithContext(ctx context.Context, shipmentID string, rate *Rate, insurance string) (out *Shipment, err error)
BuyShipmentWithContext performs the same operation as BuyShipment, but allows specifying a context that can interrupt the request.
func (*Client) CancelPickup ¶
CancelPickup cancels a scheduled pickup.
func (*Client) CancelPickupWithContext ¶
func (c *Client) CancelPickupWithContext(ctx context.Context, pickupID string) (out *Pickup, err error)
CancelPickupWithContext performs the same operation as CancelPickup, but allows specifying a context that can interrupt the request.
func (*Client) CreateAddress ¶
func (c *Client) CreateAddress(in *Address, opts *CreateAddressOptions) (out *Address, err error)
CreateAddress submits a request to create a new address, and returns the result.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateAddress( &easypost.Address{ Street1: "417 Montgomery Street", Street2: "Floor 5", City: "San Francisco", State: "CA", Zip: "94104", Country: "US", Company: "EasyPost", Phone: "415-123-4567", }, &CreateAddrssOptions{Verify: []string{"delivery"}}, )
func (*Client) CreateAddressWithContext ¶
func (c *Client) CreateAddressWithContext(ctx context.Context, in *Address, opts *CreateAddressOptions) (out *Address, err error)
CreateAddressWithContext performs the same operation as CreateAddress, but allows specifying a context that can interrupt the request.
func (*Client) CreateAndBuyBatch ¶
CreateAndBuyBatch creates and buys a new batch of shipments in one request.
func (*Client) CreateAndBuyBatchWithContext ¶
func (c *Client) CreateAndBuyBatchWithContext(ctx context.Context, in ...*Shipment) (out *Batch, err error)
CreateAndBuyBatchWithContext performs the same operation as CreateAndBuyBatch, but allows specifying a context that can interrupt the request.
func (*Client) CreateBatch ¶
CreateBatch creates a new batch of shipments. It optionally accepts one or more shipments to add to the new batch. If successful, a new batch object is returned.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateBatch( &easypost.Shipment{ID: "shp_100"}, &easypost.Shipment{ID: "shp_101"}, &easypost.Shipment{ID: "shp_102"}, )
func (*Client) CreateBatchScanForms ¶ added in v1.2.0
CreateBatchScanForms generates a scan form for the batch.
func (*Client) CreateBatchScanFormsWithContext ¶ added in v1.2.0
func (c *Client) CreateBatchScanFormsWithContext(ctx context.Context, batchID, format string) (out *Batch, err error)
CreateBatchScanFormsWithContext performs the same operation as CreateBatchScanForms, but allows specifying a context that can interrupt the request.
func (*Client) CreateBatchWithContext ¶
func (c *Client) CreateBatchWithContext(ctx context.Context, in ...*Shipment) (out *Batch, err error)
CreateBatchWithContext performs the same operation as CreateBatch, but allows specifying a context that can interrupt the request.
func (*Client) CreateCarrierAccount ¶
func (c *Client) CreateCarrierAccount(in *CarrierAccount) (out *CarrierAccount, err error)
CreateCarrierAccount creates a new carrier account. It can only be used with a production API key.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateCarrierAccount( &easypost.CarrierAccount{ Type: "UpsAccount", Description: "NY Location UPS Account", Reference: "my reference", Credentials: map[string]string{ "user_id": "USERID", "password": "PASSWORD", "access_license_number": "ALN", }, }, )
func (*Client) CreateCarrierAccountWithContext ¶
func (c *Client) CreateCarrierAccountWithContext(ctx context.Context, in *CarrierAccount) (out *CarrierAccount, err error)
CreateCarrierAccountWithContext performs the same operation as CreateCarrierAccount, but allows specifying a context that can interrupt the request.
func (*Client) CreateCustomsInfo ¶
func (c *Client) CreateCustomsInfo(in *CustomsInfo) (out *CustomsInfo, err error)
CreateCustomsInfo creates a new CustomsInfo object.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateCustomsInfo( &easypost.CustomsInfo{ CustomsCertify: true, CustomsSigner: "Steve Brule", CustomsType: "merchandise", RestrictionType: "none", EELPFC: "NOEEI 30.37(a)", CustomsItems: []*easypost.CustomsItem{ &easypost.CustomsItem{ID: "cstitem_2002"}, &easypost.CustomsItem{ Description: "Sweet shirts", Quantity: 2, Value: 23, Weight: 11, HSTarriffNumber: "654321", OriginCountry: "US", }, }, }, )
func (*Client) CreateCustomsInfoWithContext ¶
func (c *Client) CreateCustomsInfoWithContext(ctx context.Context, in *CustomsInfo) (out *CustomsInfo, err error)
CreateCustomsInfoWithContext performs the same operation as CreateCustomsInfo, but allows specifying a context that can interrupt the request.
func (*Client) CreateCustomsItem ¶
func (c *Client) CreateCustomsItem(in *CustomsItem) (out *CustomsItem, err error)
CreateCustomsItem creates a new CustomsItem object.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateCustomsItem( &easypost.CustomsItem{ Description: "T-shirt", Quantity: 1, Weight: 5, Value: 10, HSTariffNumber: "123456", OriginCountry: "US", }, )
func (*Client) CreateCustomsItemWithContext ¶
func (c *Client) CreateCustomsItemWithContext(ctx context.Context, in *CustomsItem) (out *CustomsItem, err error)
CreateCustomsItemWithContext performs the same operation as CreateCustomsItem, but allows specifying a context that can interrupt the request.
func (*Client) CreateInsurance ¶
CreateInsurance creats an insurance object for a shipment purchased outside of EasyPost. ToAddress, FromAddress, TrackingCode and Amount fields must be provided. Providing a value in the Carrier field is optional, but can help avoid ambiguity and provide a shorter response time.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateInsurace( &easypost.Insurance{ ToAddress: &easypost.Address{ID: "adr_102"}, FromAddress: &easypost.Address{ID: "adr_101"}, TrackingCode: "9400110898825022579493", Carrier: "USPS", Reference: "insuranceRef1", Amount: 100, )
func (*Client) CreateInsuranceWithContext ¶
func (c *Client) CreateInsuranceWithContext(ctx context.Context, in *Insurance) (out *Insurance, err error)
CreateInsuranceWithContext performs the same operation as CreateInsurance, but allows specifying a context that can interrupt the request.
func (*Client) CreateOrder ¶
func (c *Client) CreateOrder(in *Order, accounts ...*CarrierAccount) (out *Order, err error)
CreateOrder creates a new order object. If the accounts parameter is given, the provided carrier accounts will be used to limit the returned rates to the given carrier(s).
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateOrder( &easypost.Order{ ToAddress: &easypost.Address{ID: "adr_1001"}, FromAddress: &easypost.Address{Id: "adr_101"}, Shipments: []*easypost.Shipment{ &easypost.Shipment{ Parcel: &easypost.Parcel{ PredefinedPackage: "FedExBox", Weight: 10.2, }, }, &easypost.Shipment{ Parcel: &easypost.Parcel{ PredefinedPackage: "FedExBox", Weight: 17.5, }, }, }, }, &easypost.CarrierAccount{ID: "ca_101"}, &easypost.CarrierAccount{ID: "ca_102"}, )
func (*Client) CreateOrderWithContext ¶
func (c *Client) CreateOrderWithContext(ctx context.Context, in *Order, accounts ...*CarrierAccount) (out *Order, err error)
CreateOrderWithContext performs the same operation as CreateOrder, but allows specifying a context that can interrupt the request.
func (*Client) CreateParcel ¶
CreateParcel creates a new Parcel object.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateParcel( &easypost.Parcel{ Length: 20.2, Width: 10.9, Height: 5, Weight: 65.9, }, )
func (*Client) CreateParcelWithContext ¶
CreateParcelWithContext performs the same operation as CreateParcel, but allows specifying a context that can interrupt the request.
func (*Client) CreatePickup ¶
CreatePickup creates a new Pickup object, and automatically fetches rates for the given time and location.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreatePickup( &easypost.Pickup{ Reference: "my-first-pickup", MinDatetime: time.Date(2014, 10, 21, 0, 10, 0, 0, time.UTC), MaxDatetime: time.Date(2014, 10, 21, 15, 30, 0, 0, time.UTC), Shipment: &easypost.Shipment{ID: "shp_1"}, Address: &easypost.Address{ID: "ad_1001"}, IsAccountAddress: false, Instructions: "Special pickup instructions", }, )
func (*Client) CreatePickupWithContext ¶
CreatePickupWithContext performs the same operation as CreatePickup, but allows specifying a context that can interrupt the request.
func (*Client) CreateReport ¶
CreateReport generates a new report. Valid Fields for input are StartDate, EndDate and SendEmail. A new Report object is returned. Once the Status is available, the report can be downloded from the provided URL for 30 seconds.
c := easypost.New(MyEasyPostAPIKey) c.CreateReport( "payment_log", &easypost.Report{StartDate: "2016-10-01", EndDate: "2016-10-31"}, )
func (*Client) CreateReportWithContext ¶
func (c *Client) CreateReportWithContext(ctx context.Context, typ string, in *Report) (out *Report, err error)
CreateReportWithContext performs the same operation as CreateReport, but allows specifying a context that can interrupt the request.
func (*Client) CreateScanForm ¶
CreateScanForm creates a scan form for the given Shipments.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateScanForm("shp_1", "shp_2")
func (*Client) CreateScanFormWithContext ¶
func (c *Client) CreateScanFormWithContext(ctx context.Context, shipmentIDs ...string) (out *ScanForm, err error)
CreateScanFormWithContext performs the same operation as CreateScanForm, but allows specifying a context that can interrupt the request.
func (*Client) CreateShipment ¶
CreateShipment creates a new Shipment object. The ToAddress, FromAddress and Parcel attributes are required. These objects may be fully-specified to create new ones at the same time as creating the Shipment, or they can refer to existing objects via their ID attribute. Passing in one or more carrier accounts to CreateShipment limits the returned rates to the specified carriers.
c := easypost.New(MyEasyPostAPIKey) out, err := c.CreateShipment( &easypost.Shipment{ ToAddress: &easypost.Address{ Name: "Dr. Steve Brule", Street1: "179 N Harbor Dr", City: "Redondo Beach", State: "CA", Zip: "90277", Country: "US", Phone: "8573875756", Email: "dr_steve_brule@gmail.com", }, FromAddress: &easypost.Address{ID: "adr_101"}, Parcel: &easypost.Parcel{ Length: 20.2, Width: 10.9, Height: 5, Weight: 65.9, }, CustomsInfo: &easypost.CustomsInfo{ID: "cstinfo_1"}, }, )
func (*Client) CreateShipmentWithContext ¶
func (c *Client) CreateShipmentWithContext(ctx context.Context, in *Shipment) (out *Shipment, err error)
CreateShipmentWithContext performs the same operation as CreateShipment, but allows specifying a context that can interrupt the request.
func (*Client) CreateTracker ¶
func (c *Client) CreateTracker(opts *CreateTrackerOptions) (out *Tracker, err error)
CreateTracker creates a new Tracker object with the provided options. Providing a carrier is optional, but helps to avoid ambiguity in detecting the carrier based on the tracking code format.
func (*Client) CreateTrackerList ¶
func (c *Client) CreateTrackerList(opts ...*CreateTrackerOptions) error
CreateTrackerList asynchronously creates multiple trackers. Only TrackingCode, Carrier and IsReturn parameters are supported.
func (*Client) CreateTrackerListWithContext ¶
func (c *Client) CreateTrackerListWithContext(ctx context.Context, opts ...*CreateTrackerOptions) error
CreateTrackerListWithContext performs the same operation as CreateTrackerList, but allows specifying a context that can interrupt the request.
func (*Client) CreateTrackerWithContext ¶
func (c *Client) CreateTrackerWithContext(ctx context.Context, opts *CreateTrackerOptions) (out *Tracker, err error)
CreateTrackerWithContext performs the same operation as CreateTracker, but allows specifying a context that can interrupt the request.
func (*Client) CreateUser ¶
func (c *Client) CreateUser(in *UserOptions) (out *User, err error)
CreateUser creates a new child user.
c := easypost.New(MyEasyPostAPIKey) opts := &easypost.UserOptions{Name: easypost.StringPtr("Child User")} out, err := c.CreateUser(opts)
func (*Client) CreateUserWithContext ¶
CreateUserWithContext performs the same operation as CreateUser, but allows specifying a context that can interrupt the request.
func (*Client) CreateWebhook ¶
CreateWebhook creates a new webhook with the given URL.
func (*Client) CreateWebhookWithContext ¶
CreateWebhookWithContext performs the same operation as CreateWebhook, but allows specifying a context that can interrupt the request.
func (*Client) DeleteCarrierAccount ¶
DeleteCarrierAccount removes the carrier account with the given ID.
func (*Client) DeleteCarrierAccountWithContext ¶
func (c *Client) DeleteCarrierAccountWithContext(ctx context.Context, carrierAccountID string) error
DeleteCarrierAccountWithContext performs the same operation as DeleteCarrierAccount, but allows specifying a context that can interrupt the request.
func (*Client) DeleteUser ¶
DeleteUser removes a child user.
func (*Client) DeleteUserWithContext ¶
DeleteUserWithContext performs the same operation as DeleteUser, but allows specifying a context that can interrupt the request.
func (*Client) DeleteWebhook ¶
DeleteWebhook removes a webhook.
func (*Client) DeleteWebhookWithContext ¶
DeleteWebhookWithContext performs the same operation as DeleteWebhook, but allows specifying a context that can interrupt the request.
func (*Client) EnableWebhook ¶
EnableWebhook re-enables a disabled webhook.
func (*Client) EnableWebhookWithContext ¶
func (c *Client) EnableWebhookWithContext(ctx context.Context, webhookID string) (out *Webhook, err error)
EnableWebhookWithContext performs the same operation as EnableWebhook, but allows specifying a context that can interrupt the request.
func (*Client) GetAPIKeys ¶
GetAPIKeys returns the list of API keys associated with the current user.
func (*Client) GetAPIKeysWithContext ¶
GetAPIKeysWithContext performs the same operation as GetAPIKeys, but allows specifying a context that can interrupt the request.
func (*Client) GetAddress ¶
GetAddress retrieves a previously-created address by its ID.
func (*Client) GetAddressWithContext ¶
func (c *Client) GetAddressWithContext(ctx context.Context, addressID string) (out *Address, err error)
GetAddressWithContext performs the same operation as GetAddress, but allows specifying a context that can interrupt the request.
func (*Client) GetBatchLabels ¶
GetBatchLabels generates a label for the batch. This can only be done once per batch, and all shipments must have a "postage_purchased" status.
func (*Client) GetBatchLabelsWithContext ¶
func (c *Client) GetBatchLabelsWithContext(ctx context.Context, batchID, format string) (out *Batch, err error)
GetBatchLabelsWithContext performs the same operation as GetBatchLabels, but allows specifying a context that can interrupt the request.
func (*Client) GetBatchWithContext ¶
GetBatchWithContext performs the same operation as GetBatch, but allows specifying a context that can interrupt the request.
func (*Client) GetCarrierAccount ¶
func (c *Client) GetCarrierAccount(carrierAccountID string) (out *CarrierAccount, err error)
GetCarrierAccount retrieves a carrier account by its ID or reference.
func (*Client) GetCarrierAccountWithContext ¶
func (c *Client) GetCarrierAccountWithContext(ctx context.Context, carrierAccountID string) (out *CarrierAccount, err error)
GetCarrierAccountWithContext performs the same operation as GetCarrierAccount, but allows specifying a context that can interrupt the request.
func (*Client) GetCarrierTypes ¶
func (c *Client) GetCarrierTypes() (out []*CarrierType, err error)
GetCarrierTypes returns a list of supported carrier types for the current user.
func (*Client) GetCarrierTypesWithContext ¶
func (c *Client) GetCarrierTypesWithContext(ctx context.Context) (out []*CarrierType, err error)
GetCarrierTypesWithContext performs the same operation as GetCarrierTypes, but allows specifying a context that can interrupt the request.
func (*Client) GetCustomsInfo ¶
func (c *Client) GetCustomsInfo(customsInfoID string) (out *CustomsInfo, err error)
GetCustomsInfo returns the CustomsInfo object with the given ID or reference.
func (*Client) GetCustomsInfoWithContext ¶
func (c *Client) GetCustomsInfoWithContext(ctx context.Context, customsInfoID string) (out *CustomsInfo, err error)
GetCustomsInfoWithContext performs the same operation as GetCustomsInfo, but allows specifying a context that can interrupt the request.
func (*Client) GetCustomsItem ¶
func (c *Client) GetCustomsItem(customsItemID string) (out *CustomsItem, err error)
GetCustomsItem returns the CustomsInfo object with the given ID or reference.
func (*Client) GetCustomsItemWithContext ¶
func (c *Client) GetCustomsItemWithContext(ctx context.Context, customsItemID string) (out *CustomsItem, err error)
GetCustomsItemWithContext performs the same operation as GetCustomsItem, but allows specifying a context that can interrupt the request.
func (*Client) GetEventWithContext ¶ added in v1.1.0
GetEventWithContext performs the same operation as GetEvent, but allows specifying a context that can interrupt the request.
func (*Client) GetInsurance ¶
GetInsurance returns the Insurance object with the given ID or reference.
func (*Client) GetInsuranceWithContext ¶
func (c *Client) GetInsuranceWithContext(ctx context.Context, insuranceID string) (out *Insurance, err error)
GetInsuranceWithContext performs the same operation as GetInsurance, but allows specifying a context that can interrupt the request.
func (*Client) GetOrderRates ¶
GetOrderRates refreshes rates for an Order.
func (*Client) GetOrderRatesWithContext ¶
func (c *Client) GetOrderRatesWithContext(ctx context.Context, orderID string) (out *Order, err error)
GetOrderRatesWithContext performs the same operation as GetOrderRates, but allows specifying a context that can interrupt the request.
func (*Client) GetOrderWithContext ¶
GetOrderWithContext performs the same operation as GetOrder, but allows specifying a context that can interrupt the request.
func (*Client) GetParcelWithContext ¶
func (c *Client) GetParcelWithContext(ctx context.Context, parcelID string) (out *Parcel, err error)
GetParcelWithContext performs the same operation as GetParcel, but allows specifying a context that can interrupt the request.
func (*Client) GetPickupWithContext ¶
func (c *Client) GetPickupWithContext(ctx context.Context, pickupID string) (out *Pickup, err error)
GetPickupWithContext performs the same operation as GetPickup, but allows specifying a context that can interrupt the request.
func (*Client) GetRateWithContext ¶ added in v1.1.0
GetRateWithContext performs the same operation as GetRate, but allows specifying a context that can interrupt the request.
func (*Client) GetReportWithContext ¶
func (c *Client) GetReportWithContext(ctx context.Context, typ, reportID string) (out *Report, err error)
GetReportWithContext performs the same operation as GetReport, but allows specifying a context that can interrupt the request.
func (*Client) GetScanForm ¶
GetScanForm retrieves a ScanForm object by ID.
func (*Client) GetScanFormWithContext ¶
func (c *Client) GetScanFormWithContext(ctx context.Context, scanFormID string) (out *ScanForm, err error)
GetScanFormWithContext performs the same operation as GetScanForm, but allows specifying a context that can interrupt the request.
func (*Client) GetShipment ¶
GetShipment retrieves a Shipment object by ID.
func (*Client) GetShipmentLabel ¶
GetShipmentLabel enables retrieving the label for a shipment in a different format. The PostageLabel field in the returned Shipment object will reflect the new format.
func (*Client) GetShipmentLabelWithContext ¶
func (c *Client) GetShipmentLabelWithContext(ctx context.Context, shipmentID, format string) (out *Shipment, err error)
GetShipmentLabelWithContext performs the same operation as GetShipmentLabel, but allows specifying a context that can interrupt the request.
func (*Client) GetShipmentRates ¶
GetShipmentRates fetches the available rates for a shipment.
func (*Client) GetShipmentRatesWithContext ¶
func (c *Client) GetShipmentRatesWithContext(ctx context.Context, shipmentID string) (out []*Rate, err error)
GetShipmentRatesWithContext performs the same operation as GetShipmentRates, but allows specifying a context that can interrupt the request.
func (*Client) GetShipmentSmartrates ¶ added in v1.3.0
GetShipmentSmartrates fetches the available smartrates for a shipment.
func (*Client) GetShipmentSmartratesWithContext ¶ added in v1.3.0
func (c *Client) GetShipmentSmartratesWithContext(ctx context.Context, shipmentID string) (out []*Rate, err error)
GetShipmentSmartratesWithContext performs the same operation as GetShipmentRates, but allows specifying a context that can interrupt the request.
func (*Client) GetShipmentWithContext ¶
func (c *Client) GetShipmentWithContext(ctx context.Context, shipmentID string) (out *Shipment, err error)
GetShipmentWithContext performs the same operation as GetShipment, but allows specifying a context that can interrupt the request.
func (*Client) GetTracker ¶
GetTracker retrieves a Tracker object by ID.
func (*Client) GetTrackerWithContext ¶
func (c *Client) GetTrackerWithContext(ctx context.Context, trackerID string) (out *Tracker, err error)
GetTrackerWithContext performs the same operation as GetTracker, but allows specifying a context that can interrupt the request.
func (*Client) GetUserWithContext ¶
GetUserWithContext performs the same operation as GetUser, but allows specifying a context that can interrupt the request.
func (*Client) GetWebhook ¶
GetWebhook retrieves a Webhook object with the given ID.
func (*Client) GetWebhookWithContext ¶
func (c *Client) GetWebhookWithContext(ctx context.Context, webhookID string) (out *Webhook, err error)
GetWebhookWithContext performs the same operation as GetWebhook, but allows specifying a context that can interrupt the request.
func (*Client) InsureShipment ¶
InsureShipment purchases insurance for the shipment. Insurance should be purchased after purchasing the shipment, but before it has been processed by the carrier. On success, the purchased insurance will be reflected in the returned Shipment object's Insurance field.
func (*Client) InsureShipmentWithContext ¶
func (c *Client) InsureShipmentWithContext(ctx context.Context, shipmentID, amount string) (out *Shipment, err error)
InsureShipmentWithContext performs the same operation as InsureShipment, but allows specifying a context that can interrupt the request.
func (*Client) ListAddresses ¶
func (c *Client) ListAddresses(opts *ListOptions) (out *ListAddressResult, err error)
ListAddresses provides a paginated result of InsuAddressrance objects.
func (*Client) ListAddressesWithContext ¶
func (c *Client) ListAddressesWithContext(ctx context.Context, opts *ListOptions) (out *ListAddressResult, err error)
ListAddressesWithContext performs the same operation as ListAddresses, but allows specifying a context that can interrupt the request.
func (*Client) ListBatches ¶
func (c *Client) ListBatches(opts *ListOptions) (out *ListBatchesResult, err error)
ListBatches provides a paginated result of Insurance objects.
func (*Client) ListBatchesWithContext ¶
func (c *Client) ListBatchesWithContext(ctx context.Context, opts *ListOptions) (out *ListBatchesResult, err error)
ListBatchesWithContext performs the same operation as ListBatches, but allows specifying a context that can interrupt the request.
func (*Client) ListCarrierAccounts ¶
func (c *Client) ListCarrierAccounts() (out []*CarrierAccount, err error)
ListCarrierAccounts returns a list of all carrier accounts available to the authenticated account.
func (*Client) ListCarrierAccountsWithContext ¶
func (c *Client) ListCarrierAccountsWithContext(ctx context.Context) (out []*CarrierAccount, err error)
ListCarrierAccountsWithContext performs the same operation as ListCarrierAccounts, but allows specifying a context that can interrupt the request.
func (*Client) ListEventPayloads ¶ added in v1.1.0
func (c *Client) ListEventPayloads(eventID string) (out []*EventPayload, err error)
GetEventPayload retrieves the payload results of a previous webhook call.
func (*Client) ListEventPayloadsWithContext ¶ added in v1.1.0
func (c *Client) ListEventPayloadsWithContext(ctx context.Context, eventID string) (out []*EventPayload, err error)
GetEventPayloadWithContext performs the same operation as GetEventPaylod, but allows specifying a context that can interrupt the request.
func (*Client) ListEvents ¶ added in v1.1.0
func (c *Client) ListEvents(opts *ListOptions) (out *ListEventsResult, err error)
ListEvents provides a paginated result of Event objects.
func (*Client) ListEventsWithContext ¶ added in v1.1.0
func (c *Client) ListEventsWithContext(ctx context.Context, opts *ListOptions) (out *ListEventsResult, err error)
ListEventsWithContext performs the same operation as ListEventes, but allows specifying a context that can interrupt the request.
func (*Client) ListInsurances ¶
func (c *Client) ListInsurances(opts *ListOptions) (out *ListInsurancesResult, err error)
ListInsurances provides a paginated result of Insurance objects.
func (*Client) ListInsurancesWithContext ¶
func (c *Client) ListInsurancesWithContext(ctx context.Context, opts *ListOptions) (out *ListInsurancesResult, err error)
ListInsurancesWithContext performs the same operation as ListInsurances, but allows specifying a context that can interrupt the request.
func (*Client) ListReports ¶
func (c *Client) ListReports(typ string, opts *ListReportsOptions) (out *ListReportsResult, err error)
ListReports provides a paginated result of Report objects of the given type.
func (*Client) ListReportsWithContext ¶
func (c *Client) ListReportsWithContext(ctx context.Context, typ string, opts *ListReportsOptions) (out *ListReportsResult, err error)
ListReportsWithContext performs the same operation as ListReports, but allows specifying a context that can interrupt the request.
func (*Client) ListScanForms ¶
func (c *Client) ListScanForms(opts *ListOptions) (out *ListScanFormsResult, err error)
ListScanForms provides a paginated result of ScanForm objects.
func (*Client) ListScanFormsWithContext ¶
func (c *Client) ListScanFormsWithContext(ctx context.Context, opts *ListOptions) (out *ListScanFormsResult, err error)
ListScanFormsWithContext performs the same operation as ListScanForms, but allows specifying a context that can interrupt the request.
func (*Client) ListShipments ¶
func (c *Client) ListShipments(opts *ListShipmentsOptions) (out *ListShipmentsResult, err error)
ListShipments provides a paginated result of Shipment objects.
func (*Client) ListShipmentsWithContext ¶
func (c *Client) ListShipmentsWithContext(ctx context.Context, opts *ListShipmentsOptions) (out *ListShipmentsResult, err error)
ListShipmentsWithContext performs the same operation as ListShipments, but allows specifying a context that can interrupt the request.
func (*Client) ListTrackers ¶
func (c *Client) ListTrackers(opts *ListTrackersOptions) (out *ListTrackersResult, err error)
ListTrackers provides a paginated result of Tracker objects.
func (*Client) ListTrackersWithContext ¶
func (c *Client) ListTrackersWithContext(ctx context.Context, opts *ListTrackersOptions) (out *ListTrackersResult, err error)
ListTrackersWithContext performs the same operation as ListTrackers, but allows specifying a context that can interrupt the request.
func (*Client) ListWebhooks ¶
ListWebhooks returns all webhooks associated with the EasyPost account.
func (*Client) ListWebhooksWithContext ¶
ListWebhooksWithContext performs the same operation as ListWebhooksWithContext, but allows specifying a context that can interrupt the request.
func (*Client) RefundShipment ¶
RefundShipment requests a refund from the carrier.
func (*Client) RefundShipmentWithContext ¶
func (c *Client) RefundShipmentWithContext(ctx context.Context, shipmentID string) (out *Shipment, err error)
RefundShipmentWithContext performs the same operation as RefundShipment, but allows specifying a context that can interrupt the request.
func (*Client) RemoveShipmentsFromBatch ¶
func (c *Client) RemoveShipmentsFromBatch(batchID string, shipmentIDs ...string) (out *Batch, err error)
RemoveShipmentsFromBatch removes shipments fro, an existing batch, and returns the updated batch object.
func (*Client) RemoveShipmentsFromBatchWithContext ¶
func (c *Client) RemoveShipmentsFromBatchWithContext(ctx context.Context, batchID string, shipmentIDs ...string) (out *Batch, err error)
RemoveShipmentsFromBatchWithContext performs the same operation as RemoveShipmentsFromBatch, but allows specifying a context that can interrupt the request.
func (*Client) UpdateCarrierAccount ¶
func (c *Client) UpdateCarrierAccount(in *CarrierAccount) (out *CarrierAccount, err error)
UpdateCarrierAccount updates the carrier account. Only the Description, Reference, Credentials and TestCredentials attributes can be updated.
c := easypost.New(MyEasyPostAPIKey) out, err := c.UpdateCarrierAccount( "ca_1001", &easypost.CarrierAccount{ Description: "FL Location UPS Account", Credentials: map[string]string{ "account_number": "B2B2B2", }, }, )
func (*Client) UpdateCarrierAccountWithContext ¶
func (c *Client) UpdateCarrierAccountWithContext(ctx context.Context, in *CarrierAccount) (out *CarrierAccount, err error)
UpdateCarrierAccountWithContext performs the same operation as UpdateCarrierAccount, but allows specifying a context that can interrupt the request.
func (*Client) UpdateUser ¶
func (c *Client) UpdateUser(in *UserOptions) (out *User, err error)
UpdateUser updates a user with the attributes given in the UpdateUserOptions parameter. If the ID field of UpdateUserOptions is empty, the operation is done on the current user. All other fields are updated if they are non-nil.
func (*Client) UpdateUserWithContext ¶
UpdateUserWithContext performs the same operation as UpdateUser, but allows specifying a context that can interrupt the request.
func (*Client) VerifyAddress ¶
VerifyAddress performs address verification.
type CreateAddressOptions ¶
type CreateAddressOptions struct { Verify []string `json:"verify,omitempty"` VerifyStrict []string `json:"verify_strict,omitempty"` }
CreateAddressOptions is used to specify verification options for address creation.
type CreateTrackerOptions ¶
type CreateTrackerOptions struct { TrackingCode string Carrier string Amount string CarrierAccount string IsReturn bool FullTestTracker bool }
CreateTrackerOptions specifies options for creating a new tracker.
type CustomsInfo ¶
type CustomsInfo struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` EELPFC string `json:"eel_pfc,omitempty"` ContentsType string `json:"contents_type,omitempty"` ContentsExplanation string `json:"contents_explanation,omitempty"` CustomsCertify bool `json:"customs_certify,omitempty"` CustomsSigner string `json:"customs_signer,omitempty"` NonDeliveryOption string `json:"non_delivery_option,omitempty"` RestrictionType string `json:"restriction_type,omitempty"` CustomsItems []*CustomsItem `json:"customs_items,omitempty"` }
CustomsInfo objects contain CustomsItem objects and all necessary information for the generation of customs forms required for international shipping.
type CustomsItem ¶
type CustomsItem struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Description string `json:"description,omitempty"` Quantity float64 `json:"quantity,omitempty"` Value float64 `json:"value,omitempty,string"` Weight float64 `json:"weight,omitempty"` HSTariffNumber string `json:"hs_tariff_number,omitempty"` Code string `json:"code,omitempty"` OriginCountry string `json:"origin_country,omitempty"` Currency string `json:"currency,omitempty"` }
A CustomsItem object describes goods for international shipment.
type Event ¶ added in v1.1.0
type Event struct { ID string `json:"id,omitempty"` UserID string `json:"user_id,omitempty"` Object string `json:"object,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Description string `json:"description,omitempty"` PreviousAttributes map[string]interface{} `json:"previous_attributes,omitempty"` // Result will be populated with the relevant object type, i.e. // *Batch, *Insurance, *PaymentLog, *Refund, *Report, *Tracker or *ScanForm. // It will be nil if no 'result' field is present, which is the case for // the ListEvents and GetEvents methods. The RequestBody field of the // EventPayload type will generally be an instance of *Event with this field // present. Having the field here also enables re-using this type to // implement a webhook handler. Result interface{} `json:"result,omitempty"` Status string `json:"status,omitempty"` PendingURLs []string `json:"pending_urls,omitempty"` CompletedURLs []string `json:"completed_urls,omitempty"` }
Event objects contain details about changes to EasyPost objects
func (*Event) UnmarshalJSON ¶ added in v1.1.0
type EventPayload ¶ added in v1.1.0
type EventPayload struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` RequestURL string `json:"request_url,omitempty"` RequestHeaders map[string]string `json:"request_headers,omitempty"` // RequestBody is the raw request body that was sent to the webhook. This is // expected to be an Event object. It may either be encoded in the API // response as a string (with JSON delimiters escaped) or as base64. The // UnmarshalJSON method will attempt to convert it to an *Event type, but it // may be set to a default type if decoding to an object fails. RequestBody interface{} `json:"request_body,omitempty"` ResponseHeaders map[string]string `json:"response_headers,omitempty"` ResponseBody string `json:"response_body,omitempty"` ResponseCode int `json:"response_code,omitempty"` TotalTime int `json:"total_time,omitempty"` }
EventPayload represents the result of a webhook call.
func (*EventPayload) UnmarshalJSON ¶ added in v1.1.0
func (e *EventPayload) UnmarshalJSON(data []byte) (err error)
type Fee ¶
type Fee struct { Object string `json:"object,omitempty"` Type string `json:"type,omitempty"` Amount string `json:"amount,omitempty"` Charged bool `json:"charged,omitempty"` Refunded bool `json:"refunded,omitempty"` }
Fee objects are used to represent the breakdown of charges made when purchasing an item on EasyPost.
type Form ¶
type Form struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` FormType string `json:"form_type,omitempty"` FormURL string `json:"form_url,omitempty"` SubmittedElectronically bool `json:"submitted_electronically,omitempty"` }
A Form represents a form associated with a Shipment.
type Insurance ¶
type Insurance struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Reference string `json:"reference,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Amount string `json:"amount,omitempty"` Carrier string `json:"carrier,omitempty"` Provider string `json:"provider,omitempty"` ProviderID string `json:"provider_id,omitempty"` ShipmentID string `json:"shipment_id,omitempty"` TrackingCode string `json:"tracking_code,omitempty"` Status string `json:"status,omitempty"` Tracker *Tracker `json:"tracker,omitempty"` ToAddress *Address `json:"to_address,omitempty"` FromAddress *Address `json:"from_address,omitempty"` Fee *Fee `json:"fee,omitempty"` Messages []string `json:"messages,omitempty"` }
An Insurance object represents insurance for packages purchased both via the EasyPost API as well as shipments purchased through third parties and later registered with EasyPost.
type ListAddressResult ¶
type ListAddressResult struct { Addresses []*Address `json:"addresses,omitempty"` // HasMore indicates if there are more responses to be fetched. If True, // additional responses can be fetched by updating the ListAddressOptions // parameter's AfterID field with the ID of the last item in this object's // Addresses field. HasMore bool `json:"has_more,omitempty"` }
ListAddressResult holds the results from the list insurances API.
type ListBatchesResult ¶
type ListBatchesResult struct { Insurances []*Insurance `json:"batches,omitempty"` // HasMore indicates if there are more responses to be fetched. If True, // additional responses can be fetched by updating the ListInsurancesOptions // parameter's AfterID field with the ID of the last item in this object's // Insurances field. HasMore bool `json:"has_more,omitempty"` }
ListBatchesResult holds the results from the list insurances API.
type ListEventsResult ¶ added in v1.1.0
type ListEventsResult struct { Events []*Event `json:"events,omitempty"` // HasMore indicates if there are more responses to be fetched. If True, // additional responses can be fetched by updating the ListEventsOptions // parameter's AfterID field with the ID of the last item in this object's // Events field. HasMore bool `json:"has_more,omitempty"` }
ListEventsResult holds the results from the list events API.
type ListInsurancesResult ¶
type ListInsurancesResult struct { Insurances []*Insurance `json:"insurances,omitempty"` // HasMore indicates if there are more responses to be fetched. If True, // additional responses can be fetched by updating the ListInsurancesOptions // parameter's AfterID field with the ID of the last item in this object's // Insurances field. HasMore bool `json:"has_more,omitempty"` }
ListInsurancesResult holds the results from the list insurances API.
type ListOptions ¶
type ListOptions struct { BeforeID string `url:"before_id,omitempty"` AfterID string `url:"after_id,omitempty"` StartDateTime *time.Time `url:"start_datetime,omitempty"` EndDateTime *time.Time `url:"end_datetime,omitempty"` PageSize int `url:"page_size,omitempty"` }
ListOptions is used to specify query parameters for listing EasyPost objects.
type ListReportsOptions ¶
type ListReportsOptions struct { BeforeID string `url:"before_id,omitempty"` AfterID string `url:"after_id,omitempty"` StartDate string `url:"start_datetime,omitempty"` EndDate string `url:"end_datetime,omitempty"` PageSize int `url:"page_size,omitempty"` }
ListReportsOptions is used to specify query parameters for listing Report objects.
type ListReportsResult ¶
type ListReportsResult struct { Reports []*Report `json:"reports,omitempty"` // HasMore indicates if there are more responses to be fetched. If True, // additional responses can be fetched by updating the ListReportsOptions // parameter's AfterID field with the ID of the last item in this object's // Reports field. HasMore bool `json:"has_more,omitempty"` }
ListReportsResult holds the results from the list reports API.
type ListScanFormsResult ¶
type ListScanFormsResult struct { ScanForms []*ScanForm `json:"scan_forms,omitempty"` // HasMore indicates if there are more responses to be fetched. If True, // additional responses can be fetched by updating the ListScanFormsOptions // parameter's AfterID field with the ID of the last item in this object's // ScanForms field. HasMore bool `json:"has_more,omitempty"` }
ListScanFormsResult holds the results from the list scan forms API.
type ListShipmentsOptions ¶
type ListShipmentsOptions struct { BeforeID string `url:"before_id,omitempty"` AfterID string `url:"after_id,omitempty"` StartDateTime *time.Time `url:"start_datetime,omitempty"` EndDateTime *time.Time `url:"end_datetime,omitempty"` PageSize int `url:"page_size,omitempty"` Purchased *bool `url:"purchased,omitempty"` IncludeChildren *bool `url:"include_children,omitempty"` }
ListShipmentsOptions is used to specify query parameters for listing Shipment objects.
type ListShipmentsResult ¶
type ListShipmentsResult struct { Shipments []*Shipment `json:"shipments,omitempty"` // HasMore indicates if there are more responses to be fetched. If True, // additional responses can be fetched by updating the ListShipmentsOptions // parameter's AfterID field with the ID of the last item in this object's // Shipments field. HasMore bool `json:"has_more,omitempty"` }
ListShipmentsResult holds the results from the list shipments API.
type ListTrackersOptions ¶
type ListTrackersOptions struct { BeforeID string `url:"before_id,omitempty"` AfterID string `url:"after_id,omitempty"` StartDateTime *time.Time `url:"start_datetime,omitempty"` EndDateTime *time.Time `url:"end_datetime,omitempty"` PageSize int `url:"page_size,omitempty"` TrackingCodes []string `url:"tracking_codes,omitempty"` Carrier string `url:"carrier,omitempty"` }
ListTrackersOptions is used to specify query parameters for listing Tracker objects.
type ListTrackersResult ¶
type ListTrackersResult struct { Trackers []*Tracker `json:"trackers,omitempty"` // HasMore indicates if there are more responses to be fetched. If True, // additional responses can be fetched by updating the ListTrackersOptions // parameter's AfterID field with the ID of the last item in this object's // Trackers field. HasMore bool `json:"has_more,omitempty"` }
ListTrackersResult holds the results from the list trackers API.
type ListTrackersUpdatedOptions ¶
type ListTrackersUpdatedOptions struct { Page int `json:"page,omitempty"` PageSize int `json:"page_size,omitempty"` StatusStart *time.Time `json:"status_start,omitempty"` StatusEnd *time.Time `json:"status_end,omitempty"` TrackingDetailsStart *time.Time `json:"tracking_details_start,omitempty"` TrackingDetailsEnd *time.Time `json:"tracking_details_end,omitempty"` }
ListTrackersUpdatedOptions specifies options for the list trackers updated API.
type Order ¶
type Order struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Reference string `json:"reference,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` ToAddress *Address `json:"to_address,omitempty"` FromAddress *Address `json:"from_address,omitempty"` ReturnAddress *Address `json:"return_address,omitempty"` BuyerAddress *Address `json:"buyer_address,omitempty"` Shipments []*Shipment `json:"shipments,omitempty"` Rates []*Rate `json:"rates,omitempty"` Messages []*CarrierMessage `json:"messages,omitempty"` IsReturn bool `json:"is_return"` }
An Order object represents a collection of packages and can be used for multi-piece Shipments.
type Parcel ¶
type Parcel struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Length float64 `json:"length,omitempty"` Width float64 `json:"width,omitempty"` Height float64 `json:"height,omitempty"` PredefinedPackage string `json:"predefined_package,omitempty"` Weight float64 `json:"weight,omitempty"` }
A Parcel objects represent a physical container being shipped.
type Payment ¶
type Payment struct { Type string `json:"type,omitempty"` Account string `json:"account,omitempty"` Country string `json:"country,omitempty"` PostalCode string `json:"postal_code,omitempty"` }
Payment provides information on how a shipment is billed.
type PaymentLog ¶ added in v1.1.0
type PaymentLog struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` SourceType string `json:"source_type,omitempty"` TargetType string `json:"target_type,omitempty"` Date string `json:"date,omitempty"` ChargeType string `json:"charge_type,omitempty"` Status string `json:"status,omitempty"` Amount string `json:"amount,omitempty"` Last4 string `json:"last4,omitempty"` }
type Pickup ¶
type Pickup struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Reference string `json:"reference,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Status string `json:"status,omitempty"` MinDatetime *time.Time `json:"min_datetime,omitempty"` MaxDatetime *time.Time `json:"max_datetime,omitempty"` IsAccountAddress bool `json:"is_account_address,omitempty"` Instructions string `json:"instructions,omitempty"` Messages []*CarrierMessage `json:"messages,omitempty"` Confirmation string `json:"confirmation,omitempty"` Shipment *Shipment `json:"shipment,omitempty"` Address *Address `json:"address,omitempty"` Batch *Batch `json:"batch,omitempty"` CarrierAccounts []*CarrierAccount `json:"carrier_accounts,omitempty"` PickupRates []*PickupRate `json:"pickup_rates,omitempty"` }
A Pickup object represents a pickup from a carrier at a customer's residence or place of business.
type PickupRate ¶
type PickupRate struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Service string `json:"service,omitempty"` Carrier string `json:"carrier,omitempty"` Rate string `json:"rate,omitempty"` Currency string `json:"currency,omitempty"` PickupID string `json:"pickup_id,omitempty"` }
PickupRate contains data about the cost of a pickup.
type PostageLabel ¶
type PostageLabel struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` IntegratedForm string `json:"integrated_form,omitempty"` LabelDate *time.Time `json:"label_date,omitempty"` LabelEPL2URL string `json:"label_epl2_url,omitempty"` LabelFileType string `json:"label_file_type,omitempty"` LabelPDFURL string `json:"label_pdf_url,omitempty"` LabelResolution float64 `json:"label_resolution,omitempty"` LabelSize string `json:"label_size,omitempty"` LabelType string `json:"label_type,omitempty"` LabelURL string `json:"label_url,omitempty"` LabelZPLURL string `json:"label_zpl_url,omitempty"` }
PostageLabel provides details of a shipping label for a purchased shipment.
type Rate ¶
type Rate struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Service string `json:"service,omitempty"` Carrier string `json:"carrier,omitempty"` CarrierAccountID string `json:"carrier_account_id,omitempty"` ShipmentID string `json:"shipment_id,omitempty"` Rate string `json:"rate,omitempty"` Currency string `json:"currency,omitempty"` RetailRate string `json:"retail_rate,omitempty"` RetailCurrency string `json:"retail_currency,omitempty"` ListRate string `json:"list_rate,omitempty"` ListCurrency string `json:"list_currency,omitempty"` DeliveryDays int `json:"delivery_days,omitempty"` DeliveryDate *time.Time `json:"delivery_date,omitempty"` DeliveryDateGuaranteed bool `json:"delivery_date_guaranteed,omitempty"` EstDeliveryDays int `json:"est_delivery_dats,omitempty"` TimeInTransit *TimeInTransit `json:"time_in_transit,omitemtpy"` }
A Rate contains information on shipping cost and delivery time.
type Refund ¶ added in v1.1.0
type Refund struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` TrackingCode string `json:"tracking_code,omitempty"` ConfirmationNumber string `json:"confirmation_number,omitempty"` Status string `json:"status,omitempty"` Carrier string `json:"carrier,omitempty"` ShipmentID string `json:"shipment_id,omitempty"` }
type Report ¶
type Report struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Status string `json:"status,omitempty"` StartDate string `json:"start_date,omitempty"` EndDate string `json:"end_date,omitempty"` IncludeChildren bool `json:"include_children,omitempty"` URL string `json:"url,omitempty"` URLExpiresAt *time.Time `json:"url_expires_at,omitempty"` SendEmail bool `json:"send_email,omitempty"` }
Report represents a CSV-formatted file that is a log of all the objects created within a certain time frame.
type ScanForm ¶
type ScanForm struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Status string `json:"status,omitempty"` Message string `json:"message,omitempty"` Address *Address `json:"address,omitempty"` TrackingCodes []string `json:"tracking_codes,omitempty"` FormURL string `json:"form_url,omitempty"` FormFileType string `json:"form_file_type,omitempty"` BatchID string `json:"batch_id,omitempty"` }
A ScanForm object represents a document that can be scanned to mark all included tracking codes as "Accepted for Shipment" by the carrier.
type Shipment ¶
type Shipment struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Reference string `json:"reference,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` ToAddress *Address `json:"to_address,omitempty"` FromAddress *Address `json:"from_address,omitempty"` ReturnAddress *Address `json:"return_address,omitempty"` BuyerAddress *Address `json:"buyer_address,omitempty"` Parcel *Parcel `json:"parcel,omitempty"` Carrier string `json:"carrier,omitempty"` Service string `json:"service,omitempty"` CarrierAccountIDs []string `json:"carrier_accounts,omitempty"` CustomsInfo *CustomsInfo `json:"customs_info,omitempty"` ScanForm *ScanForm `json:"scan_form,omitempty"` Forms []*Form `json:"forms,omitempty"` Insurance string `json:"insurance,omitempty"` Rates []*Rate `json:"rates,omitempty"` SelectedRate *Rate `json:"selected_rate,omitempty"` PostageLabel *PostageLabel `json:"postage_label,omitempty"` Messages []*CarrierMessage `json:"messages,omitempty"` Options *ShipmentOptions `json:"options,omitempty"` IsReturn bool `json:"is_return,omitempty"` TrackingCode string `json:"tracking_code,omitempty"` USPSZone int `json:"usps_zone,omitempty"` Status string `json:"status,omitempty"` Tracker *Tracker `json:"tracker,omitempty"` Fees []*Fee `json:"fees,omitempty"` RefundStatus string `json:"refund_status,omitempty"` BatchID string `json:"batch_id,omitempty"` BatchStatus string `json:"batch_status,omitempty"` BatchMessage string `json:"batch_message,omitempty"` TaxIdentifiers []*TaxIdentifier `json:"tax_identifiers,omitempty"` }
A Shipment represents its namesake, and is made up of a "to" and "from" addresses, the Parcel being shipped, and any customs forms required for international deliveries.
type ShipmentOptions ¶
type ShipmentOptions struct { AdditionalHandling bool `json:"additional_handling,omitempty"` AddressValidationLevel string `json:"address_validation_level,omitempty"` Alcohol bool `json:"alcohol,omitempty"` BillReceiverAccount string `json:"bill_receiver_account,omitempty"` BillReceiverPostalCode string `json:"bill_receiver_postal_code,omitempty"` BillThirdPartyAccount string `json:"bill_third_party_account,omitempty"` BillThirdPartyCountry string `json:"bill_third_party_country,omitempty"` BillThirdPartyPostalCode string `json:"bill_third_party_postal_code,omitempty"` ByDrone bool `json:"by_drone,omitempty"` CarbonNeutral bool `json:"carbon_neutral,omitempty"` CertifiedMail bool `json:"certified_mail,omitempty"` CODAmount string `json:"cod_amount,omitempty"` CODMethod string `json:"cod_method,omitempty"` CODAddressID string `json:"cod_address_id,omitempty"` Currency string `json:"currency,omitempty"` DeliveryConfirmation string `json:"delivery_confirmation,omitempty"` DropoffType string `json:"dropoff_type,omitempty"` DryIce bool `json:"dry_ice,omitempty"` DryIceMedical bool `json:"dry_ice_medical,omitempty,string"` DryIceWeight float64 `json:"dry_ice_weight,omitempty,string"` Endorsement string `json:"endorsement,omitempty"` FreightCharge float64 `json:"freight_charge,omitempty"` HandlingInstructions string `json:"handling_insructions,omitempty"` Hazmat string `json:"hazmat,omitempty"` HoldForPickup bool `json:"hold_for_pickup,omitempty"` Incoterm string `json:"incoterm,omitempty"` InvoiceNumber string `json:"invoice_number,omitempty"` LabelDate *time.Time `json:"label_date,omitempty"` LabelFormat string `json:"label_format,omitempty"` Machinable bool `json:"machinable,omitempty"` Payment *Payment `json:"payment,omitempty"` PrintCustom1 string `json:"print_custom_1,omitempty"` PrintCustom2 string `json:"print_custom_2,omitempty"` PrintCustom3 string `json:"print_custom_3,omitempty"` PrintCustom1BarCode bool `json:"print_custom_1_barcode,omitempty"` PrintCustom2BarCode bool `json:"print_custom_2_barcode,omitempty"` PrintCustom3BarCode bool `json:"print_custom_3_barcode,omitempty"` PrintCustom1Code string `json:"print_custom_1_code,omitempty"` PrintCustom2Code string `json:"print_custom_2_code,omitempty"` PrintCustom3Code string `json:"print_custom_3_code,omitempty"` RegisteredMail bool `json:"registered_mail,omitempty"` RegisteredMailAmount float64 `json:"registered_mail_amount,omitempty"` ReturnReceipt bool `json:"return_receipt,omitempty"` SaturdayDelivery bool `json:"saturday_delivery,omitempty"` SpecialRatesEligibility string `json:"special_rates_eligibility,omitempty"` SmartpostHub string `json:"smartpost_hub,omitempty"` SmartpostManifest string `json:"smartpost_manifest,omitempty"` BillingRef string `json:"billing_ref,omitempty"` }
ShipmentOptions represents the various options that can be applied to a shipment at creation.
type TaxIdentifier ¶ added in v1.4.0
type TaxIdentifier struct { Entity string `json:"entity,omitempty"` TaxIdType string `json:"tax_id_type,omitempty"` TaxId string `json:"tax_id,omitempty"` IssuingCountry string `json:"issuing_country,omitempty"` }
TaxIdentifier objects contain tax information used by carriers.
type TimeInTransit ¶ added in v1.3.0
type TimeInTransit struct { Percentile50 int `json:"percentile_50,omitempty"` Percentile75 int `json:"percentile_75,omitempty"` Percentile85 int `json:"percentile_85,omitempty"` Percentile90 int `json:"percentile_90,omitempty"` Percentile95 int `json:"percentile_95,omitempty"` Percentile97 int `json:"percentile_97,omitempty"` Percentile99 int `json:"percentile_99,omitempty"` }
type Tracker ¶
type Tracker struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` Mode string `json:"mode,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` TrackingCode string `json:"tracking_code,omitempty"` Status string `json:"status,omitempty"` SignedBy string `json:"signed_by,omitempty"` Weight float64 `json:"weight,omitempty"` EstDeliveryDate *time.Time `json:"est_delivery_date,omitempty"` ShipmentID string `json:"shipment_id,omitempty"` Carrier string `json:"carrier,omitempty"` TrackingDetails []*TrackingDetail `json:"tracking_details,omitempty"` CarrierDetail *TrackingCarrierDetail `json:"carrier_detail,omitempty"` PublicURL string `json:"public_url,omitempty"` Fees []*Fee `json:"fees,omitempty"` Finalized bool `json:"finalized,omitempty"` IsReturn bool `json:"is_return,omitempty"` }
A Tracker object contains all of the tracking information for a package.
type TrackingCarrierDetail ¶
type TrackingCarrierDetail struct { Object string `json:"object,omitempty"` Service string `json:"service,omitempty"` ContainerType string `json:"container_type,omitempty"` EstDeliveryDateLocal string `json:"est_delivery_date_local,omitempty"` EstDeliveryTimeLocal string `json:"est_delivery_time_local,omitempty"` OriginLocation string `json:"origin_locaion,omitempty"` OriginTrackingLocation *TrackingLocation `json:"origin_tracking_location,omitempty"` DestinationLocation string `json:"destination_location,omitempty"` DestinationTrackingLocation *TrackingLocation `json:"destination_tracking_location,omitempty"` GuaranteedDeliveryDate *time.Time `json:"guaranteed_delivery_date,omitempty"` AlternateIdentifier string `json:"alternate_identifier,omitempty"` InitialDeliveryAttempt *time.Time `json:"initial_delivery_attempt,omitempty"` }
TrackingCarrierDetail provides additional tracking information from the carrier, when available.
type TrackingDetail ¶
type TrackingDetail struct { Object string `json:"object,omitempty"` Message string `json:"message,omitempty"` Description string `json:"description,omitempty"` Status string `json:"status,omitempty"` DateTime string `json:"datetime,omitempty"` Source string `json:"source,omitempty"` CarrierCode string `json:"carrier_code,omitempty"` TrackingLocation *TrackingLocation `json:"tracking_location,omitempty"` }
TrackingDetail provides information about a tracking event.
type TrackingLocation ¶
type TrackingLocation struct { Object string `json:"object,omitempty"` City string `json:"city,omitempty"` State string `json:"state,omitempty"` Country string `json:"country,omitempty"` Zip string `json:"zip,omitempty"` }
TrackingLocation provides additional information about the location of a tracking event.
type User ¶
type User struct { ID string `json:"id,omitempty"` Object string `json:"object,omitempty"` ParentID string `json:"parent_id,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` PhoneNumber string `json:"phone_number,omitempty"` Balance string `json:"balance,omitempty"` RechargeAmount string `json:"recharge_amount,omitempty"` SecondaryRechargeAmount string `json:"secondary_recharge_amount,omitempty"` RechargeThreshold string `json:"recharge_threshold,omitempty"` Children []*User `json:"children,omitempty"` APIKeys []*APIKey `json:"api_keys,omitempty"` }
A User contains data about an EasyPost account and child accounts.
type UserOptions ¶
type UserOptions struct { ID string `json:"-"` Email *string `json:"email,omitempty"` Password *string `json:"password,omitempty"` PasswordConfirmation *string `json:"password_confirmation,omitempty"` CurrentPassword *string `json:"current_password,omitempty"` Name *string `json:"name,omitempty"` PhoneNumber *string `json:"phone_number,omitempty"` RechargeAmount *string `json:"recharge_amount,omitempty"` SecondaryRechargeAmount *string `json:"secondary_recharge_amount,omitempty"` RechargeThreshold *string `json:"recharge_threshold,omitempty"` }
UserOptions specifies options for creating or updating a user.
Source Files
¶
- address.go
- api_key.go
- batch.go
- carrier.go
- carrier_message.go
- client.go
- customs.go
- error.go
- event.go
- fee.go
- insurance.go
- list_options.go
- object.go
- order.go
- parcel.go
- payment_log.go
- pickup.go
- rate.go
- refund.go
- report.go
- scan_form.go
- shipment.go
- tax_identifier.go
- tracker.go
- user.go
- util.go
- version.go
- webhook.go