Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Latest commit

 

History

History
780 lines (566 loc) · 26.4 KB

LaborApi.md

File metadata and controls

780 lines (566 loc) · 26.4 KB

LaborApi

All URIs are relative to https://connect.squareup.com

Method HTTP request Description
createBreakType POST /v2/labor/break-types CreateBreakType
createShift POST /v2/labor/shifts CreateShift
deleteBreakType DELETE /v2/labor/break-types/{id} DeleteBreakType
deleteShift DELETE /v2/labor/shifts/{id} DeleteShift
getBreakType GET /v2/labor/break-types/{id} GetBreakType
getEmployeeWage GET /v2/labor/employee-wages/{id} GetEmployeeWage
getShift GET /v2/labor/shifts/{id} GetShift
listBreakTypes GET /v2/labor/break-types ListBreakTypes
listEmployeeWages GET /v2/labor/employee-wages ListEmployeeWages
listWorkweekConfigs GET /v2/labor/workweek-configs ListWorkweekConfigs
searchShifts POST /v2/labor/shifts/search SearchShifts
updateBreakType PUT /v2/labor/break-types/{id} UpdateBreakType
updateShift PUT /v2/labor/shifts/{id} UpdateShift
updateWorkweekConfig PUT /v2/labor/workweek-configs/{id} UpdateWorkweekConfig

createBreakType

CreateBreakTypeResponse createBreakType(body)

CreateBreakType

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.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
CreateBreakTypeRequest body = new CreateBreakTypeRequest(); // CreateBreakTypeRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    CreateBreakTypeResponse result = apiInstance.createBreakType(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#createBreakType");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body CreateBreakTypeRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

CreateBreakTypeResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createShift

CreateShiftResponse createShift(body)

CreateShift

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 new `Shift` is `OPEN` and the employee has another shift with an `OPEN` status. - The `start_at` date is in the future - the `start_at` or `end_at` overlaps another shift for the same employee - If `Break`s are set in the request, a break `start_at` must not be before the `Shift.start_at`. A break `end_at` must not be after the `Shift.end_at`

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
CreateShiftRequest body = new CreateShiftRequest(); // CreateShiftRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    CreateShiftResponse result = apiInstance.createShift(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#createShift");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body CreateShiftRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

CreateShiftResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteBreakType

DeleteBreakTypeResponse deleteBreakType(id)

DeleteBreakType

