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();
}
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);
}
}
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");
}
Aggregations