Documentation
¶
Index ¶
- type CreateShippingTermEndpoint
- type CreateShippingTermRequest
- type DeleteShippingTermEndpoint
- type DeleteShippingTermRequest
- type ListShippingTermsEndpoint
- type ListShippingTermsRequest
- type RetrieveShippingTermEndpoint
- type RetrieveShippingTermRequest
- type ShippingTermSvc
- type ShippingTermSvcConfig
- type UpdateShippingTermEndpoint
- type UpdateShippingTermRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateShippingTermEndpoint ¶
type CreateShippingTermEndpoint struct{}
Creates a shipping term owned by your account.
The new term takes effect on freight quoting once it is assigned as a customer's default shipping term.
func (*CreateShippingTermEndpoint) Materialize ¶
func (e *CreateShippingTermEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateShippingTermRequest, *apiresource.ShippingTerm]
type CreateShippingTermRequest ¶
type CreateShippingTermRequest struct {
// Human-readable name for the shipping term, used to identify it when assigning shipping terms to customers and orders.
Name string `json:"name" validate:"required,max=255"`
// Freight pricing model applied by this shipping term.
//
// - `free_freight`: the buyer is never charged for shipping.
// - `flat_rate_freight`: the buyer is charged the fixed amount in `flat_rate`, regardless of what the carrier would have charged.
// - `carrier_rate_freight`: the buyer is charged the rate the carrier quotes for the order's carrier and service level.
Type constants.ShippingTermType `json:"type" validate:"required"`
// Fixed shipping charge applied to orders.
//
// Used only when `type` is `flat_rate_freight`. A `flat_rate_freight` term created without a flat rate falls through to the carrier's quoted rate.
FlatRate field.Optional[apirequest.QuantityInput] `json:"flat_rate,omitzero"`
// Order total a buyer must exceed for this term's free-shipping rules to apply.
//
// Above this total, freight is free for the service levels in `free_shipping_service_level_ids`.
MinimumOrderValue field.Optional[apirequest.QuantityInput] `json:"minimum_order_value,omitzero"`
// IDs of the service levels that ship for free once an order exceeds `minimum_order_value`.
//
// Leave this empty to let every service level ship free above the threshold. The request is rejected if any ID is not a service level available to your account.
FreeShippingServiceLevelIDs []string `json:"free_shipping_service_level_ids,omitzero"`
}
Request to create a shipping term.
func (*CreateShippingTermRequest) SchemaExample ¶
func (*CreateShippingTermRequest) SchemaExample() any
type DeleteShippingTermEndpoint ¶
type DeleteShippingTermEndpoint struct{}
Deletes a shipping term owned by your account.
System-provided default shipping terms cannot be deleted. The term's free-shipping service level rules, flat rate and minimum order value go with it, and deleting a term that has already been deleted returns an error rather than succeeding again.
func (*DeleteShippingTermEndpoint) Materialize ¶
func (e *DeleteShippingTermEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteShippingTermRequest, *apiresource.EmptyResource]
type DeleteShippingTermRequest ¶
type DeleteShippingTermRequest struct {
// Shipping term ID.
ShippingTermID string `path:"id" validate:"required"`
}
Request to delete a shipping term.
type ListShippingTermsEndpoint ¶
type ListShippingTermsEndpoint struct{}
Returns a paginated list of shipping terms, newest first.
Both the terms your account has created and the system-provided default terms are returned. The `q` parameter matches on the shipping term name.
func (*ListShippingTermsEndpoint) Materialize ¶
func (e *ListShippingTermsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListShippingTermsRequest, *apiresource.List[apiresource.ShippingTerm]]
type ListShippingTermsRequest ¶
type ListShippingTermsRequest struct {
apiresource.PaginationRequest
}
Request to list shipping terms.
type RetrieveShippingTermEndpoint ¶
type RetrieveShippingTermEndpoint struct{}
Returns a shipping term by ID.
func (*RetrieveShippingTermEndpoint) Materialize ¶
func (e *RetrieveShippingTermEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveShippingTermRequest, *apiresource.ShippingTerm]
type RetrieveShippingTermRequest ¶
type RetrieveShippingTermRequest struct {
// Shipping term ID.
ShippingTermID string `path:"id" validate:"required"`
}
Request to retrieve a shipping term.
type ShippingTermSvc ¶
type ShippingTermSvc interface {
ListShippingTerms(ctx context.Context, req *ListShippingTermsRequest) (*apiresource.List[apiresource.ShippingTerm], *apierror.APIError)
GetShippingTerm(ctx context.Context, req *RetrieveShippingTermRequest) (*apiresource.ShippingTerm, *apierror.APIError)
CreateShippingTerm(ctx context.Context, req *CreateShippingTermRequest) (*apiresource.ShippingTerm, *apierror.APIError)
UpdateShippingTerm(ctx context.Context, req *UpdateShippingTermRequest) (*apiresource.ShippingTerm, *apierror.APIError)
DeleteShippingTerm(ctx context.Context, req *DeleteShippingTermRequest) (*apiresource.EmptyResource, *apierror.APIError)
}
func NewShippingTermSvc ¶
func NewShippingTermSvc(config *ShippingTermSvcConfig) ShippingTermSvc
type ShippingTermSvcConfig ¶
type ShippingTermSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type UpdateShippingTermEndpoint ¶
type UpdateShippingTermEndpoint struct{}
Partially updates a shipping term owned by your account.
System-provided default shipping terms cannot be updated. Changes affect freight quoted after the update; freight already recorded on existing orders is not recalculated.
func (*UpdateShippingTermEndpoint) Materialize ¶
func (e *UpdateShippingTermEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateShippingTermRequest, *apiresource.ShippingTerm]
type UpdateShippingTermRequest ¶
type UpdateShippingTermRequest struct {
// Shipping term ID.
ShippingTermID string `path:"id" validate:"required"`
// Human-readable name for the shipping term, used to identify it when assigning shipping terms to customers and orders.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// Freight pricing model applied by this shipping term.
//
// - `free_freight`: the buyer is never charged for shipping.
// - `flat_rate_freight`: the buyer is charged the fixed amount in `flat_rate`, regardless of what the carrier would have charged.
// - `carrier_rate_freight`: the buyer is charged the rate the carrier quotes for the order's carrier and service level.
Type field.Optional[constants.ShippingTermType] `json:"type,omitzero"`
// Fixed shipping charge applied to orders.
//
// Used only when `type` is `flat_rate_freight`. Clearing it leaves a `flat_rate_freight` term falling through to the carrier's quoted rate.
FlatRate field.Clearable[apirequest.QuantityInput] `json:"flat_rate,omitzero"`
// Order total a buyer must exceed for this term's free-shipping rules to apply.
//
// Clearing it removes the free-shipping threshold, so orders are charged according to `type` regardless of their total.
MinimumOrderValue field.Clearable[apirequest.QuantityInput] `json:"minimum_order_value,omitzero"`
// IDs of the service levels that ship for free once an order exceeds `minimum_order_value`.
//
// Replaces the whole list rather than adding to it, and clearing it lets every service level ship free above the threshold. The request is rejected if any ID is not a service level available to your account.
FreeShippingServiceLevelIDs field.Clearable[[]string] `json:"free_shipping_service_level_ids,omitzero"`
}
Request to partially update a shipping term.
Fields left out of the request keep their current values. Send an explicit JSON `null` for `flat_rate`, `minimum_order_value`, or `free_shipping_service_level_ids` to clear the stored value.
func (*UpdateShippingTermRequest) SchemaExample ¶
func (*UpdateShippingTermRequest) SchemaExample() any