Skip to content

Commit 8ee69fe

Browse files
authored
Merge branch 'main' into public-oauth-rest-client
2 parents 5176a49 + fab34c1 commit 8ee69fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+7034
-119
lines changed

CHANGES.md

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

4+
[2024-09-25] Version 10.5.2
5+
---------------------------
6+
**Library - Chore**
7+
- [PR #815](https://github.com/twilio/twilio-java/pull/815): updated readme for Beta flag. Thanks to [@sbansla](https://github.com/sbansla)!
8+
9+
**Accounts**
10+
- Update docs and mounts.
11+
- Change library visibility to public
12+
- Enable consent and contact bulk upsert APIs in prod.
13+
14+
**Serverless**
15+
- Add is_plugin parameter in deployments api to check if it is plugins deployment
16+
17+
18+
[2024-09-18] Version 10.5.1
19+
---------------------------
20+
**Intelligence**
21+
- Remove public from operator_type
22+
- Update operator_type to include general-availablity and deprecated
23+
24+
**Numbers**
25+
- Remove beta flag for bundle clone API
26+
27+
428
[2024-09-05] Version 10.5.0
529
---------------------------
630
**Iam**

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>twilio</artifactId>
66
<packaging>jar</packaging>
77
<name>twilio</name>
8-
<version>10.5.0</version>
8+
<version>10.5.2</version>
99
<description>Twilio Java Helper Library</description>
1010
<url>https://www.twilio.com</url>
1111
<licenses>
@@ -19,7 +19,7 @@
1919
<url>[email protected]:twilio/twilio-java.git</url>
2020
<connection>scm:git:[email protected]:twilio/twilio-java.git</connection>
2121
<developerConnection>scm:git:[email protected]:twilio/twilio-java.git</developerConnection>
22-
<tag>10.5.0</tag>
22+
<tag>10.5.2</tag>
2323
</scm>
2424
<developers>
2525
<developer>

src/main/java/com/twilio/Domains.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
public enum Domains {
1414
ACCOUNTS("accounts"),
1515
API("api"),
16+
ASSISTANTS("assistants"),
1617
BULKEXPORTS("bulkexports"),
1718
CHAT("chat"),
1819
CONTENT("content"),

src/main/java/com/twilio/Twilio.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
public class Twilio {
2626

27-
public static final String VERSION = "10.5.0";
27+
public static final String VERSION = "10.5.2";
2828
public static final String JAVA_VERSION = System.getProperty("java.version");
2929
public static final String OS_NAME = System.getProperty("os.name");
3030
public static final String OS_ARCH = System.getProperty("os.arch");
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/*
2+
* This code was generated by
3+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
*
7+
* Twilio - Accounts
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.accounts.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.exception.ApiConnectionException;
25+
import com.twilio.exception.ApiException;
26+
import java.io.IOException;
27+
import java.io.InputStream;
28+
import java.util.List;
29+
import java.util.Map;
30+
import java.util.Map;
31+
import java.util.Objects;
32+
import lombok.ToString;
33+
import lombok.ToString;
34+
35+
@JsonIgnoreProperties(ignoreUnknown = true)
36+
@ToString
37+
public class BulkConsents extends Resource {
38+
39+
private static final long serialVersionUID = 126137950684284L;
40+
41+
public static BulkConsentsCreator creator(
42+
final List<Map<String, Object>> items
43+
) {
44+
return new BulkConsentsCreator(items);
45+
}
46+
47+
/**
48+
* Converts a JSON String into a BulkConsents object using the provided ObjectMapper.
49+
*
50+
* @param json Raw JSON String
51+
* @param objectMapper Jackson ObjectMapper
52+
* @return BulkConsents object represented by the provided JSON
53+
*/
54+
public static BulkConsents fromJson(
55+
final String json,
56+
final ObjectMapper objectMapper
57+
) {
58+
// Convert all checked exceptions to Runtime
59+
try {
60+
return objectMapper.readValue(json, BulkConsents.class);
61+
} catch (final JsonMappingException | JsonParseException e) {
62+
throw new ApiException(e.getMessage(), e);
63+
} catch (final IOException e) {
64+
throw new ApiConnectionException(e.getMessage(), e);
65+
}
66+
}
67+
68+
/**
69+
* Converts a JSON InputStream into a BulkConsents object using the provided
70+
* ObjectMapper.
71+
*
72+
* @param json Raw JSON InputStream
73+
* @param objectMapper Jackson ObjectMapper
74+
* @return BulkConsents object represented by the provided JSON
75+
*/
76+
public static BulkConsents fromJson(
77+
final InputStream json,
78+
final ObjectMapper objectMapper
79+
) {
80+
// Convert all checked exceptions to Runtime
81+
try {
82+
return objectMapper.readValue(json, BulkConsents.class);
83+
} catch (final JsonMappingException | JsonParseException e) {
84+
throw new ApiException(e.getMessage(), e);
85+
} catch (final IOException e) {
86+
throw new ApiConnectionException(e.getMessage(), e);
87+
}
88+
}
89+
90+
private final Map<String, Object> items;
91+
92+
@JsonCreator
93+
private BulkConsents(
94+
@JsonProperty("items") final Map<String, Object> items
95+
) {
96+
this.items = items;
97+
}
98+
99+
public final Map<String, Object> getItems() {
100+
return this.items;
101+
}
102+
103+
@Override
104+
public boolean equals(final Object o) {
105+
if (this == o) {
106+
return true;
107+
}
108+
109+
if (o == null || getClass() != o.getClass()) {
110+
return false;
111+
}
112+
113+
BulkConsents other = (BulkConsents) o;
114+
115+
return Objects.equals(items, other.items);
116+
}
117+
118+
@Override
119+
public int hashCode() {
120+
return Objects.hash(items);
121+
}
122+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* This code was generated by
3+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
*
7+
* Twilio - Accounts
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.accounts.v1;
16+
17+
import com.twilio.base.Creator;
18+
import com.twilio.constant.EnumConstants;
19+
import com.twilio.converter.Converter;
20+
import com.twilio.converter.Converter;
21+
import com.twilio.converter.Promoter;
22+
import com.twilio.exception.ApiConnectionException;
23+
import com.twilio.exception.ApiException;
24+
import com.twilio.exception.RestException;
25+
import com.twilio.http.HttpMethod;
26+
import com.twilio.http.Request;
27+
import com.twilio.http.Response;
28+
import com.twilio.http.TwilioRestClient;
29+
import com.twilio.rest.Domains;
30+
import java.util.List;
31+
import java.util.List;
32+
import java.util.Map;
33+
import java.util.Map;
34+
35+
public class BulkConsentsCreator extends Creator<BulkConsents> {
36+
37+
private List<Map<String, Object>> items;
38+
39+
public BulkConsentsCreator(final List<Map<String, Object>> items) {
40+
this.items = items;
41+
}
42+
43+
public BulkConsentsCreator setItems(final List<Map<String, Object>> items) {
44+
this.items = items;
45+
return this;
46+
}
47+
48+
public BulkConsentsCreator setItems(final Map<String, Object> items) {
49+
return setItems(Promoter.listOfOne(items));
50+
}
51+
52+
@Override
53+
public BulkConsents create(final TwilioRestClient client) {
54+
String path = "/v1/Consents/Bulk";
55+
56+
path = path.replace("{" + "Items" + "}", this.items.toString());
57+
58+
Request request = new Request(
59+
HttpMethod.POST,
60+
Domains.ACCOUNTS.toString(),
61+
path
62+
);
63+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
64+
addPostParams(request);
65+
Response response = client.request(request);
66+
if (response == null) {
67+
throw new ApiConnectionException(
68+
"BulkConsents creation failed: Unable to connect to server"
69+
);
70+
} else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) {
71+
RestException restException = RestException.fromJson(
72+
response.getStream(),
73+
client.getObjectMapper()
74+
);
75+
if (restException == null) {
76+
throw new ApiException(
77+
"Server Error, no content",
78+
response.getStatusCode()
79+
);
80+
}
81+
throw new ApiException(restException);
82+
}
83+
84+
return BulkConsents.fromJson(
85+
response.getStream(),
86+
client.getObjectMapper()
87+
);
88+
}
89+
90+
private void addPostParams(final Request request) {
91+
if (items != null) {
92+
for (Map<String, Object> prop : items) {
93+
request.addPostParam("Items", Converter.mapToJson(prop));
94+
}
95+
}
96+
}
97+
}

0 commit comments

Comments
 (0)