shipmentep

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminUpdateShipmentTrackingEndpoint

type AdminUpdateShipmentTrackingEndpoint struct{}

Rewrites the carrier, service level and master tracking number of a shipment that has already shipped. Administrators only: the ordinary update refuses to re-route a dispatched shipment, and this is the deliberate override for one that went out mis-routed.

func (*AdminUpdateShipmentTrackingEndpoint) Materialize

type AdminUpdateShipmentTrackingRequest

type AdminUpdateShipmentTrackingRequest struct {
	// ID of the shipment to correct.
	ShipmentID string `path:"id" validate:"required"`
	// Carrier master tracking number covering the shipment as a whole.
	MasterTrackingNumber field.Optional[string] `json:"master_tracking_number,omitzero" validate:"omitempty,max=255"`
	// ID of the carrier that actually carried the shipment; the shipment's cases move with it.
	CarrierID field.Optional[string] `json:"carrier_id,omitzero" validate:"omitempty"`
	// ID of the carrier service level the shipment actually travelled on.
	// Sending this without `carrier_id` keeps the existing carrier, so the service level should belong to that carrier; send `null` to drop the service level entirely.
	ServiceLevelID field.Clearable[string] `json:"service_level_id,omitzero" validate:"omitempty"`
}

! separate endpoint due to SDK type resttrictions Request to correct a shipped shipment's tracking and routing.

func (*AdminUpdateShipmentTrackingRequest) SchemaExample

func (*AdminUpdateShipmentTrackingRequest) SchemaExample() any

type CreateShipmentLineEndpoint

type CreateShipmentLineEndpoint struct{}

Adds a line to a shipment, recording how much of a sales order line the shipment carries.

The line only records what the shipment carries: it does not touch the pick for the order, so the pick's lines keep their existing packed state.

func (*CreateShipmentLineEndpoint) Materialize

type CreateShipmentLineRequest

type CreateShipmentLineRequest struct {
	// ID of the shipment to add the line to.
	ShipmentID string `path:"shipment_id" validate:"required"`
	// ID of the sales order line this shipment line fulfills.
	SalesOrderLineID string `json:"sales_order_line_id" validate:"required"`
	// Quantity shipped, as a decimal string.
	QuantityValue string `json:"quantity_value" validate:"required"`
	// ID of the unit of measure for `quantity_value`.
	QuantityUnitID string `json:"quantity_unit_id" validate:"required"`
}

Request to create a shipment line.

func (*CreateShipmentLineRequest) SchemaExample

func (*CreateShipmentLineRequest) SchemaExample() any

type DeleteShipmentEndpoint

type DeleteShipmentEndpoint struct{}

Deletes a shipment along with its lines and shipping cases.

Deleting a shipment also unpacks the associated pick lines and reopens the pick for the shipment's order so the items can be repacked.

func (*DeleteShipmentEndpoint) Materialize

type DeleteShipmentLineEndpoint

type DeleteShipmentLineEndpoint struct{}

Removes a line from a shipment.

Unlike deleting the whole shipment, removing a single line leaves the pick for the order untouched, so the pick's lines keep their existing packed state.

type DeleteShipmentLineRequest

type DeleteShipmentLineRequest struct {
	// Shipment ID.
	ShipmentID string `path:"shipment_id" validate:"required"`
	// Shipment line ID.
	ShipmentLineID string `path:"id" validate:"required"`
}

Request to delete a shipment line.

type DeleteShipmentRequest

type DeleteShipmentRequest struct {
	// Shipment ID.
	ShipmentID string `path:"id" validate:"required"`
}

Request to delete a shipment.

type EstimateRateEndpoint

type EstimateRateEndpoint struct{}

Estimates the shipping rate for one specific carrier and service level.

Freight rules are applied before live rating, in order: freight-exempt product lines, a freight-exempt customer or customer group, then the customer's default shipping term. A free-freight term and a met free-shipping minimum order value both return `0`, and a flat-rate term returns its flat rate without contacting the carrier. Live rates require the Shippo integration; without it, or for a carrier that is not linked to a live-rating account, the estimate is `0`.

Use rate shop instead to compare every carrier and service level at once.

type EstimateRateRequest

