Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateSvc ¶
type RateSvc interface {
UpdateRate(ctx context.Context, req *UpdateRateRequest) (*apiresource.Rate, *apierror.APIError)
}
func NewRateSvc ¶
func NewRateSvc(config *RateSvcConfig) RateSvc
type RateSvcConfig ¶
type RateSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type UpdateRateEndpoint ¶
type UpdateRateEndpoint struct{}
Updates the value or units of a rate in place.
A rate belongs to the resource that reports it — an item's unit price or cost, a department's labor rate, and so on — so this changes that resource's stored rate directly.
func (*UpdateRateEndpoint) Materialize ¶
func (e *UpdateRateEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateRateRequest, *apiresource.Rate]
type UpdateRateRequest ¶
type UpdateRateRequest struct {
// Rate ID.
RateID string `path:"id" validate:"required"`
// New decimal value for the rate, expressed as the amount of the numerator unit per one denominator unit.
Value field.Optional[string] `json:"value,omitzero"`
// ID of the new unit for the rate's numerator (e.g. the currency of a price).
//
// The stored value is kept as-is and is not converted into the new unit, so send `value` alongside this when the amount should change too.
NumeratorUnitID field.Optional[string] `json:"numerator_unit_id,omitzero" validate:"omitempty"`
// ID of the new unit for the rate's denominator (the per-unit basis).
//
// As with the numerator, the value is not re-scaled when the unit changes.
DenominatorUnitID field.Optional[string] `json:"denominator_unit_id,omitzero" validate:"omitempty"`
// ID of the resource that owns this rate.
//
// Used together with `object_type` to verify the owning resource exists; it does not reassign the rate.
ObjectID field.Optional[string] `json:"object_id,omitzero" validate:"omitempty"`
// Type of the resource that owns this rate.
//
// Determines the permission required for the update.
ObjectType field.Optional[constants.MeasureOwnerType] `json:"object_type,omitzero" validate:"omitempty"`
}
Request to partially update a rate.
func (*UpdateRateRequest) SchemaExample ¶
func (*UpdateRateRequest) SchemaExample() any
Click to show internal directories.
Click to hide internal directories.