Documentation
¶
Index ¶
- type CarrierSvc
- type CarrierSvcConfig
- type CreateCarrierEndpoint
- type CreateCarrierRequest
- type DeleteCarrierEndpoint
- type DeleteCarrierRequest
- type GetOAuthStatusEndpoint
- type GetOAuthStatusRequest
- type InitiateOAuthEndpoint
- type InitiateOAuthRequest
- type ListCarriersEndpoint
- type ListCarriersRequest
- type RetrieveCarrierEndpoint
- type RetrieveCarrierRequest
- type SyncOptionsEndpoint
- type SyncOptionsRequest
- type UpdateCarrierEndpoint
- type UpdateCarrierRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CarrierSvc ¶
type CarrierSvc interface {
ListCarriers(ctx context.Context, req *ListCarriersRequest) (*apiresource.List[apiresource.Carrier], *apierror.APIError)
GetCarrier(ctx context.Context, req *RetrieveCarrierRequest) (*apiresource.Carrier, *apierror.APIError)
CreateCarrier(ctx context.Context, req *CreateCarrierRequest) (*apiresource.Carrier, *apierror.APIError)
UpdateCarrier(ctx context.Context, req *UpdateCarrierRequest) (*apiresource.Carrier, *apierror.APIError)
DeleteCarrier(ctx context.Context, req *DeleteCarrierRequest) (*apiresource.EmptyResource, *apierror.APIError)
InitiateOAuth(ctx context.Context, req *InitiateOAuthRequest) (*apiresource.OAuthResponse, *apierror.APIError)
GetOAuthStatus(ctx context.Context, req *GetOAuthStatusRequest) (*apiresource.OAuthStatusResponse, *apierror.APIError)
SyncOptions(ctx context.Context, req *SyncOptionsRequest) (*apiresource.Carrier, *apierror.APIError)
}
func NewCarrierSvc ¶
func NewCarrierSvc(config *CarrierSvcConfig) CarrierSvc
type CarrierSvcConfig ¶
type CarrierSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type CreateCarrierEndpoint ¶
type CreateCarrierEndpoint struct{}
Creates a shipping carrier your account can ship orders with.
Supplying a Shippo-supported code (`fedex`, `ups`, `usps`) connects a Shippo carrier account and creates a service level for every service that carrier offers, each hidden from the customer portal until you make it visible. This requires an active Shippo integration on the account and is skipped entirely for sandbox accounts, which get a carrier record with no service levels and no live rating.
func (*CreateCarrierEndpoint) Materialize ¶
func (e *CreateCarrierEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateCarrierRequest, *apiresource.Carrier]
type CreateCarrierRequest ¶
type CreateCarrierRequest struct {
// Human-readable name for the carrier.
//
// Must not match another carrier already visible to your account, including the system-provided ones.
Name string `json:"name" validate:"required,max=255"`
// Well-known carrier code.
//
// Providing a Shippo-supported code (`fedex`, `ups`, `usps`) connects the carrier through Shippo and syncs its service levels; the other codes, such as `will_call` and `delivery`, simply describe a self-managed shipping method. Omit the code entirely when none of them fit. The code cannot be changed after the carrier is created.
Code field.Optional[constants.CarrierCode] `json:"code,omitzero"`
// Your account number with this carrier.
//
// Required when `code` is `ups` or `usps`, whose carrier accounts are connected to Shippo using this number; FedEx authorizes through OAuth instead, so no account number is needed.
AccountNumber field.Optional[string] `json:"account_number,omitzero" validate:"omitempty,max=255"`
// Whether customers can see and select this carrier at checkout in the customer portal.
CustomerPortalVisibility field.Optional[constants.CustomerPortalVisibility] `json:"customer_portal_visibility,omitzero" default:"visible"`
}
Request to create a carrier.
func (*CreateCarrierRequest) SchemaExample ¶
func (*CreateCarrierRequest) SchemaExample() any
type DeleteCarrierEndpoint ¶
type DeleteCarrierEndpoint struct{}
Deletes a carrier and all of its service levels.
If the carrier is connected through Shippo, its Shippo carrier account is deactivated. System-owned carriers cannot be deleted.
func (*DeleteCarrierEndpoint) Materialize ¶
func (e *DeleteCarrierEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteCarrierRequest, *apiresource.EmptyResource]
type DeleteCarrierRequest ¶
type DeleteCarrierRequest struct {
// Carrier ID.
CarrierID string `path:"id" validate:"required"`
}
Request to delete a carrier.
type GetOAuthStatusEndpoint ¶
type GetOAuthStatusEndpoint struct{}
Reports whether a carrier's account has been authorized for live rating and label purchase.
Only carriers connected through Shippo have an account to authorize; every other carrier reports `disconnected`, as do sandbox accounts and carriers whose account cannot be reached.
func (*GetOAuthStatusEndpoint) Materialize ¶
func (e *GetOAuthStatusEndpoint) Materialize() *apiendpoint.APIEndpoint[*GetOAuthStatusRequest, *apiresource.OAuthStatusResponse]
type GetOAuthStatusRequest ¶
type GetOAuthStatusRequest struct {
// Carrier ID.
CarrierID string `path:"id" validate:"required"`
}
Request to get carrier OAuth status.
type InitiateOAuthEndpoint ¶
type InitiateOAuthEndpoint struct{}
Starts the OAuth flow that authorizes your own account with the carrier, returning the URL to send the user to.
The carrier must already have a Shippo carrier account, which is created when the carrier is created with a Shippo-supported code. Not available in sandbox mode.
func (*InitiateOAuthEndpoint) Materialize ¶
func (e *InitiateOAuthEndpoint) Materialize() *apiendpoint.APIEndpoint[*InitiateOAuthRequest, *apiresource.OAuthResponse]
type InitiateOAuthRequest ¶
type InitiateOAuthRequest struct {
// Carrier ID.
CarrierID string `path:"id" validate:"required"`
// URL the carrier sends the user back to once they finish authorizing.
RedirectURI string `json:"redirect_uri" validate:"required"`
// Opaque value passed through the OAuth flow and handed back on the redirect.
//
// Use it to correlate the callback with the request that started it, or to carry the page the user should return to.
State field.Optional[string] `json:"state,omitzero"`
}
Request to initiate carrier OAuth.
func (*InitiateOAuthRequest) SchemaExample ¶
func (*InitiateOAuthRequest) SchemaExample() any
type ListCarriersEndpoint ¶
type ListCarriersEndpoint struct{}
Returns a paginated list of the carriers available to the current account.
This covers the carriers you have created plus the platform-provided system carriers that every account shares.
func (*ListCarriersEndpoint) Materialize ¶
func (e *ListCarriersEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListCarriersRequest, *apiresource.List[apiresource.Carrier]]
type ListCarriersRequest ¶
type ListCarriersRequest struct {
apiresource.PaginationRequest
}
Request to list carriers.
type RetrieveCarrierEndpoint ¶
type RetrieveCarrierEndpoint struct{}
Returns a carrier by ID.
func (*RetrieveCarrierEndpoint) Materialize ¶
func (e *RetrieveCarrierEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveCarrierRequest, *apiresource.Carrier]
type RetrieveCarrierRequest ¶
type RetrieveCarrierRequest struct {
// Carrier ID.
CarrierID string `path:"id" validate:"required"`
}
Request to retrieve a carrier by ID.
type SyncOptionsEndpoint ¶
type SyncOptionsEndpoint struct{}
Re-syncs a carrier's service levels from Shippo.
Service levels newly offered by the carrier are added (initially hidden from the customer portal) and previously synced ones no longer offered are removed; manually created service levels are untouched. Only available for Shippo-managed carriers; not available in sandbox mode.
func (*SyncOptionsEndpoint) Materialize ¶
func (e *SyncOptionsEndpoint) Materialize() *apiendpoint.APIEndpoint[*SyncOptionsRequest, *apiresource.Carrier]
type SyncOptionsRequest ¶
type SyncOptionsRequest struct {
// Carrier ID.
CarrierID string `path:"id" validate:"required"`
}
Request to sync a carrier's service levels from Shippo.
type UpdateCarrierEndpoint ¶
type UpdateCarrierEndpoint struct{}
Updates a carrier's name and customer portal visibility.
Only these two attributes can change: a carrier's code and account number are fixed at creation, and system-owned carriers cannot be updated at all.
func (*UpdateCarrierEndpoint) Materialize ¶
func (e *UpdateCarrierEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateCarrierRequest, *apiresource.Carrier]
type UpdateCarrierRequest ¶
type UpdateCarrierRequest struct {
// Carrier ID.
CarrierID string `path:"id" validate:"required"`
// Human-readable name for the carrier.
//
// Must not match another carrier already visible to your account, including the system-provided ones.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// Whether customers can see and select this carrier at checkout in the customer portal.
//
// Each of the carrier's service levels carries its own customer portal visibility, which this does not change.
CustomerPortalVisibility field.Optional[constants.CustomerPortalVisibility] `json:"customer_portal_visibility,omitzero"`
}
Request to update a carrier.
func (*UpdateCarrierRequest) SchemaExample ¶
func (*UpdateCarrierRequest) SchemaExample() any