partep

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PartPresenter

func PartPresenter(p *pb.PartInfo) apiresource.Part

Types

type BulkUpsertPartsEndpoint

type BulkUpsertPartsEndpoint struct{}

Creates or updates multiple parts for the account, matched by SKU, then writes asynchronously — 202 with a job to poll.

func (*BulkUpsertPartsEndpoint) Materialize

type BulkUpsertPartsRequest

type BulkUpsertPartsRequest struct {
	// Parts to create or update, matched by SKU within the account.
	Parts []UpsertPartInput `json:"parts" validate:"required,min=1,max=1000,dive"`
}

BulkUpsertPartsRequest is the request to bulk upsert parts.

func (*BulkUpsertPartsRequest) SchemaExample

func (*BulkUpsertPartsRequest) SchemaExample() any

type CreatePartEndpoint

type CreatePartEndpoint struct{}

Creates a part with the specified SKU and category.

Inventory tracking for the new part starts at a zero on-hand quantity in the category's base unit.

func (*CreatePartEndpoint) Materialize

type CreatePartRequest

type CreatePartRequest struct {
	// Stock keeping unit code for the part.
	//
	// Must be unique within the account; creating a part with a SKU already used by another item fails with a conflict error.
	SKU string `json:"sku" validate:"required,max=255"`
	// Free-form description of the part.
	Description field.Optional[string] `json:"description,omitzero"`
	// Free-form notes about the part.
	Notes field.Optional[string] `json:"notes,omitzero"`
	// ID of the item category to place the part in.
	//
	// The category's unit group determines the base unit used for the part's rates (`unit_value`, `unit_cost`, `burn_rate`).
	CategoryID string `json:"category_id" validate:"required"`
	// Initial selling price per unit.
	//
	// `numerator_unit_id` must reference a currency unit and `denominator_unit_id` must reference a non-currency unit (e.g. `$5` per `ea`). When omitted, the price is initialized to a zero rate in the category's base unit.
	UnitPrice field.Optional[apirequest.RateInput] `json:"unit_price,omitzero"`
	// Initial cost per unit.
	//
	// Follows the same unit rule as `unit_price`: currency numerator, non-currency denominator. When omitted, the cost is initialized to a zero rate in the category's base unit.
	UnitCost field.Optional[apirequest.RateInput] `json:"unit_cost,omitzero"`
	// IDs of existing attributes to link to the part at creation time.
	//
	// Each attribute's property must be one the part's category carries; an attribute from any other property fails the whole request.
	AttributeIDs []string `json:"attribute_ids,omitzero"`
}

Request to create a part.

func (*CreatePartRequest) SchemaExample

func (*CreatePartRequest) SchemaExample() any

type DeletePartEndpoint

type DeletePartEndpoint struct{}

Deletes a part.

This is a soft delete: the part is marked deleted and no longer returned by other endpoints, but the record is retained. Deleting an already-deleted part returns an error.

func (*DeletePartEndpoint) Materialize

type DeletePartRequest

type DeletePartRequest struct {
	// ID of the part to delete.
	ItemID string `path:"id" validate:"required"`
}

Request to delete a part.

type ExportPartsEndpoint

type ExportPartsEndpoint struct{}

Starts an export of every matching part and returns the job that tracks it.

func (*ExportPartsEndpoint) Materialize

type ExportPartsRequest

type ExportPartsRequest struct {
	// Free-text search term matched against the part's SKU or description.
	Query *string `json:"q"`
	// Filter to parts belonging to any of these item categories.
	CategoryIDs []string `json:"category_ids"`
	// Filter to parts carrying at least one of these attributes.
	AttributeIDs []string `json:"attribute_ids"`
	// Filter to parts created at or after this time.
	StartDate *time.Time `json:"starts_at"`
	// Filter to parts created at or before this time.
	EndDate *time.Time `json:"ends_at"`
}

Filters which parts land in the exported file.

func (*ExportPartsRequest) SchemaExample

func (*ExportPartsRequest) SchemaExample() any

type ListPartsEndpoint

type ListPartsEndpoint struct{}

