Skip to content

Commit d1e8c15

Browse files
committed
[Librarian] Regenerated @ e1d98e904674be752473dcb1f0e54c720a5d0754
1 parent fa442bd commit d1e8c15

File tree

9 files changed

+571
-7
lines changed

9 files changed

+571
-7
lines changed

CHANGES.md

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

4+
[2021-06-16] Version 8.15.0
5+
---------------------------
6+
**Library - Chore**
7+
- [PR #637](https://github.com/twilio/twilio-java/pull/637): archunit 0.19.0. Thanks to [@sullis](https://github.com/sullis)!
8+
9+
**Api**
10+
- Update `status` enum for Messages to include 'canceled'
11+
- Update `update_status` enum for Messages to include 'canceled'
12+
13+
**Trusthub**
14+
- Corrected the sid for policy sid in customer_profile_evaluation.json and trust_product_evaluation.json **(breaking change)**
15+
16+
417
[2021-06-02] Version 8.14.0
518
---------------------------
619
**Library - Feature**

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public enum Domains {
1616
EVENTS("events"),
1717
FAX("fax"),
1818
FLEXAPI("flex-api"),
19+
FRONTLINEAPI("frontline-api"),
1920
INSIGHTS("insights"),
2021
IPMESSAGING("ip-messaging"),
2122
LOOKUPS("lookups"),

src/main/java/com/twilio/rest/api/v2010/account/Message.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public enum Status {
5353
ACCEPTED("accepted"),
5454
SCHEDULED("scheduled"),
5555
READ("read"),
56-
PARTIALLY_DELIVERED("partially_delivered");
56+
PARTIALLY_DELIVERED("partially_delivered"),
57+
CANCELED("canceled");
5758

5859
private final String value;
5960

@@ -76,6 +77,30 @@ public static Status forValue(final String value) {
7677
}
7778
}
7879

80+
public enum UpdateStatus {
81+
CANCELED("canceled");
82+
83+
private final String value;
84+
85+
private UpdateStatus(final String value) {
86+
this.value = value;
87+
}
88+
89+
public String toString() {
90+
return value;
91+
}
92+
93+
/**
94+
* Generate a UpdateStatus from a string.
95+
* @param value string value
96+
* @return generated UpdateStatus
97+
*/
98+
@JsonCreator
99+
public static UpdateStatus forValue(final String value) {
100+
return Promoter.enumFromString(value, UpdateStatus.values());
101+
}
102+
}
103+
79104
public enum Direction {
80105
INBOUND("inbound"),
81106
OUTBOUND_API("outbound-api"),
Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
/**
2+
* This code was generated by
3+
* \ / _ _ _| _ _
4+
* | (_)\/(_)(_|\/| |(/_ v1.0.0
5+
* / /
6+
*/
7+
8+
package com.twilio.rest.frontlineapi.v1;
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.twilio.base.Resource;
17+
import com.twilio.converter.Promoter;
18+
import com.twilio.exception.ApiConnectionException;
19+
import com.twilio.exception.ApiException;
20+
import com.twilio.exception.RestException;
21+
import com.twilio.http.HttpMethod;
22+
import com.twilio.http.Request;
23+
import com.twilio.http.Response;
24+
import com.twilio.http.TwilioRestClient;
25+
import com.twilio.rest.Domains;
26+
import lombok.ToString;
27+
28+
import java.io.IOException;
29+
import java.io.InputStream;
30+
import java.net.URI;
31+
import java.util.Map;
32+
import java.util.Objects;
33+
34+
/**
35+
* PLEASE NOTE that this class contains beta products that are subject to
36+
* change. Use them with caution.
37+
*/
38+
@JsonIgnoreProperties(ignoreUnknown = true)
39+
@ToString
40+
public class User extends Resource {
41+
private static final long serialVersionUID = 146148351923263L;
42+
43+
public enum StateType {
44+
ACTIVE("active"),
45+
DEACTIVATED("deactivated");
46+
47+
private final String value;
48+
49+
private StateType(final String value) {
50+
this.value = value;
51+
}
52+
53+
public String toString() {
54+
return value;
55+
}
56+
57+
/**
58+
* Generate a StateType from a string.
59+
* @param value string value
60+
* @return generated StateType
61+
*/
62+
@JsonCreator
63+
public static StateType forValue(final String value) {
64+
return Promoter.enumFromString(value, StateType.values());
65+
}
66+
}
67+
68+
/**
69+
* Create a UserFetcher to execute fetch.
70+
*
71+
* @param pathSid The SID of the User resource to fetch
72+
* @return UserFetcher capable of executing the fetch
73+
*/
74+
public static UserFetcher fetcher(final String pathSid) {
75+
return new UserFetcher(pathSid);
76+
}
77+
78+
/**
79+
* Create a UserUpdater to execute update.
80+
*
81+
* @param pathSid The SID of the User resource to update
82+
* @return UserUpdater capable of executing the update
83+
*/
84+
public static UserUpdater updater(final String pathSid) {
85+
return new UserUpdater(pathSid);
86+
}
87+
88+
/**
89+
* Converts a JSON String into a User object using the provided ObjectMapper.
90+
*
91+
* @param json Raw JSON String
92+
* @param objectMapper Jackson ObjectMapper
93+
* @return User object represented by the provided JSON
94+
*/
95+
public static User fromJson(final String json, final ObjectMapper objectMapper) {
96+
// Convert all checked exceptions to Runtime
97+
try {
98+
return objectMapper.readValue(json, User.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+
/**
107+
* Converts a JSON InputStream into a User object using the provided
108+
* ObjectMapper.
109+
*
110+
* @param json Raw JSON InputStream
111+
* @param objectMapper Jackson ObjectMapper
112+
* @return User object represented by the provided JSON
113+
*/
114+
public static User fromJson(final InputStream json, final ObjectMapper objectMapper) {
115+
// Convert all checked exceptions to Runtime
116+
try {
117+
return objectMapper.readValue(json, User.class);
118+
} catch (final JsonMappingException | JsonParseException e) {
119+
throw new ApiException(e.getMessage(), e);
120+
} catch (final IOException e) {
121+
throw new ApiConnectionException(e.getMessage(), e);
122+
}
123+
}
124+
125+
private final String sid;
126+
private final String identity;
127+
private final String friendlyName;
128+
private final String avatar;
129+
private final User.StateType state;
130+
private final URI url;
131+
132+
@JsonCreator
133+
private User(@JsonProperty("sid")
134+
final String sid,
135+
@JsonProperty("identity")
136+
final String identity,
137+
@JsonProperty("friendly_name")
138+
final String friendlyName,
139+
@JsonProperty("avatar")
140+
final String avatar,
141+
@JsonProperty("state")
142+
final User.StateType state,
143+
@JsonProperty("url")
144+
final URI url) {
145+
this.sid = sid;
146+
this.identity = identity;
147+
this.friendlyName = friendlyName;
148+
this.avatar = avatar;
149+
this.state = state;
150+
this.url = url;
151+
}
152+
153+
/**
154+
* Returns The unique string that identifies the resource.
155+
*
156+
* @return The unique string that identifies the resource
157+
*/
158+
public final String getSid() {
159+
return this.sid;
160+
}
161+
162+
/**
163+
* Returns The string that identifies the resource's User.
164+
*
165+
* @return The string that identifies the resource's User
166+
*/
167+
public final String getIdentity() {
168+
return this.identity;
169+
}
170+
171+
/**
172+
* Returns The string that you assigned to describe the User.
173+
*
174+
* @return The string that you assigned to describe the User
175+
*/
176+
public final String getFriendlyName() {
177+
return this.friendlyName;
178+
}
179+
180+
/**
181+
* Returns The avatar URL which will be shown in Frontline application.
182+
*
183+
* @return The avatar URL which will be shown in Frontline application
184+
*/
185+
public final String getAvatar() {
186+
return this.avatar;
187+
}
188+
189+
/**
190+
* Returns Current state of this user.
191+
*
192+
* @return Current state of this user
193+
*/
194+
public final User.StateType getState() {
195+
return this.state;
196+
}
197+
198+
/**
199+
* Returns An absolute URL for this user..
200+
*
201+
* @return An absolute URL for this user.
202+
*/
203+
public final URI getUrl() {
204+
return this.url;
205+
}
206+
207+
@Override
208+
public boolean equals(final Object o) {
209+
if (this == o) {
210+
return true;
211+
}
212+
213+
if (o == null || getClass() != o.getClass()) {
214+
return false;
215+
}
216+
217+
User other = (User) o;
218+
219+
return Objects.equals(sid, other.sid) &&
220+
Objects.equals(identity, other.identity) &&
221+
Objects.equals(friendlyName, other.friendlyName) &&
222+
Objects.equals(avatar, other.avatar) &&
223+
Objects.equals(state, other.state) &&
224+
Objects.equals(url, other.url);
225+
}
226+
227+
@Override
228+
public int hashCode() {
229+
return Objects.hash(sid,
230+
identity,
231+
friendlyName,
232+
avatar,
233+
state,
234+
url);
235+
}
236+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* This code was generated by
3+
* \ / _ _ _| _ _
4+
* | (_)\/(_)(_|\/| |(/_ v1.0.0
5+
* / /
6+
*/
7+
8+
package com.twilio.rest.frontlineapi.v1;
9+
10+
import com.twilio.base.Fetcher;
11+
import com.twilio.exception.ApiConnectionException;
12+
import com.twilio.exception.ApiException;
13+
import com.twilio.exception.RestException;
14+
import com.twilio.http.HttpMethod;
15+
import com.twilio.http.Request;
16+
import com.twilio.http.Response;
17+
import com.twilio.http.TwilioRestClient;
18+
import com.twilio.rest.Domains;
19+
20+
/**
21+
* PLEASE NOTE that this class contains beta products that are subject to
22+
* change. Use them with caution.
23+
*/
24+
public class UserFetcher extends Fetcher<User> {
25+
private final String pathSid;
26+
27+
/**
28+
* Construct a new UserFetcher.
29+
*
30+
* @param pathSid The SID of the User resource to fetch
31+
*/
32+
public UserFetcher(final String pathSid) {
33+
this.pathSid = pathSid;
34+
}
35+
36+
/**
37+
* Make the request to the Twilio API to perform the fetch.
38+
*
39+
* @param client TwilioRestClient with which to make the request
40+
* @return Fetched User
41+
*/
42+
@Override
43+
@SuppressWarnings("checkstyle:linelength")
44+
public User fetch(final TwilioRestClient client) {
45+
Request request = new Request(
46+
HttpMethod.GET,
47+
Domains.FRONTLINEAPI.toString(),
48+
"/v1/Users/" + this.pathSid + ""
49+
);
50+
51+
Response response = client.request(request);
52+
53+
if (response == null) {
54+
throw new ApiConnectionException("User fetch failed: Unable to connect to server");
55+
} else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) {
56+
RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper());
57+
if (restException == null) {
58+
throw new ApiException("Server Error, no content");
59+
}
60+
throw new ApiException(restException);
61+
}
62+
63+
return User.fromJson(response.getStream(), client.getObjectMapper());
64+
}
65+
}

0 commit comments

Comments
 (0)