Documentation
¶
Index ¶
- type AddItemCategoryPropertyEndpoint
- type AddItemCategoryPropertyRequest
- type BulkUpsertItemCategoriesEndpoint
- type BulkUpsertItemCategoriesRequest
- type ChangeItemCategoryUnitGroupEndpoint
- type ChangeItemCategoryUnitGroupRequest
- type CreateItemCategoryEndpoint
- type CreateItemCategoryRequest
- type DeleteItemCategoryEndpoint
- type DeleteItemCategoryRequest
- type ExportItemCategoriesEndpoint
- type ExportItemCategoriesRequest
- type ItemCategorySvc
- type ItemCategorySvcConfig
- type ListItemCategoriesEndpoint
- type ListItemCategoriesRequest
- type RemoveItemCategoryPropertyEndpoint
- type RemoveItemCategoryPropertyRequest
- type RetrieveItemCategoryEndpoint
- type RetrieveItemCategoryRequest
- type UpdateItemCategoryEndpoint
- type UpdateItemCategoryRequest
- type UpsertItemCategoryInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddItemCategoryPropertyEndpoint ¶
type AddItemCategoryPropertyEndpoint struct{}
Attaches one of your account's properties to an item category.
The property then appears among the category's properties, including in the customer-facing catalog, describing a dimension along which the category's items vary. Each property name can appear only once per category, so attaching a property whose name duplicates one already there returns a conflict error.
func (*AddItemCategoryPropertyEndpoint) Materialize ¶
func (e *AddItemCategoryPropertyEndpoint) Materialize() *apiendpoint.APIEndpoint[*AddItemCategoryPropertyRequest, *apiresource.EmptyResource]
type AddItemCategoryPropertyRequest ¶
type AddItemCategoryPropertyRequest struct {
// Item category ID.
ItemCategoryID string `path:"id" validate:"required"`
// ID of the property to add to the category.
PropertyID string `path:"property_id" validate:"required"`
}
Request to add a property to an item category.
type BulkUpsertItemCategoriesEndpoint ¶
type BulkUpsertItemCategoriesEndpoint struct{}
Creates or updates multiple item categories for the account, matched by name (case-insensitive), then writes asynchronously — 202 with a job to poll.
func (*BulkUpsertItemCategoriesEndpoint) Materialize ¶
func (e *BulkUpsertItemCategoriesEndpoint) Materialize() *apiendpoint.APIEndpoint[*BulkUpsertItemCategoriesRequest, *apiresource.Job]
type BulkUpsertItemCategoriesRequest ¶
type BulkUpsertItemCategoriesRequest struct {
// Item categories to create or update, matched by name within the account.
ItemCategories []UpsertItemCategoryInput `json:"item_categories" validate:"required,min=1,max=1000,dive"`
}
BulkUpsertItemCategoriesRequest is the request to bulk upsert item categories.
func (*BulkUpsertItemCategoriesRequest) SchemaExample ¶
func (*BulkUpsertItemCategoriesRequest) SchemaExample() any
type ChangeItemCategoryUnitGroupEndpoint ¶
type ChangeItemCategoryUnitGroupEndpoint struct{}
Changes the unit group of an item category, and with it the units its items can be ordered in.
The new unit group must have the same unit type as the current one — for example, a category measured in `mass` units can only switch to another `mass` unit group. System-owned categories cannot be modified.
func (*ChangeItemCategoryUnitGroupEndpoint) Materialize ¶
func (e *ChangeItemCategoryUnitGroupEndpoint) Materialize() *apiendpoint.APIEndpoint[*ChangeItemCategoryUnitGroupRequest, *apiresource.EmptyResource]
type ChangeItemCategoryUnitGroupRequest ¶
type ChangeItemCategoryUnitGroupRequest struct {
// Item category ID.
ItemCategoryID string `path:"id" validate:"required"`
// ID of the unit group to associate with the category.
//
// Must have the same unit type as the category's current unit group; otherwise the request fails with a validation error.
UnitGroupID string `path:"unit_group_id" validate:"required"`
}
Request to change the unit group of an item category.
type CreateItemCategoryEndpoint ¶
type CreateItemCategoryEndpoint struct{}
Creates an item category owned by your account.
The new category starts with no properties; attach them afterwards with the Add Item Category Property endpoint.
func (*CreateItemCategoryEndpoint) Materialize ¶
func (e *CreateItemCategoryEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateItemCategoryRequest, *apiresource.ItemCategory]
type CreateItemCategoryRequest ¶
type CreateItemCategoryRequest struct {
// Display name of the item category.
Name string `json:"name" validate:"required,max=255"`
// What kind of items this category groups.
//
// - `material_category`: groups raw materials and components (items of type `material`).
// - `product_category`: groups finished products and parts (items of type `product` or `part`).
//
// The type is fixed once the category is created.
Type constants.ItemCategoryType `json:"type" validate:"required"`
// ID of the unit group that determines the units of measure available to items in this category.
//
// Must be one of your account's unit groups or a platform-provided one. After creation the unit group can only be replaced by another unit group of the same unit type, through the Change Item Category Unit Group endpoint.
UnitGroupID string `json:"unit_group_id" validate:"required"`
}
Request to create an item category.
func (*CreateItemCategoryRequest) SchemaExample ¶
func (*CreateItemCategoryRequest) SchemaExample() any
type DeleteItemCategoryEndpoint ¶
type DeleteItemCategoryEndpoint struct{}
Deletes an item category owned by your account.
System-owned categories cannot be deleted. Deleting a category that was already deleted returns an already-deleted error rather than a not-found error.
func (*DeleteItemCategoryEndpoint) Materialize ¶
func (e *DeleteItemCategoryEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteItemCategoryRequest, *apiresource.EmptyResource]
type DeleteItemCategoryRequest ¶
type DeleteItemCategoryRequest struct {
// Item category ID.
ItemCategoryID string `path:"id" validate:"required"`
}
Request to delete an item category.
type ExportItemCategoriesEndpoint ¶
type ExportItemCategoriesEndpoint struct{}
Starts an export of every matching item category and returns the job that tracks it.
func (*ExportItemCategoriesEndpoint) Materialize ¶
func (e *ExportItemCategoriesEndpoint) Materialize() *apiendpoint.APIEndpoint[*ExportItemCategoriesRequest, *apiresource.Job]
type ExportItemCategoriesRequest ¶
type ExportItemCategoriesRequest struct {
// Free-text search term matched against category names.
Query *string `json:"q"`
}
Filters which item categories land in the exported file.
func (*ExportItemCategoriesRequest) SchemaExample ¶
func (*ExportItemCategoriesRequest) SchemaExample() any
type ItemCategorySvc ¶
type ItemCategorySvc interface {
ListItemCategories(ctx context.Context, req *ListItemCategoriesRequest) (*apiresource.List[apiresource.ItemCategory], *apierror.APIError)
ExportItemCategories(ctx context.Context, req *ExportItemCategoriesRequest) (*apiresource.Job, *apierror.APIError)
GetItemCategory(ctx context.Context, req *RetrieveItemCategoryRequest) (*apiresource.ItemCategory, *apierror.APIError)
CreateItemCategory(ctx context.Context, req *CreateItemCategoryRequest) (*apiresource.ItemCategory, *apierror.APIError)
UpdateItemCategory(ctx context.Context, req *UpdateItemCategoryRequest) (*apiresource.ItemCategory, *apierror.APIError)
DeleteItemCategory(ctx context.Context, req *DeleteItemCategoryRequest) (*apiresource.EmptyResource, *apierror.APIError)
AddItemCategoryProperty(ctx context.Context, req *AddItemCategoryPropertyRequest) (*apiresource.EmptyResource, *apierror.APIError)
RemoveItemCategoryProperty(ctx context.Context, req *RemoveItemCategoryPropertyRequest) (*apiresource.EmptyResource, *apierror.APIError)
ChangeItemCategoryUnitGroup(ctx context.Context, req *ChangeItemCategoryUnitGroupRequest) (*apiresource.EmptyResource, *apierror.APIError)
BulkUpsertItemCategories(ctx context.Context, req *BulkUpsertItemCategoriesRequest) (*apiresource.Job, *apierror.APIError)
}
func NewItemCategorySvc ¶
func NewItemCategorySvc(config *ItemCategorySvcConfig) ItemCategorySvc
type ItemCategorySvcConfig ¶
type ItemCategorySvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type ListItemCategoriesEndpoint ¶
type ListItemCategoriesEndpoint struct{}
Returns a paginated list of the item categories available to the current account, newest first.
Both the account's own categories and the platform-provided system categories are included. The `q` search term is matched against the category name.
func (*ListItemCategoriesEndpoint) Materialize ¶
func (e *ListItemCategoriesEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListItemCategoriesRequest, *apiresource.List[apiresource.ItemCategory]]
type ListItemCategoriesRequest ¶
type ListItemCategoriesRequest struct {
apiresource.PaginationRequest
// Filter by item category type.
Type *constants.ItemCategoryType `query:"type"`
}
Request to list item categories.
type RemoveItemCategoryPropertyEndpoint ¶
type RemoveItemCategoryPropertyEndpoint struct{}
Detaches a property from an item category.
Only the link between the property and the category is removed; the property itself and its attributes are left intact and stay available to other categories. The property must belong to your account.
func (*RemoveItemCategoryPropertyEndpoint) Materialize ¶
func (e *RemoveItemCategoryPropertyEndpoint) Materialize() *apiendpoint.APIEndpoint[*RemoveItemCategoryPropertyRequest, *apiresource.EmptyResource]
type RemoveItemCategoryPropertyRequest ¶
type RemoveItemCategoryPropertyRequest struct {
// Item category ID.
ItemCategoryID string `path:"id" validate:"required"`
// ID of the property to remove from the category.
PropertyID string `path:"property_id" validate:"required"`
}
Request to remove a property from an item category.
type RetrieveItemCategoryEndpoint ¶
type RetrieveItemCategoryEndpoint struct{}
Returns an item category by ID.
Both account-owned categories and global system categories can be retrieved.
func (*RetrieveItemCategoryEndpoint) Materialize ¶
func (e *RetrieveItemCategoryEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveItemCategoryRequest, *apiresource.ItemCategory]
type RetrieveItemCategoryRequest ¶
type RetrieveItemCategoryRequest struct {
// Item category ID.
ItemCategoryID string `path:"id" validate:"required"`
}
Request to retrieve an item category.
type UpdateItemCategoryEndpoint ¶
type UpdateItemCategoryEndpoint struct{}
Updates the name or notes of an item category owned by your account.
Only the fields present in the request body are changed. A category's type is fixed at creation, and its unit group is changed through the Change Item Category Unit Group endpoint. System-owned categories cannot be updated.
func (*UpdateItemCategoryEndpoint) Materialize ¶
func (e *UpdateItemCategoryEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateItemCategoryRequest, *apiresource.ItemCategory]
type UpdateItemCategoryRequest ¶
type UpdateItemCategoryRequest struct {
// Item category ID.
ItemCategoryID string `path:"id" validate:"required"`
// Display name of the item category.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// Free-form notes about the item category.
Notes field.Optional[string] `json:"notes,omitzero"`
}
Request to partially update an item category.
func (*UpdateItemCategoryRequest) SchemaExample ¶
func (*UpdateItemCategoryRequest) SchemaExample() any
type UpsertItemCategoryInput ¶
type UpsertItemCategoryInput struct {
// Display name of the item category, used to match existing categories.
Name string `json:"name" validate:"required,max=255"`
// Item category type code. Create-only.
Type constants.ItemCategoryType `json:"type" validate:"required"`
// Unit group to associate with this item category, referenced by `id` or `name`.
UnitGroup apirequest.ObjectIdentifier `json:"unit_group" validate:"required"`
// Optional list of property names to attach to this category. Properties are matched
// by name (case-insensitive) within the account; names not found are created automatically.
// Relations are additive — existing relations are not removed.
PropertyNames []string `json:"property_names" default:"[]"`
// Optional notes.
Notes *string `json:"notes" default:"null" nullable:"true"`
}
UpsertItemCategoryInput is the input for a single item category in a bulk upsert operation.
Source Files
¶
- endpoint_add_property.go
- endpoint_bulk_upsert_item_categories.go
- endpoint_change_unit_group.go
- endpoint_create_item_category.go
- endpoint_delete_item_category.go
- endpoint_export_item_categories.go
- endpoint_list_item_categories.go
- endpoint_remove_property.go
- endpoint_retrieve_item_category.go
- endpoint_update_item_category.go
- service.go