001/* 002 * Copyright (c) 2011-2017 Nexmo Inc 003 * 004 * Permission is hereby granted, free of charge, to any person obtaining a copy 005 * of this software and associated documentation files (the "Software"), to deal 006 * in the Software without restriction, including without limitation the rights 007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 008 * copies of the Software, and to permit persons to whom the Software is 009 * furnished to do so, subject to the following conditions: 010 * 011 * The above copyright notice and this permission notice shall be included in 012 * all copies or substantial portions of the Software. 013 * 014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 020 * THE SOFTWARE. 021 */ 022package com.nexmo.client.numbers; 023 024import org.apache.http.client.methods.RequestBuilder; 025 026public class UpdateNumberRequest { 027 private final String country; 028 private final String msisdn; 029 private String moHttpUrl; 030 private String moSmppSysType; 031 private CallbackType voiceCallbackType; 032 private String voiceCallbackValue; 033 private String voiceStatusCallback; 034 private String messagesCallbackValue; 035 036 public UpdateNumberRequest(String msisdn, String country) { 037 this.country = country; 038 this.msisdn = msisdn; 039 } 040 041 public String getCountry() { 042 return country; 043 } 044 045 public String getMsisdn() { 046 return msisdn; 047 } 048 049 public String getMoHttpUrl() { 050 return moHttpUrl; 051 } 052 053 public void setMoHttpUrl(String moHttpUrl) { 054 this.moHttpUrl = moHttpUrl; 055 } 056 057 public String getMoSmppSysType() { 058 return moSmppSysType; 059 } 060 061 public void setMoSmppSysType(String moSmppSysType) { 062 this.moSmppSysType = moSmppSysType; 063 } 064 065 public CallbackType getVoiceCallbackType() { 066 return voiceCallbackType; 067 } 068 069 public void setVoiceCallbackType(CallbackType voiceCallbackType) { 070 this.voiceCallbackType = voiceCallbackType; 071 } 072 073 public String getVoiceCallbackValue() { 074 return voiceCallbackValue; 075 } 076 077 public void setVoiceCallbackValue(String voiceCallbackValue) { 078 this.voiceCallbackValue = voiceCallbackValue; 079 } 080 081 public String getVoiceStatusCallback() { 082 return voiceStatusCallback; 083 } 084 085 public void setVoiceStatusCallback(String voiceStatusCallback) { 086 this.voiceStatusCallback = voiceStatusCallback; 087 } 088 089 public String getMessagesCallbackValue() { 090 return messagesCallbackValue; 091 } 092 093 public void setMessagesCallbackValue(String messagesCallbackValue) { 094 this.messagesCallbackValue = messagesCallbackValue; 095 } 096 097 public void addParams(RequestBuilder request) { 098 request.addParameter("country", this.country).addParameter("msisdn", msisdn); 099 if (this.moHttpUrl != null) { 100 request.addParameter("moHttpUrl", moHttpUrl); 101 } 102 if (this.moSmppSysType != null) { 103 request.addParameter("moSmppSysType", moSmppSysType); 104 } 105 if (this.voiceCallbackType != null) { 106 request.addParameter("voiceCallbackType", voiceCallbackType.paramValue()); 107 } 108 if (this.voiceCallbackValue != null) { 109 request.addParameter("voiceCallbackValue", voiceCallbackValue); 110 } 111 if (this.voiceStatusCallback != null) { 112 request.addParameter("voiceStatusCallback", voiceStatusCallback); 113 } 114 if (this.messagesCallbackValue != null) { 115 request.addParameter("messagesCallbackValue", messagesCallbackValue); 116 request.addParameter("messagesCallbackType", CallbackType.APP.paramValue()); 117 } 118 } 119 120 public enum CallbackType { 121 SIP, TEL, VXML, APP; 122 123 public String paramValue() { 124 return this.name().toLowerCase(); 125 } 126 } 127}