Documentation
¶
Index ¶
- type BulkDeleteSuppliersEndpoint
- type BulkDeleteSuppliersRequest
- type CreateSupplierEndpoint
- type CreateSupplierRequest
- type DeleteSupplierEndpoint
- type DeleteSupplierRequest
- type ListSuppliersEndpoint
- type ListSuppliersRequest
- type RetrieveSupplierEndpoint
- type RetrieveSupplierRequest
- type SupplierSvc
- type SupplierSvcConfig
- type UpdateSupplierEndpoint
- type UpdateSupplierRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkDeleteSuppliersEndpoint ¶
type BulkDeleteSuppliersEndpoint struct{}
Deletes multiple suppliers in a single atomic operation.
Each supplier's saved addresses and any users belonging to it are deleted along with it. If any supplier ID is not found, no suppliers are deleted.
func (*BulkDeleteSuppliersEndpoint) Materialize ¶
func (e *BulkDeleteSuppliersEndpoint) Materialize() *apiendpoint.APIEndpoint[*BulkDeleteSuppliersRequest, *apiresource.EmptyResource]
type BulkDeleteSuppliersRequest ¶
type BulkDeleteSuppliersRequest struct {
// Supplier IDs to delete.
SupplierIDs []string `json:"supplier_ids" validate:"required"`
}
Request to delete multiple suppliers.
func (*BulkDeleteSuppliersRequest) SchemaExample ¶
func (*BulkDeleteSuppliersRequest) SchemaExample() any
type CreateSupplierEndpoint ¶
type CreateSupplierEndpoint struct{}
Creates a supplier, optionally with inline bill-to and ship-to addresses.
Returns a conflict error if another supplier in the account already uses the given number.
func (*CreateSupplierEndpoint) Materialize ¶
func (e *CreateSupplierEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateSupplierRequest, *apiresource.SupplierDetail]
type CreateSupplierRequest ¶
type CreateSupplierRequest struct {
// The supplier's name, as shown in the dashboard and on documents.
Name string `json:"name" validate:"required,max=255"`
// Human-facing supplier code, such as `SUP-001`.
//
// Must be unique per account; creating a supplier with a number already in use returns a conflict error.
Number string `json:"number" validate:"required,max=255"`
// Free-form notes about the supplier.
Note field.Optional[string] `json:"note,omitzero"`
// Default billing address to create for the supplier.
//
// A new address record is created from these values and saved to the supplier; existing addresses cannot be reused here.
BillToAddress field.Optional[apirequest.AddressInput] `json:"bill_to_address,omitzero"`
// Default shipping address to create for the supplier.
//
// If omitted and `bill_to_address` is provided, the billing address is also used as the default shipping address.
ShipToAddress field.Optional[apirequest.AddressInput] `json:"ship_to_address,omitzero"`
}
Request to create a supplier.
func (*CreateSupplierRequest) SchemaExample ¶
func (*CreateSupplierRequest) SchemaExample() any
type DeleteSupplierEndpoint ¶
type DeleteSupplierEndpoint struct{}
Deletes a supplier.
The supplier's saved addresses and any users belonging to the supplier are deleted along with it. Returns the supplier as it looked immediately before deletion. Deleting a supplier that has already been deleted returns an error rather than succeeding again.
func (*DeleteSupplierEndpoint) Materialize ¶
func (e *DeleteSupplierEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteSupplierRequest, *apiresource.SupplierDetail]
type DeleteSupplierRequest ¶
type DeleteSupplierRequest struct {
// Supplier ID.
SupplierID string `path:"id" validate:"required"`
}
Request to delete a supplier.
type ListSuppliersEndpoint ¶
type ListSuppliersEndpoint struct{}
Returns a paginated list of suppliers for the current account, newest first.
Filters combine with AND, so an item filter and a date range narrow the list together. The `q` search term matches the supplier name and number.
func (*ListSuppliersEndpoint) Materialize ¶
func (e *ListSuppliersEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListSuppliersRequest, *apiresource.List[apiresource.SupplierSummary]]
type ListSuppliersRequest ¶
type ListSuppliersRequest struct {
apiresource.PaginationRequest
// Filter to suppliers that can source any of these items.
//
// A supplier matches when it provides a material for one of the items, whether or not that material link is active.
ItemIDs []string `query:"item_ids"`
// Only return suppliers created at or after this timestamp.
StartDate *time.Time `query:"starts_at"`
// Only return suppliers created at or before this timestamp.
EndDate *time.Time `query:"ends_at"`
}
Request to list suppliers.
type RetrieveSupplierEndpoint ¶
type RetrieveSupplierEndpoint struct{}
Returns a supplier by ID.
func (*RetrieveSupplierEndpoint) Materialize ¶
func (e *RetrieveSupplierEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveSupplierRequest, *apiresource.SupplierDetail]
type RetrieveSupplierRequest ¶
type RetrieveSupplierRequest struct {
// Supplier ID.
SupplierID string `path:"id" validate:"required"`
}
Request to retrieve a supplier by ID.
type SupplierSvc ¶
type SupplierSvc interface {
ListSuppliers(ctx context.Context, req *ListSuppliersRequest) (*apiresource.List[apiresource.SupplierSummary], *apierror.APIError)
GetSupplier(ctx context.Context, req *RetrieveSupplierRequest) (*apiresource.SupplierDetail, *apierror.APIError)
CreateSupplier(ctx context.Context, req *CreateSupplierRequest) (*apiresource.SupplierDetail, *apierror.APIError)
UpdateSupplier(ctx context.Context, req *UpdateSupplierRequest) (*apiresource.SupplierDetail, *apierror.APIError)
DeleteSupplier(ctx context.Context, req *DeleteSupplierRequest) (*apiresource.SupplierDetail, *apierror.APIError)
BulkDeleteSuppliers(ctx context.Context, req *BulkDeleteSuppliersRequest) (*apiresource.EmptyResource, *apierror.APIError)
}
func NewSupplierSvc ¶
func NewSupplierSvc(config *SupplierSvcConfig) SupplierSvc
type SupplierSvcConfig ¶
type SupplierSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type UpdateSupplierEndpoint ¶
type UpdateSupplierEndpoint struct{}
Partially updates a supplier.
Only provided fields are changed. To update or clear the note, set `update_note` to `true`.
func (*UpdateSupplierEndpoint) Materialize ¶
func (e *UpdateSupplierEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateSupplierRequest, *apiresource.SupplierDetail]
type UpdateSupplierRequest ¶
type UpdateSupplierRequest struct {
// Supplier ID.
SupplierID string `path:"id" validate:"required"`
// The supplier's name, as shown in the dashboard and on documents.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// Human-facing supplier code, such as `SUP-001`.
//
// Must be unique per account; updating to a number already used by another supplier returns a conflict error.
Number field.Optional[string] `json:"number,omitzero" validate:"omitempty,max=255"`
// New value for the supplier's note.
//
// Ignored unless `update_note` is `true`.
Note field.Optional[string] `json:"note,omitzero"`
// Whether to apply the `note` field.
//
// When `true`, the note is set to the provided `note` value, or cleared if `note` is omitted. When `false`, the note is left unchanged.
UpdateNote bool `json:"update_note"`
// ID of an existing address to set as the supplier's default billing address.
BillToAddressID field.Optional[string] `json:"bill_to_address_id,omitzero" validate:"omitempty"`
// ID of an existing address to set as the supplier's default shipping address.
ShipToAddressID field.Optional[string] `json:"ship_to_address_id,omitzero" validate:"omitempty"`
}
Request to update a supplier.
func (*UpdateSupplierRequest) SchemaExample ¶
func (*UpdateSupplierRequest) SchemaExample() any