type EstimateRateRequest struct {
	// ID of the carrier to rate.
	CarrierID string `json:"carrier_id" validate:"required"`
	// ID of the carrier service level to rate.
	ServiceLevelID string `json:"service_level_id" validate:"required"`
	// Product lines of the items being shipped, used to apply freight exemptions.
	//
	// If any listed product line is freight exempt, the estimated rate is `0`.
	ProductLineIDs []string `json:"product_line_ids,omitzero"`
	// ID of the customer the shipment is for, used to apply the customer's freight policy and default shipping term.
	//
	// A customer that is freight exempt through its own policy or through one of its groups, or whose shipping term is free freight, yields a rate of `0`; a flat-rate shipping term returns the flat rate. Omitting the customer skips all of these rules and quotes the plain carrier rate.
	CustomerID field.Optional[string] `json:"customer_id,omitzero"`
	// Origin address.
	//
	// A live carrier rate requires a postal code and country here; without them the request fails rather than returning a meaningless estimate.
	FromAddress apirequest.AddressInput `json:"from_address" validate:"required"`
	// Destination address.
	ToAddress apirequest.AddressInput `json:"to_address" validate:"required"`
	// Parcels to estimate rates for.
	Parcels []ParcelInput `json:"parcels" validate:"required,min=1"`
	// Total value of the order, used to evaluate the free-shipping minimum order value on the customer's shipping term.
	//
	// Free shipping applies only when the total is strictly above the threshold, and only for the service levels the shipping term allows.
	OrderTotal field.Optional[float64] `json:"order_total,omitzero"`
}

Request to estimate a shipping rate.

func (*EstimateRateRequest) SchemaExample

func (*EstimateRateRequest) SchemaExample() any

type ListShipmentLinesEndpoint

type ListShipmentLinesEndpoint struct{}

Returns a paginated list of lines for the specified shipment.

type ListShipmentLinesRequest

type ListShipmentLinesRequest struct {
	// Shipment ID.
	ShipmentID string `path:"shipment_id" validate:"required"`
	apiresource.PaginationRequest
}

Request to list lines for a shipment.

type ListShipmentsEndpoint

type ListShipmentsEndpoint struct{}

Returns a paginated list of shipments, newest first.

Filters combine with AND, while the values within a single list filter combine with OR. The `q` search term matches the shipment number, note, bill of lading and master tracking number, as well as the sales order number, customer name and customer PO number.

type ListShipmentsRequest

type ListShipmentsRequest struct {
	apiresource.PaginationRequest
	// Only include shipments with this status, either `packed` or `shipped`.
	Status *string `query:"status"`
	// Only include shipments containing at least one line for any of these items.
	ItemIDs []string `query:"item_ids"`
	// Only include shipments for any of these customers.
	CustomerIDs []string `query:"customer_ids"`
	// Only include shipments containing at least one line whose product belongs to any of these product lines.
	ProductLineIDs []string `query:"product_line_ids"`
	// Only include shipments whose customer belongs to any of these customer groups.
	CustomerGroupIDs []string `query:"customer_group_ids"`
	// Only include shipments whose customer is assigned to any of these sales reps, given as account
	// user IDs matching the customer's default sales rep.
	SalesRepIDs []string `query:"sales_rep_ids"`
	// Only include shipments created on or after this date (`YYYY-MM-DD`).
	//
	// Filters on when the shipment was created, not on when it was shipped.
	StartDate *string `query:"starts_at"`
	// Only include shipments created on or before this date (`YYYY-MM-DD`).
	//
	// Filters on when the shipment was created, not on when it was shipped.
	EndDate *string `query:"ends_at"`
}

Request to list shipments.

type ParcelInput

type ParcelInput struct {
	// Parcel weight in pounds.
	Weight float64 `json:"weight" validate:"required"`
	// Parcel length in inches.
	Length float64 `json:"length" validate:"required"`
	// Parcel width in inches.
	Width float64 `json:"width" validate:"required"`
	// Parcel height in inches.
	Height float64 `json:"height" validate:"required"`
}

A parcel's weight and dimensions for shipping rate calculations.

type RateShopEndpoint

type RateShopEndpoint struct{}

Compares shipping rates across all of the account's carriers and service levels for the given addresses and parcels.

Returns options sorted by rate ascending, after applying the account's freight rules: freight-exempt product lines or customers and free-freight shipping terms return no options, a flat-rate shipping term replaces carrier rates with the flat rate, and a met free-shipping minimum order value zeroes the rate on eligible options.

Live carrier rates require the Shippo integration. Carriers that are not linked to a live-rating account are returned at a rate of `0`, while carriers that are linked but whose rates cannot be fetched are left out of the results entirely. Customer portal callers only see carriers and service levels that have been enabled for the portal.

func (*RateShopEndpoint) Materialize

type RateShopRequest

