本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
GetUserEndpoints
搭配使用 AWS SDK
以下代码示例显示了如何使用GetUserEndpoints
。
- Java
-
- SDK适用于 Java 2.x
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.pinpoint.PinpointClient; import software.amazon.awssdk.services.pinpoint.model.EndpointResponse; import software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsRequest; import software.amazon.awssdk.services.pinpoint.model.GetUserEndpointsResponse; import software.amazon.awssdk.services.pinpoint.model.PinpointException; import java.util.List; /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class ListEndpointIds { public static void main(String[] args) { final String usage = """ Usage: <applicationId> <userId> Where: applicationId - The ID of the Amazon Pinpoint application that has the endpoint. userId - The user id applicable to the endpoints"""; if (args.length != 2) { System.out.println(usage); System.exit(1); } String applicationId = args[0]; String userId = args[1]; PinpointClient pinpoint = PinpointClient.builder() .region(Region.US_EAST_1) .build(); listAllEndpoints(pinpoint, applicationId, userId); pinpoint.close(); } 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); } } }
-
有关API详细信息,请参阅 “AWS SDK for Java 2.x API参考 GetUserEndpoints” 中的。
-
有关 AWS SDK开发者指南和代码示例的完整列表,请参阅将 Amazon Pinpoint 与 AWS SDK。本主题还包括有关入门的信息以及有关先前SDK版本的详细信息。
GetSmsChannel
SendMessages