use of software.amazon.awssdk.services.pinpoint.model.SegmentResponse in project aws-doc-sdk-examples by awsdocs.
the class ListSegments method listSegs.
// snippet-start:[pinpoint.java2.listsegments.main]
public static void listSegs(PinpointClient pinpoint, String appId) {
try {
GetSegmentsRequest request = GetSegmentsRequest.builder().applicationId(appId).build();
GetSegmentsResponse response = pinpoint.getSegments(request);
List<SegmentResponse> segments = response.segmentsResponse().item();
for (SegmentResponse segment : segments) {
System.out.println("Segement " + segment.id() + " " + segment.name() + " " + segment.lastModifiedDate());
}
} catch (PinpointException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
use of software.amazon.awssdk.services.pinpoint.model.SegmentResponse in project aws-doc-sdk-examples by awsdocs.
the class CreateSegment method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage: " + "CreateSegment <appId>\n\n" + "Where:\n" + " appId - the application ID to create a segment 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();
SegmentResponse result = createSegment(pinpoint, appId);
System.out.println("Segment " + result.name() + " created.");
System.out.println(result.segmentType());
pinpoint.close();
}
Aggregations