type RateShopRequest struct {
	// Product lines of the items being shipped, used to apply freight exemptions.
	//
	// If any listed product line is freight exempt, no options are returned and `exemption_type` is `freight_exempt`.
	ProductLineIDs []string `json:"product_line_ids,omitzero"`
	// ID of the customer the shipment is for, used to apply the customer's freight policy and default shipping term.
	//
	// A customer that is freight exempt through its own policy or through one of its groups, or whose shipping term is free freight, returns no options with `exemption_type` set to `freight_exempt`; a flat-rate shipping term replaces carrier rates with the flat rate. Omitting the customer skips all of these rules and returns plain carrier rates.
	CustomerID field.Optional[string] `json:"customer_id,omitzero"`
	// Origin address.
	//
	// When omitted, the account's configured ship-from origin is used, which is how customer portal callers rate shop without knowing the seller's address.
	FromAddress field.Optional[apirequest.AddressInput] `json:"from_address,omitzero"`
	// Destination address.
	ToAddress apirequest.AddressInput `json:"to_address" validate:"required"`
	// Parcels to rate shop.
	Parcels []ParcelInput `json:"parcels" validate:"required,min=1"`
	// Total value of the order, used to evaluate the free-shipping minimum order value on the customer's shipping term.
	//
	// Free shipping applies only when the total is strictly above the threshold, and only for the service levels the shipping term allows.
	OrderTotal field.Optional[float64] `json:"order_total,omitzero"`
}

Request to rate shop across carriers.

func (*RateShopRequest) SchemaExample

func (*RateShopRequest) SchemaExample() any

type RetrieveShipmentEndpoint

type RetrieveShipmentEndpoint struct{}

Returns a shipment by ID.

func (*RetrieveShipmentEndpoint) Materialize

type RetrieveShipmentLineEndpoint

type RetrieveShipmentLineEndpoint struct{}

Returns a shipment line by ID.

type RetrieveShipmentLineRequest

type RetrieveShipmentLineRequest struct {
	// Shipment ID.
	ShipmentID string `path:"shipment_id" validate:"required"`
	// Shipment line ID.
	ShipmentLineID string `path:"id" validate:"required"`
}

Request to retrieve a shipment line.

type RetrieveShipmentRequest

type RetrieveShipmentRequest struct {
	// Shipment ID.
	ShipmentID string `path:"id" validate:"required"`
}

Request to retrieve a shipment by ID.

type ShipShipmentEndpoint

type ShipShipmentEndpoint struct{}

Dispatches a packed shipment, marking it and its cases as shipped.

Sets the shipment status to `shipped`, records `shipped_at` and the acting user as `shipped_by`, marks all shipping cases as shipped, and assigns an SSCC to any case that does not already have one. Fails with a conflict error if the shipment has already been shipped, so shipping is a one-way move that can only be reversed with the void action.

func (*ShipShipmentEndpoint) Materialize

type ShipShipmentRequest

type ShipShipmentRequest struct {
	// ID of the shipment to ship.
	ShipmentID string `path:"id" validate:"required"`
	// Whether to email the customer a shipping notification.
	//
	// Whether to email the customer the invoice raised for this shipment.
	EmailCustomer bool `json:"email_customer"`
}

Request to mark a shipment as shipped.

func (*ShipShipmentRequest) SchemaExample

func (*ShipShipmentRequest) SchemaExample() any

type ShipmentSvc

type ShipmentSvc interface {
	ListShipments(ctx context.Context, req *ListShipmentsRequest) (*apiresource.List[apiresource.Shipment], *apierror.APIError)
	GetShipment(ctx context.Context, req *RetrieveShipmentRequest) (*apiresource.Shipment, *apierror.APIError)
	UpdateShipment(ctx context.Context, req *UpdateShipmentRequest) (*apiresource.Shipment, *apierror.APIError)
	AdminUpdateShipmentTracking(ctx context.Context, req *AdminUpdateShipmentTrackingRequest) (*apiresource.Shipment, *apierror.APIError)
	DeleteShipment(ctx context.Context, req *DeleteShipmentRequest) (*apiresource.EmptyResource, *apierror.APIError)
	ShipShipment(ctx context.Context, req *ShipShipmentRequest) (*apiresource.Shipment, *apierror.APIError)
	VoidShipment(ctx context.Context, req *VoidShipmentRequest) (*apiresource.Shipment, *apierror.APIError)
	EstimateRate(ctx context.Context, req *EstimateRateRequest) (*apiresource.EstimateRateResult, *apierror.APIError)
	RateShop(ctx context.Context, req *RateShopRequest) (*apiresource.RateShopResult, *apierror.APIError)
	ListShipmentLines(ctx context.Context, req *ListShipmentLinesRequest) (*apiresource.List[apiresource.ShipmentLine], *apierror.APIError)
	GetShipmentLine(ctx context.Context, req *RetrieveShipmentLineRequest) (*apiresource.ShipmentLine, *apierror.APIError)
	CreateShipmentLine(ctx context.Context, req *CreateShipmentLineRequest) (*apiresource.ShipmentLine, *apierror.APIError)
	UpdateShipmentLine(ctx context.Context, req *UpdateShipmentLineRequest) (*apiresource.ShipmentLine, *apierror.APIError)
	DeleteShipmentLine(ctx context.Context, req *DeleteShipmentLineRequest) (*apiresource.EmptyResource, *apierror.APIError)
}

