Skip to content

Latest commit

 

History

History
85 lines (58 loc) · 2.69 KB

customer-segments.md

File metadata and controls

85 lines (58 loc) · 2.69 KB

Customer Segments

CustomerSegmentsApi customerSegmentsApi = client.getCustomerSegmentsApi();

Class Name

CustomerSegmentsApi

Methods

List Customer Segments

Retrieves the list of customer segments of a business.

CompletableFuture<ListCustomerSegmentsResponse> listCustomerSegmentsAsync(
    final String cursor,
    final Integer limit)

Parameters

Parameter Type Tags Description
cursor String Query, Optional A pagination cursor returned by previous calls to ListCustomerSegments.
This cursor is used to retrieve the next set of query results.

For more information, see Pagination.
limit Integer 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 specified 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.

Response Type

ListCustomerSegmentsResponse

Example Usage

customerSegmentsApi.listCustomerSegmentsAsync(null, null).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});

Retrieve Customer Segment

Retrieves a specific customer segment as identified by the segment_id value.

CompletableFuture<RetrieveCustomerSegmentResponse> retrieveCustomerSegmentAsync(
    final String segmentId)

Parameters

Parameter Type Tags Description
segmentId String Template, Required The Square-issued ID of the customer segment.

Response Type

RetrieveCustomerSegmentResponse

Example Usage

String segmentId = "segment_id4";

customerSegmentsApi.retrieveCustomerSegmentAsync(segmentId).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});