Deletes an existing `BreakType`. A `BreakType` can be deleted even if it is referenced from a `Shift`.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String id = "id_example"; // String | UUID for the `BreakType` being deleted.
try {
    DeleteBreakTypeResponse result = apiInstance.deleteBreakType(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#deleteBreakType");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id String UUID for the `BreakType` being deleted.

Return type

DeleteBreakTypeResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteShift

DeleteShiftResponse deleteShift(id)

DeleteShift

Deletes a `Shift`.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String id = "id_example"; // String | UUID for the `Shift` being deleted.
try {
    DeleteShiftResponse result = apiInstance.deleteShift(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#deleteShift");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id String UUID for the `Shift` being deleted.

Return type

DeleteShiftResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getBreakType

GetBreakTypeResponse getBreakType(id)

GetBreakType

Returns a single `BreakType` specified by id.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String id = "id_example"; // String | UUID for the `BreakType` being retrieved.
try {
    GetBreakTypeResponse result = apiInstance.getBreakType(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#getBreakType");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id String UUID for the `BreakType` being retrieved.

Return type

GetBreakTypeResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getEmployeeWage

GetEmployeeWageResponse getEmployeeWage(id)

GetEmployeeWage

Returns a single `EmployeeWage` specified by id.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String id = "id_example"; // String | UUID for the `EmployeeWage` being retrieved.
try {
    GetEmployeeWageResponse result = apiInstance.getEmployeeWage(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#getEmployeeWage");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id String UUID for the `EmployeeWage` being retrieved.

Return type

GetEmployeeWageResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getShift

GetShiftResponse getShift(id)

GetShift

Returns a single `Shift` specified by id.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String id = "id_example"; // String | UUID for the `Shift` being retrieved.
try {
    GetShiftResponse result = apiInstance.getShift(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#getShift");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id String UUID for the `Shift` being retrieved.

Return type

GetShiftResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

listBreakTypes

ListBreakTypesResponse listBreakTypes(locationId, limit, cursor)

ListBreakTypes

Returns a paginated list of `BreakType` instances for a business.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String locationId = "locationId_example"; // String | Filter Break Types returned to only those that are associated with the specified location.
Integer limit = 56; // Integer | Maximum number of Break Types to return per page. Can range between 1 and 200. The default is the maximum at 200.
String cursor = "cursor_example"; // String | Pointer to the next page of Break Type results to fetch.
try {
    ListBreakTypesResponse result = apiInstance.listBreakTypes(locationId, limit, cursor);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#listBreakTypes");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
locationId String Filter Break Types returned to only those that are associated with the specified location. [optional]
limit Integer Maximum number of Break Types to return per page. Can range between 1 and 200. The default is the maximum at 200. [optional]
cursor String Pointer to the next page of Break Type results to fetch. [optional]

Return type

ListBreakTypesResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

listEmployeeWages

ListEmployeeWagesResponse listEmployeeWages(employeeId, limit, cursor)

ListEmployeeWages

Returns a paginated list of `EmployeeWage` instances for a business.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String employeeId = "employeeId_example"; // String | Filter wages returned to only those that are associated with the specified employee.
Integer limit = 56; // Integer | Maximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200.
String cursor = "cursor_example"; // String | Pointer to the next page of Employee Wage results to fetch.
try {
    ListEmployeeWagesResponse result = apiInstance.listEmployeeWages(employeeId, limit, cursor);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#listEmployeeWages");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
employeeId String Filter wages returned to only those that are associated with the specified employee. [optional]
limit Integer Maximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200. [optional]
cursor String Pointer to the next page of Employee Wage results to fetch. [optional]

Return type

ListEmployeeWagesResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

listWorkweekConfigs

ListWorkweekConfigsResponse listWorkweekConfigs(limit, cursor)

ListWorkweekConfigs

Returns a list of `WorkweekConfig` instances for a business.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
Integer limit = 56; // Integer | Maximum number of Workweek Configs to return per page.
String cursor = "cursor_example"; // String | Pointer to the next page of Workweek Config results to fetch.
try {
    ListWorkweekConfigsResponse result = apiInstance.listWorkweekConfigs(limit, cursor);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#listWorkweekConfigs");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
limit Integer Maximum number of Workweek Configs to return per page. [optional]
cursor String Pointer to the next page of Workweek Config results to fetch. [optional]

Return type

ListWorkweekConfigsResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

searchShifts

SearchShiftsResponse searchShifts(body)

SearchShifts

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`

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
SearchShiftsRequest body = new SearchShiftsRequest(); // SearchShiftsRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    SearchShiftsResponse result = apiInstance.searchShifts(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#searchShifts");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body SearchShiftsRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

SearchShiftsResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateBreakType

UpdateBreakTypeResponse updateBreakType(id, body)

UpdateBreakType

Updates an existing `BreakType`.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String id = "id_example"; // String | UUID for the `BreakType` being updated.
UpdateBreakTypeRequest body = new UpdateBreakTypeRequest(); // UpdateBreakTypeRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    UpdateBreakTypeResponse result = apiInstance.updateBreakType(id, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#updateBreakType");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id String UUID for the `BreakType` being updated.
body UpdateBreakTypeRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

UpdateBreakTypeResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateShift

UpdateShiftResponse updateShift(id, body)

UpdateShift

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`.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String id = "id_example"; // String | ID of the object being updated.
UpdateShiftRequest body = new UpdateShiftRequest(); // UpdateShiftRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    UpdateShiftResponse result = apiInstance.updateShift(id, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#updateShift");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id String ID of the object being updated.
body UpdateShiftRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

UpdateShiftResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateWorkweekConfig

UpdateWorkweekConfigResponse updateWorkweekConfig(id, body)

UpdateWorkweekConfig

Updates a `WorkweekConfig`.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.LaborApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

LaborApi apiInstance = new LaborApi();
String id = "id_example"; // String | UUID for the `WorkweekConfig` object being updated.
UpdateWorkweekConfigRequest body = new UpdateWorkweekConfigRequest(); // UpdateWorkweekConfigRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    UpdateWorkweekConfigResponse result = apiInstance.updateWorkweekConfig(id, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling LaborApi#updateWorkweekConfig");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id String UUID for the `WorkweekConfig` object being updated.
body UpdateWorkweekConfigRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

UpdateWorkweekConfigResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json