001package com.plivo.api.models.application; 002 003import com.plivo.api.models.base.Creator; 004import com.plivo.api.util.Utils; 005import retrofit2.Call; 006 007public class ApplicationCreator extends Creator<ApplicationCreateResponse> { 008 009 private String appName; 010 private String answerUrl; 011 private String answerMethod; 012 private String hangupUrl; 013 private String hangupMethod; 014 private String fallbackAnswerUrl; 015 private String fallbackMethod; 016 private String messageUrl; 017 private String messageMethod; 018 private Boolean defaultNumberApp; 019 private Boolean defaultEndpointApp; 020 private String subaccount; 021 private Boolean logIncomingMessages; 022 023 /** 024 * @param appName The name of your application 025 */ 026 ApplicationCreator(String appName) { 027 if (!Utils.allNotNull(appName)) { 028 throw new IllegalArgumentException("appName and answerUrl must not be null"); 029 } 030 031 this.appName = appName; 032 } 033 034 public String appName() { 035 return this.appName; 036 } 037 038 public String answerUrl() { 039 return this.answerUrl; 040 } 041 042 public String answerMethod() { 043 return this.answerMethod; 044 } 045 046 public String hangupUrl() { 047 return this.hangupUrl; 048 } 049 050 public String hangupMethod() { 051 return this.hangupMethod; 052 } 053 054 public String fallbackAnswerUrl() { 055 return this.fallbackAnswerUrl; 056 } 057 058 public String fallbackMethod() { 059 return this.fallbackMethod; 060 } 061 062 public String messageUrl() { 063 return this.messageUrl; 064 } 065 066 public String messageMethod() { 067 return this.messageMethod; 068 } 069 070 public Boolean defaultNumberApp() { 071 return this.defaultNumberApp; 072 } 073 074 public Boolean defaultEndpointApp() { 075 return this.defaultEndpointApp; 076 } 077 078 public String subaccount() { 079 return this.subaccount; 080 } 081 082 public Boolean logIncomingMessages() { 083 return this.logIncomingMessages; 084 } 085 086 public ApplicationCreator appName(final String appName) { 087 this.appName = appName; 088 return this; 089 } 090 091 public ApplicationCreator answerUrl(final String answerUrl) { 092 this.answerUrl = answerUrl; 093 return this; 094 } 095 096 public ApplicationCreator answerMethod(final String answerMethod) { 097 this.answerMethod = answerMethod; 098 return this; 099 } 100 101 public ApplicationCreator hangupUrl(final String hangupUrl) { 102 this.hangupUrl = hangupUrl; 103 return this; 104 } 105 106 public ApplicationCreator hangupMethod(final String hangupMethod) { 107 this.hangupMethod = hangupMethod; 108 return this; 109 } 110 111 public ApplicationCreator fallbackAnswerUrl(final String fallbackAnswerUrl) { 112 this.fallbackAnswerUrl = fallbackAnswerUrl; 113 return this; 114 } 115 116 public ApplicationCreator fallbackMethod(final String fallbackMethod) { 117 this.fallbackMethod = fallbackMethod; 118 return this; 119 } 120 121 public ApplicationCreator messageUrl(final String messageUrl) { 122 this.messageUrl = messageUrl; 123 return this; 124 } 125 126 public ApplicationCreator messageMethod(final String messageMethod) { 127 this.messageMethod = messageMethod; 128 return this; 129 } 130 131 public ApplicationCreator defaultNumberApp(final Boolean defaultNumberApp) { 132 this.defaultNumberApp = defaultNumberApp; 133 return this; 134 } 135 136 public ApplicationCreator defaultEndpointApp(final Boolean defaultEndpointApp) { 137 this.defaultEndpointApp = defaultEndpointApp; 138 return this; 139 } 140 141 public ApplicationCreator subaccount(final String subaccount) { 142 this.subaccount = subaccount; 143 return this; 144 } 145 146 public ApplicationCreator logIncomingMessages(final Boolean logIncomingMessages) { 147 this.logIncomingMessages = logIncomingMessages; 148 return this; 149 } 150 151 @Override 152 protected Call<ApplicationCreateResponse> obtainCall() { 153 return client().getApiService().applicationCreate(client().getAuthId(), this); 154 } 155}