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

Latest commit

 

History

History
821 lines (546 loc) · 26.8 KB

LaborApi.md

File metadata and controls

821 lines (546 loc) · 26.8 KB

SquareConnect.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
getTeamMemberWage GET /v2/labor/team-member-wages/{id} GetTeamMemberWage
listBreakTypes GET /v2/labor/break-types ListBreakTypes
listEmployeeWages GET /v2/labor/employee-wages ListEmployeeWages
listTeamMemberWages GET /v2/labor/team-member-wages ListTeamMemberWages
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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var body = SquareConnect.LaborApi.constructFromObject({}); // CreateBreakTypeRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.createBreakType(body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var body = SquareConnect.LaborApi.constructFromObject({}); // CreateShiftRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.createShift(body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var id = SquareConnect.LaborApi.constructFromObject({}); // String | UUID for the `BreakType` being deleted.

apiInstance.deleteBreakType(id).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var id = SquareConnect.LaborApi.constructFromObject({}); // String | UUID for the `Shift` being deleted.

apiInstance.deleteShift(id).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var id = SquareConnect.LaborApi.constructFromObject({}); // String | UUID for the `BreakType` being retrieved.

apiInstance.getBreakType(id).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

Note: This endpoint is deprecated.

GetEmployeeWageResponse getEmployeeWage(id)

GetEmployeeWage

Returns a single `EmployeeWage` specified by id.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var id = SquareConnect.LaborApi.constructFromObject({}); // String | UUID for the `EmployeeWage` being retrieved.

apiInstance.getEmployeeWage(id).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var id = SquareConnect.LaborApi.constructFromObject({}); // String | UUID for the `Shift` being retrieved.

apiInstance.getShift(id).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

getTeamMemberWage

GetTeamMemberWageResponse getTeamMemberWage(id)

GetTeamMemberWage

Returns a single `TeamMemberWage` specified by id.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var id = SquareConnect.LaborApi.constructFromObject({}); // String | UUID for the `TeamMemberWage` being retrieved.

apiInstance.getTeamMemberWage(id).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

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

Return type

GetTeamMemberWageResponse

Authorization

oauth2

HTTP request headers

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

listBreakTypes

ListBreakTypesResponse listBreakTypes(opts)

ListBreakTypes

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

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var opts = { 
  'locationId': SquareConnect.LaborApi.constructFromObject({});, // String | Filter Break Types returned to only those that are associated with the specified location.
  'limit': SquareConnect.LaborApi.constructFromObject({});, // Number | Maximum number of Break Types to return per page. Can range between 1 and 200. The default is the maximum at 200.
  'cursor': SquareConnect.LaborApi.constructFromObject({}); // String | Pointer to the next page of Break Type results to fetch.
};
apiInstance.listBreakTypes(opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
locationId String Filter Break Types returned to only those that are associated with the specified location. [optional]
limit Number 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

Note: This endpoint is deprecated.

ListEmployeeWagesResponse listEmployeeWages(opts)

ListEmployeeWages

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

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var opts = { 
  'employeeId': SquareConnect.LaborApi.constructFromObject({});, // String | Filter wages returned to only those that are associated with the specified employee.
  'limit': SquareConnect.LaborApi.constructFromObject({});, // Number | Maximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200.
  'cursor': SquareConnect.LaborApi.constructFromObject({}); // String | Pointer to the next page of Employee Wage results to fetch.
};
apiInstance.listEmployeeWages(opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
employeeId String Filter wages returned to only those that are associated with the specified employee. [optional]
limit Number 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

listTeamMemberWages

ListTeamMemberWagesResponse listTeamMemberWages(opts)

ListTeamMemberWages

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

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var opts = { 
  'teamMemberId': SquareConnect.LaborApi.constructFromObject({});, // String | Filter wages returned to only those that are associated with the specified team member.
  'limit': SquareConnect.LaborApi.constructFromObject({});, // Number | Maximum number of Team Member Wages to return per page. Can range between 1 and 200. The default is the maximum at 200.
  'cursor': SquareConnect.LaborApi.constructFromObject({}); // String | Pointer to the next page of Employee Wage results to fetch.
};
apiInstance.listTeamMemberWages(opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
teamMemberId String Filter wages returned to only those that are associated with the specified team member. [optional]
limit Number Maximum number of Team Member 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

ListTeamMemberWagesResponse

Authorization

oauth2

HTTP request headers

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

listWorkweekConfigs

ListWorkweekConfigsResponse listWorkweekConfigs(opts)

ListWorkweekConfigs

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

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var opts = { 
  'limit': SquareConnect.LaborApi.constructFromObject({});, // Number | Maximum number of Workweek Configs to return per page.
  'cursor': SquareConnect.LaborApi.constructFromObject({}); // String | Pointer to the next page of Workweek Config results to fetch.
};
apiInstance.listWorkweekConfigs(opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
limit Number 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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var body = SquareConnect.LaborApi.constructFromObject({}); // SearchShiftsRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.searchShifts(body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var id = SquareConnect.LaborApi.constructFromObject({}); // String | UUID for the `BreakType` being updated.

var body = SquareConnect.LaborApi.constructFromObject({}); // UpdateBreakTypeRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.updateBreakType(id, body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var id = SquareConnect.LaborApi.constructFromObject({}); // String | ID of the object being updated.

var body = SquareConnect.LaborApi.constructFromObject({}); // UpdateShiftRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.updateShift(id, body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LaborApi();

var id = SquareConnect.LaborApi.constructFromObject({}); // String | UUID for the `WorkweekConfig` object being updated.

var body = SquareConnect.LaborApi.constructFromObject({}); // UpdateWorkweekConfigRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.updateWorkweekConfig(id, body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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