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 035 public UpdateNumberRequest(String msisdn, String country) { 036 this.country = country; 037 this.msisdn = msisdn; 038 } 039 040 public String getCountry() { 041 return country; 042 } 043 044 public String getMsisdn() { 045 return msisdn; 046 } 047 048 public String getMoHttpUrl() { 049 return moHttpUrl; 050 } 051 052 public void setMoHttpUrl(String moHttpUrl) { 053 this.moHttpUrl = moHttpUrl; 054 } 055 056 public String getMoSmppSysType() { 057 return moSmppSysType; 058 } 059 060 public void setMoSmppSysType(String moSmppSysType) { 061 this.moSmppSysType = moSmppSysType; 062 } 063 064 public CallbackType getVoiceCallbackType() { 065 return voiceCallbackType; 066 } 067 068 public void setVoiceCallbackType(CallbackType voiceCallbackType) { 069 this.voiceCallbackType = voiceCallbackType; 070 } 071 072 public String getVoiceCallbackValue() { 073 return voiceCallbackValue; 074 } 075 076 public void setVoiceCallbackValue(String voiceCallbackValue) { 077 this.voiceCallbackValue = voiceCallbackValue; 078 } 079 080 public String getVoiceStatusCallback() { 081 return voiceStatusCallback; 082 } 083 084 public void setVoiceStatusCallback(String voiceStatusCallback) { 085 this.voiceStatusCallback = voiceStatusCallback; 086 } 087 088 public void addParams(RequestBuilder request) { 089 request.addParameter("country", this.country).addParameter("msisdn", msisdn); 090 if (this.moHttpUrl != null) { 091 request.addParameter("moHttpUrl", moHttpUrl); 092 } 093 if (this.moSmppSysType != null) { 094 request.addParameter("moSmppSysType", moSmppSysType); 095 } 096 if (this.voiceCallbackType != null) { 097 request.addParameter("voiceCallbackType", voiceCallbackType.paramValue()); 098 } 099 if (this.voiceCallbackValue != null) { 100 request.addParameter("voiceCallbackValue", voiceCallbackValue); 101 } 102 if (this.voiceStatusCallback != null) { 103 request.addParameter("voiceStatusCallback", voiceStatusCallback); 104 } 105 106 } 107 108 public enum CallbackType { 109 SIP, TEL, VXML, APP; 110 111 public String paramValue() { 112 return this.name().toString().toLowerCase(); 113 } 114 } 115}