001/* 002 * Copyright 2020 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.account; 017 018import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 019import com.fasterxml.jackson.annotation.JsonInclude; 020import com.fasterxml.jackson.annotation.JsonProperty; 021import com.fasterxml.jackson.databind.ObjectMapper; 022import com.vonage.client.VonageUnexpectedException; 023 024import java.io.IOException; 025 026@JsonInclude(JsonInclude.Include.NON_NULL) 027@JsonIgnoreProperties(ignoreUnknown = true) 028public class SettingsResponse { 029 @JsonProperty("mo-callback-url") 030 private String incomingSmsUrl; 031 @JsonProperty("dr-callback-url") 032 private String deliveryReceiptUrl; 033 @JsonProperty("max-outbound-request") 034 private Integer maxOutboundMessagesPerSecond; 035 @JsonProperty("max-inbound-request") 036 private Integer maxInboundMessagesPerSecond; 037 @JsonProperty("max-calls-per-second") 038 private Integer maxApiCallsPerSecond; 039 040 /** 041 * @return The URL where Vonage will send a webhook when an incoming SMS is received when a number-specific URL is 042 * not configured. 043 */ 044 public String getIncomingSmsUrl() { 045 return incomingSmsUrl; 046 } 047 048 /** 049 * @return The URL where Vonage will send a webhook when a delivery receipt is received when a number-specific URL is 050 * not configured. 051 */ 052 public String getDeliveryReceiptUrl() { 053 return deliveryReceiptUrl; 054 } 055 056 /** 057 * @return The maximum number of outbound messages per second. 058 */ 059 public Integer getMaxOutboundMessagesPerSecond() { 060 return maxOutboundMessagesPerSecond; 061 } 062 063 /** 064 * @return The maximum number of inbound messages per second. 065 */ 066 public Integer getMaxInboundMessagesPerSecond() { 067 return maxInboundMessagesPerSecond; 068 } 069 070 /** 071 * @return The maximum number of API calls per second. 072 */ 073 public Integer getMaxApiCallsPerSecond() { 074 return maxApiCallsPerSecond; 075 } 076 077 public static SettingsResponse fromJson(String json) { 078 try { 079 ObjectMapper mapper = new ObjectMapper(); 080 return mapper.readValue(json, SettingsResponse.class); 081 } catch (IOException e) { 082 throw new VonageUnexpectedException("Failed to produce SettingsResponse from json.", e); 083 } 084 } 085}