Documentation
¶
Index ¶
- func ProductLinePresenter(pl *pb.ProductLineInfo, ownerAccount *apiresource.Account) apiresource.ProductLine
- type BulkUpsertProductLinesEndpoint
- type BulkUpsertProductLinesRequest
- type CreateProductLineEndpoint
- type CreateProductLineRequest
- type DeleteProductLineEndpoint
- type DeleteProductLineRequest
- type ExportProductLinesEndpoint
- type ExportProductLinesRequest
- type ListProductLinesEndpoint
- type ListProductLinesRequest
- type ProductLineSvc
- type ProductLineSvcConfig
- type RetrieveProductLineEndpoint
- type RetrieveProductLineRequest
- type UpdateProductLineEndpoint
- type UpdateProductLineRequest
- type UpsertProductLineInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProductLinePresenter ¶
func ProductLinePresenter(pl *pb.ProductLineInfo, ownerAccount *apiresource.Account) apiresource.ProductLine
Types ¶
type BulkUpsertProductLinesEndpoint ¶
type BulkUpsertProductLinesEndpoint struct{}
Creates or updates multiple product lines for the account, matched by name (case-insensitive), then writes asynchronously — 202 with a job to poll.
func (*BulkUpsertProductLinesEndpoint) Materialize ¶
func (e *BulkUpsertProductLinesEndpoint) Materialize() *apiendpoint.APIEndpoint[*BulkUpsertProductLinesRequest, *apiresource.Job]
type BulkUpsertProductLinesRequest ¶
type BulkUpsertProductLinesRequest struct {
// Product lines to create or update, matched by name within the account.
ProductLines []UpsertProductLineInput `json:"product_lines" validate:"required,min=1,max=1000,dive"`
}
BulkUpsertProductLinesRequest is the request to bulk upsert product lines.
func (*BulkUpsertProductLinesRequest) SchemaExample ¶
func (*BulkUpsertProductLinesRequest) SchemaExample() any
type CreateProductLineEndpoint ¶
type CreateProductLineEndpoint struct{}
Creates a product line owned by your account.
The new line starts with no products; assign products to it by setting their product line. Customers and account groups can only be granted access to lines your account owns, so this is the starting point for scoping a customer's catalog.
func (*CreateProductLineEndpoint) Materialize ¶
func (e *CreateProductLineEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateProductLineRequest, *apiresource.ProductLine]
type CreateProductLineRequest ¶
type CreateProductLineRequest struct {
// Display name of the product line.
//
// Must be unique among the product lines visible to your account, including the shared system lines; a duplicate name returns a conflict error.
Name string `json:"name" validate:"required,max=255"`
// ID of the unit group to associate with this product line.
//
// The unit group determines the set of units available to products in this product line. It must be a unit group your account owns or one of the shared system unit groups.
UnitGroupID string `json:"unit_group_id" validate:"required"`
// Default commission policy for products in this product line.
//
// - `commission_exempt`: no commission applies to these products.
// - `commission_applied`: commission applies to these products, unless overridden elsewhere.
CommissionPolicy constants.CommissionPolicy `json:"commission_policy" validate:"required"`
// The lot products in this line are made in — a doff, a pallet.
//
// Sizes the campaigns a production schedule plans, and defaults the quantity when a batch is added to a production run. The unit is part of the value, since 60 pairs and 60 eaches are different lots, and it must belong to the unit group given by `unit_group_id`. The value must be greater than zero. Leave this out for a line with no lot convention, and planning falls back to the lot of the line an item feeds into, and then to the account-wide default lot size.
DefaultLot field.Optional[apirequest.QuantityInput] `json:"default_lot,omitzero"`
// How products in this line are produced when they do not say for themselves.
//
// - `make_to_stock`: built to the forecast, holding a safety stock against its variability.
// - `make_to_order`: built only against orders already on the book, holding no buffer.
FulfillmentPolicy field.Optional[constants.FulfillmentPolicy] `json:"fulfillment_policy,omitzero"`
// Default freight policy for products in this product line.
//
// - `free_freight`: these products do not incur a freight charge.
// - `billed_freight`: freight is billed for these products, unless overridden elsewhere.
FreightPolicy constants.FreightPolicy `json:"freight_policy" validate:"required"`
}
Request to create a product line.
func (*CreateProductLineRequest) SchemaExample ¶
func (*CreateProductLineRequest) SchemaExample() any
type DeleteProductLineEndpoint ¶
type DeleteProductLineEndpoint struct{}
Permanently deletes a product line your account owns.
The reserved `shipping`, `service`, `credit`, and `tax` lines cannot be deleted, and neither can the shared system lines, which belong to no single account. Deleting a line that was already deleted returns an already-deleted error rather than succeeding silently.
func (*DeleteProductLineEndpoint) Materialize ¶
func (e *DeleteProductLineEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteProductLineRequest, *apiresource.EmptyResource]
type DeleteProductLineRequest ¶
type DeleteProductLineRequest struct {
// Product line ID.
ProductLineID string `path:"id" validate:"required"`
}
Request to delete a product line.
type ExportProductLinesEndpoint ¶
type ExportProductLinesEndpoint struct{}
Starts an export of every matching product line and returns the job that tracks it; system
func (*ExportProductLinesEndpoint) Materialize ¶
func (e *ExportProductLinesEndpoint) Materialize() *apiendpoint.APIEndpoint[*ExportProductLinesRequest, *apiresource.Job]
type ExportProductLinesRequest ¶
type ExportProductLinesRequest struct {
// Free-text search term matched against product line names.
Query *string `json:"q"`
}
Filters which product lines land in the exported file.
func (*ExportProductLinesRequest) SchemaExample ¶
func (*ExportProductLinesRequest) SchemaExample() any
type ListProductLinesEndpoint ¶
type ListProductLinesEndpoint struct{}
Returns a paginated list of product lines, newest first.
Covers both the product lines your account owns and the shared system lines. The `q` search term is matched against the product line name.
func (*ListProductLinesEndpoint) Materialize ¶
func (e *ListProductLinesEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListProductLinesRequest, *apiresource.List[apiresource.ProductLine]]
type ListProductLinesRequest ¶
type ListProductLinesRequest struct {
apiresource.PaginationRequest
}
Request to list product lines.
type ProductLineSvc ¶
type ProductLineSvc interface {
ListProductLines(ctx context.Context, req *ListProductLinesRequest) (*apiresource.List[apiresource.ProductLine], *apierror.APIError)
ExportProductLines(ctx context.Context, req *ExportProductLinesRequest) (*apiresource.Job, *apierror.APIError)
GetProductLine(ctx context.Context, req *RetrieveProductLineRequest) (*apiresource.ProductLine, *apierror.APIError)
CreateProductLine(ctx context.Context, req *CreateProductLineRequest) (*apiresource.ProductLine, *apierror.APIError)
UpdateProductLine(ctx context.Context, req *UpdateProductLineRequest) (*apiresource.ProductLine, *apierror.APIError)
DeleteProductLine(ctx context.Context, req *DeleteProductLineRequest) (*apiresource.EmptyResource, *apierror.APIError)
BulkUpsertProductLines(ctx context.Context, req *BulkUpsertProductLinesRequest) (*apiresource.Job, *apierror.APIError)
}
func NewProductLineSvc ¶
func NewProductLineSvc(config *ProductLineSvcConfig) ProductLineSvc
type ProductLineSvcConfig ¶
type ProductLineSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type RetrieveProductLineEndpoint ¶
type RetrieveProductLineEndpoint struct{}
Returns a single product line by ID.
Both the product lines your account owns and the shared system lines can be retrieved.
func (*RetrieveProductLineEndpoint) Materialize ¶
func (e *RetrieveProductLineEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveProductLineRequest, *apiresource.ProductLine]
type RetrieveProductLineRequest ¶
type RetrieveProductLineRequest struct {
// Product line ID.
ProductLineID string `path:"id" validate:"required"`
}
Request to get a product line.
type UpdateProductLineEndpoint ¶
type UpdateProductLineEndpoint struct{}
Partially updates a product line your account owns.
Only the provided fields are changed. The reserved `shipping`, `service`, `credit`, and `tax` lines cannot be updated, and neither can the shared system lines, which belong to no single account.
func (*UpdateProductLineEndpoint) Materialize ¶
func (e *UpdateProductLineEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateProductLineRequest, *apiresource.ProductLine]
type UpdateProductLineRequest ¶
type UpdateProductLineRequest struct {
// Product line ID.
ProductLineID string `path:"id" validate:"required"`
// Display name of the product line.
//
// Must be unique among the product lines visible to your account, including the shared system lines; a duplicate name returns a conflict error.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// Default commission policy for products in this product line.
//
// - `commission_exempt`: no commission applies to these products.
// - `commission_applied`: commission applies to these products, unless overridden elsewhere.
CommissionPolicy field.Optional[constants.CommissionPolicy] `json:"commission_policy,omitzero"`
// Default freight policy for products in this product line.
//
// - `free_freight`: these products do not incur a freight charge.
// - `billed_freight`: freight is billed for these products, unless overridden elsewhere.
FreightPolicy field.Optional[constants.FreightPolicy] `json:"freight_policy,omitzero"`
// The lot products in this line are made in — a doff, a pallet.
//
// Sizes the campaigns a production schedule plans, and defaults the quantity when a batch is added to a production run. The unit is part of the value, since 60 pairs and 60 eaches are different lots, and it must belong to the line's unit group — the new one when `unit_group_id` changes in the same request. Send `null` to remove the line's lot convention, after which planning falls back to the lot of the line an item feeds into, and then to the account-wide default lot size.
DefaultLot field.Clearable[apirequest.QuantityInput] `json:"default_lot,omitzero"`
// How products in this line are produced when they do not say for themselves.
//
// - `make_to_stock`: built to the forecast, holding a safety stock against its variability.
// - `make_to_order`: built only against orders already on the book, holding no buffer.
//
// Clearing it returns the line's products to the account default.
FulfillmentPolicy field.Clearable[constants.FulfillmentPolicy] `json:"fulfillment_policy,omitzero"`
// ID of the unit group to associate with this product line.
//
// The unit group determines the set of units available to products in this product line. It must be a unit group your account owns or one of the shared system unit groups. A lot already stored on the line is not rechecked when the group changes, so send `default_lot` alongside to keep the two consistent.
UnitGroupID field.Optional[string] `json:"unit_group_id,omitzero" validate:"omitempty"`
}
Request to partially update a product line.
func (*UpdateProductLineRequest) SchemaExample ¶
func (*UpdateProductLineRequest) SchemaExample() any
type UpsertProductLineInput ¶
type UpsertProductLineInput struct {
// Display name of the product line, matched case-insensitively against existing lines.
// A row matching a system product line fails — system lines cannot be modified.
Name string `json:"name" validate:"required,max=255"`
// Unit group to associate with this product line, referenced by `id` or `name`.
UnitGroup apirequest.ObjectIdentifier `json:"unit_group" validate:"required"`
// Default commission policy for products in this product line.
//
// - `commission_exempt`: no commission applies to these products.
// - `commission_applied`: commission applies to these products, unless overridden elsewhere.
CommissionPolicy constants.CommissionPolicy `json:"commission_policy" validate:"required"`
// Default freight policy for products in this product line.
//
// - `free_freight`: these products do not incur a freight charge.
// - `billed_freight`: freight is billed for these products, unless overridden elsewhere.
FreightPolicy constants.FreightPolicy `json:"freight_policy" validate:"required"`
}
UpsertProductLineInput is the input for a single product line in a bulk upsert operation.