Documentation
¶
Index ¶
- func LocationTypeListPresenter(ctx context.Context, resp *pb.ListLocationTypesResponse) *apiresource.List[apiresource.LocationType]
- func LocationTypePresenter(slt *pb.LocationTypeInfo) apiresource.LocationType
- type BulkUpsertLocationsEndpoint
- type BulkUpsertLocationsRequest
- type CreateLocationEndpoint
- type CreateLocationRequest
- type DeleteLocationEndpoint
- type DeleteLocationRequest
- type ExportLocationsEndpoint
- type ExportLocationsRequest
- type ListLocationTypesEndpoint
- type ListLocationTypesRequest
- type ListLocationsEndpoint
- type ListLocationsRequest
- type LocationSvc
- type LocationSvcConfig
- type RetrieveLocationEndpoint
- type RetrieveLocationRequest
- type RetrieveLocationTypeEndpoint
- type RetrieveLocationTypeRequest
- type UpdateLocationEndpoint
- type UpdateLocationRequest
- type UpsertLocationInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LocationTypeListPresenter ¶
func LocationTypeListPresenter(ctx context.Context, resp *pb.ListLocationTypesResponse) *apiresource.List[apiresource.LocationType]
func LocationTypePresenter ¶
func LocationTypePresenter(slt *pb.LocationTypeInfo) apiresource.LocationType
Types ¶
type BulkUpsertLocationsEndpoint ¶
type BulkUpsertLocationsEndpoint struct{}
Creates or updates multiple locations for the account, matched by name (case-insensitive), then writes asynchronously — 202 with a job to poll.
func (*BulkUpsertLocationsEndpoint) Materialize ¶
func (e *BulkUpsertLocationsEndpoint) Materialize() *apiendpoint.APIEndpoint[*BulkUpsertLocationsRequest, *apiresource.Job]
type BulkUpsertLocationsRequest ¶
type BulkUpsertLocationsRequest struct {
// Locations to create or update, matched by name within the account.
Locations []UpsertLocationInput `json:"locations" validate:"required,min=1,max=1000,dive"`
}
BulkUpsertLocationsRequest is the request to bulk upsert locations.
func (*BulkUpsertLocationsRequest) SchemaExample ¶
func (*BulkUpsertLocationsRequest) SchemaExample() any
type CreateLocationEndpoint ¶
type CreateLocationEndpoint struct{}
Creates a storage location, optionally placing it in the location hierarchy.
func (*CreateLocationEndpoint) Materialize ¶
func (e *CreateLocationEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateLocationRequest, *apiresource.Location]
type CreateLocationRequest ¶
type CreateLocationRequest struct {
// Display name of the location.
//
// Maximum 255 characters.
Name string `json:"name" validate:"required,max=255"`
// This location's level in the storage hierarchy.
//
// The levels run from largest to smallest: `building`, `section`, `aisle`, `rack`, `shelf`, `bin`. They are descriptive labels rather than a rule — the parent you choose is not required to be the next level up.
TypeCode constants.LocationTypeCode `json:"type" validate:"required"`
// The location this one sits under in the storage hierarchy.
//
// Must be an existing location in your account. Omit to create a top-level location.
ParentID field.Optional[string] `json:"parent_id,omitzero"`
// Existing locations to attach beneath the new location.
//
// Each listed location is reparented onto the new location, detaching it from its current parent. Every ID must belong to your account.
ChildIDs field.Optional[[]string] `json:"child_ids,omitzero"`
}
Request to create a location.
func (*CreateLocationRequest) SchemaExample ¶
func (*CreateLocationRequest) SchemaExample() any
type DeleteLocationEndpoint ¶
type DeleteLocationEndpoint struct{}
Deletes a location.
Fails if the location has child locations; remove or reassign the children first.
func (*DeleteLocationEndpoint) Materialize ¶
func (e *DeleteLocationEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteLocationRequest, *apiresource.EmptyResource]
type DeleteLocationRequest ¶
type DeleteLocationRequest struct {
// Location ID.
LocationID string `path:"id" validate:"required"`
}
Request to delete a location.
type ExportLocationsEndpoint ¶
type ExportLocationsEndpoint struct{}
Starts an export of every matching storage location and returns the job that tracks it.
func (*ExportLocationsEndpoint) Materialize ¶
func (e *ExportLocationsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ExportLocationsRequest, *apiresource.Job]
type ExportLocationsRequest ¶
type ExportLocationsRequest struct {
// Free-text search term matched against location names.
Query *string `json:"q"`
}
Filters which storage locations land in the exported file.
func (*ExportLocationsRequest) SchemaExample ¶
func (*ExportLocationsRequest) SchemaExample() any
type ListLocationTypesEndpoint ¶
type ListLocationTypesEndpoint struct{}
Returns a paginated list of location types.
Location types are platform-defined and the same for every account, so this list is the complete set of levels you can assign when creating a location. The `q` search term matches on location type name.
func (*ListLocationTypesEndpoint) Materialize ¶
func (e *ListLocationTypesEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListLocationTypesRequest, *apiresource.List[apiresource.LocationType]]
type ListLocationTypesRequest ¶
type ListLocationTypesRequest struct {
apiresource.PaginationRequest
}
Request to list location types.
type ListLocationsEndpoint ¶
type ListLocationsEndpoint struct{}
Returns a paginated list of locations in your account, newest first.
Every location is returned regardless of its depth in the hierarchy, so top-level locations and their descendants appear side by side. The `q` search term matches on location name.
func (*ListLocationsEndpoint) Materialize ¶
func (e *ListLocationsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListLocationsRequest, *apiresource.List[apiresource.Location]]
type ListLocationsRequest ¶
type ListLocationsRequest struct {
apiresource.PaginationRequest
}
Request to list locations.
type LocationSvc ¶
type LocationSvc interface {
ListLocations(ctx context.Context, req *ListLocationsRequest) (*apiresource.List[apiresource.Location], *apierror.APIError)
ExportLocations(ctx context.Context, req *ExportLocationsRequest) (*apiresource.Job, *apierror.APIError)
GetLocation(ctx context.Context, req *RetrieveLocationRequest) (*apiresource.Location, *apierror.APIError)
CreateLocation(ctx context.Context, req *CreateLocationRequest) (*apiresource.Location, *apierror.APIError)
UpdateLocation(ctx context.Context, req *UpdateLocationRequest) (*apiresource.Location, *apierror.APIError)
DeleteLocation(ctx context.Context, req *DeleteLocationRequest) (*apiresource.EmptyResource, *apierror.APIError)
BulkUpsertLocations(ctx context.Context, req *BulkUpsertLocationsRequest) (*apiresource.Job, *apierror.APIError)
ListLocationTypes(ctx context.Context, req *ListLocationTypesRequest) (*apiresource.List[apiresource.LocationType], *apierror.APIError)
GetLocationType(ctx context.Context, req *RetrieveLocationTypeRequest) (*apiresource.LocationType, *apierror.APIError)
}
func NewLocationSvc ¶
func NewLocationSvc(config *LocationSvcConfig) LocationSvc
type LocationSvcConfig ¶
type LocationSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type RetrieveLocationEndpoint ¶
type RetrieveLocationEndpoint struct{}
Returns a location by ID.
func (*RetrieveLocationEndpoint) Materialize ¶
func (e *RetrieveLocationEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveLocationRequest, *apiresource.Location]
type RetrieveLocationRequest ¶
type RetrieveLocationRequest struct {
// Location ID.
LocationID string `path:"id" validate:"required"`
}
Request to get a location.
type RetrieveLocationTypeEndpoint ¶
type RetrieveLocationTypeEndpoint struct{}
Returns a location type by ID or code.
func (*RetrieveLocationTypeEndpoint) Materialize ¶
func (e *RetrieveLocationTypeEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveLocationTypeRequest, *apiresource.LocationType]
type RetrieveLocationTypeRequest ¶
type RetrieveLocationTypeRequest struct {
// Location type ID or code, such as `building` or `bin`.
Identifier string `path:"id" validate:"required"`
}
Request to get a location type.
type UpdateLocationEndpoint ¶
type UpdateLocationEndpoint struct{}
Partially updates a location.
func (*UpdateLocationEndpoint) Materialize ¶
func (e *UpdateLocationEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateLocationRequest, *apiresource.Location]
type UpdateLocationRequest ¶
type UpdateLocationRequest struct {
// Location ID.
LocationID string `path:"id" validate:"required"`
// Display name of the location.
//
// Maximum 255 characters.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// This location's level in the storage hierarchy.
//
// The levels run from largest to smallest: `building`, `section`, `aisle`, `rack`, `shelf`, `bin`. They are descriptive labels rather than a rule — the parent is not required to be the next level up.
TypeCode field.Optional[constants.LocationTypeCode] `json:"type,omitzero"`
// The location this one sits under in the storage hierarchy.
//
// Must be an existing location in your account, and cannot be the location being updated. Send `null` to detach it from its parent and make it a top-level location.
ParentID field.Clearable[string] `json:"parent_id,omitzero" validate:"omitempty"`
// The locations that sit directly beneath this one.
//
// This replaces the full set of children: current children that are not listed are detached and become top-level locations, and listed locations are reparented onto this location. Send `null` to detach every child. Omit the field to leave the existing children untouched.
ChildIDs field.Clearable[[]string] `json:"child_ids,omitzero"`
}
Request to partially update a location.
func (*UpdateLocationRequest) SchemaExample ¶
func (*UpdateLocationRequest) SchemaExample() any
type UpsertLocationInput ¶
type UpsertLocationInput struct {
// Display name of the location, used to match existing locations.
Name string `json:"name" validate:"required,max=255"`
// Location type code.
TypeCode constants.LocationTypeCode `json:"type" validate:"required"`
// Parent location, referenced by `id` or `name`, or by name for a location in the same
// batch. Omitted, a new location is top-level and an existing one keeps its parent.
Parent *apirequest.ObjectIdentifier `json:"parent,omitempty"`
// Child locations to re-parent under this one, referenced by `id` or `name`, or by name
// for a location in the same batch. Redundant with `parent` on each child.
Children []apirequest.ObjectIdentifier `json:"children,omitempty"`
}
UpsertLocationInput is the input for a single location in a bulk upsert operation.