CustomerGroupsApi customerGroupsApi = client.getCustomerGroupsApi();
CustomerGroupsApi
- List Customer Groups
- Create Customer Group
- Delete Customer Group
- Retrieve Customer Group
- Update Customer Group
Retrieves the list of customer groups of a business.
CompletableFuture<ListCustomerGroupsResponse> listCustomerGroupsAsync(
final String cursor)
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. |
String cursor = "cursor6";
customerGroupsApi.listCustomerGroupsAsync(cursor).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Creates a new customer group for a business.
The request must include the name
value of the group.
CompletableFuture<CreateCustomerGroupResponse> createCustomerGroupAsync(
final CreateCustomerGroupRequest body)
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. |
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;
});
Deletes a customer group as identified by the group_id
value.
CompletableFuture<DeleteCustomerGroupResponse> deleteCustomerGroupAsync(
final String groupId)
Parameter | Type | Tags | Description |
---|---|---|---|
groupId |
String |
Template, Required | The ID of the customer group to delete. |
String groupId = "group_id0";
customerGroupsApi.deleteCustomerGroupAsync(groupId).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Retrieves a specific customer group as identified by the group_id
value.
CompletableFuture<RetrieveCustomerGroupResponse> retrieveCustomerGroupAsync(
final String groupId)
Parameter | Type | Tags | Description |
---|---|---|---|
groupId |
String |
Template, Required | The ID of the customer group to retrieve. |
String groupId = "group_id0";
customerGroupsApi.retrieveCustomerGroupAsync(groupId).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Updates a customer group as identified by the group_id
value.
CompletableFuture<UpdateCustomerGroupResponse> updateCustomerGroupAsync(
final String groupId,
final UpdateCustomerGroupRequest body)
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. |
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;
});