|
| 1 | +# Customer Groups |
| 2 | + |
| 3 | +```java |
| 4 | +CustomerGroupsApi customerGroupsApi = client.getCustomerGroupsApi(); |
| 5 | +``` |
| 6 | + |
| 7 | +## Class Name |
| 8 | + |
| 9 | +`CustomerGroupsApi` |
| 10 | + |
| 11 | +## Methods |
| 12 | + |
| 13 | +* [List Customer Groups](/doc/customer-groups.md#list-customer-groups) |
| 14 | +* [Create Customer Group](/doc/customer-groups.md#create-customer-group) |
| 15 | +* [Delete Customer Group](/doc/customer-groups.md#delete-customer-group) |
| 16 | +* [Retrieve Customer Group](/doc/customer-groups.md#retrieve-customer-group) |
| 17 | +* [Update Customer Group](/doc/customer-groups.md#update-customer-group) |
| 18 | + |
| 19 | +## List Customer Groups |
| 20 | + |
| 21 | +Retrieves the list of customer groups of a business. |
| 22 | + |
| 23 | +```java |
| 24 | +CompletableFuture<ListCustomerGroupsResponse> listCustomerGroupsAsync( |
| 25 | + final String cursor) |
| 26 | +``` |
| 27 | + |
| 28 | +### Parameters |
| 29 | + |
| 30 | +| Parameter | Type | Tags | Description | |
| 31 | +| --- | --- | --- | --- | |
| 32 | +| `cursor` | `String` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for your original query.<br><br>See the [Pagination guide](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. | |
| 33 | + |
| 34 | +### Response Type |
| 35 | + |
| 36 | +[`ListCustomerGroupsResponse`](/doc/models/list-customer-groups-response.md) |
| 37 | + |
| 38 | +### Example Usage |
| 39 | + |
| 40 | +```java |
| 41 | +customerGroupsApi.listCustomerGroupsAsync(null).thenAccept(result -> { |
| 42 | + // TODO success callback handler |
| 43 | +}).exceptionally(exception -> { |
| 44 | + // TODO failure callback handler |
| 45 | + return null; |
| 46 | +}); |
| 47 | +``` |
| 48 | + |
| 49 | +## Create Customer Group |
| 50 | + |
| 51 | +Creates a new customer group for a business. |
| 52 | + |
| 53 | +The request must include at least the `name` value of the group. |
| 54 | + |
| 55 | +```java |
| 56 | +CompletableFuture<CreateCustomerGroupResponse> createCustomerGroupAsync( |
| 57 | + final CreateCustomerGroupRequest body) |
| 58 | +``` |
| 59 | + |
| 60 | +### Parameters |
| 61 | + |
| 62 | +| Parameter | Type | Tags | Description | |
| 63 | +| --- | --- | --- | --- | |
| 64 | +| `body` | [`CreateCustomerGroupRequest`](/doc/models/create-customer-group-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. | |
| 65 | + |
| 66 | +### Response Type |
| 67 | + |
| 68 | +[`CreateCustomerGroupResponse`](/doc/models/create-customer-group-response.md) |
| 69 | + |
| 70 | +### Example Usage |
| 71 | + |
| 72 | +```java |
| 73 | +CustomerGroup bodyGroup = new CustomerGroup.Builder( |
| 74 | + "Loyal Customers") |
| 75 | + .build(); |
| 76 | +CreateCustomerGroupRequest body = new CreateCustomerGroupRequest.Builder( |
| 77 | + bodyGroup) |
| 78 | + .build(); |
| 79 | + |
| 80 | +customerGroupsApi.createCustomerGroupAsync(body).thenAccept(result -> { |
| 81 | + // TODO success callback handler |
| 82 | +}).exceptionally(exception -> { |
| 83 | + // TODO failure callback handler |
| 84 | + return null; |
| 85 | +}); |
| 86 | +``` |
| 87 | + |
| 88 | +## Delete Customer Group |
| 89 | + |
| 90 | +Deletes a customer group as identified by the `group_id` value. |
| 91 | + |
| 92 | +```java |
| 93 | +CompletableFuture<DeleteCustomerGroupResponse> deleteCustomerGroupAsync( |
| 94 | + final String groupId) |
| 95 | +``` |
| 96 | + |
| 97 | +### Parameters |
| 98 | + |
| 99 | +| Parameter | Type | Tags | Description | |
| 100 | +| --- | --- | --- | --- | |
| 101 | +| `groupId` | `String` | Template, Required | The ID of the customer group to delete. | |
| 102 | + |
| 103 | +### Response Type |
| 104 | + |
| 105 | +[`DeleteCustomerGroupResponse`](/doc/models/delete-customer-group-response.md) |
| 106 | + |
| 107 | +### Example Usage |
| 108 | + |
| 109 | +```java |
| 110 | +String groupId = "group_id0"; |
| 111 | + |
| 112 | +customerGroupsApi.deleteCustomerGroupAsync(groupId).thenAccept(result -> { |
| 113 | + // TODO success callback handler |
| 114 | +}).exceptionally(exception -> { |
| 115 | + // TODO failure callback handler |
| 116 | + return null; |
| 117 | +}); |
| 118 | +``` |
| 119 | + |
| 120 | +## Retrieve Customer Group |
| 121 | + |
| 122 | +Retrieves a specific customer group as identified by the `group_id` value. |
| 123 | + |
| 124 | +```java |
| 125 | +CompletableFuture<RetrieveCustomerGroupResponse> retrieveCustomerGroupAsync( |
| 126 | + final String groupId) |
| 127 | +``` |
| 128 | + |
| 129 | +### Parameters |
| 130 | + |
| 131 | +| Parameter | Type | Tags | Description | |
| 132 | +| --- | --- | --- | --- | |
| 133 | +| `groupId` | `String` | Template, Required | The ID of the customer group to retrieve. | |
| 134 | + |
| 135 | +### Response Type |
| 136 | + |
| 137 | +[`RetrieveCustomerGroupResponse`](/doc/models/retrieve-customer-group-response.md) |
| 138 | + |
| 139 | +### Example Usage |
| 140 | + |
| 141 | +```java |
| 142 | +String groupId = "group_id0"; |
| 143 | + |
| 144 | +customerGroupsApi.retrieveCustomerGroupAsync(groupId).thenAccept(result -> { |
| 145 | + // TODO success callback handler |
| 146 | +}).exceptionally(exception -> { |
| 147 | + // TODO failure callback handler |
| 148 | + return null; |
| 149 | +}); |
| 150 | +``` |
| 151 | + |
| 152 | +## Update Customer Group |
| 153 | + |
| 154 | +Updates a customer group as identified by the `group_id` value. |
| 155 | + |
| 156 | +```java |
| 157 | +CompletableFuture<UpdateCustomerGroupResponse> updateCustomerGroupAsync( |
| 158 | + final String groupId, |
| 159 | + final UpdateCustomerGroupRequest body) |
| 160 | +``` |
| 161 | + |
| 162 | +### Parameters |
| 163 | + |
| 164 | +| Parameter | Type | Tags | Description | |
| 165 | +| --- | --- | --- | --- | |
| 166 | +| `groupId` | `String` | Template, Required | The ID of the customer group to update. | |
| 167 | +| `body` | [`UpdateCustomerGroupRequest`](/doc/models/update-customer-group-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. | |
| 168 | + |
| 169 | +### Response Type |
| 170 | + |
| 171 | +[`UpdateCustomerGroupResponse`](/doc/models/update-customer-group-response.md) |
| 172 | + |
| 173 | +### Example Usage |
| 174 | + |
| 175 | +```java |
| 176 | +String groupId = "group_id0"; |
| 177 | +CustomerGroup bodyGroup = new CustomerGroup.Builder( |
| 178 | + "Loyal Customers") |
| 179 | + .build(); |
| 180 | +UpdateCustomerGroupRequest body = new UpdateCustomerGroupRequest.Builder( |
| 181 | + bodyGroup) |
| 182 | + .build(); |
| 183 | + |
| 184 | +customerGroupsApi.updateCustomerGroupAsync(groupId, body).thenAccept(result -> { |
| 185 | + // TODO success callback handler |
| 186 | +}).exceptionally(exception -> { |
| 187 | + // TODO failure callback handler |
| 188 | + return null; |
| 189 | +}); |
| 190 | +``` |
| 191 | + |
0 commit comments