Skip to content

Latest commit

 

History

History
380 lines (271 loc) · 11.9 KB

team.md

File metadata and controls

380 lines (271 loc) · 11.9 KB

Team

team_api = client.team

Class Name

TeamApi

Methods

Create Team Member

Creates a single TeamMember object. The TeamMember object is returned on successful creates. You must provide the following values in your request to this endpoint:

  • given_name
  • family_name

Learn about Troubleshooting the Team API.

def create_team_member(self,
                      body)

Parameters

Parameter Type Tags Description
body Create Team Member Request Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Create Team Member Response

Example Usage

body = {}
body['idempotency_key'] = 'idempotency-key-0'
body['team_member'] = {}
body['team_member']['id'] = 'id2'
body['team_member']['reference_id'] = 'reference_id_1'
body['team_member']['is_owner'] = False
body['team_member']['status'] = 'ACTIVE'
body['team_member']['given_name'] = 'Joe'
body['team_member']['family_name'] = 'Doe'
body['team_member']['email_address'] = '[email protected]'
body['team_member']['phone_number'] = '+14159283333'
body['team_member']['assigned_locations'] = {}
body['team_member']['assigned_locations']['assignment_type'] = 'EXPLICIT_LOCATIONS'
body['team_member']['assigned_locations']['location_ids'] = ['YSGH2WBKG94QZ', 'GA2Y9HSJ8KRYT']

