Search in sources :

Example 1 with EndpointResponse

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

the class UpdateEndpoint method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "CreateEndpoint <appId>\n\n" + "Where:\n" + "  appId - the ID of the application to create an endpoint for.\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String appId = args[0];
    PinpointClient pinpoint = PinpointClient.builder().region(Region.US_EAST_1).build();
    EndpointResponse response = createEndpoint(pinpoint, appId);
    System.out.println("Got Endpoint: " + response.id());
    pinpoint.close();
}
Also used : UpdateEndpointResponse(software.amazon.awssdk.services.pinpoint.model.UpdateEndpointResponse) EndpointResponse(software.amazon.awssdk.services.pinpoint.model.EndpointResponse) GetEndpointResponse(software.amazon.awssdk.services.pinpoint.model.GetEndpointResponse) PinpointClient(software.amazon.awssdk.services.pinpoint.PinpointClient)

Example 2 with EndpointResponse

use of software.amazon.awssdk.services.pinpoint.model.EndpointResponse 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)

Example 3 with EndpointResponse

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

the class LookUpEndpoint method lookupPinpointEndpoint.

// snippet-start:[pinpoint.java2.lookup.main]
public static void lookupPinpointEndpoint(PinpointClient pinpoint, String appId, String endpoint) {
    try {
        GetEndpointRequest appRequest = GetEndpointRequest.builder().applicationId(appId).endpointId(endpoint).build();
        GetEndpointResponse result = pinpoint.getEndpoint(appRequest);
        EndpointResponse endResponse = result.endpointResponse();
        // Uses the Google Gson library to pretty print the endpoint JSON.
        Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).setPrettyPrinting().create();
        String endpointJson = gson.toJson(endResponse);
        System.out.println(endpointJson);
    } catch (PinpointException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
    System.out.println("Done");
}
Also used : GetEndpointResponse(software.amazon.awssdk.services.pinpoint.model.GetEndpointResponse) EndpointResponse(software.amazon.awssdk.services.pinpoint.model.EndpointResponse) GetEndpointResponse(software.amazon.awssdk.services.pinpoint.model.GetEndpointResponse) GsonBuilder(com.google.gson.GsonBuilder) PinpointException(software.amazon.awssdk.services.pinpoint.model.PinpointException) Gson(com.google.gson.Gson) GetEndpointRequest(software.amazon.awssdk.services.pinpoint.model.GetEndpointRequest)

Aggregations

EndpointResponse (software.amazon.awssdk.services.pinpoint.model.EndpointResponse)3 GetEndpointResponse (software.amazon.awssdk.services.pinpoint.model.GetEndpointResponse)2 PinpointException (software.amazon.awssdk.services.pinpoint.model.PinpointException)2 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 PinpointClient (software.amazon.awssdk.services.pinpoint.PinpointClient)1 GetEndpointRequest (software.amazon.awssdk.services.pinpoint.model.GetEndpointRequest)1 GetUserEndpointsRequest (software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsRequest)1 GetUserEndpointsResponse (software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsResponse)1 UpdateEndpointResponse (software.amazon.awssdk.services.pinpoint.model.UpdateEndpointResponse)1