當前位置: 首頁>>代碼示例>>Java>>正文


Java SMSReportResponse類代碼示例

本文整理匯總了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);
}
 
開發者ID:openMF,項目名稱:message-gateway,代碼行數:14,代碼來源:InfoBipApiResource.java

示例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("------------------------------------------------");
        }
    }
 
開發者ID:infobip,項目名稱:infobip-api-java-client,代碼行數:16,代碼來源:PullSentDeliveryReportsExample.java

示例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);
}
 
開發者ID:infobip,項目名稱:infobip-api-java-client,代碼行數:13,代碼來源:GetSentSmsDeliveryReports.java

示例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("------------------------------------------------");
        }
    }
 
開發者ID:infobip,項目名稱:infobip-api-java-client,代碼行數:51,代碼來源:DeserializeDeliveryReportExample.java


注:本文中的infobip.api.model.sms.mt.reports.SMSReportResponse類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。