Search in sources :

Example 1 with GetUserEndpointsRequest

use of software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsRequest in project aws-doc-sdk-examples by awsdocs.

the class ListEndpointIds method listAllEndpoints.

// snippet-start:[pinpoint.java2.list_endpoints.main]
public static void listAllEndpoints(PinpointClient pinpoint, String applicationId, String userId) {
    try {
        GetUserEndpointsRequest endpointsRequest = GetUserEndpointsRequest.builder().userId(userId).applicationId(applicationId).build();
        GetUserEndpointsResponse response = pinpoint.getUserEndpoints(endpointsRequest);
        List<EndpointResponse> endpoints = response.endpointsResponse().item();
        // Display the results
        for (EndpointResponse endpoint : endpoints) {
            System.out.println("The channel type is: " + endpoint.channelType());
            System.out.println("The address is  " + endpoint.address());
        }
    } catch (PinpointException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : EndpointResponse(software.amazon.awssdk.services.pinpoint.model.EndpointResponse) PinpointException(software.amazon.awssdk.services.pinpoint.model.PinpointException) GetUserEndpointsRequest(software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsRequest) GetUserEndpointsResponse(software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsResponse)

Aggregations

EndpointResponse (software.amazon.awssdk.services.pinpoint.model.EndpointResponse)1 GetUserEndpointsRequest (software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsRequest)1 GetUserEndpointsResponse (software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsResponse)1 PinpointException (software.amazon.awssdk.services.pinpoint.model.PinpointException)1