本文整理汇总了Java中infobip.api.model.sms.mt.reports.SMSReportResponse类的典型用法代码示例。如果您正苦于以下问题:Java SMSReportResponse类的具体用法?Java SMSReportResponse怎么用?Java SMSReportResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SMSReportResponse类属于infobip.api.model.sms.mt.reports包,在下文中一共展示了SMSReportResponse类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDeliveryStatus
import infobip.api.model.sms.mt.reports.SMSReportResponse; //导入依赖的package包/类
@RequestMapping(value = "/report/{messageId}", method = RequestMethod.POST, consumes = {"application/json"}, produces = {"application/json"})
public ResponseEntity<Void> updateDeliveryStatus(@PathVariable("messageId") final Long messageId, @RequestBody final SMSReportResponse payload) {
SMSMessage message = this.smsOutboundMessageRepository.findOne(messageId) ;
if(message != null) {
SMSReport report = payload.getResults().get(0) ;
logger.debug("Status Callback received from InfoBip for "+messageId+" with status:"+report.getStatus());
message.setDeliveryStatus(InfoBipStatus.smsStatus(report.getStatus().getGroupId()).getValue());
this.smsOutboundMessageRepository.save(message) ;
}else {
logger.info("Message with Message id "+messageId+" Not found");
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
示例2: main
import infobip.api.model.sms.mt.reports.SMSReportResponse; //导入依赖的package包/类
public static void main(String[] args) {
GetSentSmsDeliveryReports client = new GetSentSmsDeliveryReports(new BasicAuthConfiguration(USERNAME, PASSWORD));
SMSReportResponse response = client.execute(null, null, 10);
for (SMSReport result : response.getResults()) {
System.out.println("Message ID: " + result.getMessageId());
System.out.println("Sent at: " + result.getSentAt());
System.out.println("Receiver: " + result.getTo());
System.out.println("Status: " + result.getStatus().getName());
System.out.println("Price: " + result.getPrice().getPricePerMessage() + " " + result.getPrice().getCurrency());
System.out.println("------------------------------------------------");
}
}
示例3: execute
import infobip.api.model.sms.mt.reports.SMSReportResponse; //导入依赖的package包/类
public SMSReportResponse execute(String bulkId, String messageId, Integer limit) {
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(configuration.getBaseUrl())
.setRequestInterceptor(getRequestInterceptor())
.setConverter(new GsonConverter(new GsonBuilder()
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
.create()))
.setClient(new TimeoutClientProvider(configuration))
.build();
GetSentSmsDeliveryReportsService service = restAdapter.create(GetSentSmsDeliveryReportsService.class);
return service.execute(bulkId, messageId, limit);
}
示例4: main
import infobip.api.model.sms.mt.reports.SMSReportResponse; //导入依赖的package包/类
public static void main(String[] args) {
String responseBody =
"{\n" +
" \"results\": [\n" +
" {\n" +
" \"bulkId\": \"BULK-ID-123-xyz\",\n" +
" \"messageId\": \"c9823180-94d4-4ea0-9bf3-ec907e7534a6\",\n" +
" \"to\": \"41793026731\",\n" +
" \"sentAt\": \"2015-06-04T13:01:52.933\",\n" +
" \"doneAt\": \"2015-06-04T13:02:00.134+0000\",\n" +
" \"smsCount\": 1,\n" +
" \"price\": {\n" +
" \"pricePerMessage\": 0.0001000000,\n" +
" \"currency\": \"EUR\"\n" +
" },\n" +
" \"status\": {\n" +
" \"groupId\": 3,\n" +
" \"groupName\": \"DELIVERED\",\n" +
" \"id\": 5,\n" +
" \"name\": \"DELIVERED_TO_HANDSET\",\n" +
" \"description\": \"Message delivered to handset\"\n" +
" },\n" +
" \"error\": {\n" +
" \"groupId\": 0,\n" +
" \"groupName\": \"OK\",\n" +
" \"id\": 0,\n" +
" \"name\": \"NO_ERROR\",\n" +
" \"description\": \"No Error\",\n" +
" \"permanent\": false\n" +
" }\n" +
" }\n" +
" ]\n" +
"}";
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
SMSReportResponse smsReportResponse = gson.fromJson(responseBody, SMSReportResponse.class);
for (SMSReport result : smsReportResponse.getResults()) {
System.out.println("Message ID: " + result.getMessageId());
System.out.println("Sent at: " + result.getSentAt());
System.out.println("Done at: " + result.getDoneAt());
System.out.println("Sender: " + result.getFrom());
System.out.println("Receiver: " + result.getTo());
System.out.println("Message text: " + result.getText());
System.out.println("Status: " + result.getStatus().getName());
System.out.println("Price: " + result.getPrice().getPricePerMessage() + " " + result.getPrice().getCurrency());
System.out.println("------------------------------------------------");
}
}