1+ /**
2+ * This code was generated by
3+ * \ / _ _ _| _ _
4+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
5+ * / /
6+ */
7+
8+ package com .twilio .rest .api .v2010 .account .sip .domain ;
9+
10+ import com .fasterxml .jackson .annotation .JsonCreator ;
11+ import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
12+ import com .fasterxml .jackson .annotation .JsonProperty ;
13+ import com .fasterxml .jackson .core .JsonParseException ;
14+ import com .fasterxml .jackson .databind .JsonMappingException ;
15+ import com .fasterxml .jackson .databind .ObjectMapper ;
16+ import com .google .common .base .MoreObjects ;
17+ import com .twilio .base .Resource ;
18+ import com .twilio .converter .DateConverter ;
19+ import com .twilio .exception .ApiConnectionException ;
20+ import com .twilio .exception .ApiException ;
21+ import com .twilio .exception .RestException ;
22+ import com .twilio .http .HttpMethod ;
23+ import com .twilio .http .Request ;
24+ import com .twilio .http .Response ;
25+ import com .twilio .http .TwilioRestClient ;
26+ import com .twilio .rest .Domains ;
27+ import org .joda .time .DateTime ;
28+
29+ import java .io .IOException ;
30+ import java .io .InputStream ;
31+ import java .util .Map ;
32+ import java .util .Objects ;
33+
34+ @ JsonIgnoreProperties (ignoreUnknown = true )
35+ public class RegistrationEndpoint extends Resource {
36+ private static final long serialVersionUID = 4913379366057L ;
37+
38+ /**
39+ * Create a RegistrationEndpointReader to execute read.
40+ *
41+ * @param accountSid The account_sid
42+ * @param domainSid The domain_sid
43+ * @param region The region
44+ * @param registrant The registrant
45+ * @return RegistrationEndpointReader capable of executing the read
46+ */
47+ public static RegistrationEndpointReader reader (final String accountSid ,
48+ final String domainSid ,
49+ final String region ,
50+ final String registrant ) {
51+ return new RegistrationEndpointReader (accountSid , domainSid , region , registrant );
52+ }
53+
54+ /**
55+ * Create a RegistrationEndpointReader to execute read.
56+ *
57+ * @param domainSid The domain_sid
58+ * @param region The region
59+ * @param registrant The registrant
60+ * @return RegistrationEndpointReader capable of executing the read
61+ */
62+ public static RegistrationEndpointReader reader (final String domainSid ,
63+ final String region ,
64+ final String registrant ) {
65+ return new RegistrationEndpointReader (domainSid , region , registrant );
66+ }
67+
68+ /**
69+ * Converts a JSON String into a RegistrationEndpoint object using the provided
70+ * ObjectMapper.
71+ *
72+ * @param json Raw JSON String
73+ * @param objectMapper Jackson ObjectMapper
74+ * @return RegistrationEndpoint object represented by the provided JSON
75+ */
76+ public static RegistrationEndpoint fromJson (final String json , final ObjectMapper objectMapper ) {
77+ // Convert all checked exceptions to Runtime
78+ try {
79+ return objectMapper .readValue (json , RegistrationEndpoint .class );
80+ } catch (final JsonMappingException | JsonParseException e ) {
81+ throw new ApiException (e .getMessage (), e );
82+ } catch (final IOException e ) {
83+ throw new ApiConnectionException (e .getMessage (), e );
84+ }
85+ }
86+
87+ /**
88+ * Converts a JSON InputStream into a RegistrationEndpoint object using the
89+ * provided ObjectMapper.
90+ *
91+ * @param json Raw JSON InputStream
92+ * @param objectMapper Jackson ObjectMapper
93+ * @return RegistrationEndpoint object represented by the provided JSON
94+ */
95+ public static RegistrationEndpoint fromJson (final InputStream json , final ObjectMapper objectMapper ) {
96+ // Convert all checked exceptions to Runtime
97+ try {
98+ return objectMapper .readValue (json , RegistrationEndpoint .class );
99+ } catch (final JsonMappingException | JsonParseException e ) {
100+ throw new ApiException (e .getMessage (), e );
101+ } catch (final IOException e ) {
102+ throw new ApiConnectionException (e .getMessage (), e );
103+ }
104+ }
105+
106+ private final String addressOfRecord ;
107+ private final DateTime dateCreated ;
108+ private final DateTime dateUpdated ;
109+ private final DateTime dateExpires ;
110+ private final String sipCallId ;
111+ private final String sipContact ;
112+ private final Integer sipCseq ;
113+ private final String sipPath ;
114+ private final String sipVia ;
115+ private final String userAgent ;
116+ private final String channelType ;
117+ private final String displayName ;
118+
119+ @ JsonCreator
120+ private RegistrationEndpoint (@ JsonProperty ("address_of_record" )
121+ final String addressOfRecord ,
122+ @ JsonProperty ("date_created" )
123+ final String dateCreated ,
124+ @ JsonProperty ("date_updated" )
125+ final String dateUpdated ,
126+ @ JsonProperty ("date_expires" )
127+ final String dateExpires ,
128+ @ JsonProperty ("sip_call_id" )
129+ final String sipCallId ,
130+ @ JsonProperty ("sip_contact" )
131+ final String sipContact ,
132+ @ JsonProperty ("sip_cseq" )
133+ final Integer sipCseq ,
134+ @ JsonProperty ("sip_path" )
135+ final String sipPath ,
136+ @ JsonProperty ("sip_via" )
137+ final String sipVia ,
138+ @ JsonProperty ("user_agent" )
139+ final String userAgent ,
140+ @ JsonProperty ("channel_type" )
141+ final String channelType ,
142+ @ JsonProperty ("display_name" )
143+ final String displayName ) {
144+ this .addressOfRecord = addressOfRecord ;
145+ this .dateCreated = DateConverter .rfc2822DateTimeFromString (dateCreated );
146+ this .dateUpdated = DateConverter .rfc2822DateTimeFromString (dateUpdated );
147+ this .dateExpires = DateConverter .rfc2822DateTimeFromString (dateExpires );
148+ this .sipCallId = sipCallId ;
149+ this .sipContact = sipContact ;
150+ this .sipCseq = sipCseq ;
151+ this .sipPath = sipPath ;
152+ this .sipVia = sipVia ;
153+ this .userAgent = userAgent ;
154+ this .channelType = channelType ;
155+ this .displayName = displayName ;
156+ }
157+
158+ /**
159+ * Returns The The address_of_record.
160+ *
161+ * @return The address_of_record
162+ */
163+ public final String getAddressOfRecord () {
164+ return this .addressOfRecord ;
165+ }
166+
167+ /**
168+ * Returns The The date_created.
169+ *
170+ * @return The date_created
171+ */
172+ public final DateTime getDateCreated () {
173+ return this .dateCreated ;
174+ }
175+
176+ /**
177+ * Returns The The date_updated.
178+ *
179+ * @return The date_updated
180+ */
181+ public final DateTime getDateUpdated () {
182+ return this .dateUpdated ;
183+ }
184+
185+ /**
186+ * Returns The The date_expires.
187+ *
188+ * @return The date_expires
189+ */
190+ public final DateTime getDateExpires () {
191+ return this .dateExpires ;
192+ }
193+
194+ /**
195+ * Returns The The sip_call_id.
196+ *
197+ * @return The sip_call_id
198+ */
199+ public final String getSipCallId () {
200+ return this .sipCallId ;
201+ }
202+
203+ /**
204+ * Returns The The sip_contact.
205+ *
206+ * @return The sip_contact
207+ */
208+ public final String getSipContact () {
209+ return this .sipContact ;
210+ }
211+
212+ /**
213+ * Returns The The sip_cseq.
214+ *
215+ * @return The sip_cseq
216+ */
217+ public final Integer getSipCseq () {
218+ return this .sipCseq ;
219+ }
220+
221+ /**
222+ * Returns The The sip_path.
223+ *
224+ * @return The sip_path
225+ */
226+ public final String getSipPath () {
227+ return this .sipPath ;
228+ }
229+
230+ /**
231+ * Returns The The sip_via.
232+ *
233+ * @return The sip_via
234+ */
235+ public final String getSipVia () {
236+ return this .sipVia ;
237+ }
238+
239+ /**
240+ * Returns The The user_agent.
241+ *
242+ * @return The user_agent
243+ */
244+ public final String getUserAgent () {
245+ return this .userAgent ;
246+ }
247+
248+ /**
249+ * Returns The The channel_type.
250+ *
251+ * @return The channel_type
252+ */
253+ public final String getChannelType () {
254+ return this .channelType ;
255+ }
256+
257+ /**
258+ * Returns The The display_name.
259+ *
260+ * @return The display_name
261+ */
262+ public final String getDisplayName () {
263+ return this .displayName ;
264+ }
265+
266+ @ Override
267+ public boolean equals (final Object o ) {
268+ if (this == o ) {
269+ return true ;
270+ }
271+
272+ if (o == null || getClass () != o .getClass ()) {
273+ return false ;
274+ }
275+
276+ RegistrationEndpoint other = (RegistrationEndpoint ) o ;
277+
278+ return Objects .equals (addressOfRecord , other .addressOfRecord ) &&
279+ Objects .equals (dateCreated , other .dateCreated ) &&
280+ Objects .equals (dateUpdated , other .dateUpdated ) &&
281+ Objects .equals (dateExpires , other .dateExpires ) &&
282+ Objects .equals (sipCallId , other .sipCallId ) &&
283+ Objects .equals (sipContact , other .sipContact ) &&
284+ Objects .equals (sipCseq , other .sipCseq ) &&
285+ Objects .equals (sipPath , other .sipPath ) &&
286+ Objects .equals (sipVia , other .sipVia ) &&
287+ Objects .equals (userAgent , other .userAgent ) &&
288+ Objects .equals (channelType , other .channelType ) &&
289+ Objects .equals (displayName , other .displayName );
290+ }
291+
292+ @ Override
293+ public int hashCode () {
294+ return Objects .hash (addressOfRecord ,
295+ dateCreated ,
296+ dateUpdated ,
297+ dateExpires ,
298+ sipCallId ,
299+ sipContact ,
300+ sipCseq ,
301+ sipPath ,
302+ sipVia ,
303+ userAgent ,
304+ channelType ,
305+ displayName );
306+ }
307+
308+ @ Override
309+ public String toString () {
310+ return MoreObjects .toStringHelper (this )
311+ .add ("addressOfRecord" , addressOfRecord )
312+ .add ("dateCreated" , dateCreated )
313+ .add ("dateUpdated" , dateUpdated )
314+ .add ("dateExpires" , dateExpires )
315+ .add ("sipCallId" , sipCallId )
316+ .add ("sipContact" , sipContact )
317+ .add ("sipCseq" , sipCseq )
318+ .add ("sipPath" , sipPath )
319+ .add ("sipVia" , sipVia )
320+ .add ("userAgent" , userAgent )
321+ .add ("channelType" , channelType )
322+ .add ("displayName" , displayName )
323+ .toString ();
324+ }
325+ }
0 commit comments