Skip to content

Commit

Permalink
[Librarian] Regenerated @ 08245333f4a8c9235d547b189cd9c422f73e0e7e 7b…
Browse files Browse the repository at this point in the history
…b98153c25ebfee95e6e85bd4c57969e6d02435
  • Loading branch information
twilio-dx committed Sep 25, 2024
1 parent bb8ec5f commit d5806b1
Show file tree
Hide file tree
Showing 24 changed files with 2,324 additions and 37 deletions.
14 changes: 14 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
twilio-java changelog
=====================

[2024-09-25] Version 10.5.2
---------------------------
**Library - Chore**
- [PR #815](https://github.com/twilio/twilio-java/pull/815): updated readme for Beta flag. Thanks to [@sbansla](https://github.com/sbansla)!

**Accounts**
- Update docs and mounts.
- Change library visibility to public
- Enable consent and contact bulk upsert APIs in prod.

**Serverless**
- Add is_plugin parameter in deployments api to check if it is plugins deployment


[2024-09-18] Version 10.5.1
---------------------------
**Intelligence**
Expand Down
122 changes: 122 additions & 0 deletions src/main/java/com/twilio/rest/accounts/v1/BulkConsents.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

package com.twilio.rest.accounts.v1;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Resource;
import com.twilio.exception.ApiConnectionException;
import com.twilio.exception.ApiException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.Objects;
import lombok.ToString;
import lombok.ToString;

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

private static final long serialVersionUID = 126137950684284L;

public static BulkConsentsCreator creator(
final List<Map<String, Object>> items
) {
return new BulkConsentsCreator(items);
}

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

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

private final Map<String, Object> items;

@JsonCreator
private BulkConsents(
@JsonProperty("items") final Map<String, Object> items
) {
this.items = items;
}

public final Map<String, Object> getItems() {
return this.items;
}

@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}

if (o == null || getClass() != o.getClass()) {
return false;
}

BulkConsents other = (BulkConsents) o;

return Objects.equals(items, other.items);
}

@Override
public int hashCode() {
return Objects.hash(items);
}
}
97 changes: 97 additions & 0 deletions src/main/java/com/twilio/rest/accounts/v1/BulkConsentsCreator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

package com.twilio.rest.accounts.v1;

import com.twilio.base.Creator;
import com.twilio.constant.EnumConstants;
import com.twilio.converter.Converter;
import com.twilio.converter.Converter;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
import com.twilio.exception.ApiException;
import com.twilio.exception.RestException;
import com.twilio.http.HttpMethod;
import com.twilio.http.Request;
import com.twilio.http.Response;
import com.twilio.http.TwilioRestClient;
import com.twilio.rest.Domains;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;

public class BulkConsentsCreator extends Creator<BulkConsents> {

private List<Map<String, Object>> items;

public BulkConsentsCreator(final List<Map<String, Object>> items) {
this.items = items;
}

public BulkConsentsCreator setItems(final List<Map<String, Object>> items) {
this.items = items;
return this;
}

public BulkConsentsCreator setItems(final Map<String, Object> items) {
return setItems(Promoter.listOfOne(items));
}

@Override
public BulkConsents create(final TwilioRestClient client) {
String path = "/v1/Consents/Bulk";

path = path.replace("{" + "Items" + "}", this.items.toString());

Request request = new Request(
HttpMethod.POST,
Domains.ACCOUNTS.toString(),
path
);
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
addPostParams(request);
Response response = client.request(request);
if (response == null) {
throw new ApiConnectionException(
"BulkConsents creation failed: Unable to connect to server"
);
} else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) {
RestException restException = RestException.fromJson(
response.getStream(),
client.getObjectMapper()
);
if (restException == null) {
throw new ApiException(
"Server Error, no content",
response.getStatusCode()
);
}
throw new ApiException(restException);
}

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

private void addPostParams(final Request request) {
if (items != null) {
for (Map<String, Object> prop : items) {
request.addPostParam("Items", Converter.mapToJson(prop));
}
}
}
}
122 changes: 122 additions & 0 deletions src/main/java/com/twilio/rest/accounts/v1/BulkContacts.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

package com.twilio.rest.accounts.v1;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Resource;
import com.twilio.exception.ApiConnectionException;
import com.twilio.exception.ApiException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.Objects;
import lombok.ToString;
import lombok.ToString;

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

private static final long serialVersionUID = 126137950684284L;

public static BulkContactsCreator creator(
final List<Map<String, Object>> items
) {
return new BulkContactsCreator(items);
}

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

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

private final Map<String, Object> items;

@JsonCreator
private BulkContacts(
@JsonProperty("items") final Map<String, Object> items
) {
this.items = items;
}

public final Map<String, Object> getItems() {
return this.items;
}

@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}

if (o == null || getClass() != o.getClass()) {
return false;
}

BulkContacts other = (BulkContacts) o;

return Objects.equals(items, other.items);
}

@Override
public int hashCode() {
return Objects.hash(items);
}
}
Loading

0 comments on commit d5806b1

Please sign in to comment.