Skip to content

Commit

Permalink
feat: Support for token based authentication and no auth rest calls (#…
Browse files Browse the repository at this point in the history
…587)

This reverts commit 7f53ea0.
  • Loading branch information
AsabuHere committed Jun 27, 2024
1 parent 7f53ea0 commit 4fca828
Show file tree
Hide file tree
Showing 36 changed files with 1,678 additions and 179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.api.v2010;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Creator;
import com.twilio.constant.EnumConstants;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
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.math.BigDecimal;
import java.util.List;
Expand All @@ -52,6 +49,10 @@

import java.net.URI;

import com.twilio.base.Creator;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;

public class AccountCreator extends Creator<Account>{
private Account.XTwilioWebhookEnabled xTwilioWebhookEnabled;
private URI recordingStatusCallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.api.v2010;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Deleter;
import com.twilio.converter.Promoter;
import com.twilio.constant.EnumConstants;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
import com.twilio.converter.Converter;
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.time.LocalDate;
import java.io.IOException;
Expand All @@ -45,6 +42,10 @@

import lombok.ToString;

import com.twilio.base.Deleter;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;

public class AccountDeleter extends Deleter<Account> {
private String pathSid;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.api.v2010;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Fetcher;
import com.twilio.constant.EnumConstants;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
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.io.IOException;
Expand All @@ -46,6 +43,10 @@

import lombok.ToString;

import com.twilio.base.Fetcher;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;

public class AccountFetcher extends Fetcher<Account> {
private String pathSid;

Expand All @@ -71,7 +72,7 @@ public Account fetch(final TwilioRestClient client) {
Response response = client.request(request);

if (response == null) {
throw new ApiConnectionException("Account fetch failed: Unable to connect to server");
throw new ApiConnectionException("Account fetch failed: Unable to connect to server");
} else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) {
RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper());
if (restException == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,16 @@
package com.twilio.rest.api.v2010;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Reader;
import com.twilio.constant.EnumConstants;
import com.twilio.base.ResourceSet;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
import com.twilio.converter.PrefixedCollapsibleMap;
import com.twilio.converter.Converter;
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 com.twilio.base.Page;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.io.IOException;
Expand All @@ -47,6 +42,12 @@

import lombok.ToString;

import com.twilio.base.Page;
import com.twilio.base.Reader;
import com.twilio.base.ResourceSet;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;

public class AccountReader extends Reader<Account> {
private ZonedDateTime dateCreated;
private LocalDate dateTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.api.v2010;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Updater;
import com.twilio.constant.EnumConstants;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
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.time.format.DateTimeFormatter;
import com.twilio.converter.DateConverter;
Expand All @@ -46,6 +43,11 @@

import lombok.ToString;

import com.twilio.base.Updater;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;


public class AccountUpdater extends Updater<Account>{
private Account.Status status;
private String pathSid;
Expand Down Expand Up @@ -96,6 +98,7 @@ public Account update(final TwilioRestClient client){

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

private void addPostParams(final Request request) {
if (pauseBehavior != null) {
request.addPostParam("PauseBehavior", pauseBehavior);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.api.v2010.account;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Creator;
import com.twilio.constant.EnumConstants;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
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.math.BigDecimal;
import java.util.List;
Expand All @@ -52,6 +49,10 @@

import java.net.URI;

import com.twilio.base.Creator;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;

public class CallCreator extends Creator<Call>{
private String requiredStringProperty;
private HttpMethod testMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.api.v2010.account;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Deleter;
import com.twilio.converter.Promoter;
import com.twilio.constant.EnumConstants;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
import com.twilio.converter.Converter;
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.time.LocalDate;
import java.io.IOException;
Expand All @@ -45,6 +42,10 @@

import lombok.ToString;

import com.twilio.base.Deleter;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;

public class CallDeleter extends Deleter<Call> {
private Integer pathTestInteger;
private String pathAccountSid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.api.v2010.account;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Fetcher;
import com.twilio.constant.EnumConstants;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
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.io.IOException;
Expand All @@ -46,6 +43,10 @@

import lombok.ToString;

import com.twilio.base.Fetcher;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;

public class CallFetcher extends Fetcher<Call> {
private Integer pathTestInteger;
private String pathAccountSid;
Expand Down Expand Up @@ -75,7 +76,7 @@ public Call fetch(final TwilioRestClient client) {
Response response = client.request(request);

if (response == null) {
throw new ApiConnectionException("Call fetch failed: Unable to connect to server");
throw new ApiConnectionException("Call fetch failed: Unable to connect to server");
} else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) {
RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper());
if (restException == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.api.v2010.account.call;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Updater;
import com.twilio.constant.EnumConstants;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
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.time.format.DateTimeFormatter;
import com.twilio.converter.DateConverter;
Expand All @@ -46,6 +43,11 @@

import lombok.ToString;

import com.twilio.base.Updater;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;


public class FeedbackCallSummaryUpdater extends Updater<FeedbackCallSummary>{
private String pathSid;
private LocalDate endDate;
Expand Down Expand Up @@ -108,6 +110,7 @@ public FeedbackCallSummary update(final TwilioRestClient client){

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

private void addPostParams(final Request request) {
if (accountSid != null) {
request.addPostParam("AccountSid", accountSid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.flexapi.v1;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Updater;
import com.twilio.constant.EnumConstants;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
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.time.format.DateTimeFormatter;
import com.twilio.converter.DateConverter;
Expand All @@ -46,6 +43,11 @@

import lombok.ToString;

import com.twilio.base.Updater;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;


public class CallUpdater extends Updater<Call>{
private String pathSid;

Expand Down Expand Up @@ -78,4 +80,5 @@ public Call update(final TwilioRestClient client){

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.twilio.rest.flexapi.v1.credential;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Deleter;
import com.twilio.converter.Promoter;
import com.twilio.constant.EnumConstants;
import com.twilio.exception.ApiConnectionException;
Expand All @@ -24,9 +23,7 @@
import com.twilio.converter.Converter;
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.time.LocalDate;
import java.io.IOException;
Expand All @@ -45,6 +42,10 @@

import lombok.ToString;

import com.twilio.base.Deleter;
import com.twilio.http.Request;
import com.twilio.http.TwilioRestClient;

public class AwsDeleter extends Deleter<Aws> {
private String pathSid;

Expand Down
Loading

0 comments on commit 4fca828

Please sign in to comment.