Skip to content

Latest commit

 

History

History
513 lines (417 loc) · 14.5 KB

team.md

File metadata and controls

513 lines (417 loc) · 14.5 KB

Team

ITeamApi teamApi = client.TeamApi;

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.

CreateTeamMemberAsync(
    Models.CreateTeamMemberRequest body)

Parameters

Parameter Type Tags Description
body CreateTeamMemberRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.CreateTeamMemberResponse>

Example Usage

CreateTeamMemberRequest body = new CreateTeamMemberRequest.Builder()
.IdempotencyKey("idempotency-key-0")
.TeamMember(
    new TeamMember.Builder()
    .ReferenceId("reference_id_1")
    .Status("ACTIVE")
    .GivenName("Joe")
    .FamilyName("Doe")
    .EmailAddress("[email protected]")
    .PhoneNumber("+14159283333")
    .AssignedLocations(
        new TeamMemberAssignedLocations.Builder()
        .AssignmentType("EXPLICIT_LOCATIONS")
        .LocationIds(
            new List<string>
            {
                "YSGH2WBKG94QZ",
                "GA2Y9HSJ8KRYT",
            })
        .Build())
    .Build())
.Build();

try
{
    CreateTeamMemberResponse result = await teamApi.CreateTeamMemberAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

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.

BulkCreateTeamMembersAsync(
    Models.BulkCreateTeamMembersRequest body)

Parameters

Parameter Type Tags Description
body BulkCreateTeamMembersRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.BulkCreateTeamMembersResponse>

Example Usage

BulkCreateTeamMembersRequest body = new BulkCreateTeamMembersRequest.Builder(
    new Dictionary<string, CreateTeamMemberRequest>
    {
        ["idempotency-key-1"] = new CreateTeamMemberRequest.Builder()
        .TeamMember(
            new TeamMember.Builder()
            .ReferenceId("reference_id_1")
            .GivenName("Joe")
            .FamilyName("Doe")
            .EmailAddress("[email protected]")
            .PhoneNumber("+14159283333")
            .AssignedLocations(
                new TeamMemberAssignedLocations.Builder()
                .AssignmentType("EXPLICIT_LOCATIONS")
                .LocationIds(
                    new List<string>
                    {
                        "YSGH2WBKG94QZ",
                        "GA2Y9HSJ8KRYT",
                    })
                .Build())
            .Build())
        .Build(),
        ["idempotency-key-2"] = new CreateTeamMemberRequest.Builder()
        .TeamMember(
            new TeamMember.Builder()
            .ReferenceId("reference_id_2")
            .GivenName("Jane")
            .FamilyName("Smith")
            .EmailAddress("[email protected]")
            .PhoneNumber("+14159223334")
            .AssignedLocations(
                new TeamMemberAssignedLocations.Builder()
                .AssignmentType("ALL_CURRENT_AND_FUTURE_LOCATIONS")
                .Build())
            .Build())
        .Build(),
    }
)
.Build();

try
{
    BulkCreateTeamMembersResponse result = await teamApi.BulkCreateTeamMembersAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

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.

BulkUpdateTeamMembersAsync(
    Models.BulkUpdateTeamMembersRequest body)

Parameters

Parameter Type Tags Description
body BulkUpdateTeamMembersRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.BulkUpdateTeamMembersResponse>

Example Usage

BulkUpdateTeamMembersRequest body = new BulkUpdateTeamMembersRequest.Builder(
    new Dictionary<string, UpdateTeamMemberRequest>
    {
        ["AFMwA08kR-MIF-3Vs0OE"] = new UpdateTeamMemberRequest.Builder()
        .TeamMember(
            new TeamMember.Builder()
            .ReferenceId("reference_id_2")
            .IsOwner(false)
            .Status("ACTIVE")
            .GivenName("Jane")
            .FamilyName("Smith")
            .EmailAddress("[email protected]")
            .PhoneNumber("+14159223334")
            .AssignedLocations(
                new TeamMemberAssignedLocations.Builder()
                .AssignmentType("ALL_CURRENT_AND_FUTURE_LOCATIONS")
                .Build())
            .Build())
        .Build(),
        ["fpgteZNMaf0qOK-a4t6P"] = new UpdateTeamMemberRequest.Builder()
        .TeamMember(
            new TeamMember.Builder()
            .ReferenceId("reference_id_1")
            .IsOwner(false)
            .Status("ACTIVE")
            .GivenName("Joe")
            .FamilyName("Doe")
            .EmailAddress("[email protected]")
            .PhoneNumber("+14159283333")
            .AssignedLocations(
                new TeamMemberAssignedLocations.Builder()
                .AssignmentType("EXPLICIT_LOCATIONS")
                .LocationIds(
                    new List<string>
                    {
                        "YSGH2WBKG94QZ",
                        "GA2Y9HSJ8KRYT",
                    })
                .Build())
            .Build())
        .Build(),
    }
)
.Build();

try
{
    BulkUpdateTeamMembersResponse result = await teamApi.BulkUpdateTeamMembersAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Search Team Members

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

  • location IDs
  • status
SearchTeamMembersAsync(
    Models.SearchTeamMembersRequest body)

Parameters

Parameter Type Tags Description
body SearchTeamMembersRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.SearchTeamMembersResponse>

Example Usage

SearchTeamMembersRequest body = new SearchTeamMembersRequest.Builder()
.Query(
    new SearchTeamMembersQuery.Builder()
    .Filter(
        new SearchTeamMembersFilter.Builder()
        .LocationIds(
            new List<string>
            {
                "0G5P3VGACMMQZ",
            })
        .Status("ACTIVE")
        .Build())
    .Build())
.Limit(10)
.Build();

try
{
    SearchTeamMembersResponse result = await teamApi.SearchTeamMembersAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Retrieve Team Member

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

RetrieveTeamMemberAsync(
    string teamMemberId)

Parameters

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

Response Type

Task<Models.RetrieveTeamMemberResponse>

Example Usage

string teamMemberId = "team_member_id0";
try
{
    RetrieveTeamMemberResponse result = await teamApi.RetrieveTeamMemberAsync(teamMemberId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Update Team Member

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

UpdateTeamMemberAsync(
    string teamMemberId,
    Models.UpdateTeamMemberRequest body)

Parameters

Parameter Type Tags Description
teamMemberId string Template, Required The ID of the team member to update.
body UpdateTeamMemberRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Task<Models.UpdateTeamMemberResponse>

Example Usage

string teamMemberId = "team_member_id0";
UpdateTeamMemberRequest body = new UpdateTeamMemberRequest.Builder()
.TeamMember(
    new TeamMember.Builder()
    .ReferenceId("reference_id_1")
    .Status("ACTIVE")
    .GivenName("Joe")
    .FamilyName("Doe")
    .EmailAddress("[email protected]")
    .PhoneNumber("+14159283333")
    .AssignedLocations(
        new TeamMemberAssignedLocations.Builder()
        .AssignmentType("EXPLICIT_LOCATIONS")
        .LocationIds(
            new List<string>
            {
                "YSGH2WBKG94QZ",
                "GA2Y9HSJ8KRYT",
            })
        .Build())
    .Build())
.Build();

try
{
    UpdateTeamMemberResponse result = await teamApi.UpdateTeamMemberAsync(
        teamMemberId,
        body
    );
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Retrieve Wage Setting

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

RetrieveWageSettingAsync(
    string teamMemberId)

Parameters

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

Response Type

Task<Models.RetrieveWageSettingResponse>

Example Usage

string teamMemberId = "team_member_id0";
try
{
    RetrieveWageSettingResponse result = await teamApi.RetrieveWageSettingAsync(teamMemberId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

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.

UpdateWageSettingAsync(
    string teamMemberId,
    Models.UpdateWageSettingRequest body)

Parameters

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

See the corresponding object definition for field details.

Response Type

Task<Models.UpdateWageSettingResponse>

Example Usage

string teamMemberId = "team_member_id0";
UpdateWageSettingRequest body = new UpdateWageSettingRequest.Builder(
    new WageSetting.Builder()
    .JobAssignments(
        new List<JobAssignment>
        {
            new JobAssignment.Builder(
                "Manager",
                "SALARY"
            )
            .AnnualRate(
                new Money.Builder()
                .Amount(3000000L)
                .Currency("USD")
                .Build())
            .WeeklyHours(40)
            .Build(),
            new JobAssignment.Builder(
                "Cashier",
                "HOURLY"
            )
            .HourlyRate(
                new Money.Builder()
                .Amount(1200L)
                .Currency("USD")
                .Build())
            .Build(),
        })
    .IsOvertimeExempt(true)
    .Build()
)
.Build();

try
{
    UpdateWageSettingResponse result = await teamApi.UpdateWageSettingAsync(
        teamMemberId,
        body
    );
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}