Documentation
¶
Index ¶
- type CreateSupplierMaterialEndpoint
- type CreateSupplierMaterialRequest
- type DeleteSupplierMaterialEndpoint
- type DeleteSupplierMaterialRequest
- type ListSupplierMaterialsEndpoint
- type ListSupplierMaterialsRequest
- type RetrieveSupplierMaterialEndpoint
- type RetrieveSupplierMaterialRequest
- type SupplierMaterialSvc
- type SupplierMaterialSvcConfig
- type UpdateSupplierMaterialEndpoint
- type UpdateSupplierMaterialRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateSupplierMaterialEndpoint ¶
type CreateSupplierMaterialEndpoint struct{}
Links a material to a supplier, recording the supplier's part number and description for it.
func (*CreateSupplierMaterialEndpoint) Materialize ¶
func (e *CreateSupplierMaterialEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateSupplierMaterialRequest, *apiresource.SupplierMaterial]
type CreateSupplierMaterialRequest ¶
type CreateSupplierMaterialRequest struct {
// ID of the supplier to link the material to.
SupplierID string `path:"supplier_id" validate:"required"`
// ID of the material the supplier provides.
//
// A material can be linked to a given supplier at most once; creating a duplicate link fails with a conflict error.
MaterialID string `json:"material_id" validate:"required"`
// The part number the supplier uses for this material in their own catalog.
SupplierPartNumber string `json:"supplier_part_number" validate:"required,max=255"`
// The supplier's own description of this material.
SupplierDescription field.Optional[string] `json:"supplier_description,omitzero" validate:"omitempty,max=255"`
// Whether this supplier is currently one you would source the material from.
//
// Links are created active unless this is explicitly set to `false`.
IsActive field.Optional[bool] `json:"is_active,omitzero"`
}
Request to create a supplier material.
func (*CreateSupplierMaterialRequest) SchemaExample ¶
func (*CreateSupplierMaterialRequest) SchemaExample() any
type DeleteSupplierMaterialEndpoint ¶
type DeleteSupplierMaterialEndpoint struct{}
Deletes a supplier material link.
Returns the link as it looked immediately before deletion. Removing the link does not affect the underlying material or supplier.
func (*DeleteSupplierMaterialEndpoint) Materialize ¶
func (e *DeleteSupplierMaterialEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteSupplierMaterialRequest, *apiresource.SupplierMaterial]
type DeleteSupplierMaterialRequest ¶
type DeleteSupplierMaterialRequest struct {
// ID of the supplier the material is linked to.
SupplierID string `path:"supplier_id" validate:"required"`
// ID of the material whose supplier link to delete.
//
// Supplier materials are addressed by the combination of supplier and material, so this path parameter takes the material's ID.
MaterialID string `path:"id" validate:"required"`
}
Request to delete a supplier material.
type ListSupplierMaterialsEndpoint ¶
type ListSupplierMaterialsEndpoint struct{}
Returns a paginated list of materials linked to the given supplier, newest first.
Both active and inactive links are returned. The `q` search term matches the supplier part number and description as well as the underlying item's SKU and description.
func (*ListSupplierMaterialsEndpoint) Materialize ¶
func (e *ListSupplierMaterialsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListSupplierMaterialsRequest, *apiresource.List[apiresource.SupplierMaterial]]
type ListSupplierMaterialsRequest ¶
type ListSupplierMaterialsRequest struct {
apiresource.PaginationRequest
// ID of the supplier whose material links to list.
SupplierID string `path:"supplier_id" validate:"required"`
}
Request to list supplier materials.
type RetrieveSupplierMaterialEndpoint ¶
type RetrieveSupplierMaterialEndpoint struct{}
Returns the supplier material link for the given supplier and material.
func (*RetrieveSupplierMaterialEndpoint) Materialize ¶
func (e *RetrieveSupplierMaterialEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveSupplierMaterialRequest, *apiresource.SupplierMaterial]
type RetrieveSupplierMaterialRequest ¶
type RetrieveSupplierMaterialRequest struct {
// ID of the supplier the material is linked to.
SupplierID string `path:"supplier_id" validate:"required"`
// ID of the material whose supplier link to retrieve.
//
// Supplier materials are addressed by the combination of supplier and material, so this path parameter takes the material's ID.
MaterialID string `path:"id" validate:"required"`
}
Request to retrieve a supplier material.
type SupplierMaterialSvc ¶
type SupplierMaterialSvc interface {
ListSupplierMaterials(ctx context.Context, req *ListSupplierMaterialsRequest) (*apiresource.List[apiresource.SupplierMaterial], *apierror.APIError)
GetSupplierMaterial(ctx context.Context, req *RetrieveSupplierMaterialRequest) (*apiresource.SupplierMaterial, *apierror.APIError)
CreateSupplierMaterial(ctx context.Context, req *CreateSupplierMaterialRequest) (*apiresource.SupplierMaterial, *apierror.APIError)
UpdateSupplierMaterial(ctx context.Context, req *UpdateSupplierMaterialRequest) (*apiresource.SupplierMaterial, *apierror.APIError)
DeleteSupplierMaterial(ctx context.Context, req *DeleteSupplierMaterialRequest) (*apiresource.SupplierMaterial, *apierror.APIError)
}
func NewSupplierMaterialSvc ¶
func NewSupplierMaterialSvc(config *SupplierMaterialSvcConfig) SupplierMaterialSvc
type SupplierMaterialSvcConfig ¶
type SupplierMaterialSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type UpdateSupplierMaterialEndpoint ¶
type UpdateSupplierMaterialEndpoint struct{}
Partially updates a supplier material.
Fields not provided retain their current values.
func (*UpdateSupplierMaterialEndpoint) Materialize ¶
func (e *UpdateSupplierMaterialEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateSupplierMaterialRequest, *apiresource.SupplierMaterial]
type UpdateSupplierMaterialRequest ¶
type UpdateSupplierMaterialRequest struct {
// ID of the supplier the material is linked to.
SupplierID string `path:"supplier_id" validate:"required"`
// ID of the material whose supplier link to update.
//
// Supplier materials are addressed by the combination of supplier and material, so this path parameter takes the material's ID.
MaterialID string `path:"id" validate:"required"`
// New part number the supplier uses for this material.
SupplierPartNumber field.Optional[string] `json:"supplier_part_number,omitzero" validate:"omitempty,max=255"`
// New supplier description of this material.
SupplierDescription field.Optional[string] `json:"supplier_description,omitzero" validate:"omitempty,max=255"`
// Whether this supplier is currently one you would source the material from.
IsActive field.Optional[bool] `json:"is_active,omitzero"`
}
Request to update a supplier material.
func (*UpdateSupplierMaterialRequest) SchemaExample ¶
func (*UpdateSupplierMaterialRequest) SchemaExample() any