diff --git a/pom.xml b/pom.xml
index c69973166..98b0b4263 100644
--- a/pom.xml
+++ b/pom.xml
@@ -182,7 +182,7 @@
org.projectlombok
lombok
- 1.18.24
+ 1.18.30
provided
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/Account.java b/src/main/java/com/twilio/rest/previewiam/organizations/Account.java
new file mode 100644
index 000000000..2923a824b
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/Account.java
@@ -0,0 +1,182 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+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.bearertoken.Resource;
+import com.twilio.converter.DateConverter;
+import com.twilio.converter.Promoter;
+import com.twilio.exception.ApiConnectionException;
+
+import com.twilio.exception.ApiException;
+
+import lombok.ToString;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.time.ZonedDateTime;
+
+import java.util.Objects;
+
+import lombok.ToString;
+
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@ToString
+public class Account extends Resource {
+ private static final long serialVersionUID = 140632441815443L;
+
+
+
+ public static AccountFetcher fetcher(final String pathOrganizationSid, final String pathAccountSid){
+ return new AccountFetcher(pathOrganizationSid, pathAccountSid);
+ }
+
+ public static AccountReader reader(final String pathOrganizationSid){
+ return new AccountReader(pathOrganizationSid);
+ }
+
+ /**
+ * Converts a JSON String into a Account object using the provided ObjectMapper.
+ *
+ * @param json Raw JSON String
+ * @param objectMapper Jackson ObjectMapper
+ * @return Account object represented by the provided JSON
+ */
+ public static Account fromJson(final String json, final ObjectMapper objectMapper) {
+ // Convert all checked exceptions to Runtime
+ try {
+ return objectMapper.readValue(json, Account.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 Account object using the provided
+ * ObjectMapper.
+ *
+ * @param json Raw JSON InputStream
+ * @param objectMapper Jackson ObjectMapper
+ * @return Account object represented by the provided JSON
+ */
+ public static Account fromJson(final InputStream json, final ObjectMapper objectMapper) {
+ // Convert all checked exceptions to Runtime
+ try {
+ return objectMapper.readValue(json, Account.class);
+ } catch (final JsonMappingException | JsonParseException e) {
+ throw new ApiException(e.getMessage(), e);
+ } catch (final IOException e) {
+ throw new ApiConnectionException(e.getMessage(), e);
+ }
+ }
+
+ private final String accountSid;
+ private final String friendlyName;
+ private final Account.StatusEnum status;
+ private final String ownerSid;
+ private final ZonedDateTime dateCreated;
+
+ @JsonCreator
+ private Account(
+ @JsonProperty("account_sid")
+ final String accountSid,
+
+ @JsonProperty("friendly_name")
+ final String friendlyName,
+
+ @JsonProperty("status")
+ final Account.StatusEnum status,
+
+ @JsonProperty("owner_sid")
+ final String ownerSid,
+
+ @JsonProperty("date_created")
+ final String dateCreated
+ ) {
+ this.accountSid = accountSid;
+ this.friendlyName = friendlyName;
+ this.status = status;
+ this.ownerSid = ownerSid;
+ this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated);
+ }
+
+ public final String getAccountSid() {
+ return this.accountSid;
+ }
+ public final String getFriendlyName() {
+ return this.friendlyName;
+ }
+ public final Account.StatusEnum getStatus() {
+ return this.status;
+ }
+ public final String getOwnerSid() {
+ return this.ownerSid;
+ }
+ public final ZonedDateTime getDateCreated() {
+ return this.dateCreated;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this==o) {
+ return true;
+ }
+
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Account other = (Account) o;
+
+ return Objects.equals(accountSid, other.accountSid) && Objects.equals(friendlyName, other.friendlyName) && Objects.equals(status, other.status) && Objects.equals(ownerSid, other.ownerSid) && Objects.equals(dateCreated, other.dateCreated) ;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(accountSid, friendlyName, status, ownerSid, dateCreated);
+ }
+
+ public enum StatusEnum {
+ ACTIVE("active"),
+ SUSPENDED("suspended"),
+ PENDING_CLOSURE("pending_closure"),
+ CLOSED("closed");
+
+ private final String value;
+
+ private StatusEnum(final String value) {
+ this.value = value;
+ }
+
+ public String toString() {
+ return value;
+ }
+
+ @JsonCreator
+ public static StatusEnum forValue(final String value) {
+ return Promoter.enumFromString(value, StatusEnum.values());
+ }
+ }
+
+}
+
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/AccountFetcher.java b/src/main/java/com/twilio/rest/previewiam/organizations/AccountFetcher.java
new file mode 100644
index 000000000..a00d88c95
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/AccountFetcher.java
@@ -0,0 +1,67 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+
+import com.twilio.base.bearertoken.Fetcher;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+public class AccountFetcher extends Fetcher {
+ private String pathOrganizationSid;
+ private String pathAccountSid;
+
+ public AccountFetcher(final String pathOrganizationSid, final String pathAccountSid){
+ this.pathOrganizationSid = pathOrganizationSid;
+ this.pathAccountSid = pathAccountSid;
+ }
+
+
+ @Override
+ public Account fetch(final BearerTokenTwilioRestClient client) {
+ String path = "/Organizations/{organizationSid}/Accounts/{accountSid}";
+
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+ path = path.replace("{"+"accountSid"+"}", this.pathAccountSid.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+ Response response = client.request(request);
+
+ if (response == null) {
+ throw new ApiConnectionException("Account fetch failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 Account.fromJson(response.getStream(), client.getObjectMapper());
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/AccountReader.java b/src/main/java/com/twilio/rest/previewiam/organizations/AccountReader.java
new file mode 100644
index 000000000..fa11857ad
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/AccountReader.java
@@ -0,0 +1,123 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+import com.twilio.base.bearertoken.Page;
+import com.twilio.base.bearertoken.Reader;
+import com.twilio.base.bearertoken.ResourceSet;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+public class AccountReader extends Reader {
+ private String pathOrganizationSid;
+ private Integer pageSize;
+
+ public AccountReader(final String pathOrganizationSid){
+ this.pathOrganizationSid = pathOrganizationSid;
+ }
+
+ public AccountReader setPageSize(final Integer pageSize){
+ this.pageSize = pageSize;
+ return this;
+ }
+
+ @Override
+ public ResourceSet read(final BearerTokenTwilioRestClient client) {
+ return new ResourceSet<>(this, client, firstPage(client));
+ }
+
+ public Page firstPage(final BearerTokenTwilioRestClient client) {
+ String path = "/Organizations/{organizationSid}/Accounts";
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+
+ addQueryParams(request);
+ return pageForRequest(client, request);
+ }
+
+ private Page pageForRequest(final BearerTokenTwilioRestClient client, final BearerTokenRequest request) {
+ Response response = client.request(request);
+
+ if (response == null) {
+ throw new ApiConnectionException("Account read failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 Page.fromJson(
+ "content",
+ response.getContent(),
+ Account.class,
+ client.getObjectMapper()
+ );
+ }
+
+ @Override
+ public Page previousPage(final Page page, final BearerTokenTwilioRestClient client) {
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ page.getPreviousPageUrl(Domains.PREVIEWIAM.toString())
+ );
+ return pageForRequest(client, request);
+ }
+
+
+ @Override
+ public Page nextPage(final Page page, final BearerTokenTwilioRestClient client) {
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ page.getNextPageUrl(Domains.PREVIEWIAM.toString())
+ );
+ return pageForRequest(client, request);
+ }
+
+ @Override
+ public Page getPage(final String targetUrl, final BearerTokenTwilioRestClient client) {
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ targetUrl
+ );
+
+ return pageForRequest(client, request);
+ }
+ private void addQueryParams(final BearerTokenRequest request) {
+ if (pageSize != null) {
+
+ request.addQueryParam("PageSize", pageSize.toString());
+ }
+
+ if(getPageSize() != null) {
+ request.addQueryParam("PageSize", Integer.toString(getPageSize()));
+ }
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/Authorize.java b/src/main/java/com/twilio/rest/previewiam/organizations/Authorize.java
new file mode 100644
index 000000000..357abd141
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/Authorize.java
@@ -0,0 +1,123 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+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.noauth.Resource;
+import com.twilio.exception.ApiConnectionException;
+
+import com.twilio.exception.ApiException;
+
+import lombok.ToString;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import java.util.Objects;
+
+import lombok.ToString;
+
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@ToString
+public class Authorize extends Resource {
+ private static final long serialVersionUID = 245900587626041L;
+
+
+
+ public static AuthorizeFetcher fetcher(){
+ return new AuthorizeFetcher();
+ }
+
+ /**
+ * Converts a JSON String into a Authorize object using the provided ObjectMapper.
+ *
+ * @param json Raw JSON String
+ * @param objectMapper Jackson ObjectMapper
+ * @return Authorize object represented by the provided JSON
+ */
+ public static Authorize fromJson(final String json, final ObjectMapper objectMapper) {
+ // Convert all checked exceptions to Runtime
+ try {
+ return objectMapper.readValue(json, Authorize.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 Authorize object using the provided
+ * ObjectMapper.
+ *
+ * @param json Raw JSON InputStream
+ * @param objectMapper Jackson ObjectMapper
+ * @return Authorize object represented by the provided JSON
+ */
+ public static Authorize fromJson(final InputStream json, final ObjectMapper objectMapper) {
+ // Convert all checked exceptions to Runtime
+ try {
+ return objectMapper.readValue(json, Authorize.class);
+ } catch (final JsonMappingException | JsonParseException e) {
+ throw new ApiException(e.getMessage(), e);
+ } catch (final IOException e) {
+ throw new ApiConnectionException(e.getMessage(), e);
+ }
+ }
+
+ private final URI redirectTo;
+
+ @JsonCreator
+ private Authorize(
+ @JsonProperty("redirect_to")
+ final URI redirectTo
+ ) {
+ this.redirectTo = redirectTo;
+ }
+
+ public final URI getRedirectTo() {
+ return this.redirectTo;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this==o) {
+ return true;
+ }
+
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Authorize other = (Authorize) o;
+
+ return Objects.equals(redirectTo, other.redirectTo) ;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(redirectTo);
+ }
+
+
+}
+
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/AuthorizeFetcher.java b/src/main/java/com/twilio/rest/previewiam/organizations/AuthorizeFetcher.java
new file mode 100644
index 000000000..f34321b32
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/AuthorizeFetcher.java
@@ -0,0 +1,109 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+
+import com.twilio.base.noauth.Fetcher;
+import com.twilio.http.noauth.NoAuthRequest;
+import com.twilio.http.noauth.NoAuthTwilioRestClient;
+
+public class AuthorizeFetcher extends Fetcher {
+ private String responseType;
+ private String clientId;
+ private String redirectUri;
+ private String scope;
+ private String state;
+
+ public AuthorizeFetcher(){
+ }
+
+ public AuthorizeFetcher setResponseType(final String responseType){
+ this.responseType = responseType;
+ return this;
+ }
+ public AuthorizeFetcher setClientId(final String clientId){
+ this.clientId = clientId;
+ return this;
+ }
+ public AuthorizeFetcher setRedirectUri(final String redirectUri){
+ this.redirectUri = redirectUri;
+ return this;
+ }
+ public AuthorizeFetcher setScope(final String scope){
+ this.scope = scope;
+ return this;
+ }
+ public AuthorizeFetcher setState(final String state){
+ this.state = state;
+ return this;
+ }
+
+ @Override
+ public Authorize fetch(final NoAuthTwilioRestClient client) {
+ String path = "/v1/authorize";
+
+
+ NoAuthRequest request = new NoAuthRequest(
+ HttpMethod.GET,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+ addQueryParams(request);
+ Response response = client.request(request);
+
+ if (response == null) {
+ throw new ApiConnectionException("Authorize fetch failed: Unable to connect to server");
+ } else if (!NoAuthTwilioRestClient.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 Authorize.fromJson(response.getStream(), client.getObjectMapper());
+ }
+ private void addQueryParams(final NoAuthRequest request) {
+ if (responseType != null) {
+
+ request.addQueryParam("response_type", responseType);
+ }
+ if (clientId != null) {
+
+ request.addQueryParam("client_id", clientId);
+ }
+ if (redirectUri != null) {
+
+ request.addQueryParam("redirect_uri", redirectUri);
+ }
+ if (scope != null) {
+
+ request.addQueryParam("scope", scope);
+ }
+ if (state != null) {
+
+ request.addQueryParam("state", state);
+ }
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignment.java b/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignment.java
new file mode 100644
index 000000000..f7f8f3b27
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignment.java
@@ -0,0 +1,192 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.twilio.base.bearertoken.Resource;
+import com.twilio.exception.ApiConnectionException;
+
+import com.twilio.exception.ApiException;
+
+import lombok.ToString;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.Objects;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@ToString
+public class RoleAssignment extends Resource {
+ private static final long serialVersionUID = 175566213667704L;
+
+
+ @ToString
+ static public class PublicApiCreateRoleAssignmentRequest {
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("role_sid")
+ @Getter @Setter private String roleSid;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("scope")
+ @Getter @Setter private String scope;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("identity")
+ @Getter @Setter private String identity;
+
+ public PublicApiCreateRoleAssignmentRequest(final String roleSid, final String scope, final String identity ) {
+ this.roleSid = roleSid;
+ this.scope = scope;
+ this.identity = identity;
+ }
+
+ public static PublicApiCreateRoleAssignmentRequest fromJson(String jsonString, ObjectMapper mapper) throws IOException {
+ return mapper.readValue(jsonString, PublicApiCreateRoleAssignmentRequest.class);
+ }
+ }
+
+ public static RoleAssignmentCreator creator(final String pathOrganizationSid, final RoleAssignment.PublicApiCreateRoleAssignmentRequest publicApiCreateRoleAssignmentRequest){
+ return new RoleAssignmentCreator(pathOrganizationSid, publicApiCreateRoleAssignmentRequest);
+ }
+
+ public static RoleAssignmentDeleter deleter(final String pathOrganizationSid, final String pathRoleAssignmentSid){
+ return new RoleAssignmentDeleter(pathOrganizationSid, pathRoleAssignmentSid);
+ }
+
+ public static RoleAssignmentReader reader(final String pathOrganizationSid){
+ return new RoleAssignmentReader(pathOrganizationSid);
+ }
+
+ /**
+ * Converts a JSON String into a RoleAssignment object using the provided ObjectMapper.
+ *
+ * @param json Raw JSON String
+ * @param objectMapper Jackson ObjectMapper
+ * @return RoleAssignment object represented by the provided JSON
+ */
+ public static RoleAssignment fromJson(final String json, final ObjectMapper objectMapper) {
+ // Convert all checked exceptions to Runtime
+ try {
+ return objectMapper.readValue(json, RoleAssignment.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 RoleAssignment object using the provided
+ * ObjectMapper.
+ *
+ * @param json Raw JSON InputStream
+ * @param objectMapper Jackson ObjectMapper
+ * @return RoleAssignment object represented by the provided JSON
+ */
+ public static RoleAssignment fromJson(final InputStream json, final ObjectMapper objectMapper) {
+ // Convert all checked exceptions to Runtime
+ try {
+ return objectMapper.readValue(json, RoleAssignment.class);
+ } catch (final JsonMappingException | JsonParseException e) {
+ throw new ApiException(e.getMessage(), e);
+ } catch (final IOException e) {
+ throw new ApiConnectionException(e.getMessage(), e);
+ }
+ }
+ public static String toJson(Object object, ObjectMapper mapper) {
+ try {
+ return mapper.writeValueAsString(object);
+ } catch (final JsonMappingException e) {
+ throw new ApiException(e.getMessage(), e);
+ } catch (JsonProcessingException e) {
+ throw new ApiException(e.getMessage(), e);
+ } catch (final IOException e) {
+ throw new ApiConnectionException(e.getMessage(), e);
+ }
+ }
+ private final String sid;
+ private final String roleSid;
+ private final String scope;
+ private final String identity;
+
+ @JsonCreator
+ private RoleAssignment(
+ @JsonProperty("sid")
+ final String sid,
+
+ @JsonProperty("role_sid")
+ final String roleSid,
+
+ @JsonProperty("scope")
+ final String scope,
+
+ @JsonProperty("identity")
+ final String identity
+ ) {
+ this.sid = sid;
+ this.roleSid = roleSid;
+ this.scope = scope;
+ this.identity = identity;
+ }
+
+ public final String getSid() {
+ return this.sid;
+ }
+ public final String getRoleSid() {
+ return this.roleSid;
+ }
+ public final String getScope() {
+ return this.scope;
+ }
+ public final String getIdentity() {
+ return this.identity;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this==o) {
+ return true;
+ }
+
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ RoleAssignment other = (RoleAssignment) o;
+
+ return Objects.equals(sid, other.sid) && Objects.equals(roleSid, other.roleSid) && Objects.equals(scope, other.scope) && Objects.equals(identity, other.identity) ;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sid, roleSid, scope, identity);
+ }
+
+
+}
+
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignmentCreator.java b/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignmentCreator.java
new file mode 100644
index 000000000..a45ee3a95
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignmentCreator.java
@@ -0,0 +1,80 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.twilio.constant.EnumConstants;
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+
+import com.twilio.base.bearertoken.Creator;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+public class RoleAssignmentCreator extends Creator{
+ private String pathOrganizationSid;
+ private RoleAssignment.PublicApiCreateRoleAssignmentRequest publicApiCreateRoleAssignmentRequest;
+
+ public RoleAssignmentCreator(final String pathOrganizationSid, final RoleAssignment.PublicApiCreateRoleAssignmentRequest publicApiCreateRoleAssignmentRequest) {
+ this.pathOrganizationSid = pathOrganizationSid;
+ this.publicApiCreateRoleAssignmentRequest = publicApiCreateRoleAssignmentRequest;
+ }
+
+ public RoleAssignmentCreator setPublicApiCreateRoleAssignmentRequest(final RoleAssignment.PublicApiCreateRoleAssignmentRequest publicApiCreateRoleAssignmentRequest){
+ this.publicApiCreateRoleAssignmentRequest = publicApiCreateRoleAssignmentRequest;
+ return this;
+ }
+
+ @Override
+ public RoleAssignment create(final BearerTokenTwilioRestClient client){
+ String path = "/Organizations/{organizationSid}/RoleAssignments";
+
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+ path = path.replace("{"+"PublicApiCreateRoleAssignmentRequest"+"}", this.publicApiCreateRoleAssignmentRequest.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.POST,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+ request.setContentType(EnumConstants.ContentType.JSON);
+ addPostParams(request, client);
+ Response response = client.request(request);
+ if (response == null) {
+ throw new ApiConnectionException("RoleAssignment creation failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 RoleAssignment.fromJson(response.getStream(), client.getObjectMapper());
+ }
+ private void addPostParams(final BearerTokenRequest request, BearerTokenTwilioRestClient client) {
+ ObjectMapper objectMapper = client.getObjectMapper();
+ if (publicApiCreateRoleAssignmentRequest != null) {
+ request.setBody(RoleAssignment.toJson(publicApiCreateRoleAssignmentRequest, objectMapper));
+ }
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignmentDeleter.java b/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignmentDeleter.java
new file mode 100644
index 000000000..e48d7bc59
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignmentDeleter.java
@@ -0,0 +1,65 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+import com.twilio.base.bearertoken.Deleter;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+public class RoleAssignmentDeleter extends Deleter {
+ private String pathOrganizationSid;
+ private String pathRoleAssignmentSid;
+
+ public RoleAssignmentDeleter(final String pathOrganizationSid, final String pathRoleAssignmentSid){
+ this.pathOrganizationSid = pathOrganizationSid;
+ this.pathRoleAssignmentSid = pathRoleAssignmentSid;
+ }
+
+
+ @Override
+ public boolean delete(final BearerTokenTwilioRestClient client) {
+ String path = "/Organizations/{organizationSid}/RoleAssignments/{roleAssignmentSid}";
+
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+ path = path.replace("{"+"roleAssignmentSid"+"}", this.pathRoleAssignmentSid.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.DELETE,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+ Response response = client.request(request);
+
+ if (response == null) {
+ throw new ApiConnectionException("RoleAssignment delete failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 response.getStatusCode() == 204;
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignmentReader.java b/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignmentReader.java
new file mode 100644
index 000000000..19c73564f
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/RoleAssignmentReader.java
@@ -0,0 +1,141 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+import com.twilio.base.bearertoken.Page;
+import com.twilio.base.bearertoken.Reader;
+import com.twilio.base.bearertoken.ResourceSet;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+public class RoleAssignmentReader extends Reader {
+ private String pathOrganizationSid;
+ private Integer pageSize;
+ private String identity;
+ private String scope;
+
+ public RoleAssignmentReader(final String pathOrganizationSid){
+ this.pathOrganizationSid = pathOrganizationSid;
+ }
+
+ public RoleAssignmentReader setPageSize(final Integer pageSize){
+ this.pageSize = pageSize;
+ return this;
+ }
+ public RoleAssignmentReader setIdentity(final String identity){
+ this.identity = identity;
+ return this;
+ }
+ public RoleAssignmentReader setScope(final String scope){
+ this.scope = scope;
+ return this;
+ }
+
+ @Override
+ public ResourceSet read(final BearerTokenTwilioRestClient client) {
+ return new ResourceSet<>(this, client, firstPage(client));
+ }
+
+ public Page firstPage(final BearerTokenTwilioRestClient client) {
+ String path = "/Organizations/{organizationSid}/RoleAssignments";
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+
+ addQueryParams(request);
+ return pageForRequest(client, request);
+ }
+
+ private Page pageForRequest(final BearerTokenTwilioRestClient client, final BearerTokenRequest request) {
+ Response response = client.request(request);
+
+ if (response == null) {
+ throw new ApiConnectionException("RoleAssignment read failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 Page.fromJson(
+ "content",
+ response.getContent(),
+ RoleAssignment.class,
+ client.getObjectMapper()
+ );
+ }
+
+ @Override
+ public Page previousPage(final Page page, final BearerTokenTwilioRestClient client) {
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ page.getPreviousPageUrl(Domains.PREVIEWIAM.toString())
+ );
+ return pageForRequest(client, request);
+ }
+
+
+ @Override
+ public Page nextPage(final Page page, final BearerTokenTwilioRestClient client) {
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ page.getNextPageUrl(Domains.PREVIEWIAM.toString())
+ );
+ return pageForRequest(client, request);
+ }
+
+ @Override
+ public Page getPage(final String targetUrl, final BearerTokenTwilioRestClient client) {
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ targetUrl
+ );
+
+ return pageForRequest(client, request);
+ }
+ private void addQueryParams(final BearerTokenRequest request) {
+ if (pageSize != null) {
+
+ request.addQueryParam("PageSize", pageSize.toString());
+ }
+ if (identity != null) {
+
+ request.addQueryParam("Identity", identity);
+ }
+ if (scope != null) {
+
+ request.addQueryParam("Scope", scope);
+ }
+
+ if(getPageSize() != null) {
+ request.addQueryParam("PageSize", Integer.toString(getPageSize()));
+ }
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/User.java b/src/main/java/com/twilio/rest/previewiam/organizations/User.java
new file mode 100644
index 000000000..4da49d4e0
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/User.java
@@ -0,0 +1,349 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.twilio.base.bearertoken.Resource;
+import com.twilio.exception.ApiConnectionException;
+
+import com.twilio.exception.ApiException;
+
+import lombok.ToString;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.time.ZonedDateTime;
+
+import java.util.List;
+import java.util.Objects;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@ToString
+public class User extends Resource {
+ private static final long serialVersionUID = 281207691925540L;
+
+
+ @ToString
+ static public class ScimName {
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("givenName")
+ @Getter @Setter private String givenName;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("familyName")
+ @Getter @Setter private String familyName;
+
+
+ public static ScimName fromJson(String jsonString, ObjectMapper mapper) throws IOException {
+ return mapper.readValue(jsonString, ScimName.class);
+ }
+ }
+ @ToString
+ static public class ScimEmailAddress {
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("primary")
+ @Getter @Setter private Boolean primary;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("value")
+ @Getter @Setter private String value;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("type")
+ @Getter @Setter private String type;
+
+
+ public static ScimEmailAddress fromJson(String jsonString, ObjectMapper mapper) throws IOException {
+ return mapper.readValue(jsonString, ScimEmailAddress.class);
+ }
+ }
+ @ToString
+ static public class ScimMeta {
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("resourceType")
+ @Getter @Setter private String resourceType;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("created")
+ @Getter @Setter private ZonedDateTime created;
+ public String getCreated() {
+ return created.toInstant().toString();
+ }
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("lastModified")
+ @Getter @Setter private ZonedDateTime lastModified;
+ public String getLastModified() {
+ return lastModified.toInstant().toString();
+ }
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("version")
+ @Getter @Setter private String version;
+
+
+ public static ScimMeta fromJson(String jsonString, ObjectMapper mapper) throws IOException {
+ return mapper.readValue(jsonString, ScimMeta.class);
+ }
+ }
+ @ToString
+ static public class ScimUser {
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("id")
+ @Getter @Setter private String id;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("externalId")
+ @Getter @Setter private String externalId;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("userName")
+ @Getter @Setter private String userName;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("displayName")
+ @Getter @Setter private String displayName;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("name")
+ @Getter @Setter private ScimName name;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("emails")
+ @Getter @Setter private List emails;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("active")
+ @Getter @Setter private Boolean active;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("locale")
+ @Getter @Setter private String locale;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("timezone")
+ @Getter @Setter private String timezone;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("schemas")
+ @Getter @Setter private List schemas;
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("meta")
+ @Getter @Setter private ScimMeta meta;
+
+ public ScimUser(final String userName ) {
+ this.userName = userName;
+ }
+
+ public static ScimUser fromJson(String jsonString, ObjectMapper mapper) throws IOException {
+ return mapper.readValue(jsonString, ScimUser.class);
+ }
+ }
+
+ public static UserCreator creator(final String pathOrganizationSid, final User.ScimUser scimUser){
+ return new UserCreator(pathOrganizationSid, scimUser);
+ }
+
+ public static UserDeleter deleter(final String pathOrganizationSid, final String pathUserSid){
+ return new UserDeleter(pathOrganizationSid, pathUserSid);
+ }
+
+ public static UserFetcher fetcher(final String pathOrganizationSid, final String pathUserSid){
+ return new UserFetcher(pathOrganizationSid, pathUserSid);
+ }
+
+ public static UserReader reader(final String pathOrganizationSid){
+ return new UserReader(pathOrganizationSid);
+ }
+
+ public static UserUpdater updater(final String pathOrganizationSid, final String pathUserSid, final User.ScimUser scimUser){
+ return new UserUpdater(pathOrganizationSid, pathUserSid, scimUser);
+ }
+
+ /**
+ * Converts a JSON String into a User object using the provided ObjectMapper.
+ *
+ * @param json Raw JSON String
+ * @param objectMapper Jackson ObjectMapper
+ * @return User object represented by the provided JSON
+ */
+ public static User fromJson(final String json, final ObjectMapper objectMapper) {
+ // Convert all checked exceptions to Runtime
+ try {
+ return objectMapper.readValue(json, User.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 User object using the provided
+ * ObjectMapper.
+ *
+ * @param json Raw JSON InputStream
+ * @param objectMapper Jackson ObjectMapper
+ * @return User object represented by the provided JSON
+ */
+ public static User fromJson(final InputStream json, final ObjectMapper objectMapper) {
+ // Convert all checked exceptions to Runtime
+ try {
+ return objectMapper.readValue(json, User.class);
+ } catch (final JsonMappingException | JsonParseException e) {
+ throw new ApiException(e.getMessage(), e);
+ } catch (final IOException e) {
+ throw new ApiConnectionException(e.getMessage(), e);
+ }
+ }
+ public static String toJson(Object object, ObjectMapper mapper) {
+ try {
+ return mapper.writeValueAsString(object);
+ } catch (final JsonMappingException e) {
+ throw new ApiException(e.getMessage(), e);
+ } catch (JsonProcessingException e) {
+ throw new ApiException(e.getMessage(), e);
+ } catch (final IOException e) {
+ throw new ApiConnectionException(e.getMessage(), e);
+ }
+ }
+ private final String id;
+ private final String externalId;
+ private final String userName;
+ private final String displayName;
+ private final ScimName name;
+ private final List emails;
+ private final Boolean active;
+ private final String locale;
+ private final String timezone;
+ private final List schemas;
+ private final ScimMeta meta;
+
+ @JsonCreator
+ private User(
+ @JsonProperty("id")
+ final String id,
+
+ @JsonProperty("external_id")
+ final String externalId,
+
+ @JsonProperty("user_name")
+ final String userName,
+
+ @JsonProperty("display_name")
+ final String displayName,
+
+ @JsonProperty("name")
+ final ScimName name,
+
+ @JsonProperty("emails")
+ final List emails,
+
+ @JsonProperty("active")
+ final Boolean active,
+
+ @JsonProperty("locale")
+ final String locale,
+
+ @JsonProperty("timezone")
+ final String timezone,
+
+ @JsonProperty("schemas")
+ final List schemas,
+
+ @JsonProperty("meta")
+ final ScimMeta meta
+ ) {
+ this.id = id;
+ this.externalId = externalId;
+ this.userName = userName;
+ this.displayName = displayName;
+ this.name = name;
+ this.emails = emails;
+ this.active = active;
+ this.locale = locale;
+ this.timezone = timezone;
+ this.schemas = schemas;
+ this.meta = meta;
+ }
+
+ public final String getId() {
+ return this.id;
+ }
+ public final String getExternalId() {
+ return this.externalId;
+ }
+ public final String getUserName() {
+ return this.userName;
+ }
+ public final String getDisplayName() {
+ return this.displayName;
+ }
+ public final ScimName getName() {
+ return this.name;
+ }
+ public final List getEmails() {
+ return this.emails;
+ }
+ public final Boolean getActive() {
+ return this.active;
+ }
+ public final String getLocale() {
+ return this.locale;
+ }
+ public final String getTimezone() {
+ return this.timezone;
+ }
+ public final List getSchemas() {
+ return this.schemas;
+ }
+ public final ScimMeta getMeta() {
+ return this.meta;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this==o) {
+ return true;
+ }
+
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ User other = (User) o;
+
+ return Objects.equals(id, other.id) && Objects.equals(externalId, other.externalId) && Objects.equals(userName, other.userName) && Objects.equals(displayName, other.displayName) && Objects.equals(name, other.name) && Objects.equals(emails, other.emails) && Objects.equals(active, other.active) && Objects.equals(locale, other.locale) && Objects.equals(timezone, other.timezone) && Objects.equals(schemas, other.schemas) && Objects.equals(meta, other.meta) ;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, externalId, userName, displayName, name, emails, active, locale, timezone, schemas, meta);
+ }
+
+
+}
+
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/UserCreator.java b/src/main/java/com/twilio/rest/previewiam/organizations/UserCreator.java
new file mode 100644
index 000000000..0e5453c12
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/UserCreator.java
@@ -0,0 +1,80 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.twilio.constant.EnumConstants;
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+
+import com.twilio.base.bearertoken.Creator;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+public class UserCreator extends Creator{
+ private String pathOrganizationSid;
+ private User.ScimUser scimUser;
+
+ public UserCreator(final String pathOrganizationSid, final User.ScimUser scimUser) {
+ this.pathOrganizationSid = pathOrganizationSid;
+ this.scimUser = scimUser;
+ }
+
+ public UserCreator setScimUser(final User.ScimUser scimUser){
+ this.scimUser = scimUser;
+ return this;
+ }
+
+ @Override
+ public User create(final BearerTokenTwilioRestClient client){
+ String path = "/Organizations/{organizationSid}/scim/Users";
+
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+ path = path.replace("{"+"ScimUser"+"}", this.scimUser.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.POST,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+ request.setContentType(EnumConstants.ContentType.JSON);
+ addPostParams(request, client);
+ Response response = client.request(request);
+ if (response == null) {
+ throw new ApiConnectionException("User creation failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 User.fromJson(response.getStream(), client.getObjectMapper());
+ }
+ private void addPostParams(final BearerTokenRequest request, BearerTokenTwilioRestClient client) {
+ ObjectMapper objectMapper = client.getObjectMapper();
+ if (scimUser != null) {
+ request.setBody(User.toJson(scimUser, objectMapper));
+ }
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/UserDeleter.java b/src/main/java/com/twilio/rest/previewiam/organizations/UserDeleter.java
new file mode 100644
index 000000000..cf4325d5e
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/UserDeleter.java
@@ -0,0 +1,65 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+import com.twilio.base.bearertoken.Deleter;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+public class UserDeleter extends Deleter {
+ private String pathOrganizationSid;
+ private String pathUserSid;
+
+ public UserDeleter(final String pathOrganizationSid, final String pathUserSid){
+ this.pathOrganizationSid = pathOrganizationSid;
+ this.pathUserSid = pathUserSid;
+ }
+
+
+ @Override
+ public boolean delete(final BearerTokenTwilioRestClient client) {
+ String path = "/Organizations/{organizationSid}/scim/Users/{userSid}";
+
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+ path = path.replace("{"+"userSid"+"}", this.pathUserSid.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.DELETE,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+ Response response = client.request(request);
+
+ if (response == null) {
+ throw new ApiConnectionException("User delete failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 response.getStatusCode() == 204;
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/UserFetcher.java b/src/main/java/com/twilio/rest/previewiam/organizations/UserFetcher.java
new file mode 100644
index 000000000..d3d2d9597
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/UserFetcher.java
@@ -0,0 +1,67 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+
+import com.twilio.base.bearertoken.Fetcher;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+public class UserFetcher extends Fetcher {
+ private String pathOrganizationSid;
+ private String pathUserSid;
+
+ public UserFetcher(final String pathOrganizationSid, final String pathUserSid){
+ this.pathOrganizationSid = pathOrganizationSid;
+ this.pathUserSid = pathUserSid;
+ }
+
+
+ @Override
+ public User fetch(final BearerTokenTwilioRestClient client) {
+ String path = "/Organizations/{organizationSid}/scim/Users/{userSid}";
+
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+ path = path.replace("{"+"userSid"+"}", this.pathUserSid.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+ Response response = client.request(request);
+
+ if (response == null) {
+ throw new ApiConnectionException("User fetch failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 User.fromJson(response.getStream(), client.getObjectMapper());
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/UserReader.java b/src/main/java/com/twilio/rest/previewiam/organizations/UserReader.java
new file mode 100644
index 000000000..291693d28
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/UserReader.java
@@ -0,0 +1,123 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+import com.twilio.base.bearertoken.Page;
+import com.twilio.base.bearertoken.Reader;
+import com.twilio.base.bearertoken.ResourceSet;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+public class UserReader extends Reader {
+ private String pathOrganizationSid;
+ private String filter;
+
+ public UserReader(final String pathOrganizationSid){
+ this.pathOrganizationSid = pathOrganizationSid;
+ }
+
+ public UserReader setFilter(final String filter){
+ this.filter = filter;
+ return this;
+ }
+
+ @Override
+ public ResourceSet read(final BearerTokenTwilioRestClient client) {
+ return new ResourceSet<>(this, client, firstPage(client));
+ }
+
+ public Page firstPage(final BearerTokenTwilioRestClient client) {
+ String path = "/Organizations/{organizationSid}/scim/Users";
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+
+ addQueryParams(request);
+ return pageForRequest(client, request);
+ }
+
+ private Page pageForRequest(final BearerTokenTwilioRestClient client, final BearerTokenRequest request) {
+ Response response = client.request(request);
+
+ if (response == null) {
+ throw new ApiConnectionException("User read failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 Page.fromJson(
+ "Resources",
+ response.getContent(),
+ User.class,
+ client.getObjectMapper()
+ );
+ }
+
+ @Override
+ public Page previousPage(final Page page, final BearerTokenTwilioRestClient client) {
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ page.getPreviousPageUrl(Domains.PREVIEWIAM.toString())
+ );
+ return pageForRequest(client, request);
+ }
+
+
+ @Override
+ public Page nextPage(final Page page, final BearerTokenTwilioRestClient client) {
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ page.getNextPageUrl(Domains.PREVIEWIAM.toString())
+ );
+ return pageForRequest(client, request);
+ }
+
+ @Override
+ public Page getPage(final String targetUrl, final BearerTokenTwilioRestClient client) {
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.GET,
+ targetUrl
+ );
+
+ return pageForRequest(client, request);
+ }
+ private void addQueryParams(final BearerTokenRequest request) {
+ if (filter != null) {
+
+ request.addQueryParam("filter", filter);
+ }
+
+ if(getPageSize() != null) {
+ request.addQueryParam("PageSize", Integer.toString(getPageSize()));
+ }
+ }
+}
diff --git a/src/main/java/com/twilio/rest/previewiam/organizations/UserUpdater.java b/src/main/java/com/twilio/rest/previewiam/organizations/UserUpdater.java
new file mode 100644
index 000000000..c63afb72c
--- /dev/null
+++ b/src/main/java/com/twilio/rest/previewiam/organizations/UserUpdater.java
@@ -0,0 +1,97 @@
+/*
+ * This code was generated by
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
+ *
+ * Organization Public API
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package com.twilio.rest.previewiam.organizations;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.twilio.constant.EnumConstants;
+import com.twilio.exception.ApiConnectionException;
+import com.twilio.exception.ApiException;
+import com.twilio.exception.RestException;
+import com.twilio.http.HttpMethod;
+import com.twilio.http.Response;
+import com.twilio.rest.Domains;
+
+
+
+
+import com.twilio.base.bearertoken.Updater;
+import com.twilio.http.bearertoken.BearerTokenRequest;
+import com.twilio.http.bearertoken.BearerTokenTwilioRestClient;
+
+
+public class UserUpdater extends Updater{
+ private String pathOrganizationSid;
+ private String pathUserSid;
+ private User.ScimUser scimUser;
+ private String ifMatch;
+
+ public UserUpdater(final String pathOrganizationSid, final String pathUserSid, final User.ScimUser scimUser){
+ this.pathOrganizationSid = pathOrganizationSid;
+ this.pathUserSid = pathUserSid;
+ this.scimUser = scimUser;
+ }
+
+ public UserUpdater setScimUser(final User.ScimUser scimUser){
+ this.scimUser = scimUser;
+ return this;
+ }
+ public UserUpdater setIfMatch(final String ifMatch){
+ this.ifMatch = ifMatch;
+ return this;
+ }
+
+ @Override
+ public User update(final BearerTokenTwilioRestClient client){
+ String path = "/Organizations/{organizationSid}/scim/Users/{userSid}";
+
+ path = path.replace("{"+"organizationSid"+"}", this.pathOrganizationSid.toString());
+ path = path.replace("{"+"userSid"+"}", this.pathUserSid.toString());
+ path = path.replace("{"+"ScimUser"+"}", this.scimUser.toString());
+
+ BearerTokenRequest request = new BearerTokenRequest(
+ HttpMethod.PUT,
+ Domains.PREVIEWIAM.toString(),
+ path
+ );
+ request.setContentType(EnumConstants.ContentType.JSON);
+ addPostParams(request, client);
+ addHeaderParams(request);
+ Response response = client.request(request);
+ if (response == null) {
+ throw new ApiConnectionException("User update failed: Unable to connect to server");
+ } else if (!BearerTokenTwilioRestClient.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 User.fromJson(response.getStream(), client.getObjectMapper());
+ }
+
+ private void addPostParams(final BearerTokenRequest request, BearerTokenTwilioRestClient client) {
+ ObjectMapper objectMapper = client.getObjectMapper();
+ if (scimUser != null) {
+ request.setBody(User.toJson(scimUser, objectMapper));
+ }
+ }
+ private void addHeaderParams(final BearerTokenRequest request) {
+ if (ifMatch != null) {
+ request.addHeaderParam("If-Match", ifMatch);
+
+ }
+ }
+}
diff --git a/src/test/java/com/twilio/ClusterTest.java b/src/test/java/com/twilio/ClusterTest.java
index 93a92c4ca..ae4dfe7fd 100644
--- a/src/test/java/com/twilio/ClusterTest.java
+++ b/src/test/java/com/twilio/ClusterTest.java
@@ -17,94 +17,44 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.twilio.rest.previewiam.organizations.Account;
+import com.twilio.rest.previewiam.organizations.Token;
+import com.twilio.base.bearertoken.ResourceSet;
+import com.twilio.http.bearertoken.OrgsTokenManager;
import static org.junit.Assert.*;
public class ClusterTest {
String fromNumber;
String toNumber;
+ String grantType;
+ String clientId;
+ String clientSecret;
+ String organisationSid;
@Before
public void setUp() {
// only run when ClusterTest property is passed (mvn test -Dtest="ClusterTest"), skip test run on mvn test
Assume.assumeThat(System.getProperty("Test"), CoreMatchers.is("ClusterTest"));
- fromNumber = System.getenv("TWILIO_FROM_NUMBER");
- toNumber = System.getenv("TWILIO_TO_NUMBER");
- String apiKey = System.getenv("TWILIO_API_KEY");
- String secret = System.getenv("TWILIO_API_SECRET");
- String accountSid = System.getenv("TWILIO_ACCOUNT_SID");
- Twilio.init(apiKey, secret, accountSid);
- }
-
- @Test
- public void testSendingAText() {
- Message message = Message.creator(
- new com.twilio.type.PhoneNumber(toNumber), new com.twilio.type.PhoneNumber(fromNumber),
- "Where's Wallace?")
- .create();
- assertNotNull(message);
- assertTrue(message.getBody().contains("Where's Wallace?"));
- assertEquals(fromNumber, message.getFrom().toString());
- assertEquals(toNumber, message.getTo().toString());
- }
-
- @Test
- public void testListingNumbers() {
- Page phoneNumbers = IncomingPhoneNumber.reader().firstPage();
- assertNotNull(phoneNumbers);
- assertTrue(phoneNumbers.getRecords().size() > 0);
- }
+ grantType = "client_credentials";
+ clientId = "client_id";
+ clientSecret = "client_secret";
+ organisationSid = "organisation_sid";
- @Test
- public void testListingANumber() {
- IncomingPhoneNumberReader phoneNumberReader =
- IncomingPhoneNumber.reader();
- phoneNumberReader.setPhoneNumber(fromNumber);
- Page phoneNumbers = phoneNumberReader.firstPage();
- assertNotNull(phoneNumbers);
- assertEquals(fromNumber, phoneNumbers.getRecords().get(0).getPhoneNumber().toString());
}
@Test
- public void testSpecialCharacters() {
- Service service = Service.creator("service|friendly&name").create();
- assertNotNull(service);
-
- User user = User.creator(service.getSid(), "user|identity&string").create();
- assertNotNull(user);
+ public void testOrgsApi(){
- boolean isUserDeleted = User.deleter(service.getSid(), user.getSid()).delete();
- assertTrue(isUserDeleted);
+ //Setting access token
+ TwilioOrgsTokenAuth.init(grantType, clientId, clientSecret);
- boolean isServiceDeleted = Service.deleter(service.getSid()).delete();
- assertTrue(isServiceDeleted);
+ //Fetching the account information
+ ResourceSet accountSet = Account.reader(organisationSid).read();
+ String accountSid = accountSet.iterator().next().getAccountSid();
+ System.out.println(accountSid);
}
- @Test
- public void testListParams() {
- Map sinkConfiguration = new HashMap<>();
- sinkConfiguration.put("destination", "http://example.org/webhook");
- sinkConfiguration.put("method", "post");
- sinkConfiguration.put("batch_events",false);
- List