LaborApi laborApi = client.getLaborApi();
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.
CompletableFuture<ListBreakTypesResponse> listBreakTypesAsync(
final String locationId,
final Integer limit,
final String cursor)
Parameter | Type | Tags | Description |
---|---|---|---|
locationId |
String |
Query, Optional | Filter the returned BreakType results to only those that are associated with thespecified location. |
limit |
Integer |
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 |
Query, Optional | A pointer to the next page of BreakType results to fetch. |
laborApi.listBreakTypesAsync(null, null, null).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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.
CompletableFuture<CreateBreakTypeResponse> createBreakTypeAsync(
final CreateBreakTypeRequest body)
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. |
CreateBreakTypeRequest body = new CreateBreakTypeRequest.Builder(
new BreakType.Builder(
"CGJN03P1D08GF",
"Lunch Break",
"PT30M",
true
)
.build()
)
.idempotencyKey("PAD3NG5KSN2GL")
.build();
laborApi.createBreakTypeAsync(body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Deletes an existing BreakType
.
A BreakType
can be deleted even if it is referenced from a Shift
.
CompletableFuture<DeleteBreakTypeResponse> deleteBreakTypeAsync(
final String id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the BreakType being deleted. |
String id = "id0";
laborApi.deleteBreakTypeAsync(id).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Returns a single BreakType
specified by id
.
CompletableFuture<GetBreakTypeResponse> getBreakTypeAsync(
final String id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the BreakType being retrieved. |
String id = "id0";
laborApi.getBreakTypeAsync(id).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Updates an existing BreakType
.
CompletableFuture<UpdateBreakTypeResponse> updateBreakTypeAsync(
final String id,
final UpdateBreakTypeRequest body)
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. |
String id = "id0";
UpdateBreakTypeRequest body = new UpdateBreakTypeRequest.Builder(
new BreakType.Builder(
"26M7H24AZ9N6R",
"Lunch",
"PT50M",
true
)
.version(1)
.build()
)
.build();
laborApi.updateBreakTypeAsync(id, body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
This endpoint is deprecated.
Returns a paginated list of EmployeeWage
instances for a business.
CompletableFuture<ListEmployeeWagesResponse> listEmployeeWagesAsync(
final String employeeId,
final Integer limit,
final String cursor)
Parameter | Type | Tags | Description |
---|---|---|---|
employeeId |
String |
Query, Optional | Filter the returned wages to only those that are associated with the specified employee. |
limit |
Integer |
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 |
Query, Optional | A pointer to the next page of EmployeeWage results to fetch. |
laborApi.listEmployeeWagesAsync(null, null, null).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
This endpoint is deprecated.
Returns a single EmployeeWage
specified by id
.
CompletableFuture<GetEmployeeWageResponse> getEmployeeWageAsync(
final String id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the EmployeeWage being retrieved. |
String id = "id0";
laborApi.getEmployeeWageAsync(id).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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 newShift
isOPEN
and the team member 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 team member. - 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.
CompletableFuture<CreateShiftResponse> createShiftAsync(
final CreateShiftRequest body)
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. |
CreateShiftRequest body = new CreateShiftRequest.Builder(
new Shift.Builder(
"PAA1RJZZKXBFG",
"2019-01-25T03:11:00-05:00"
)
.endAt("2019-01-25T13:11:00-05:00")
.wage(new ShiftWage.Builder()
.title("Barista")
.hourlyRate(new Money.Builder()
.amount(1100L)
.currency("USD")
.build())
.tipEligible(true)
.build())
.breaks(Arrays.asList(
new Break.Builder(
"2019-01-25T06:11:00-05:00",
"REGS1EQR1TPZ5",
"Tea Break",
"PT5M",
true
)
.endAt("2019-01-25T06:16:00-05:00")
.build()
))
.teamMemberId("ormj0jJJZ5OZIzxrZYJI")
.declaredCashTipMoney(new Money.Builder()
.amount(500L)
.currency("USD")
.build())
.build()
)
.idempotencyKey("HIDSNG5KS478L")
.build();
laborApi.createShiftAsync(body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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
orCLOSED
) - Shift start
- Shift end
- Workday details
The list can be sorted by:
START_AT
END_AT
CREATED_AT
UPDATED_AT
CompletableFuture<SearchShiftsResponse> searchShiftsAsync(
final SearchShiftsRequest body)
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. |
SearchShiftsRequest body = new SearchShiftsRequest.Builder()
.query(new ShiftQuery.Builder()
.filter(new ShiftFilter.Builder()
.workday(new ShiftWorkday.Builder()
.dateRange(new DateRange.Builder()
.startDate("2019-01-20")
.endDate("2019-02-03")
.build())
.matchShiftsBy("START_AT")
.defaultTimezone("America/Los_Angeles")
.build())
.build())
.build())
.limit(100)
.build();
laborApi.searchShiftsAsync(body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Deletes a Shift
.
CompletableFuture<DeleteShiftResponse> deleteShiftAsync(
final String id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the Shift being deleted. |
String id = "id0";
laborApi.deleteShiftAsync(id).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Returns a single Shift
specified by id
.
CompletableFuture<GetShiftResponse> getShiftAsync(
final String id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the Shift being retrieved. |
String id = "id0";
laborApi.getShiftAsync(id).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
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
.
CompletableFuture<UpdateShiftResponse> updateShiftAsync(
final String id,
final UpdateShiftRequest body)
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. |
String id = "id0";
UpdateShiftRequest body = new UpdateShiftRequest.Builder(
new Shift.Builder(
"PAA1RJZZKXBFG",
"2019-01-25T03:11:00-05:00"
)
.endAt("2019-01-25T13:11:00-05:00")
.wage(new ShiftWage.Builder()
.title("Bartender")
.hourlyRate(new Money.Builder()
.amount(1500L)
.currency("USD")
.build())
.tipEligible(true)
.build())
.breaks(Arrays.asList(
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()
))
.version(1)
.teamMemberId("ormj0jJJZ5OZIzxrZYJI")
.declaredCashTipMoney(new Money.Builder()
.amount(500L)
.currency("USD")
.build())
.build()
)
.build();
laborApi.updateShiftAsync(id, body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Returns a paginated list of TeamMemberWage
instances for a business.
CompletableFuture<ListTeamMemberWagesResponse> listTeamMemberWagesAsync(
final String teamMemberId,
final Integer limit,
final String cursor)
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
String |
Query, Optional | Filter the returned wages to only those that are associated with the specified team member. |
limit |
Integer |
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 |
Query, Optional | A pointer to the next page of EmployeeWage results to fetch. |
laborApi.listTeamMemberWagesAsync(null, null, null).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Returns a single TeamMemberWage
specified by id
.
CompletableFuture<GetTeamMemberWageResponse> getTeamMemberWageAsync(
final String id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the TeamMemberWage being retrieved. |
String id = "id0";
laborApi.getTeamMemberWageAsync(id).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Returns a list of WorkweekConfig
instances for a business.
CompletableFuture<ListWorkweekConfigsResponse> listWorkweekConfigsAsync(
final Integer limit,
final String cursor)
Parameter | Type | Tags | Description |
---|---|---|---|
limit |
Integer |
Query, Optional | The maximum number of WorkweekConfigs results to return per page. |
cursor |
String |
Query, Optional | A pointer to the next page of WorkweekConfig results to fetch. |
laborApi.listWorkweekConfigsAsync(null, null).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});
Updates a WorkweekConfig
.
CompletableFuture<UpdateWorkweekConfigResponse> updateWorkweekConfigAsync(
final String id,
final UpdateWorkweekConfigRequest body)
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. |
String id = "id0";
UpdateWorkweekConfigRequest body = new UpdateWorkweekConfigRequest.Builder(
new WorkweekConfig.Builder(
"MON",
"10:00"
)
.version(10)
.build()
)
.build();
laborApi.updateWorkweekConfigAsync(id, body).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
// TODO failure callback handler
exception.printStackTrace();
return null;
});