const 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 Team Member Wages
- Get Team Member Wage
- List Workweek Configs
- Update Workweek Config
Returns a paginated list of BreakType
instances for a business.
async listBreakTypes(
locationId?: string,
limit?: number,
cursor?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListBreakTypesResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
locationId |
string | undefined |
Query, Optional | Filter the returned BreakType results to only those that are associated with thespecified location. |
limit |
number | undefined |
Query, Optional | The maximum number of BreakType results to return per page. The number can range between 1and 200. The default is 200. |
cursor |
string | undefined |
Query, Optional | A pointer to the next page of BreakType results to fetch. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
try {
const { result, ...httpResponse } = await laborApi.listBreakTypes();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
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 three BreakType
instances per location. If you attempt to add a fourth
BreakType
for a location, an INVALID_REQUEST_ERROR
"Exceeded limit of 3 breaks per location."
is returned.
async createBreakType(
body: CreateBreakTypeRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CreateBreakTypeResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateBreakTypeRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const bodyBreakType: BreakType = {
locationId: 'CGJN03P1D08GF',
breakName: 'Lunch Break',
expectedDuration: 'PT30M',
isPaid: true,
};
const body: CreateBreakTypeRequest = {
breakType: bodyBreakType,
};
body.idempotencyKey = 'PAD3NG5KSN2GL';
try {
const { result, ...httpResponse } = await laborApi.createBreakType(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Deletes an existing BreakType
.
A BreakType
can be deleted even if it is referenced from a Shift
.
async deleteBreakType(
id: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<DeleteBreakTypeResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The UUID for the BreakType being deleted. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const id = 'id0';
try {
const { result, ...httpResponse } = await laborApi.deleteBreakType(id);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Returns a single BreakType
specified by id
.
async getBreakType(
id: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetBreakTypeResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The UUID for the BreakType being retrieved. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const id = 'id0';
try {
const { result, ...httpResponse } = await laborApi.getBreakType(id);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Updates an existing BreakType
.
async updateBreakType(
id: string,
body: UpdateBreakTypeRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<UpdateBreakTypeResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The UUID for the BreakType being updated. |
body |
UpdateBreakTypeRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const id = 'id0';
const contentType = null;
const bodyBreakType: BreakType = {
locationId: '26M7H24AZ9N6R',
breakName: 'Lunch',
expectedDuration: 'PT50M',
isPaid: true,
};
bodyBreakType.version = 1;
const body: UpdateBreakTypeRequest = {
breakType: bodyBreakType,
};
try {
const { result, ...httpResponse } = await laborApi.updateBreakType(id, body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
This endpoint is deprecated.
Returns a paginated list of EmployeeWage
instances for a business.
async listEmployeeWages(
employeeId?: string,
limit?: number,
cursor?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListEmployeeWagesResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
employeeId |
string | undefined |
Query, Optional | Filter the returned wages to only those that are associated with the specified employee. |
limit |
number | undefined |
Query, Optional | The maximum number of EmployeeWage results to return per page. The number can range between1 and 200. The default is 200. |
cursor |
string | undefined |
Query, Optional | A pointer to the next page of EmployeeWage results to fetch. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
try {
const { result, ...httpResponse } = await laborApi.listEmployeeWages();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
This endpoint is deprecated.
Returns a single EmployeeWage
specified by id
.
async getEmployeeWage(
id: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetEmployeeWageResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The UUID for the EmployeeWage being retrieved. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const id = 'id0';
try {
const { result, ...httpResponse } = await laborApi.getEmployeeWage(id);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Creates a new Shift
.
A Shift
represents a complete workday 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
date overlaps another shift for the same employee. - The
Break
instances are set in the request and a breakstart_at
is before theShift.start_at
, a breakend_at
is after theShift.end_at
, or both.
async createShift(
body: CreateShiftRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CreateShiftResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateShiftRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const bodyShiftWageHourlyRate: Money = {};
bodyShiftWageHourlyRate.amount = BigInt(1100);
bodyShiftWageHourlyRate.currency = 'USD';
const bodyShiftWage: ShiftWage = {};
bodyShiftWage.title = 'Barista';
bodyShiftWage.hourlyRate = bodyShiftWageHourlyRate;
const bodyShiftBreaks: Break[] = [];
const bodyShiftbreaks0: Break = {
startAt: '2019-01-25T11:11:00+00:00',
breakTypeId: 'REGS1EQR1TPZ5',
name: 'Tea Break',
expectedDuration: 'PT5M',
isPaid: true,
};
bodyShiftbreaks0.endAt = '2019-01-25T11:16:00+00:00';
bodyShiftBreaks[0] = bodyShiftbreaks0;
const bodyShift: Shift = {
startAt: '2019-01-25T08:11:00+00:00',
};
bodyShift.locationId = 'PAA1RJZZKXBFG';
bodyShift.endAt = '2019-01-25T18:11:00+00:00';
bodyShift.wage = bodyShiftWage;
bodyShift.breaks = bodyShiftBreaks;
bodyShift.teamMemberId = 'ormj0jJJZ5OZIzxrZYJI';
const body: CreateShiftRequest = {
shift: bodyShift,
};
body.idempotencyKey = 'HIDSNG5KS478L';
try {
const { result, ...httpResponse } = await laborApi.createShift(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Returns a paginated list of Shift
records for a business.
The list to be returned can be filtered by:
- Location IDs.
- Employee IDs.
- Shift status (
OPEN
andCLOSED
). - Shift start.
- Shift end.
- Workday details.
The list can be sorted by:
start_at
.end_at
.created_at
.updated_at
.
async searchShifts(
body: SearchShiftsRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<SearchShiftsResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
SearchShiftsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const bodyQueryFilterWorkdayDateRange: DateRange = {};
bodyQueryFilterWorkdayDateRange.startDate = '2019-01-20';
bodyQueryFilterWorkdayDateRange.endDate = '2019-02-03';
const bodyQueryFilterWorkday: ShiftWorkday = {};
bodyQueryFilterWorkday.dateRange = bodyQueryFilterWorkdayDateRange;
bodyQueryFilterWorkday.matchShiftsBy = 'START_AT';
bodyQueryFilterWorkday.defaultTimezone = 'America/Los_Angeles';
const bodyQueryFilter: ShiftFilter = {};
bodyQueryFilter.workday = bodyQueryFilterWorkday;
const bodyQuery: ShiftQuery = {};
bodyQuery.filter = bodyQueryFilter;
const body: SearchShiftsRequest = {};
body.query = bodyQuery;
body.limit = 100;
try {
const { result, ...httpResponse } = await laborApi.searchShifts(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Deletes a Shift
.
async deleteShift(
id: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<DeleteShiftResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The UUID for the Shift being deleted. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const id = 'id0';
try {
const { result, ...httpResponse } = await laborApi.deleteShift(id);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Returns a single Shift
specified by id
.
async getShift(
id: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetShiftResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The UUID for the Shift being retrieved. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const id = 'id0';
try {
const { result, ...httpResponse } = await laborApi.getShift(id);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = 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
.
async updateShift(
id: string,
body: UpdateShiftRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<UpdateShiftResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The ID of the object being updated. |
body |
UpdateShiftRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const id = 'id0';
const contentType = null;
const bodyShiftWageHourlyRate: Money = {};
bodyShiftWageHourlyRate.amount = BigInt(1500);
bodyShiftWageHourlyRate.currency = 'USD';
const bodyShiftWage: ShiftWage = {};
bodyShiftWage.title = 'Bartender';
bodyShiftWage.hourlyRate = bodyShiftWageHourlyRate;
const bodyShiftBreaks: Break[] = [];
const bodyShiftbreaks0: Break = {
startAt: '2019-01-25T11:11:00+00:00',
breakTypeId: 'REGS1EQR1TPZ5',
name: 'Tea Break',
expectedDuration: 'PT5M',
isPaid: true,
};
bodyShiftbreaks0.id = 'X7GAQYVVRRG6P';
bodyShiftbreaks0.endAt = '2019-01-25T11:16:00+00:00';
bodyShiftBreaks[0] = bodyShiftbreaks0;
const bodyShift: Shift = {
startAt: '2019-01-25T08:11:00+00:00',
};
bodyShift.locationId = 'PAA1RJZZKXBFG';
bodyShift.endAt = '2019-01-25T18:11:00+00:00';
bodyShift.wage = bodyShiftWage;
bodyShift.breaks = bodyShiftBreaks;
bodyShift.version = 1;
bodyShift.teamMemberId = 'ormj0jJJZ5OZIzxrZYJI';
const body: UpdateShiftRequest = {
shift: bodyShift,
};
try {
const { result, ...httpResponse } = await laborApi.updateShift(id, body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Returns a paginated list of TeamMemberWage
instances for a business.
async listTeamMemberWages(
teamMemberId?: string,
limit?: number,
cursor?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListTeamMemberWagesResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
string | undefined |
Query, Optional | Filter the returned wages to only those that are associated with the specified team member. |
limit |
number | undefined |
Query, Optional | The maximum number of TeamMemberWage results to return per page. The number can range between1 and 200. The default is 200. |
cursor |
string | undefined |
Query, Optional | A pointer to the next page of EmployeeWage results to fetch. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
try {
const { result, ...httpResponse } = await laborApi.listTeamMemberWages();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Returns a single TeamMemberWage
specified by id
.
async getTeamMemberWage(
id: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetTeamMemberWageResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The UUID for the TeamMemberWage being retrieved. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const id = 'id0';
try {
const { result, ...httpResponse } = await laborApi.getTeamMemberWage(id);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Returns a list of WorkweekConfig
instances for a business.
async listWorkweekConfigs(
limit?: number,
cursor?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListWorkweekConfigsResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
limit |
number | undefined |
Query, Optional | The maximum number of WorkweekConfigs results to return per page. |
cursor |
string | undefined |
Query, Optional | A pointer to the next page of WorkweekConfig results to fetch. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
try {
const { result, ...httpResponse } = await laborApi.listWorkweekConfigs();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Updates a WorkweekConfig
.
async updateWorkweekConfig(
id: string,
body: UpdateWorkweekConfigRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<UpdateWorkweekConfigResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The UUID for the WorkweekConfig object being updated. |
body |
UpdateWorkweekConfigRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const id = 'id0';
const contentType = null;
const bodyWorkweekConfig: WorkweekConfig = {
startOfWeek: 'MON',
startOfDayLocalTime: '10:00',
};
bodyWorkweekConfig.version = 10;
const body: UpdateWorkweekConfigRequest = {
workweekConfig: bodyWorkweekConfig,
};
try {
const { result, ...httpResponse } = await laborApi.updateWorkweekConfig(id, body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}