Skip to content

Commit

Permalink
[Librarian] Regenerated @ 021bab52f93b55d7a5786bd27716bf3a0be2d7b9 aa…
Browse files Browse the repository at this point in the history
…81ca7c51512c448626fafb32aeb46838510334
  • Loading branch information
twilio-dx committed Oct 3, 2024
1 parent 8f1d9f3 commit 9523ee0
Show file tree
Hide file tree
Showing 36 changed files with 76 additions and 3,596 deletions.
19 changes: 19 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
twilio-java changelog
=====================

[2024-10-03] Version 10.6.0
---------------------------
**Library - Chore**
- [PR #818](https://github.com/twilio/twilio-java/pull/818): updated readme with Orgs example. Thanks to [@sbansla](https://github.com/sbansla)!

**Library - Feature**
- [PR #813](https://github.com/twilio/twilio-java/pull/813): Added OAuth Support for Public APIs with TokenManager Integration. Thanks to [@sbansla](https://github.com/sbansla)!

**Messaging**
- Add A2P external campaign CnpMigration flag

**Numbers**
- Add address sid to portability API

**Verify**
- Add `SnaClientToken` optional parameter on Verification check.
- Add `EnableSnaClientToken` optional parameter for Verification creation.


[2024-09-25] Version 10.5.2
---------------------------
**Library - Chore**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@

@JsonIgnoreProperties(ignoreUnknown = true)
@ToString
public class NewApiKey extends Resource {
public class Key extends Resource {

private static final long serialVersionUID = 217181042856619L;

public static NewApiKeyCreator creator(final String accountSid) {
return new NewApiKeyCreator(accountSid);
public static KeyCreator creator(final String accountSid) {
return new KeyCreator(accountSid);
}

/**
* Converts a JSON String into a NewApiKey object using the provided ObjectMapper.
* Converts a JSON String into a Key object using the provided ObjectMapper.
*
* @param json Raw JSON String
* @param objectMapper Jackson ObjectMapper
* @return NewApiKey object represented by the provided JSON
* @return Key object represented by the provided JSON
*/
public static NewApiKey fromJson(
public static Key fromJson(
final String json,
final ObjectMapper objectMapper
) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, NewApiKey.class);
return objectMapper.readValue(json, Key.class);
} catch (final JsonMappingException | JsonParseException e) {
throw new ApiException(e.getMessage(), e);
} catch (final IOException e) {
Expand All @@ -66,20 +66,20 @@ public static NewApiKey fromJson(
}

/**
* Converts a JSON InputStream into a NewApiKey object using the provided
* Converts a JSON InputStream into a Key object using the provided
* ObjectMapper.
*
* @param json Raw JSON InputStream
* @param objectMapper Jackson ObjectMapper
* @return NewApiKey object represented by the provided JSON
* @return Key object represented by the provided JSON
*/
public static NewApiKey fromJson(
public static Key fromJson(
final InputStream json,
final ObjectMapper objectMapper
) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, NewApiKey.class);
return objectMapper.readValue(json, Key.class);
} catch (final JsonMappingException | JsonParseException e) {
throw new ApiException(e.getMessage(), e);
} catch (final IOException e) {
Expand All @@ -95,7 +95,7 @@ public static NewApiKey fromJson(
private final Map<String, Object> policy;

@JsonCreator
private NewApiKey(
private Key(
@JsonProperty("sid") final String sid,
@JsonProperty("friendly_name") final String friendlyName,
@JsonProperty("date_created") final String dateCreated,
Expand Down Expand Up @@ -145,7 +145,7 @@ public boolean equals(final Object o) {
return false;
}

NewApiKey other = (NewApiKey) o;
Key other = (Key) o;

return (
Objects.equals(sid, other.sid) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,39 @@
import java.util.Map;
import java.util.Map;

public class NewApiKeyCreator extends Creator<NewApiKey> {
public class KeyCreator extends Creator<Key> {

private String accountSid;
private String friendlyName;
private NewApiKey.Keytype keyType;
private Key.Keytype keyType;
private Map<String, Object> policy;

public NewApiKeyCreator(final String accountSid) {
public KeyCreator(final String accountSid) {
this.accountSid = accountSid;
}

public NewApiKeyCreator setAccountSid(final String accountSid) {
public KeyCreator setAccountSid(final String accountSid) {
this.accountSid = accountSid;
return this;
}

public NewApiKeyCreator setFriendlyName(final String friendlyName) {
public KeyCreator setFriendlyName(final String friendlyName) {
this.friendlyName = friendlyName;
return this;
}

public NewApiKeyCreator setKeyType(final NewApiKey.Keytype keyType) {
public KeyCreator setKeyType(final Key.Keytype keyType) {
this.keyType = keyType;
return this;
}

public NewApiKeyCreator setPolicy(final Map<String, Object> policy) {
public KeyCreator setPolicy(final Map<String, Object> policy) {
this.policy = policy;
return this;
}

@Override
public NewApiKey create(final TwilioRestClient client) {
public Key create(final TwilioRestClient client) {
String path = "/v1/Keys";

path =
Expand All @@ -77,7 +77,7 @@ public NewApiKey create(final TwilioRestClient client) {
Response response = client.request(request);
if (response == null) {
throw new ApiConnectionException(
"NewApiKey creation failed: Unable to connect to server"
"Key creation failed: Unable to connect to server"
);
} else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) {
RestException restException = RestException.fromJson(
Expand All @@ -93,10 +93,7 @@ public NewApiKey create(final TwilioRestClient client) {
throw new ApiException(restException);
}

return NewApiKey.fromJson(
response.getStream(),
client.getObjectMapper()
);
return Key.fromJson(response.getStream(), client.getObjectMapper());
}

private void addPostParams(final Request request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class PortingPortabilityFetcher extends Fetcher<PortingPortability> {

private com.twilio.type.PhoneNumber pathPhoneNumber;
private String targetAccountSid;
private String addressSid;

public PortingPortabilityFetcher(
final com.twilio.type.PhoneNumber pathPhoneNumber
Expand All @@ -43,6 +44,11 @@ public PortingPortabilityFetcher setTargetAccountSid(
return this;
}

public PortingPortabilityFetcher setAddressSid(final String addressSid) {
this.addressSid = addressSid;
return this;
}

@Override
public PortingPortability fetch(final TwilioRestClient client) {
String path = "/v1/Porting/Portability/PhoneNumber/{PhoneNumber}";
Expand Down Expand Up @@ -90,5 +96,8 @@ private void addQueryParams(final Request request) {
if (targetAccountSid != null) {
request.addQueryParam("TargetAccountSid", targetAccountSid);
}
if (addressSid != null) {
request.addQueryParam("AddressSid", addressSid);
}
}
}
Loading

0 comments on commit 9523ee0

Please sign in to comment.