Skip to content

Commit 28476af

Browse files
committed
[Librarian] Regenerated @ d9d9306ce476f68a10ab20bf103e0e31e523a4b3
1 parent ab31155 commit 28476af

20 files changed

+2541
-3
lines changed

CHANGES.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
twilio-java changelog
22
=====================
33

4+
[2023-06-28] Version 9.8.0
5+
--------------------------
6+
**Library - Chore**
7+
- [PR #754](https://github.com/twilio/twilio-java/pull/754): Add content type enum to request. Thanks to [@sbansla](https://github.com/sbansla)!
8+
- [PR #753](https://github.com/twilio/twilio-java/pull/753): added content type enum. Thanks to [@sbansla](https://github.com/sbansla)!
9+
10+
**Lookups**
11+
- Add `reassigned_number` package to the lookup response
12+
13+
**Numbers**
14+
- Add hosted_number_order under version `/v2`.
15+
- Update properties in Porting and Bulk Porting APIs. **(breaking change)**
16+
- Added bulk Portability API under version `/v1`.
17+
- Added Portability API under version `/v1`.
18+
19+
420
[2023-06-15] Version 9.7.0
521
--------------------------
622
**Api**

src/main/java/com/twilio/rest/lookups/v2/PhoneNumber.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
@JsonIgnoreProperties(ignoreUnknown = true)
4343
@ToString
4444
public class PhoneNumber extends Resource {
45-
private static final long serialVersionUID = 224955107223793L;
45+
private static final long serialVersionUID = 170815477017777L;
4646

4747
public static PhoneNumberFetcher fetcher(final String pathPhoneNumber){
4848
return new PhoneNumberFetcher(pathPhoneNumber);
@@ -120,6 +120,7 @@ public static ValidationError forValue(final String value) {
120120
private final Map<String, Object> liveActivity;
121121
private final Map<String, Object> lineTypeIntelligence;
122122
private final Map<String, Object> identityMatch;
123+
private final Map<String, Object> reassignedNumber;
123124
private final Map<String, Object> smsPumpingRisk;
124125
private final URI url;
125126

@@ -161,6 +162,9 @@ private PhoneNumber(
161162
@JsonProperty("identity_match")
162163
final Map<String, Object> identityMatch,
163164

165+
@JsonProperty("reassigned_number")
166+
final Map<String, Object> reassignedNumber,
167+
164168
@JsonProperty("sms_pumping_risk")
165169
final Map<String, Object> smsPumpingRisk,
166170

@@ -179,6 +183,7 @@ private PhoneNumber(
179183
this.liveActivity = liveActivity;
180184
this.lineTypeIntelligence = lineTypeIntelligence;
181185
this.identityMatch = identityMatch;
186+
this.reassignedNumber = reassignedNumber;
182187
this.smsPumpingRisk = smsPumpingRisk;
183188
this.url = url;
184189
}
@@ -219,6 +224,9 @@ public final Map<String, Object> getLineTypeIntelligence() {
219224
public final Map<String, Object> getIdentityMatch() {
220225
return this.identityMatch;
221226
}
227+
public final Map<String, Object> getReassignedNumber() {
228+
return this.reassignedNumber;
229+
}
222230
public final Map<String, Object> getSmsPumpingRisk() {
223231
return this.smsPumpingRisk;
224232
}
@@ -238,12 +246,12 @@ public boolean equals(final Object o) {
238246

239247
PhoneNumber other = (PhoneNumber) o;
240248

241-
return Objects.equals(callingCountryCode, other.callingCountryCode) && Objects.equals(countryCode, other.countryCode) && Objects.equals(phoneNumber, other.phoneNumber) && Objects.equals(nationalFormat, other.nationalFormat) && Objects.equals(valid, other.valid) && Objects.equals(validationErrors, other.validationErrors) && Objects.equals(callerName, other.callerName) && Objects.equals(simSwap, other.simSwap) && Objects.equals(callForwarding, other.callForwarding) && Objects.equals(liveActivity, other.liveActivity) && Objects.equals(lineTypeIntelligence, other.lineTypeIntelligence) && Objects.equals(identityMatch, other.identityMatch) && Objects.equals(smsPumpingRisk, other.smsPumpingRisk) && Objects.equals(url, other.url) ;
249+
return Objects.equals(callingCountryCode, other.callingCountryCode) && Objects.equals(countryCode, other.countryCode) && Objects.equals(phoneNumber, other.phoneNumber) && Objects.equals(nationalFormat, other.nationalFormat) && Objects.equals(valid, other.valid) && Objects.equals(validationErrors, other.validationErrors) && Objects.equals(callerName, other.callerName) && Objects.equals(simSwap, other.simSwap) && Objects.equals(callForwarding, other.callForwarding) && Objects.equals(liveActivity, other.liveActivity) && Objects.equals(lineTypeIntelligence, other.lineTypeIntelligence) && Objects.equals(identityMatch, other.identityMatch) && Objects.equals(reassignedNumber, other.reassignedNumber) && Objects.equals(smsPumpingRisk, other.smsPumpingRisk) && Objects.equals(url, other.url) ;
242250
}
243251

244252
@Override
245253
public int hashCode() {
246-
return Objects.hash(callingCountryCode, countryCode, phoneNumber, nationalFormat, valid, validationErrors, callerName, simSwap, callForwarding, liveActivity, lineTypeIntelligence, identityMatch, smsPumpingRisk, url);
254+
return Objects.hash(callingCountryCode, countryCode, phoneNumber, nationalFormat, valid, validationErrors, callerName, simSwap, callForwarding, liveActivity, lineTypeIntelligence, identityMatch, reassignedNumber, smsPumpingRisk, url);
247255
}
248256

249257
}

src/main/java/com/twilio/rest/lookups/v2/PhoneNumberFetcher.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class PhoneNumberFetcher extends Fetcher<PhoneNumber> {
4141
private String addressCountryCode;
4242
private String nationalId;
4343
private String dateOfBirth;
44+
private String lastVerifiedDate;
4445

4546
public PhoneNumberFetcher(final String pathPhoneNumber){
4647
this.pathPhoneNumber = pathPhoneNumber;
@@ -94,6 +95,10 @@ public PhoneNumberFetcher setDateOfBirth(final String dateOfBirth){
9495
this.dateOfBirth = dateOfBirth;
9596
return this;
9697
}
98+
public PhoneNumberFetcher setLastVerifiedDate(final String lastVerifiedDate){
99+
this.lastVerifiedDate = lastVerifiedDate;
100+
return this;
101+
}
97102

98103
@Override
99104
public PhoneNumber fetch(final TwilioRestClient client) {
@@ -170,5 +175,9 @@ private void addQueryParams(final Request request) {
170175

171176
request.addQueryParam("DateOfBirth", dateOfBirth);
172177
}
178+
if (lastVerifiedDate != null) {
179+
180+
request.addQueryParam("LastVerifiedDate", lastVerifiedDate);
181+
}
173182
}
174183
}
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
/*
2+
* This code was generated by
3+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
*
7+
* Twilio - Numbers
8+
* This is the public Twilio REST API.
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator.
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
package com.twilio.rest.numbers.v1;
16+
17+
import com.fasterxml.jackson.annotation.JsonCreator;
18+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
19+
import com.fasterxml.jackson.annotation.JsonProperty;
20+
import com.fasterxml.jackson.core.JsonParseException;
21+
import com.fasterxml.jackson.databind.JsonMappingException;
22+
import com.fasterxml.jackson.databind.ObjectMapper;
23+
import com.twilio.base.Resource;
24+
import com.twilio.converter.DateConverter;
25+
import com.twilio.converter.Promoter;
26+
import com.twilio.exception.ApiConnectionException;
27+
28+
import com.twilio.exception.ApiException;
29+
30+
import lombok.ToString;
31+
32+
import java.io.IOException;
33+
import java.io.InputStream;
34+
import java.net.URI;
35+
import java.time.ZonedDateTime;
36+
37+
import java.util.List;
38+
import java.util.Map;
39+
import java.util.Objects;
40+
41+
42+
import java.util.Map;
43+
44+
@JsonIgnoreProperties(ignoreUnknown = true)
45+
@ToString
46+
public class PortingBulkPortability extends Resource {
47+
private static final long serialVersionUID = 54521824330020L;
48+
49+
public static PortingBulkPortabilityCreator creator(final List<String> phoneNumbers){
50+
return new PortingBulkPortabilityCreator(phoneNumbers);
51+
}
52+
53+
public static PortingBulkPortabilityFetcher fetcher(final String pathSid){
54+
return new PortingBulkPortabilityFetcher(pathSid);
55+
}
56+
57+
/**
58+
* Converts a JSON String into a PortingBulkPortability object using the provided ObjectMapper.
59+
*
60+
* @param json Raw JSON String
61+
* @param objectMapper Jackson ObjectMapper
62+
* @return PortingBulkPortability object represented by the provided JSON
63+
*/
64+
public static PortingBulkPortability fromJson(final String json, final ObjectMapper objectMapper) {
65+
// Convert all checked exceptions to Runtime
66+
try {
67+
return objectMapper.readValue(json, PortingBulkPortability.class);
68+
} catch (final JsonMappingException | JsonParseException e) {
69+
throw new ApiException(e.getMessage(), e);
70+
} catch (final IOException e) {
71+
throw new ApiConnectionException(e.getMessage(), e);
72+
}
73+
}
74+
75+
/**
76+
* Converts a JSON InputStream into a PortingBulkPortability object using the provided
77+
* ObjectMapper.
78+
*
79+
* @param json Raw JSON InputStream
80+
* @param objectMapper Jackson ObjectMapper
81+
* @return PortingBulkPortability object represented by the provided JSON
82+
*/
83+
public static PortingBulkPortability fromJson(final InputStream json, final ObjectMapper objectMapper) {
84+
// Convert all checked exceptions to Runtime
85+
try {
86+
return objectMapper.readValue(json, PortingBulkPortability.class);
87+
} catch (final JsonMappingException | JsonParseException e) {
88+
throw new ApiException(e.getMessage(), e);
89+
} catch (final IOException e) {
90+
throw new ApiConnectionException(e.getMessage(), e);
91+
}
92+
}
93+
public enum Status {
94+
IN_PROGRESS("in-progress"),
95+
COMPLETED("completed"),
96+
EXPIRED("expired");
97+
98+
private final String value;
99+
100+
private Status(final String value) {
101+
this.value = value;
102+
}
103+
104+
public String toString() {
105+
return value;
106+
}
107+
108+
@JsonCreator
109+
public static Status forValue(final String value) {
110+
return Promoter.enumFromString(value, Status.values());
111+
}
112+
}
113+
114+
private final String sid;
115+
private final PortingBulkPortability.Status status;
116+
private final ZonedDateTime datetimeCreated;
117+
private final List<Map<String, Object>> phoneNumbers;
118+
private final URI url;
119+
120+
@JsonCreator
121+
private PortingBulkPortability(
122+
@JsonProperty("sid")
123+
final String sid,
124+
125+
@JsonProperty("status")
126+
final PortingBulkPortability.Status status,
127+
128+
@JsonProperty("datetime_created")
129+
final String datetimeCreated,
130+
131+
@JsonProperty("phone_numbers")
132+
final List<Map<String, Object>> phoneNumbers,
133+
134+
@JsonProperty("url")
135+
final URI url
136+
) {
137+
this.sid = sid;
138+
this.status = status;
139+
this.datetimeCreated = DateConverter.iso8601DateTimeFromString(datetimeCreated);
140+
this.phoneNumbers = phoneNumbers;
141+
this.url = url;
142+
}
143+
144+
public final String getSid() {
145+
return this.sid;
146+
}
147+
public final PortingBulkPortability.Status getStatus() {
148+
return this.status;
149+
}
150+
public final ZonedDateTime getDatetimeCreated() {
151+
return this.datetimeCreated;
152+
}
153+
public final List<Map<String, Object>> getPhoneNumbers() {
154+
return this.phoneNumbers;
155+
}
156+
public final URI getUrl() {
157+
return this.url;
158+
}
159+
160+
@Override
161+
public boolean equals(final Object o) {
162+
if (this==o) {
163+
return true;
164+
}
165+
166+
if (o == null || getClass() != o.getClass()) {
167+
return false;
168+
}
169+
170+
PortingBulkPortability other = (PortingBulkPortability) o;
171+
172+
return Objects.equals(sid, other.sid) && Objects.equals(status, other.status) && Objects.equals(datetimeCreated, other.datetimeCreated) && Objects.equals(phoneNumbers, other.phoneNumbers) && Objects.equals(url, other.url) ;
173+
}
174+
175+
@Override
176+
public int hashCode() {
177+
return Objects.hash(sid, status, datetimeCreated, phoneNumbers, url);
178+
}
179+
180+
}
181+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* This code was generated by
3+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
*
7+
* Twilio - Numbers
8+
* This is the public Twilio REST API.
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator.
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
package com.twilio.rest.numbers.v1;
16+
17+
import com.twilio.base.Creator;
18+
import com.twilio.converter.Promoter;
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 java.util.List;
28+
29+
import java.util.List;
30+
31+
32+
33+
public class PortingBulkPortabilityCreator extends Creator<PortingBulkPortability>{
34+
private List<String> phoneNumbers;
35+
36+
public PortingBulkPortabilityCreator(final List<String> phoneNumbers) {
37+
this.phoneNumbers = phoneNumbers;
38+
}
39+
40+
public PortingBulkPortabilityCreator setPhoneNumbers(final List<String> phoneNumbers){
41+
this.phoneNumbers = phoneNumbers;
42+
return this;
43+
}
44+
public PortingBulkPortabilityCreator setPhoneNumbers(final String phoneNumbers){
45+
return setPhoneNumbers(Promoter.listOfOne(phoneNumbers));
46+
}
47+
48+
@Override
49+
public PortingBulkPortability create(final TwilioRestClient client){
50+
String path = "/v1/Porting/Portability";
51+
52+
path = path.replace("{"+"PhoneNumbers"+"}", this.phoneNumbers.toString());
53+
54+
Request request = new Request(
55+
HttpMethod.POST,
56+
Domains.NUMBERS.toString(),
57+
path
58+
);
59+
addPostParams(request);
60+
Response response = client.request(request);
61+
if (response == null) {
62+
throw new ApiConnectionException("PortingBulkPortability creation failed: Unable to connect to server");
63+
} else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) {
64+
RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper());
65+
if (restException == null) {
66+
throw new ApiException("Server Error, no content");
67+
}
68+
throw new ApiException(restException);
69+
}
70+
71+
return PortingBulkPortability.fromJson(response.getStream(), client.getObjectMapper());
72+
}
73+
private void addPostParams(final Request request) {
74+
if (phoneNumbers != null) {
75+
for (String prop : phoneNumbers) {
76+
request.addPostParam("PhoneNumbers", prop);
77+
}
78+
79+
}
80+
}
81+
}

0 commit comments

Comments
 (0)