Skip to content

Latest commit

 

History

History
200 lines (143 loc) · 5.51 KB

customer-groups.md

File metadata and controls

200 lines (143 loc) · 5.51 KB

Customer Groups

CustomerGroupsApi customerGroupsApi = client.getCustomerGroupsApi();

Class Name

CustomerGroupsApi

Methods

List Customer Groups

Retrieves the list of customer groups of a business.

CompletableFuture<ListCustomerGroupsResponse> listCustomerGroupsAsync(
    final String cursor)

Parameters

Parameter Type Tags Description
cursor String Query, Optional A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See the Pagination guide for more information.

Response Type

ListCustomerGroupsResponse

Example Usage

String cursor = "cursor6";

customerGroupsApi.listCustomerGroupsAsync(cursor).thenAccept(result -> {
    // TODO success callback handler
}).exceptionally(exception -> {
    // TODO failure callback handler
    return null;
});

Create Customer Group

Creates a new customer group for a business.

The request must include the name value of the group.

CompletableFuture<CreateCustomerGroupResponse> createCustomerGroupAsync(
    final CreateCustomerGroupRequest body)

Parameters

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

See the corresponding object definition for field details.

Response Type

CreateCustomerGroupResponse

Example Usage

CustomerGroup bodyGroup = new CustomerGroup.Builder(
        "Loyal Customers")
    .id("id4")
    .createdAt("created_at2")
    .updatedAt("updated_at0")
    .build();
CreateCustomerGroupRequest body = new CreateCustomerGroupRequest.Builder(
        bodyGroup)
    .idempotencyKey("idempotency_key2")
    .build();

customerGroupsApi.createCustomerGroupAsync(body).thenAccept(result -> {
    // TODO success callback handler
}).exceptionally(exception -> {
    // TODO failure callback handler
    return null;
});

Delete Customer Group

Deletes a customer group as identified by the group_id value.

CompletableFuture<DeleteCustomerGroupResponse> deleteCustomerGroupAsync(
    final String groupId)

Parameters

Parameter Type Tags Description
groupId String Template, Required The ID of the customer group to delete.

Response Type

DeleteCustomerGroupResponse

Example Usage

String groupId = "group_id0";

customerGroupsApi.deleteCustomerGroupAsync(groupId).thenAccept(result -> {
    // TODO success callback handler
}).exceptionally(exception -> {
    // TODO failure callback handler
    return null;
});

Retrieve Customer Group

Retrieves a specific customer group as identified by the group_id value.

CompletableFuture<RetrieveCustomerGroupResponse> retrieveCustomerGroupAsync(
    final String groupId)

Parameters

Parameter Type Tags Description
groupId String Template, Required The ID of the customer group to retrieve.

Response Type

RetrieveCustomerGroupResponse

Example Usage

String groupId = "group_id0";

customerGroupsApi.retrieveCustomerGroupAsync(groupId).thenAccept(result -> {
    // TODO success callback handler
}).exceptionally(exception -> {
    // TODO failure callback handler
    return null;
});

Update Customer Group

Updates a customer group as identified by the group_id value.

CompletableFuture<UpdateCustomerGroupResponse> updateCustomerGroupAsync(
    final String groupId,
    final UpdateCustomerGroupRequest body)

Parameters

Parameter Type Tags Description
groupId String Template, Required The ID of the customer group to update.
body UpdateCustomerGroupRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

UpdateCustomerGroupResponse

Example Usage

String groupId = "group_id0";
CustomerGroup bodyGroup = new CustomerGroup.Builder(
        "Loyal Customers")
    .id("id4")
    .createdAt("created_at2")
    .updatedAt("updated_at0")
    .build();
UpdateCustomerGroupRequest body = new UpdateCustomerGroupRequest.Builder(
        bodyGroup)
    .build();

customerGroupsApi.updateCustomerGroupAsync(groupId, body).thenAccept(result -> {
    // TODO success callback handler
}).exceptionally(exception -> {
    // TODO failure callback handler
    return null;
});