result = team_api.create_team_member(body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Bulk Create Team Members

Creates multiple TeamMember objects. The created TeamMember objects are returned on successful creates. This process is non-transactional and processes as much of the request as possible. If one of the creates in the request cannot be successfully processed, the request is not marked as failed, but the body of the response contains explicit error information for the failed create.

Learn about Troubleshooting the Team API.

def bulk_create_team_members(self,
                            body)

Parameters

Parameter Type Tags Description
body Bulk Create Team Members Request Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Bulk Create Team Members Response

Example Usage

body = {}
body['team_members'] = {}

result = team_api.bulk_create_team_members(body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Bulk Update Team Members

Updates multiple TeamMember objects. The updated TeamMember objects are returned on successful updates. This process is non-transactional and processes as much of the request as possible. If one of the updates in the request cannot be successfully processed, the request is not marked as failed, but the body of the response contains explicit error information for the failed update. Learn about Troubleshooting the Team API.

def bulk_update_team_members(self,
                            body)

Parameters

Parameter Type Tags Description
body Bulk Update Team Members Request Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Bulk Update Team Members Response

Example Usage

body = {}
body['team_members'] = {}

result = team_api.bulk_update_team_members(body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Search Team Members

Returns a paginated list of TeamMember objects for a business. The list can be filtered by the following:

  • location IDs
  • status
def search_team_members(self,
                       body)

Parameters

Parameter Type Tags Description
body Search Team Members Request Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Search Team Members Response

Example Usage

body = {}
body['query'] = {}
body['query']['filter'] = {}
body['query']['filter']['location_ids'] = ['0G5P3VGACMMQZ']
body['query']['filter']['status'] = 'ACTIVE'
body['limit'] = 10
body['cursor'] = 'cursor0'

result = team_api.search_team_members(body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Retrieve Team Member

Retrieves a TeamMember object for the given TeamMember.id. Learn about Troubleshooting the Team API.

def retrieve_team_member(self,
                        team_member_id)

Parameters

Parameter Type Tags Description
team_member_id string Template, Required The ID of the team member to retrieve.

Response Type

Retrieve Team Member Response

Example Usage

team_member_id = 'team_member_id0'

result = team_api.retrieve_team_member(team_member_id)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Update Team Member

Updates a single TeamMember object. The TeamMember object is returned on successful updates. Learn about Troubleshooting the Team API.

def update_team_member(self,
                      team_member_id,
                      body)

Parameters

Parameter Type Tags Description
team_member_id string Template, Required The ID of the team member to update.
body Update Team Member Request Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Update Team Member Response

Example Usage

team_member_id = 'team_member_id0'
body = {}
body['team_member'] = {}
body['team_member']['id'] = 'id2'
body['team_member']['reference_id'] = 'reference_id_1'
body['team_member']['is_owner'] = False
body['team_member']['status'] = 'ACTIVE'
body['team_member']['given_name'] = 'Joe'
body['team_member']['family_name'] = 'Doe'
body['team_member']['email_address'] = '[email protected]'
body['team_member']['phone_number'] = '+14159283333'
body['team_member']['assigned_locations'] = {}
body['team_member']['assigned_locations']['assignment_type'] = 'EXPLICIT_LOCATIONS'
body['team_member']['assigned_locations']['location_ids'] = ['YSGH2WBKG94QZ', 'GA2Y9HSJ8KRYT']

result = team_api.update_team_member(team_member_id, body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Retrieve Wage Setting

Retrieves a WageSetting object for a team member specified by TeamMember.id. Learn about Troubleshooting the Team API.

def retrieve_wage_setting(self,
                         team_member_id)

Parameters

Parameter Type Tags Description
team_member_id string Template, Required The ID of the team member for which to retrieve the wage setting.

Response Type

Retrieve Wage Setting Response

Example Usage

team_member_id = 'team_member_id0'

result = team_api.retrieve_wage_setting(team_member_id)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Update Wage Setting

Creates or updates a WageSetting object. The object is created if a WageSetting with the specified team_member_id does not exist. Otherwise, it fully replaces the WageSetting object for the team member. The WageSetting is returned on a successful update. Learn about Troubleshooting the Team API.

def update_wage_setting(self,
                       team_member_id,
                       body)

Parameters

Parameter Type Tags Description
team_member_id string Template, Required The ID of the team member for which to update the WageSetting object.
body Update Wage Setting Request Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Update Wage Setting Response

Example Usage

team_member_id = 'team_member_id0'
body = {}
body['wage_setting'] = {}
body['wage_setting']['team_member_id'] = 'team_member_id2'
body['wage_setting']['job_assignments'] = []

body['wage_setting']['job_assignments'].append({})
body['wage_setting']['job_assignments'][0]['job_title'] = 'Manager'
body['wage_setting']['job_assignments'][0]['pay_type'] = 'SALARY'
body['wage_setting']['job_assignments'][0]['hourly_rate'] = {}
body['wage_setting']['job_assignments'][0]['hourly_rate']['amount'] = 117
body['wage_setting']['job_assignments'][0]['hourly_rate']['currency'] = 'ERN'
body['wage_setting']['job_assignments'][0]['annual_rate'] = {}
body['wage_setting']['job_assignments'][0]['annual_rate']['amount'] = 3000000
body['wage_setting']['job_assignments'][0]['annual_rate']['currency'] = 'USD'
body['wage_setting']['job_assignments'][0]['weekly_hours'] = 40

body['wage_setting']['job_assignments'].append({})
body['wage_setting']['job_assignments'][1]['job_title'] = 'Cashier'
body['wage_setting']['job_assignments'][1]['pay_type'] = 'HOURLY'
body['wage_setting']['job_assignments'][1]['hourly_rate'] = {}
body['wage_setting']['job_assignments'][1]['hourly_rate']['amount'] = 1200
body['wage_setting']['job_assignments'][1]['hourly_rate']['currency'] = 'USD'
body['wage_setting']['job_assignments'][1]['annual_rate'] = {}
body['wage_setting']['job_assignments'][1]['annual_rate']['amount'] = 58
body['wage_setting']['job_assignments'][1]['annual_rate']['currency'] = 'DZD'
body['wage_setting']['job_assignments'][1]['weekly_hours'] = 226

body['wage_setting']['is_overtime_exempt'] = True
body['wage_setting']['version'] = 122
body['wage_setting']['created_at'] = 'created_at0'

result = team_api.update_wage_setting(team_member_id, body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)