Returns a paginated list of parts for the current account, most recently created first.

The `q` search term matches the part's SKU or description. When it is supplied, the parts whose SKU matches it most closely are returned first, ordered by creation time within each level of match.

func (*ListPartsEndpoint) Materialize

type ListPartsRequest

type ListPartsRequest struct {
	apiresource.PaginationRequest
	// Only return parts belonging to any of these item categories.
	CategoryIDs []string `query:"category_ids"`
	// Only return parts carrying at least one of these attributes.
	AttributeIDs []string `query:"attribute_ids"`
	// Only return parts created at or after this time.
	StartDate *time.Time `query:"starts_at"`
	// Only return parts created at or before this time.
	EndDate *time.Time `query:"ends_at"`
}

Request to list parts.

type PartSvcConfig

type PartSvcConfig struct {
	// CoreClient (required) is the core-service gRPC client.
	CoreClient pb.CoreServiceClient
}

type RetrievePartEndpoint

type RetrievePartEndpoint struct{}

Returns a part by ID.

func (*RetrievePartEndpoint) Materialize

type RetrievePartRequest

type RetrievePartRequest struct {
	// ID of the part to retrieve.
	ItemID string `path:"id" validate:"required"`
}

Request to retrieve a part by ID.

type UpdatePartEndpoint

type UpdatePartEndpoint struct{}

Partially updates a part.

Fields not provided retain their current values. Only the SKU, description, and notes are editable here; the part's category and attributes are changed through the item endpoints.

func (*UpdatePartEndpoint) Materialize

type UpdatePartRequest

type UpdatePartRequest struct {
	// ID of the part to update.
	ItemID string `path:"id" validate:"required"`
	// New stock keeping unit code for the part.
	//
	// Must remain unique within the account; a conflict error is returned if another item already uses it.
	SKU field.Optional[string] `json:"sku,omitzero" validate:"omitempty,max=255"`
	// New free-form description of the part.
	Description field.Clearable[string] `json:"description,omitzero"`
	// New free-form notes about the part.
	Notes field.Clearable[string] `json:"notes,omitzero"`
}

Request to partially update a part.

func (*UpdatePartRequest) SchemaExample

func (*UpdatePartRequest) SchemaExample() any

type UpsertPartInput

type UpsertPartInput struct {
	// SKU for the part, matched against existing parts in the account: a match updates in
	// place, otherwise a part is created. A SKU held by a non-part item fails that row.
	SKU string `json:"sku" validate:"required,max=255"`
	// Free-form description of the part.
	Description field.Optional[string] `json:"description,omitzero"`
	// Free-form notes about the part.
	Notes field.Optional[string] `json:"notes,omitzero"`
	// Item category to place the part in, referenced by `id` or `name`. Create-only; its
	// unit group determines the base unit of the part's rates.
	Category apirequest.ObjectIdentifier `json:"category" validate:"required"`
	// Selling price per unit — a currency numerator over a per-unit denominator. Omitted, it
	// defaults to a zero rate in the category's base unit and is left unchanged on update.
	UnitPrice field.Optional[apirequest.RateInput] `json:"unit_price,omitzero"`
	// Cost per unit. Same unit rule and omission behaviour as `unit_price`.
	UnitCost field.Optional[apirequest.RateInput] `json:"unit_cost,omitzero"`
	// Properties to attach to the part, matched/created by name + value. Additive —
	// existing attributes are not removed.
	Properties []UpsertPartProperty `json:"properties" default:"[]" validate:"dive"`
}

UpsertPartInput is the input for a single part in a bulk upsert operation.

type UpsertPartProperty

type UpsertPartProperty struct {
	// Property name (e.g. "Material"). Matched case-insensitively; created if missing.
	Name string `json:"name" validate:"required,max=255"`
	// Property value (e.g. "Steel"). Matched exactly; created under the property if missing.
	Value string `json:"value" validate:"required,max=255" format:"decimal"`
}

UpsertPartProperty is a property name + value pair attached to a part. The property and its value (an attribute) are created if they do not yet exist.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL