Documentation ¶
Index ¶
- Constants
- Variables
- type CheckPoint
- type Client
- func (c *Client) DeleteTracking(tracking Tracking) error
- func (c *Client) DetectCourier(tracking Tracking) (Courier, error)
- func (c *Client) GetTracking(tracking Tracking) (Tracking, error)
- func (c *Client) GetTrackings() ([]Tracking, error)
- func (c *Client) PostTracking(tracking Tracking) (Tracking, error)
- type Courier
- type Data
- type Meta
- type Notification
- type Response
- type TimeJSON
- type Tracking
Constants ¶
const ( // APIUri holds the AfterShip API uri. APIUri = "https://api.aftership.com" // APIVersion holds the AfterShip API version. APIVersion = "v4" // APIKeyHeader is the header key for the API. APIKeyHeader = "aftership-api-key" // TrackingsEndpoint is the API endoint for trackings. TrackingsEndpoint = "/trackings" // CouriersEndpoint is the API endpoint for couriers. CouriersEndpoint = "/couriers" // CouriersAllEndpoint is the API endpoint for all couriers. CouriersAllEndpoint = "/couriers/all" // CouriersDetectEndpoint is the API endpoint for detecting couriers. CouriersDetectEndpoint = "/couriers/detect" // LastCheckpointEndpoint is the API endpoint for the last checkpoint of a tracking. LastCheckpointEndpoint = "/last_checkpoint" // NotificationsEndpoint is the API endpoint for interacting with notifications. NotificationsEndpoint = "/notifications" )
Variables ¶
var ( // ErrorEmptyResult defines the error when the result is empty. ErrorEmptyResult = errors.New("Empty result") )
Functions ¶
This section is empty.
Types ¶
type CheckPoint ¶
type CheckPoint struct { Slug string `json:"slug,omitempty"` Tag string `json:"tag,omitempty"` Message string `json:"message,omitempty"` CreatedAt TimeJSON `json:"created_at,omitempty"` CheckPointTime TimeJSON `json:"checkpoint_time,omitempty"` City string `json:"city,omitempty"` State string `json:"state,omitempty"` Zip string `json:"zip,omitempty"` CountryName string `json:"country_name,omitempty"` CountryISO string `json:"country_iso3,omitempty"` Coordinates []string `json:"coordinates,omitempty"` Location string `json:"location,omitempty"` }
CheckPoint defines the data struct for a checkpoint object.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds the information needed for Aftership API authentication.
func (*Client) DeleteTracking ¶ added in v0.0.3
DeleteTracking deletes a specific tracking. From: https://docs.aftership.com/api/4/trackings/delete-trackings
func (*Client) DetectCourier ¶ added in v0.0.2
DetectCourier returns a matched courier based on tracking number. From: https://docs.aftership.com/api/4/couriers/post-couriers-detect
func (*Client) GetTracking ¶ added in v0.0.2
GetTracking returns a specific tracking. From: https://docs.aftership.com/api/4/trackings/get-trackings-slug-tracking_number
func (*Client) GetTrackings ¶
GetTrackings returns the trackings. From: https://docs.aftership.com/api/4/trackings/get-trackings
func (*Client) PostTracking ¶
PostTracking creates a new tracking. From: https://docs.aftership.com/api/4/trackings/get-trackings
type Courier ¶
type Courier struct { Name string `json:"name,omitempty"` OtherName string `json:"other_name,omitempty"` Slug string `json:"slug,omitempty"` Phone string `json:"phone,omitempty"` URL string `json:"web_url,omitempty"` RequiredFields []string `json:"required_fields,omitempty"` OptionalFields []string `json:"optional_fields,omitempty"` }
Courier defines the data struct for a courier object. From: https://docs.aftership.com/api/4/couriers/
type Data ¶
type Data struct { Checkpoint CheckPoint `json:"checkpoint,omitempty"` Couriers []Courier `json:"couriers,omitempty"` Notification Notification `json:"notification,omitempty"` Trackings []Tracking `json:"trackings,omitempty"` Tracking Tracking `json:"tracking,omitempty"` }
Data holds the data in a response object, From: https://docs.aftership.com/api/4/overview
type Meta ¶
type Meta struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` Type string `json:"type,omitempty"` }
Meta defines the data struct for the metadata. From: https://docs.aftership.com/api/4/overview
type Notification ¶
type Notification struct { AndroidPhones []string `json:"android,omitempty"` PhoneNumbers []string `json:"smses,omitempty"` Emails []string `json:"emails,omitempty"` ApplePhones []string `json:"ios,omitempty"` }
Notification defines the data struct for a notification object. From: https://docs.aftership.com/api/4/notifications/
type Response ¶
Response defines the data struct for an API response object. From: https://docs.aftership.com/api/4/overview
type TimeJSON ¶
TimeJSON is the time format returned by the AfterShip API.
func (*TimeJSON) UnmarshalJSON ¶
UnmarshalJSON sets the TimeJSON correctly from a string.
type Tracking ¶
type Tracking struct { ID string `json:"id,omitempty"` TrackingNumber string `json:"tracking_number,omitempty"` Active bool `json:"active,omitempty"` Slug string `json:"slug,omitempty"` Title string `json:"title,omitempty"` Tag string `json:"tag,omitempty"` PhoneNumbers []string `json:"smses,omitempty"` Emails []string `json:"emails,omitempty"` OrderID string `json:"order_id,omitempty"` OrderIDPath string `json:"order_id_path,omitempty"` CustomFields map[string]string `json:"custom_fields,omitempty"` Language string `json:"language,omitempty"` CreatedAt TimeJSON `json:"created_at,omitempty"` UpdatedAt TimeJSON `json:"updated_at,omitempty"` TrackingAccountNumber string `json:"tracking_account_number,omitempty"` TrackingPostalCode string `json:"tracking_postal_code,omitempty"` TrackingShipDate string `json:"tracking_ship_date,omitempty"` ExpectedDelivery string `json:"expected_delivery,omitempty"` Note string `json:"note,omitempty"` OriginCountryISO string `json:"origin_country_iso3,omitempty"` ShipmentPackageCount int `json:"shipment_package_count,omitempty"` ShipmentType string `json:"shipment_type,omitempty"` SignedBy string `json:"signed_by,omitempty"` Source string `json:"source,omitempty"` TrackedCount int `json:"tracked_count,omitempty"` UniqueToken string `json:"unique_token,omitempty"` Checkpoints []CheckPoint `json:"checkpoints,omitempty"` }
Tracking define the data struct for a tracking object. From: https://docs.aftership.com/api/4/trackings/