func NewShipmentSvc

func NewShipmentSvc(config *ShipmentSvcConfig) ShipmentSvc

type ShipmentSvcConfig

type ShipmentSvcConfig struct {
	// CoreClient (required) is the core-service shipping gRPC client.
	CoreClient pb.CoreShippingServiceClient
}

type UpdateShipmentEndpoint

type UpdateShipmentEndpoint struct{}

Updates a shipment's paperwork details and carrier selection.

Only the fields sent are changed. A shipment's status is not editable here: use the ship and void actions to move a shipment between `packed` and `shipped`.

func (*UpdateShipmentEndpoint) Materialize

type UpdateShipmentLineEndpoint

type UpdateShipmentLineEndpoint struct{}

Changes the shipped quantity on a shipment line.

The line stays attached to the sales order line it was created against, and changing the quantity does not touch the pick for the order.

func (*UpdateShipmentLineEndpoint) Materialize

type UpdateShipmentLineRequest

type UpdateShipmentLineRequest struct {
	// Shipment ID.
	ShipmentID string `path:"shipment_id" validate:"required"`
	// Shipment line ID.
	ShipmentLineID string `path:"id" validate:"required"`
	// Quantity shipped, as a decimal string.
	QuantityValue field.Optional[string] `json:"quantity_value,omitzero"`
	// ID of the unit of measure for `quantity_value`.
	QuantityUnitID field.Optional[string] `json:"quantity_unit_id,omitzero" validate:"omitempty"`
}

Request to partially update a shipment line.

func (*UpdateShipmentLineRequest) SchemaExample

func (*UpdateShipmentLineRequest) SchemaExample() any

type UpdateShipmentRequest

type UpdateShipmentRequest struct {
	// ID of the shipment to update.
	ShipmentID string `path:"id" validate:"required"`
	// Note for the shipment.
	Note field.Optional[string] `json:"note,omitzero"`
	// Human-readable shipment number.
	Number field.Optional[string] `json:"number,omitzero" validate:"omitempty,max=255"`
	// Carrier master tracking number covering the shipment as a whole.
	MasterTrackingNumber field.Optional[string] `json:"master_tracking_number,omitzero" validate:"omitempty,max=255"`
	// ID of the carrier to set on the shipment's freight.
	//
	// Changing the carrier records the new selection only; it does not re-rate the shipment, so the freight charges already recorded on the shipping cases are left as they are.
	CarrierID field.Optional[string] `json:"carrier_id,omitzero" validate:"omitempty"`
	// ID of the carrier service level to set on the shipment's freight.
	//
	// Sending this without `carrier_id` keeps the existing carrier, so the service level should belong to that carrier; send `null` to drop the service level entirely.
	ServiceLevelID field.Clearable[string] `json:"service_level_id,omitzero" validate:"omitempty"`
}

Request to partially update a shipment.

func (*UpdateShipmentRequest) SchemaExample

func (*UpdateShipmentRequest) SchemaExample() any

type VoidShipmentEndpoint

type VoidShipmentEndpoint struct{}

Voids a shipped shipment, returning it to the `packed` status so it can be corrected and shipped again.

Only shipments in the `shipped` status can be voided; otherwise a conflict error is returned. Voiding clears `shipped_at`, `shipped_by` and the master tracking number, clears the shipped timestamp, tracking number and label on every shipping case and resets each case's freight charge to zero, deletes the invoice raised for the shipment if one exists, and returns the associated sales order to its unfulfilled state. Case SSCCs are kept.

func (*VoidShipmentEndpoint) Materialize

type VoidShipmentRequest

type VoidShipmentRequest struct {
	// ID of the shipment to void.
	ShipmentID string `path:"id" validate:"required"`
}

Request to void a shipment.

Jump to

Keyboard shortcuts

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