ILaborApi laborApi = client.LaborApi;
LaborApi
- List Break Types
- Create Break Type
- Delete Break Type
- Get Break Type
- Update Break Type
- List Employee Wages
- Get Employee Wage
- Create Shift
- Search Shifts
- Delete Shift
- Get Shift
- Update Shift
- List Workweek Configs
- Update Workweek Config
Returns a paginated list of BreakType
instances for a business.
ListBreakTypesAsync(string locationId = null, int? limit = null, string cursor = null)
Parameter | Type | Tags | Description |
---|---|---|---|
locationId |
string |
Query, Optional | Filter Break Types returned to only those that are associated with the specified location. |
limit |
int? |
Query, Optional | Maximum number of Break Types to return per page. Can range between 1 and 200. The default is the maximum at 200. |
cursor |
string |
Query, Optional | Pointer to the next page of Break Type results to fetch. |
Task<Models.ListBreakTypesResponse>
try
{
ListBreakTypesResponse result = await laborApi.ListBreakTypesAsync(null, null, null);
}
catch (ApiException e){};
Creates a new BreakType
.
A BreakType
is a template for creating Break
objects.
You must provide the following values in your request to this
endpoint:
location_id
break_name
expected_duration
is_paid
You can only have 3 BreakType
instances per location. If you attempt to add a 4th
BreakType
for a location, an INVALID_REQUEST_ERROR
"Exceeded limit of 3 breaks per location."
is returned.
CreateBreakTypeAsync(Models.CreateBreakTypeRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Models.CreateBreakTypeRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.CreateBreakTypeResponse>
var bodyBreakType = new BreakType.Builder(
"CGJN03P1D08GF",
"Lunch Break",
"PT30M",
true)
.Build();
var body = new CreateBreakTypeRequest.Builder(
bodyBreakType)
.IdempotencyKey("PAD3NG5KSN2GL")
.Build();
try
{
CreateBreakTypeResponse result = await laborApi.CreateBreakTypeAsync(body);
}
catch (ApiException e){};
Deletes an existing BreakType
.
A BreakType
can be deleted even if it is referenced from a Shift
.
DeleteBreakTypeAsync(string id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | UUID for the BreakType being deleted. |
Task<Models.DeleteBreakTypeResponse>
string id = "id0";
try
{
DeleteBreakTypeResponse result = await laborApi.DeleteBreakTypeAsync(id);
}
catch (ApiException e){};
Returns a single BreakType
specified by id.
GetBreakTypeAsync(string id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | UUID for the BreakType being retrieved. |
Task<Models.GetBreakTypeResponse>
string id = "id0";
try
{
GetBreakTypeResponse result = await laborApi.GetBreakTypeAsync(id);
}
catch (ApiException e){};
Updates an existing BreakType
.
UpdateBreakTypeAsync(string id, Models.UpdateBreakTypeRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | UUID for the BreakType being updated. |
body |
Models.UpdateBreakTypeRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdateBreakTypeResponse>
string id = "id0";
var bodyBreakType = new BreakType.Builder(
"26M7H24AZ9N6R",
"Lunch",
"PT50M",
true)
.Version(1)
.Build();
var body = new UpdateBreakTypeRequest.Builder(
bodyBreakType)
.Build();
try
{
UpdateBreakTypeResponse result = await laborApi.UpdateBreakTypeAsync(id, body);
}
catch (ApiException e){};
Returns a paginated list of EmployeeWage
instances for a business.
ListEmployeeWagesAsync(string employeeId = null, int? limit = null, string cursor = null)
Parameter | Type | Tags | Description |
---|---|---|---|
employeeId |
string |
Query, Optional | Filter wages returned to only those that are associated with the specified employee. |
limit |
int? |
Query, Optional | Maximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200. |
cursor |
string |
Query, Optional | Pointer to the next page of Employee Wage results to fetch. |
Task<Models.ListEmployeeWagesResponse>
try
{
ListEmployeeWagesResponse result = await laborApi.ListEmployeeWagesAsync(null, null, null);
}
catch (ApiException e){};
Returns a single EmployeeWage
specified by id.
GetEmployeeWageAsync(string id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | UUID for the EmployeeWage being retrieved. |
Task<Models.GetEmployeeWageResponse>
string id = "id0";
try
{
GetEmployeeWageResponse result = await laborApi.GetEmployeeWageAsync(id);
}
catch (ApiException e){};
Creates a new Shift
.
A Shift
represents a complete work day for a single employee.
You must provide the following values in your request to this
endpoint:
location_id
employee_id
start_at
An attempt to create a new Shift
can result in a BAD_REQUEST
error when:
- The
status
of the newShift
isOPEN
and the employee has another shift with anOPEN
status. - The
start_at
date is in the future - the
start_at
orend_at
overlaps another shift for the same employee - If
Break
s are set in the request, a breakstart_at
must not be before theShift.start_at
. A breakend_at
must not be after theShift.end_at
CreateShiftAsync(Models.CreateShiftRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Models.CreateShiftRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.CreateShiftResponse>
var bodyShiftWageHourlyRate = new Money.Builder()
.Amount(1100L)
.Currency("USD")
.Build();
var bodyShiftWage = new ShiftWage.Builder()
.Title("Barista")
.HourlyRate(bodyShiftWageHourlyRate)
.Build();
var bodyShiftBreaks = new List<Break>();
var bodyShiftBreaks0 = new Break.Builder(
"2019-01-25T06:11:00-05:00",
"REGS1EQR1TPZ5",
"Tea Break",
"PT5M",
true)
.EndAt("2019-01-25T06:16:00-05:00")
.Build();
bodyShiftBreaks.Add(bodyShiftBreaks0);
var bodyShift = new Shift.Builder(
"ormj0jJJZ5OZIzxrZYJI",
"2019-01-25T03:11:00-05:00")
.LocationId("PAA1RJZZKXBFG")
.EndAt("2019-01-25T13:11:00-05:00")
.Wage(bodyShiftWage)
.Breaks(bodyShiftBreaks)
.Build();
var body = new CreateShiftRequest.Builder(
bodyShift)
.IdempotencyKey("HIDSNG5KS478L")
.Build();
try
{
CreateShiftResponse result = await laborApi.CreateShiftAsync(body);
}
catch (ApiException e){};
Returns a paginated list of Shift
records for a business.
The list to be returned can be filtered by:
- Location IDs and
- employee IDs and
- shift status (
OPEN
,CLOSED
) and - shift start and
- shift end and
- work day details
The list can be sorted by:
start_at
end_at
created_at
updated_at
SearchShiftsAsync(Models.SearchShiftsRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Models.SearchShiftsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.SearchShiftsResponse>
var bodyQueryFilterWorkdayDateRange = new DateRange.Builder()
.StartDate("2019-01-20")
.EndDate("2019-02-03")
.Build();
var bodyQueryFilterWorkday = new ShiftWorkday.Builder()
.DateRange(bodyQueryFilterWorkdayDateRange)
.MatchShiftsBy("START_AT")
.DefaultTimezone("America/Los_Angeles")
.Build();
var bodyQueryFilter = new ShiftFilter.Builder()
.Workday(bodyQueryFilterWorkday)
.Build();
var bodyQuery = new ShiftQuery.Builder()
.Filter(bodyQueryFilter)
.Build();
var body = new SearchShiftsRequest.Builder()
.Query(bodyQuery)
.Limit(100)
.Build();
try
{
SearchShiftsResponse result = await laborApi.SearchShiftsAsync(body);
}
catch (ApiException e){};
Deletes a Shift
.
DeleteShiftAsync(string id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | UUID for the Shift being deleted. |
Task<Models.DeleteShiftResponse>
string id = "id0";
try
{
DeleteShiftResponse result = await laborApi.DeleteShiftAsync(id);
}
catch (ApiException e){};
Returns a single Shift
specified by id.
GetShiftAsync(string id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | UUID for the Shift being retrieved. |
string id = "id0";
try
{
GetShiftResponse result = await laborApi.GetShiftAsync(id);
}
catch (ApiException e){};
Updates an existing Shift
.
When adding a Break
to a Shift
, any earlier Breaks
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
.
UpdateShiftAsync(string id, Models.UpdateShiftRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | ID of the object being updated. |
body |
Models.UpdateShiftRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdateShiftResponse>
string id = "id0";
var bodyShiftWageHourlyRate = new Money.Builder()
.Amount(1500L)
.Currency("USD")
.Build();
var bodyShiftWage = new ShiftWage.Builder()
.Title("Bartender")
.HourlyRate(bodyShiftWageHourlyRate)
.Build();
var bodyShiftBreaks = new List<Break>();
var bodyShiftBreaks0 = new Break.Builder(
"2019-01-25T06:11:00-05:00",
"REGS1EQR1TPZ5",
"Tea Break",
"PT5M",
true)
.Id("X7GAQYVVRRG6P")
.EndAt("2019-01-25T06:16:00-05:00")
.Build();
bodyShiftBreaks.Add(bodyShiftBreaks0);
var bodyShift = new Shift.Builder(
"ormj0jJJZ5OZIzxrZYJI",
"2019-01-25T03:11:00-05:00")
.LocationId("PAA1RJZZKXBFG")
.EndAt("2019-01-25T13:11:00-05:00")
.Wage(bodyShiftWage)
.Breaks(bodyShiftBreaks)
.Version(1)
.Build();
var body = new UpdateShiftRequest.Builder(
bodyShift)
.Build();
try
{
UpdateShiftResponse result = await laborApi.UpdateShiftAsync(id, body);
}
catch (ApiException e){};
Returns a list of WorkweekConfig
instances for a business.
ListWorkweekConfigsAsync(int? limit = null, string cursor = null)
Parameter | Type | Tags | Description |
---|---|---|---|
limit |
int? |
Query, Optional | Maximum number of Workweek Configs to return per page. |
cursor |
string |
Query, Optional | Pointer to the next page of Workweek Config results to fetch. |
Task<Models.ListWorkweekConfigsResponse>
try
{
ListWorkweekConfigsResponse result = await laborApi.ListWorkweekConfigsAsync(null, null);
}
catch (ApiException e){};
Updates a WorkweekConfig
.
UpdateWorkweekConfigAsync(string id, Models.UpdateWorkweekConfigRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | UUID for the WorkweekConfig object being updated. |
body |
Models.UpdateWorkweekConfigRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdateWorkweekConfigResponse>
string id = "id0";
var bodyWorkweekConfig = new WorkweekConfig.Builder(
"MON",
"10:00")
.Version(10)
.Build();
var body = new UpdateWorkweekConfigRequest.Builder(
bodyWorkweekConfig)
.Build();
try
{
UpdateWorkweekConfigResponse result = await laborApi.UpdateWorkweekConfigAsync(id, body);
}
catch (ApiException e){};