Documentation
¶
Index ¶
- type CreateOperatingCalendarClosureEndpoint
- type CreateOperatingCalendarClosureRequest
- type CreateOperatingCalendarEndpoint
- type CreateOperatingCalendarRequest
- type DeleteOperatingCalendarClosureEndpoint
- type DeleteOperatingCalendarClosureRequest
- type DeleteOperatingCalendarEndpoint
- type DeleteOperatingCalendarRequest
- type ListOperatingCalendarClosuresEndpoint
- type ListOperatingCalendarClosuresRequest
- type ListOperatingCalendarsEndpoint
- type ListOperatingCalendarsRequest
- type OperatingCalendarSvc
- type OperatingCalendarSvcConfig
- type RetrieveOperatingCalendarEndpoint
- type RetrieveOperatingCalendarRequest
- type UpdateOperatingCalendarEndpoint
- type UpdateOperatingCalendarRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateOperatingCalendarClosureEndpoint ¶
type CreateOperatingCalendarClosureEndpoint struct{}
Closes a calendar on a date.
Every ship-by date resolved against this calendar afterwards walks past the closure: a carrier that does not move on Thanksgiving pushes the day an order has to leave earlier, and a plant shutdown does the same.
Closing the same date twice is a no-op rather than an error, so re-seeding a year is safe and never renames a closure somebody has relabelled.
func (*CreateOperatingCalendarClosureEndpoint) Materialize ¶
func (e *CreateOperatingCalendarClosureEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateOperatingCalendarClosureRequest, *apiresource.OperatingCalendarClosure]
type CreateOperatingCalendarClosureRequest ¶
type CreateOperatingCalendarClosureRequest struct {
// Operating calendar ID.
OperatingCalendarID string `path:"id" validate:"required"`
// The date nothing operates. Truncated to a day.
ClosedOn time.Time `json:"closed_on" validate:"required"`
// What the closure is, such as "Thanksgiving Day" or "Summer shutdown".
Name string `json:"name" validate:"required,max=255"`
}
Request to close a calendar on a date.
func (*CreateOperatingCalendarClosureRequest) SchemaExample ¶
func (*CreateOperatingCalendarClosureRequest) SchemaExample() any
type CreateOperatingCalendarEndpoint ¶
type CreateOperatingCalendarEndpoint struct{}
Creates an operating calendar.
The days govern every ship-by date resolved against this calendar: a plant that tenders freight Monday to Thursday never gets committed to a Friday shipment, and a customer's promised delivery date is worked back from a day they can actually receive on.
A calendar starts with no closures. Add holidays and shutdowns to it separately.
func (*CreateOperatingCalendarEndpoint) Materialize ¶
func (e *CreateOperatingCalendarEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateOperatingCalendarRequest, *apiresource.OperatingCalendar]
type CreateOperatingCalendarRequest ¶
type CreateOperatingCalendarRequest struct {
// Short stable identifier, unique per account.
Code string `json:"code" validate:"required,max=32"`
// Human-readable name.
Name string `json:"name" validate:"required,max=255"`
// Which side of a shipment this calendar describes.
Kind constants.OperatingCalendarKind `json:"kind" validate:"required"`
// Open weekdays as seven characters of '0' or '1', Monday first. "1111100" is Monday to Friday; "1111000" is a Monday-to-Thursday plant. At least one day must be open.
DaysOfWeek string `json:"days_of_week" validate:"required,len=7"`
// Local time freight has to be tendered by, as "15:00". Only a shipping calendar accepts one.
CutoffAt field.Optional[string] `json:"cutoff_at,omitzero" validate:"omitempty,max=8"`
// IANA zone the cutoff is read in, such as "America/Chicago". On a receiving calendar, leave it unset to take the zone from the ship-to address.
Timezone field.Optional[string] `json:"timezone,omitzero" validate:"omitempty,max=64"`
// Make this the calendar used when nothing more specific is linked. Setting it demotes whichever calendar of the same kind held the role.
IsDefault field.Optional[bool] `json:"is_default,omitzero"`
}
Request to create an operating calendar.
func (*CreateOperatingCalendarRequest) SchemaExample ¶
func (*CreateOperatingCalendarRequest) SchemaExample() any
type DeleteOperatingCalendarClosureEndpoint ¶
type DeleteOperatingCalendarClosureEndpoint struct{}
Reopens a date the calendar was closed on.
Used to drop a seeded holiday a plant actually works through. Orders already issued keep the dates they were stamped with.
func (*DeleteOperatingCalendarClosureEndpoint) Materialize ¶
func (e *DeleteOperatingCalendarClosureEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteOperatingCalendarClosureRequest, *apiresource.EmptyResource]
type DeleteOperatingCalendarClosureRequest ¶
type DeleteOperatingCalendarClosureRequest struct {
// Operating calendar ID.
OperatingCalendarID string `path:"id" validate:"required"`
// Closure ID.
ClosureID string `path:"closure_id" validate:"required"`
}
Request to reopen a closed date.
type DeleteOperatingCalendarEndpoint ¶
type DeleteOperatingCalendarEndpoint struct{}
Deletes an operating calendar.
Refused while any address, customer, customer group, or account setting still points at it. Deleting a calendar out from under its references would quietly return every affected order to a plain Monday-to-Friday week, which reads as the feature breaking rather than as a decision anybody made — so re-point them first.
func (*DeleteOperatingCalendarEndpoint) Materialize ¶
func (e *DeleteOperatingCalendarEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteOperatingCalendarRequest, *apiresource.EmptyResource]
type DeleteOperatingCalendarRequest ¶
type DeleteOperatingCalendarRequest struct {
// Operating calendar ID.
OperatingCalendarID string `path:"id" validate:"required"`
}
Request to delete an operating calendar.
type ListOperatingCalendarClosuresEndpoint ¶
type ListOperatingCalendarClosuresEndpoint struct{}
Lists the dates a calendar is shut, within a date window.
Bounded rather than exhaustive: a calendar accumulates closures indefinitely, and the useful answer is the year either side of today. Widen it with `from_date` and `to_date`.
func (*ListOperatingCalendarClosuresEndpoint) Materialize ¶
func (e *ListOperatingCalendarClosuresEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListOperatingCalendarClosuresRequest, *apiresource.List[apiresource.OperatingCalendarClosure]]
type ListOperatingCalendarClosuresRequest ¶
type ListOperatingCalendarClosuresRequest struct {
// Operating calendar ID.
OperatingCalendarID string `path:"id" validate:"required"`
// Earliest closure date to return. Defaults to a year ago.
FromDate *time.Time `query:"from_date" validate:"omitempty"`
// Latest closure date to return. Defaults to a year ahead.
ToDate *time.Time `query:"to_date" validate:"omitempty"`
}
Request to list a calendar's closures.
type ListOperatingCalendarsEndpoint ¶
type ListOperatingCalendarsEndpoint struct{}
Lists the operating calendars configured for the account.
Both kinds are returned unless `kind` narrows it, ordered with each kind's default first.
func (*ListOperatingCalendarsEndpoint) Materialize ¶
func (e *ListOperatingCalendarsEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListOperatingCalendarsRequest, *apiresource.List[apiresource.OperatingCalendar]]
type ListOperatingCalendarsRequest ¶
type ListOperatingCalendarsRequest struct {
// Return only shipping or only receiving calendars.
Kind *constants.OperatingCalendarKind `query:"kind" validate:"omitempty"`
}
Request to list an account's operating calendars.
type OperatingCalendarSvc ¶
type OperatingCalendarSvc interface {
ListOperatingCalendars(ctx context.Context, req *ListOperatingCalendarsRequest) (*apiresource.List[apiresource.OperatingCalendar], *apierror.APIError)
RetrieveOperatingCalendar(ctx context.Context, req *RetrieveOperatingCalendarRequest) (*apiresource.OperatingCalendar, *apierror.APIError)
CreateOperatingCalendar(ctx context.Context, req *CreateOperatingCalendarRequest) (*apiresource.OperatingCalendar, *apierror.APIError)
UpdateOperatingCalendar(ctx context.Context, req *UpdateOperatingCalendarRequest) (*apiresource.OperatingCalendar, *apierror.APIError)
DeleteOperatingCalendar(ctx context.Context, req *DeleteOperatingCalendarRequest) (*apiresource.EmptyResource, *apierror.APIError)
ListOperatingCalendarClosures(ctx context.Context, req *ListOperatingCalendarClosuresRequest) (*apiresource.List[apiresource.OperatingCalendarClosure], *apierror.APIError)
CreateOperatingCalendarClosure(ctx context.Context, req *CreateOperatingCalendarClosureRequest) (*apiresource.OperatingCalendarClosure, *apierror.APIError)
DeleteOperatingCalendarClosure(ctx context.Context, req *DeleteOperatingCalendarClosureRequest) (*apiresource.EmptyResource, *apierror.APIError)
}
func NewOperatingCalendarSvc ¶
func NewOperatingCalendarSvc(config *OperatingCalendarSvcConfig) OperatingCalendarSvc
type OperatingCalendarSvcConfig ¶
type OperatingCalendarSvcConfig struct {
// CoreClient (required) is the core-service production-schedule gRPC client, which carries the calendar RPCs.
CoreClient pb.CoreProductionScheduleServiceClient
}
type RetrieveOperatingCalendarEndpoint ¶
type RetrieveOperatingCalendarEndpoint struct{}
Retrieves one operating calendar by ID.
func (*RetrieveOperatingCalendarEndpoint) Materialize ¶
func (e *RetrieveOperatingCalendarEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveOperatingCalendarRequest, *apiresource.OperatingCalendar]
type RetrieveOperatingCalendarRequest ¶
type RetrieveOperatingCalendarRequest struct {
// Operating calendar ID.
OperatingCalendarID string `path:"id" validate:"required"`
}
Request to retrieve one operating calendar.
type UpdateOperatingCalendarEndpoint ¶
type UpdateOperatingCalendarEndpoint struct{}
Updates an operating calendar.
A calendar's kind cannot change: a shipping calendar that became a receiving one would silently drop the pickup cutoff every commitment resolved against it depends on. Create a second calendar instead.
Changes apply to commitments made from now on. Orders already issued keep the dates they were stamped with, so adding a holiday never retroactively makes a past order late.
func (*UpdateOperatingCalendarEndpoint) Materialize ¶
func (e *UpdateOperatingCalendarEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateOperatingCalendarRequest, *apiresource.OperatingCalendar]
type UpdateOperatingCalendarRequest ¶
type UpdateOperatingCalendarRequest struct {
// Operating calendar ID.
OperatingCalendarID string `path:"id" validate:"required"`
// Human-readable name.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// Open weekdays as seven characters of '0' or '1', Monday first. At least one day must be open.
DaysOfWeek field.Optional[string] `json:"days_of_week,omitzero" validate:"omitempty,len=7"`
// Local time freight has to be tendered by. Clearing it leaves the ship-by date a day with no time of day attached.
CutoffAt field.Clearable[string] `json:"cutoff_at,omitzero" validate:"omitempty,max=8"`
// IANA zone the cutoff is read in. Clearing it on a receiving calendar returns to taking the zone from the ship-to address.
Timezone field.Clearable[string] `json:"timezone,omitzero" validate:"omitempty,max=64"`
// Make this the calendar used when nothing more specific is linked. Setting it demotes whichever calendar of the same kind held the role.
IsDefault field.Optional[bool] `json:"is_default,omitzero"`
}
Request to update an operating calendar.
Source Files
¶
- endpoint_create_operating_calendar.go
- endpoint_create_operating_calendar_closure.go
- endpoint_delete_operating_calendar.go
- endpoint_delete_operating_calendar_closure.go
- endpoint_list_operating_calendar_closures.go
- endpoint_list_operating_calendars.go
- endpoint_retrieve_operating_calendar.go
- endpoint_update_operating_calendar.go
- service.go