ICustomerGroupsApi customerGroupsApi = client.CustomerGroupsApi;
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.
ListCustomerGroupsAsync(
string cursor = null,
int? limit = null)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
string |
Query, Optional | A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for your original query. For more information, see Pagination. |
limit |
int? |
Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. If the limit is less than 1 or greater than 50, Square returns a 400 VALUE_TOO_LOW or 400 VALUE_TOO_HIGH error. The default value is 50.For more information, see Pagination. |
Task<Models.ListCustomerGroupsResponse>
try
{
ListCustomerGroupsResponse result = await customerGroupsApi.ListCustomerGroupsAsync();
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Creates a new customer group for a business.
The request must include the name
value of the group.
CreateCustomerGroupAsync(
Models.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. |
Task<Models.CreateCustomerGroupResponse>
CreateCustomerGroupRequest body = new CreateCustomerGroupRequest.Builder(
new CustomerGroup.Builder(
"Loyal Customers"
)
.Build()
)
.Build();
try
{
CreateCustomerGroupResponse result = await customerGroupsApi.CreateCustomerGroupAsync(body);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Deletes a customer group as identified by the group_id
value.
DeleteCustomerGroupAsync(
string groupId)
Parameter | Type | Tags | Description |
---|---|---|---|
groupId |
string |
Template, Required | The ID of the customer group to delete. |
Task<Models.DeleteCustomerGroupResponse>
string groupId = "group_id0";
try
{
DeleteCustomerGroupResponse result = await customerGroupsApi.DeleteCustomerGroupAsync(groupId);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Retrieves a specific customer group as identified by the group_id
value.
RetrieveCustomerGroupAsync(
string groupId)
Parameter | Type | Tags | Description |
---|---|---|---|
groupId |
string |
Template, Required | The ID of the customer group to retrieve. |
Task<Models.RetrieveCustomerGroupResponse>
string groupId = "group_id0";
try
{
RetrieveCustomerGroupResponse result = await customerGroupsApi.RetrieveCustomerGroupAsync(groupId);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Updates a customer group as identified by the group_id
value.
UpdateCustomerGroupAsync(
string groupId,
Models.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. |
Task<Models.UpdateCustomerGroupResponse>
string groupId = "group_id0";
UpdateCustomerGroupRequest body = new UpdateCustomerGroupRequest.Builder(
new CustomerGroup.Builder(
"Loyal Customers"
)
.Build()
)
.Build();
try
{
UpdateCustomerGroupResponse result = await customerGroupsApi.UpdateCustomerGroupAsync(
groupId,
body
);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}