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.numbers; 017 018import org.apache.http.client.methods.RequestBuilder; 019 020public class UpdateNumberRequest { 021 private final String country; 022 private final String msisdn; 023 private String moHttpUrl; 024 private String moSmppSysType; 025 private CallbackType voiceCallbackType; 026 private String voiceCallbackValue; 027 private String voiceStatusCallback; 028 private String messagesCallbackValue; 029 030 public UpdateNumberRequest(String msisdn, String country) { 031 this.country = country; 032 this.msisdn = msisdn; 033 } 034 035 public String getCountry() { 036 return country; 037 } 038 039 public String getMsisdn() { 040 return msisdn; 041 } 042 043 public String getMoHttpUrl() { 044 return moHttpUrl; 045 } 046 047 public void setMoHttpUrl(String moHttpUrl) { 048 this.moHttpUrl = moHttpUrl; 049 } 050 051 public String getMoSmppSysType() { 052 return moSmppSysType; 053 } 054 055 public void setMoSmppSysType(String moSmppSysType) { 056 this.moSmppSysType = moSmppSysType; 057 } 058 059 public CallbackType getVoiceCallbackType() { 060 return voiceCallbackType; 061 } 062 063 public void setVoiceCallbackType(CallbackType voiceCallbackType) { 064 this.voiceCallbackType = voiceCallbackType; 065 } 066 067 public String getVoiceCallbackValue() { 068 return voiceCallbackValue; 069 } 070 071 public void setVoiceCallbackValue(String voiceCallbackValue) { 072 this.voiceCallbackValue = voiceCallbackValue; 073 } 074 075 public String getVoiceStatusCallback() { 076 return voiceStatusCallback; 077 } 078 079 public void setVoiceStatusCallback(String voiceStatusCallback) { 080 this.voiceStatusCallback = voiceStatusCallback; 081 } 082 083 public String getMessagesCallbackValue() { 084 return messagesCallbackValue; 085 } 086 087 public void setMessagesCallbackValue(String messagesCallbackValue) { 088 this.messagesCallbackValue = messagesCallbackValue; 089 } 090 091 public void addParams(RequestBuilder request) { 092 request.addParameter("country", this.country).addParameter("msisdn", msisdn); 093 if (this.moHttpUrl != null) { 094 request.addParameter("moHttpUrl", moHttpUrl); 095 } 096 if (this.moSmppSysType != null) { 097 request.addParameter("moSmppSysType", moSmppSysType); 098 } 099 if (this.voiceCallbackType != null) { 100 request.addParameter("voiceCallbackType", voiceCallbackType.paramValue()); 101 } 102 if (this.voiceCallbackValue != null) { 103 request.addParameter("voiceCallbackValue", voiceCallbackValue); 104 } 105 if (this.voiceStatusCallback != null) { 106 request.addParameter("voiceStatusCallback", voiceStatusCallback); 107 } 108 if (this.messagesCallbackValue != null) { 109 request.addParameter("messagesCallbackValue", messagesCallbackValue); 110 request.addParameter("messagesCallbackType", CallbackType.APP.paramValue()); 111 } 112 } 113 114 public enum CallbackType { 115 SIP, TEL, VXML, APP; 116 117 public String paramValue() { 118 return this.name().toLowerCase(); 119 } 120 } 121}