types

package
v1.36.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	Status           int             `json:"status"`
	Message          string          `json:"message"`
	Resource         json.RawMessage `json:"resource"`
	ResourceLocation string          `json:"resourceLocation"`
}

Webhook request body

type Date

type Date struct {
	time.Time
}

Custom time type for parsing Shipwire's funky timestamps

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) (err error)

type Error

type Error struct {
	Type    string `json:"type"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Hold

type Hold struct {
	// Hold ID
	ID int `json:"id"`

	// Shipwire Order ID
	OrderID int `json:"orderId"`

	// Hanzo Order ID
	ExternalOrderID string `json:"externalOrderId,omitempty"`

	Type    string `json:"type"`
	SubType string `json:"subType"`

	Description string `json:"description"`

	// Since when is this hold applied
	AppliedDate Date `json:"appliedDate"`

	// When was this order cleared, or null if it's still active.
	ClearedDate Date `json:"clearedDate"`
}

type Item

type Item struct {
	SKU      string `json:"sku"`
	Quantity int    `json:"quantity"`
}

type Order

type Order struct {
	ID            int    `json:"id"`
	ExternalID    string `json:"externalId"`
	OrderNo       string `json:"orderNo"`
	TransactionID string `json:"transactionId"`

	CommerceName string `json:"commerceName"`

	NeedsReview      int    `json:"needsReview"`
	LastUpdatedDate  Date   `json:"lastUpdatedDate"`
	ProcessAfterDate Date   `json:"processAfterDate"`
	Status           string `json:"status"`

	PurchaseOrderID         string `json:"purchaseOrderId,omitempty"`
	PurchaseOrderExternalID string `json:"purchaseOrderExternalId,omitempty"`
	PurchaseOrderNo         string `json:"purchaseOrderNo,omitempty"`

	VendorExternalID string `json:"vendorExternalId,omitempty"`
	VendorID         string `json:"vendorId,omitempty"`
	VendorName       string `json:"vendorName,omitempty"`

	ShipFrom struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			Company string `json:"company"`
		} `json:"resource"`
	} `json:"shipFrom"`

	ShipTo struct {
		ResourceLocation string `json:"resourceLocation,omitempty"`
		Resource         struct {
			City         string `json:"city"`
			Name         string `json:"name"`
			IsPoBox      int    `json:"isPoBox"`
			Address1     string `json:"address1"`
			Company      string `json:"company"`
			Address3     string `json:"address3"`
			IsCommercial int    `json:"isCommercial"`
			Email        string `json:"email"`
			Phone        string `json:"phone"`
			State        string `json:"state"`
			Country      string `json:"country"`
			PostalCode   string `json:"postalCode"`
			Address2     string `json:"address2"`
		} `json:"resource"`
	} `json:"shipTo"`

	Options struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			WarehouseID                    int         `json:"warehouseId"`
			BillingType                    interface{} `json:"billingType"`
			WarehouseRegion                string      `json:"warehouseRegion"`
			Referrer                       string      `json:"referrer"`
			ForceAddress                   int         `json:"forceAddress"`
			WarehouseExternalID            interface{} `json:"warehouseExternalId"`
			ForceDuplicate                 int         `json:"forceDuplicate"`
			ServiceLevelCode               string      `json:"serviceLevelCode"`
			CarrierAccountNumber           interface{} `json:"carrierAccountNumber"`
			SameDay                        string      `json:"sameDay"`
			ThirdPartyCarrierCodeRequested interface{} `json:"thirdPartyCarrierCodeRequested"`
			WarehouseArea                  interface{} `json:"warehouseArea"`
			CarrierCode                    string      `json:"carrierCode"`
			ChannelName                    interface{} `json:"channelName"`
			TestOrder                      int         `json:"testOrder"`
		} `json:"resource"`
	} `json:"options"`

	PricingEstimate struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			Packaging float64 `json:"packaging"`
			Total     float64 `json:"total"`
			Insurance float64 `json:"insurance"`
			Shipping  float64 `json:"shipping"`
			Handling  float64 `json:"handling"`
		} `json:"resource"`
	} `json:"pricingEstimate"`

	Pricing struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			Packaging float64 `json:"packaging"`
			Total     float64 `json:"total"`
			Handling  float64 `json:"handling"`
			Insurance float64 `json:"insurance"`
			Shipping  float64 `json:"shipping"`
		} `json:"resource"`
	} `json:"pricing"`

	FreightSummary struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			WeightUnit      interface{} `json:"weightUnit"`
			MeasurementType interface{} `json:"measurementType"`
			TotalWeight     string      `json:"totalWeight"`
		} `json:"resource"`
	} `json:"freightSummary"`

	Routing struct {
		ResourceLocation string `json:"resourceLocation,omitempty"`
		Resource         struct {
			DestinationLatitude  interface{} `json:"destinationLatitude"`
			DestinationLongitude interface{} `json:"destinationLongitude"`
			OriginLatitude       float64     `json:"originLatitude"`
			OriginLongitude      float64     `json:"originLongitude"`
			PhysicalWarehouseID  interface{} `json:"physicalWarehouseId"`
			WarehouseExternalID  interface{} `json:"warehouseExternalId"`
			WarehouseID          int         `json:"warehouseId"`
			WarehouseName        interface{} `json:"warehouseName"`
		} `json:"resource"`
	} `json:"routing"`

	CommercialInvoice struct {
		ResourceLocation string `json:"resourceLocation"`
	} `json:"commercialInvoice"`

	ShipwireAnywhere struct {
		ResourceLocation string `json:"resourceLocation,omitempty"`
		Resource         struct {
			Status string `json:"status"`
		} `json:"resource"`
	} `json:"shipwireAnywhere"`

	Events struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			CancelledDate         Date `json:"cancelledDate"`
			CompletedDate         Date `json:"completedDate"`
			CreatedDate           Date `json:"createdDate"`
			ExpectedCompletedDate Date `json:"expectedCompletedDate"`
			ExpectedDate          Date `json:"expectedDate"`
			ExpectedSubmittedDate Date `json:"expectedSubmittedDate"`
			LastManualUpdateDate  Date `json:"lastManualUpdateDate"`
			PickedUpDate          Date `json:"pickedUpDate"`
			ProcessedDate         Date `json:"processedDate"`
			ReturnedDate          Date `json:"returnedDate"`
			SubmittedDate         Date `json:"submittedDate"`
		} `json:"resource"`
	} `json:"events"`

	Items struct {
		ResourceLocation string   `json:"resourceLocation"`
		Resource         Resource `json:"resource"`
	} `json:"items"`

	Pieces struct {
		ResourceLocation string   `json:"resourceLocation"`
		Resource         Resource `json:"resource"`
	} `json:"pieces"`

	ShippingLabel struct {
		ResourceLocation string   `json:"resourceLocation"`
		Resource         Resource `json:"resource"`
	} `json:"shippingLabel"`

	Trackings struct {
		ResourceLocation string   `json:"resourceLocation"`
		Resource         Resource `json:"resource"`
	} `json:"trackings"`

	Holds struct {
		ResourceLocation string   `json:"resourceLocation"`
		Resource         Resource `json:"resource"`
	} `json:"holds"`

	Returns struct {
		ResourceLocation string   `json:"resourceLocation"`
		Resource         Resource `json:"resource"`
	} `json:"returns"`

	PackingList struct {
		ResourceLocation string   `json:"resourceLocation"`
		Resource         Resource `json:"resource"`
	} `json:"packingList"`

	SplitOrders struct {
		ResourceLocation string   `json:"resourceLocation"`
		Resource         Resource `json:"resource"`
	} `json:"splitOrders"`
}

type OrderOptions

type OrderOptions struct {
	Service ServiceLevelCode `json:"service"`
}

type OrderRequest

type OrderRequest struct {
	ExternalID   string `json:"externalId"`
	OrderNo      string `json:"orderNo"`
	CommerceName string `json:"commerceName"`

	Options struct {
		ServiceLevelCode ServiceLevelCode `json:"serviceLevelCode"`
	} `json:"options"`

	ShipTo struct {
		Name       string `json:"name"`
		Email      string `json:"email"`
		Address1   string `json:"address1"`
		Address2   string `json:"address2"`
		City       string `json:"city"`
		State      string `json:"state"`
		PostalCode string `json:"postalCode"`
		Country    string `json:"country"`
	} `json:"shipTo"`

	Items []Item `json:"items"`
}

type RateRequest

type RateRequest struct {
	Options struct {
		Currency              string `json:"currency"`
		CanSplit              int    `json:"canSplit"`
		WarehouseArea         string `json:"warehouseArea"`
		ChannelName           string `json:"channelName"`
		ExpectedShipDate      string `json:"expectedShipDate"`
		HighAccuracyEstimates int    `json:"highAccuracyEstimates"`
		ReturnAllRates        int    `json:"returnAllRates"`
	} `json:"options"`

	Order struct {
		ShipTo struct {
			Address1     string `json:"address1"`
			Address2     string `json:"address2"`
			Address3     string `json:"address3"`
			City         string `json:"city"`
			PostalCode   string `json:"postalCode"`
			State        string `json:"state"`
			Country      string `json:"country"`
			IsCommercial int    `json:"isCommercial"`
			IsPoBox      int    `json:"isPoBox"`
		} `json:"shipTo"`
		Items []Item `json:"items"`
	} `json:"order"`
}

type RateResponse

type RateResponse struct {
	Status           int      `json:"status"`
	Message          string   `json:"message"`
	Warnings         struct{} `json:"warnings"`
	Errors           struct{} `json:"errors"`
	ResourceLocation string   `json:"resourceLocation"`
	Resource         []Rates  `json:"resource"`
}

type Rates

type Rates struct {
	WarehouseName       string      `json:"warehouseName"`
	WarehouseID         int         `json:"warehouseId"`
	WarehouseExternalID string      `json:"warehouseExternalId"`
	VendorID            interface{} `json:"vendorId"`
	VendorExternalID    interface{} `json:"vendorExternalId"`
	VendorName          interface{} `json:"vendorName"`

	ShipTo struct {
		Email        string `json:"email"`
		Name         string `json:"name"`
		Company      string `json:"company"`
		Address1     string `json:"address1"`
		Address2     string `json:"address2"`
		Address3     string `json:"address3"`
		City         string `json:"city"`
		State        string `json:"state"`
		PostalCode   string `json:"postalCode"`
		Country      string `json:"country"`
		Phone        string `json:"phone"`
		IsCommercial int    `json:"isCommercial"`
		IsPoBox      int    `json:"isPoBox"`
	} `json:"shipTo"`

	Pieces []struct {
		Length struct {
			Amount float64 `json:"amount"`
			Units  string  `json:"units"`
		} `json:"length"`
		Width struct {
			Amount float64 `json:"amount"`
			Units  string  `json:"units"`
		} `json:"width"`
		Height struct {
			Amount float64 `json:"amount"`
			Units  string  `json:"units"`
		} `json:"height"`
		Weight struct {
			Amount float64 `json:"amount"`
			Units  string  `json:"units"`
			Type   string  `json:"type"`
		} `json:"weight"`
		Subweights []struct {
			Amount float64 `json:"amount"`
			Units  string  `json:"units"`
			Type   string  `json:"type"`
		} `json:"subweights"`
		Contents []struct {
			Sku      string `json:"sku"`
			Quantity int    `json:"quantity"`
		} `json:"contents"`
	} `json:"pieces"`

	ShippingOptions []struct {
		Carrier struct {
			Code        string   `json:"code"`
			Name        string   `json:"name"`
			Description string   `json:"description"`
			Properties  []string `json:"properties"`
		} `json:"carrier"`
		Cost struct {
			Currency         string  `json:"currency"`
			Type             string  `json:"type"`
			Name             string  `json:"name"`
			Amount           float64 `json:"amount"`
			Converted        bool    `json:"converted"`
			OriginalAmount   float64 `json:"originalAmount"`
			OriginalCurrency string  `json:"originalCurrency"`
		} `json:"cost"`
		Subtotals []struct {
			Currency         string  `json:"currency"`
			Type             string  `json:"type"`
			Name             string  `json:"name"`
			Amount           float64 `json:"amount"`
			Converted        bool    `json:"converted"`
			OriginalAmount   float64 `json:"originalAmount"`
			OriginalCurrency string  `json:"originalCurrency"`
		} `json:"subtotals"`
		ExpectedShipDate        Date   `json:"expectedShipDate"`
		ExpectedDeliveryMinDate Date   `json:"expectedDeliveryMinDate"`
		ExpectedDeliveryMaxDate Date   `json:"expectedDeliveryMaxDate"`
		ServiceLevel            string `json:"serviceLevel"`
	} `json:"shippingOptions"`

	RecommendedShippingOptionsIndex struct {
		GD   int `json:"GD"`
		TwoD int `json:"2D"`
		OneD int `json:"1D"`
	} `json:"recommendedShippingOptionsIndex"`
}

type Request

type Request struct {
	Topic                 string    `json:"topic"`
	Attempt               int       `json:"attempt"`
	Timestamp             time.Time `json:"timestamp"`
	UniqueEventId         string    `json:"uniqueEventID"`
	WebhookSubscriptionId int       `json:"webhookSubscriptionID"`
	Body                  Body      `json:"body"`
}

Webhook request

type Resource

type Resource struct {
	Offset   int    `json:"offset"`
	Total    int    `json:"total"`
	Previous string `json:"previous"`
	Next     string `json:"next"`
	Items    []struct {
		ResourceLocation string          `json:"resourceLocation"`
		Resource         json.RawMessage `json:"resource"`
	} `json:"items"`
}

Webhook request resource

type Response

type Response struct {
	// Randomly returns errors in different places
	Error  string  `json:"error,omitempty"`
	Errors []Error `json:"errors,omitempty"`

	Status           int    `json:"status"`
	Message          string `json:"message"`
	ResourceLocation string `json:"resourceLocation"`
	Resource         struct {
		Items []struct {
			ResourceLocation string          `json:"resourceLocation"`
			Resource         json.RawMessage `json:"resource"`
		} `json:"items"`
	} `json:"resource"`
}

type Return

type Return struct {
	ExternalID    string `json:"externalId"`
	OrderNo       string `json:"orderNo"`
	ID            int    `json:"id"`
	TransactionID string `json:"transactionId"`

	Options struct {
		ResourceLocation interface{} `json:"resourceLocation"`
		Resource         struct {
			WarehouseID         int    `json:"warehouseId"`
			WarehouseExternalID string `json:"warehouseExternalId"`
			WarehouseRegion     string `json:"warehouseRegion"`
		} `json:"resource"`
	} `json:"options"`

	ExpectedDate    Date   `json:"expectedDate"`
	CommerceName    string `json:"commerceName"`
	LastUpdatedDate Date   `json:"lastUpdatedDate"`
	Status          string `json:"status"`

	Items struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			Offset   int         `json:"offset"`
			Total    int         `json:"total"`
			Previous interface{} `json:"previous"`
			Next     interface{} `json:"next"`
			Items    []struct {
				ResourceLocation interface{} `json:"resourceLocation"`
				Resource         struct {
					Sku               string `json:"sku"`
					Quantity          int    `json:"quantity"`
					ProductID         int    `json:"productId"`
					ProductExternalID string `json:"productExternalId"`
					OrderID           int    `json:"orderId"`
					OrderExternalID   string `json:"orderExternalId"`
					Expected          int    `json:"expected"`
					Pending           int    `json:"pending"`
					Good              int    `json:"good"`
					InReview          int    `json:"inReview"`
					Damaged           int    `json:"damaged"`
				} `json:"resource"`
			} `json:"items"`
		} `json:"resource"`
	} `json:"items"`

	Holds struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			Offset   int           `json:"offset"`
			Total    int           `json:"total"`
			Previous interface{}   `json:"previous"`
			Next     interface{}   `json:"next"`
			Items    []interface{} `json:"items"`
		} `json:"resource"`
	} `json:"holds"`

	Trackings struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			Offset   int           `json:"offset"`
			Total    int           `json:"total"`
			Previous interface{}   `json:"previous"`
			Next     interface{}   `json:"next"`
			Items    []interface{} `json:"items"`
		} `json:"resource"`
	} `json:"trackings"`

	Labels struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         struct {
			Offset   int         `json:"offset"`
			Total    int         `json:"total"`
			Previous interface{} `json:"previous"`
			Next     interface{} `json:"next"`
			Items    []struct {
				ResourceLocation string `json:"resourceLocation"`
				Resource         struct {
					ID              int    `json:"id"`
					OrderID         int    `json:"orderId"`
					OrderExternalID string `json:"orderExternalId"`
				} `json:"resource"`
			} `json:"items"`
		} `json:"resource"`
	} `json:"labels"`

	Routing struct {
		ResourceLocation interface{} `json:"resourceLocation"`
		Resource         struct {
			WarehouseID         int     `json:"warehouseId"`
			WarehouseExternalID string  `json:"warehouseExternalId"`
			WarehouseName       string  `json:"warehouseName"`
			OriginLongitude     float64 `json:"originLongitude"`
			OriginLatitude      float64 `json:"originLatitude"`
			WarehouseRegion     string  `json:"warehouseRegion"`
		} `json:"resource"`
	} `json:"routing"`

	Events struct {
		ResourceLocation interface{} `json:"resourceLocation"`
		Resource         struct {
			CreatedDate          Date `json:"createdDate"`
			PickedUpDate         Date `json:"pickedUpDate"`
			SubmittedDate        Date `json:"submittedDate"`
			ProcessedDate        Date `json:"processedDate"`
			CompletedDate        Date `json:"completedDate"`
			ExpectedDate         Date `json:"expectedDate"`
			DeliveredDate        Date `json:"deliveredDate"`
			CancelledDate        Date `json:"cancelledDate"`
			ReturnedDate         Date `json:"returnedDate"`
			LastManualUpdateDate Date `json:"lastManualUpdateDate"`
		} `json:"resource"`
	} `json:"events"`

	Documents interface{} `json:"documents"`

	OriginalOrder struct {
		ResourceLocation string `json:"resourceLocation"`
		Resource         Order  `json:"resource"`
	} `json:"originalOrder"`
}

type ReturnOptions

type ReturnOptions struct {
	EmailCustomer        bool   `json:"email"`
	GeneratePrepaidLabel bool   `json:"prepaid"`
	Summary              string `json:"summary"`
	WarehouseRegion      string `json:"warehouseRegion"`
}

type ReturnRequest

type ReturnRequest struct {
	ExternalID    string `json:"externalId"`
	OriginalOrder struct {
		ID int `json:"id"`
	} `json:"originalOrder"`
	Items   []Item `json:"items"`
	Options struct {
		GeneratePrepaidLabel int    `json:"generatePrepaidLabel"`
		EmailCustomer        int    `json:"emailCustomer"`
		WarehouseID          int    `json:"warehouseId,omitempty"`
		WarehouseExternalID  string `json:"warehouseExternalId,omitempty"`
		WarehouseRegion      string `json:"warehouseRegion,omitempty"`
	} `json:"options"`
}

type ServiceLevelCode

type ServiceLevelCode string
const (
	DomesticGround        ServiceLevelCode = "GD"
	Domestic2Day          ServiceLevelCode = "2D"
	Domestic1Day          ServiceLevelCode = "1D"
	InternationalEconomy  ServiceLevelCode = "E-INTL"
	InternationalStandard ServiceLevelCode = "INTL"
	InternationalPlus     ServiceLevelCode = "PL-INTL"
	InternationalPremium  ServiceLevelCode = "PM-INTL"
)

type Tracking

type Tracking struct {
	ID              int    `json:"id"`
	OrderID         int    `json:"orderId"`
	PieceID         int    `json:"pieceId"`
	OrderExternalID string `json:"orderExternalId"`
	Carrier         string `json:"carrier"`
	Url             string `json:"url"`

	Summary     string `json:"summary"`
	SummaryDate Date   `json:"summaryDate"`

	Tracking    string `json:"tracking"`
	TrackedDate Date   `json:"trackedDate"`

	LabelCreatedDate Date `json:"labelCreatedDate"`

	FirstScanRegion     string `json:"firstScanRegion"`
	FirstScanPostalCode string `json:"firstScanPostalCode"`
	FirstScanCountry    string `json:"firstScanCountry"`
	FirstScanDate       Date   `json:"firstScanDate"`

	DeliveryCity       string `json:"deliveryCity"`
	DeliveryRegion     string `json:"deliveryRegion"`
	DeliveryPostalCode string `json:"DeliveryPostalCode"`
	DeliveryCountry    string `json:"DeliveryCountry"`
	DeliveredDate      Date   `json:"deliveredDate"`
}

Jump to

Keyboard shortcuts

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