Documentation
¶
Index ¶
- type Client
- func (c *Client) Create(ctx context.Context, request *labor.CreateShiftRequest, ...) (*squaregosdk.CreateShiftResponse, error)
- func (c *Client) Delete(ctx context.Context, request *labor.DeleteShiftsRequest, ...) (*squaregosdk.DeleteShiftResponse, error)
- func (c *Client) Get(ctx context.Context, request *labor.GetShiftsRequest, ...) (*squaregosdk.GetShiftResponse, error)
- func (c *Client) Search(ctx context.Context, request *labor.SearchShiftsRequest, ...) (*squaregosdk.SearchShiftsResponse, error)
- func (c *Client) Update(ctx context.Context, request *labor.UpdateShiftRequest, ...) (*squaregosdk.UpdateShiftResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...option.RequestOption) *Client
func (*Client) Create ¶
func (c *Client) Create( ctx context.Context, request *labor.CreateShiftRequest, opts ...option.RequestOption, ) (*squaregosdk.CreateShiftResponse, error)
Creates a new `Shift`.
A `Shift` represents a complete workday for a single team member. You must provide the following values in your request to this endpoint:
- `location_id` - `team_member_id` - `start_at`
An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when: - The `status` of the new `Shift` is `OPEN` and the team member has another shift with an `OPEN` status. - The `start_at` date is in the future. - The `start_at` or `end_at` date overlaps another shift for the same team member. - The `Break` instances are set in the request and a break `start_at` is before the `Shift.start_at`, a break `end_at` is after the `Shift.end_at`, or both.
func (*Client) Delete ¶
func (c *Client) Delete( ctx context.Context, request *labor.DeleteShiftsRequest, opts ...option.RequestOption, ) (*squaregosdk.DeleteShiftResponse, error)
Deletes a `Shift`.
func (*Client) Get ¶
func (c *Client) Get( ctx context.Context, request *labor.GetShiftsRequest, opts ...option.RequestOption, ) (*squaregosdk.GetShiftResponse, error)
Returns a single `Shift` specified by `id`.
func (*Client) Search ¶
func (c *Client) Search( ctx context.Context, request *labor.SearchShiftsRequest, opts ...option.RequestOption, ) (*squaregosdk.SearchShiftsResponse, error)
Returns a paginated list of `Shift` records for a business. The list to be returned can be filtered by: - Location IDs - Team member IDs - Shift status (`OPEN` or `CLOSED`) - Shift start - Shift end - Workday details
The list can be sorted by: - `START_AT` - `END_AT` - `CREATED_AT` - `UPDATED_AT`
func (*Client) Update ¶
func (c *Client) Update( ctx context.Context, request *labor.UpdateShiftRequest, opts ...option.RequestOption, ) (*squaregosdk.UpdateShiftResponse, error)
Updates an existing `Shift`.
When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have the `end_at` property set to a valid RFC-3339 datetime string.
When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at` set on each `Break`.