Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressSvc ¶
type AddressSvc interface {
ListAddresses(ctx context.Context, req *ListAddressesRequest) (*apiresource.List[apiresource.Address], *apierror.APIError)
GetAddress(ctx context.Context, req *RetrieveAddressRequest) (*apiresource.Address, *apierror.APIError)
CreateAddress(ctx context.Context, req *apirequest.AddressInput) (*apiresource.Address, *apierror.APIError)
UpdateAddress(ctx context.Context, req *UpdateAddressRequest) (*apiresource.Address, *apierror.APIError)
DeleteAddress(ctx context.Context, req *DeleteAddressRequest) (*apiresource.EmptyResource, *apierror.APIError)
}
func NewAddressSvc ¶
func NewAddressSvc(config *AddressSvcConfig) AddressSvc
type AddressSvcConfig ¶
type AddressSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type CreateAddressEndpoint ¶
type CreateAddressEndpoint struct{}
Creates an address.
The address is saved to the account you are acting in, which may be your own account or a customer or supplier account you manage, and can then be used as a billing or shipping address on sales orders, invoices, and shipments.
func (*CreateAddressEndpoint) Materialize ¶
func (e *CreateAddressEndpoint) Materialize() *apiendpoint.APIEndpoint[*apirequest.AddressInput, *apiresource.Address]
type DeleteAddressEndpoint ¶
type DeleteAddressEndpoint struct{}
Deletes an address.
Deletion fails if the address is in use as a billing or shipping address on a sales order, invoice, or shipment, or as a default account address.
func (*DeleteAddressEndpoint) Materialize ¶
func (e *DeleteAddressEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteAddressRequest, *apiresource.EmptyResource]
type DeleteAddressRequest ¶
type DeleteAddressRequest struct {
// Address ID.
AddressID string `path:"id" validate:"required"`
}
Request to delete an address.
type ListAddressesEndpoint ¶
type ListAddressesEndpoint struct{}
Returns a paginated list of addresses.
Addresses belonging to the account you are acting in are returned newest first. The `q` search term matches the address name, street lines, city, state, postal code, and country.
func (*ListAddressesEndpoint) Materialize ¶
func (e *ListAddressesEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListAddressesRequest, *apiresource.List[apiresource.Address]]
type ListAddressesRequest ¶
type ListAddressesRequest struct {
apiresource.PaginationRequest
// Filters results to addresses of the given type.
Type *constants.AddressType `query:"type"`
}
Request to list addresses.
type RetrieveAddressEndpoint ¶
type RetrieveAddressEndpoint struct{}
Retrieves an address by ID.
func (*RetrieveAddressEndpoint) Materialize ¶
func (e *RetrieveAddressEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveAddressRequest, *apiresource.Address]
type RetrieveAddressRequest ¶
type RetrieveAddressRequest struct {
// Address ID.
AddressID string `path:"id" validate:"required"`
}
Request to get an address.
type UpdateAddressEndpoint ¶
type UpdateAddressEndpoint struct{}
Partially updates an address.
Changing a street, locality, state, postal code, or country field may replace the address's geolocation, so the geolocation `id` in the response can change.
func (*UpdateAddressEndpoint) Materialize ¶
func (e *UpdateAddressEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateAddressRequest, *apiresource.Address]
type UpdateAddressRequest ¶
type UpdateAddressRequest struct {
// Address ID.
AddressID string `path:"id" validate:"required"`
// Display name of the address.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,min=1,max=255"`
// Phone number associated with the address.
//
// Send `null` to clear.
Phone field.Clearable[string] `json:"phone,omitzero" validate:"omitempty,max=255"`
// Email address associated with the address.
//
// Send `null` to clear.
Email field.Clearable[string] `json:"email,omitzero" validate:"omitempty,custom_email,max=255"`
// How the address is used.
//
// - `standard`: a normal shipping or billing address.
// - `drop_ship`: an address an order is shipped to directly, typically a third party or end customer rather than the account itself.
Type field.Optional[constants.AddressType] `json:"type,omitzero"`
// The operating calendar naming the days this dock accepts freight, overriding the customer's own. Clearing it returns this address to the customer's own calendar.
ReceiveCalendarID field.Clearable[string] `json:"receive_calendar_id,omitzero" validate:"omitempty"`
// First line of the street address.
StreetLine1 field.Optional[string] `json:"street_line_1,omitzero" validate:"omitempty,max=255"`
// Second line of the street address.
//
// Send `null` to clear.
StreetLine2 field.Clearable[string] `json:"street_line_2,omitzero" validate:"omitempty,max=255"`
// City or locality.
Locality field.Optional[string] `json:"locality,omitzero" validate:"omitempty,max=255"`
// State or administrative area.
State field.Optional[string] `json:"state,omitzero" validate:"omitempty,max=255"`
// Postal or ZIP code.
PostalCode field.Optional[string] `json:"postal_code,omitzero" validate:"omitempty,max=255"`
// Two-letter country code.
Country field.Optional[string] `json:"country,omitzero" validate:"omitempty,max=2"`
}
Request to partially update an address.
Omitted fields are left unchanged.
func (*UpdateAddressRequest) SchemaExample ¶
func (*UpdateAddressRequest) SchemaExample() any