diff --git a/examples/csharp/src/Twilio/Rest/Api/V2010/Account/Call/FeedbackCallSummaryResource.cs b/examples/csharp/src/Twilio/Rest/Api/V2010/Account/Call/FeedbackCallSummaryResource.cs index 91e2b7351..d211831c7 100644 --- a/examples/csharp/src/Twilio/Rest/Api/V2010/Account/Call/FeedbackCallSummaryResource.cs +++ b/examples/csharp/src/Twilio/Rest/Api/V2010/Account/Call/FeedbackCallSummaryResource.cs @@ -25,8 +25,6 @@ using Twilio.Types; - - namespace Twilio.Rest.Api.V2010.Account.Call { public class FeedbackCallSummaryResource : Resource diff --git a/examples/csharp/src/Twilio/Rest/Api/V2010/Account/CallResource.cs b/examples/csharp/src/Twilio/Rest/Api/V2010/Account/CallResource.cs index 7f0c78496..ad0d34fd9 100644 --- a/examples/csharp/src/Twilio/Rest/Api/V2010/Account/CallResource.cs +++ b/examples/csharp/src/Twilio/Rest/Api/V2010/Account/CallResource.cs @@ -25,8 +25,6 @@ using Twilio.Types; - - namespace Twilio.Rest.Api.V2010.Account { public class CallResource : Resource diff --git a/examples/csharp/src/Twilio/Rest/Api/V2010/AccountResource.cs b/examples/csharp/src/Twilio/Rest/Api/V2010/AccountResource.cs index 77545c99d..f2719523b 100644 --- a/examples/csharp/src/Twilio/Rest/Api/V2010/AccountResource.cs +++ b/examples/csharp/src/Twilio/Rest/Api/V2010/AccountResource.cs @@ -25,8 +25,6 @@ using Twilio.Types; - - namespace Twilio.Rest.Api.V2010 { public class AccountResource : Resource diff --git a/examples/csharp/src/Twilio/Rest/FlexApi/V1/CallResource.cs b/examples/csharp/src/Twilio/Rest/FlexApi/V1/CallResource.cs index 17d61aa0a..bbe77b31f 100644 --- a/examples/csharp/src/Twilio/Rest/FlexApi/V1/CallResource.cs +++ b/examples/csharp/src/Twilio/Rest/FlexApi/V1/CallResource.cs @@ -25,8 +25,6 @@ - - namespace Twilio.Rest.FlexApi.V1 { public class CallResource : Resource diff --git a/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/Aws/HistoryResource.cs b/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/Aws/HistoryResource.cs index 52d16c36f..6f0243eba 100644 --- a/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/Aws/HistoryResource.cs +++ b/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/Aws/HistoryResource.cs @@ -25,8 +25,6 @@ - - namespace Twilio.Rest.FlexApi.V1.Credential.Aws { public class HistoryResource : Resource diff --git a/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/AwsResource.cs b/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/AwsResource.cs index 8b9f121fb..fbbdf9632 100644 --- a/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/AwsResource.cs +++ b/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/AwsResource.cs @@ -25,8 +25,6 @@ - - namespace Twilio.Rest.FlexApi.V1.Credential { public class AwsResource : Resource diff --git a/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/NewCredentialsResource.cs b/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/NewCredentialsResource.cs index 8b9293561..515501877 100644 --- a/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/NewCredentialsResource.cs +++ b/examples/csharp/src/Twilio/Rest/FlexApi/V1/Credential/NewCredentialsResource.cs @@ -25,8 +25,6 @@ using Twilio.Types; - - namespace Twilio.Rest.FlexApi.V1.Credential { public class NewCredentialsResource : Resource diff --git a/examples/csharp/src/Twilio/Rest/PreviewIam/Organizations/UserResource.cs b/examples/csharp/src/Twilio/Rest/PreviewIam/Organizations/UserResource.cs index 0d8660353..24f1cb684 100644 --- a/examples/csharp/src/Twilio/Rest/PreviewIam/Organizations/UserResource.cs +++ b/examples/csharp/src/Twilio/Rest/PreviewIam/Organizations/UserResource.cs @@ -23,10 +23,6 @@ using Twilio.Exceptions; using Twilio.Http; -using Twilio.Base.BearerToken; -using Twilio.Clients.BearerToken; -using Twilio.Http.BearerToken; - namespace Twilio.Rest.PreviewIam.Organizations @@ -238,7 +234,7 @@ public ScimUser Build() - private static TokenRequest BuildCreateRequest(CreateUserOptions options, TwilioOrgsTokenRestClient client) + private static Request BuildCreateRequest(CreateUserOptions options, ITwilioRestClient client) { string path = "/Organizations/{organizationSid}/scim/Users"; @@ -246,7 +242,7 @@ private static TokenRequest BuildCreateRequest(CreateUserOptions options, Twilio string PathOrganizationSid = options.PathOrganizationSid.ToString(); path = path.Replace("{"+"OrganizationSid"+"}", PathOrganizationSid); - return new TokenRequest( + return new Request( HttpMethod.Post, Rest.Domain.PreviewIam, path, @@ -261,9 +257,9 @@ private static TokenRequest BuildCreateRequest(CreateUserOptions options, Twilio /// Create User parameters /// Client to make requests to Twilio /// A single instance of User - public static UserResource Create(CreateUserOptions options, TwilioOrgsTokenRestClient client = null) + public static UserResource Create(CreateUserOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildCreateRequest(options, client)); return FromJson(response.Content); } @@ -273,9 +269,9 @@ public static UserResource Create(CreateUserOptions options, TwilioOrgsTokenRest /// Create User parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task CreateAsync(CreateUserOptions options, TwilioOrgsTokenRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateUserOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return FromJson(response.Content); } @@ -289,7 +285,7 @@ public static async System.Threading.Tasks.Task CreateAsync(Create public static UserResource Create( string pathOrganizationSid, UserResource.ScimUser scimUser, - TwilioOrgsTokenRestClient client = null) + ITwilioRestClient client = null) { var options = new CreateUserOptions(pathOrganizationSid, scimUser){ }; return Create(options, client); @@ -304,7 +300,7 @@ public static UserResource Create( public static async System.Threading.Tasks.Task CreateAsync( string pathOrganizationSid, UserResource.ScimUser scimUser, - TwilioOrgsTokenRestClient client = null) + ITwilioRestClient client = null) { var options = new CreateUserOptions(pathOrganizationSid, scimUser){ }; return await CreateAsync(options, client); @@ -315,7 +311,7 @@ public static async System.Threading.Tasks.Task CreateAsync( /// Delete User parameters /// Client to make requests to Twilio /// A single instance of User - private static TokenRequest BuildDeleteRequest(DeleteUserOptions options, TwilioOrgsTokenRestClient client) + private static Request BuildDeleteRequest(DeleteUserOptions options, ITwilioRestClient client) { string path = "/Organizations/{organizationSid}/scim/Users/{userSid}"; @@ -325,7 +321,7 @@ private static TokenRequest BuildDeleteRequest(DeleteUserOptions options, Twilio string PathUserSid = options.PathUserSid.ToString(); path = path.Replace("{"+"UserSid"+"}", PathUserSid); - return new TokenRequest( + return new Request( HttpMethod.Delete, Rest.Domain.PreviewIam, path, @@ -338,9 +334,9 @@ private static TokenRequest BuildDeleteRequest(DeleteUserOptions options, Twilio /// Delete User parameters /// Client to make requests to Twilio /// A single instance of User - public static bool Delete(DeleteUserOptions options, TwilioOrgsTokenRestClient client = null) + public static bool Delete(DeleteUserOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildDeleteRequest(options, client)); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } @@ -351,9 +347,9 @@ public static bool Delete(DeleteUserOptions options, TwilioOrgsTokenRestClient c /// Client to make requests to Twilio /// Task that resolves to A single instance of User public static async System.Threading.Tasks.Task DeleteAsync(DeleteUserOptions options, - TwilioOrgsTokenRestClient client = null) + ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildDeleteRequest(options, client)); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } @@ -364,7 +360,7 @@ public static async System.Threading.Tasks.Task DeleteAsync(DeleteUserOpti /// /// Client to make requests to Twilio /// A single instance of User - public static bool Delete(string pathOrganizationSid, string pathUserSid, TwilioOrgsTokenRestClient client = null) + public static bool Delete(string pathOrganizationSid, string pathUserSid, ITwilioRestClient client = null) { var options = new DeleteUserOptions(pathOrganizationSid, pathUserSid) ; return Delete(options, client); @@ -376,14 +372,14 @@ public static bool Delete(string pathOrganizationSid, string pathUserSid, Twilio /// /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task DeleteAsync(string pathOrganizationSid, string pathUserSid, TwilioOrgsTokenRestClient client = null) + public static async System.Threading.Tasks.Task DeleteAsync(string pathOrganizationSid, string pathUserSid, ITwilioRestClient client = null) { var options = new DeleteUserOptions(pathOrganizationSid, pathUserSid) ; return await DeleteAsync(options, client); } #endif - private static TokenRequest BuildFetchRequest(FetchUserOptions options, TwilioOrgsTokenRestClient client) + private static Request BuildFetchRequest(FetchUserOptions options, ITwilioRestClient client) { string path = "/Organizations/{organizationSid}/scim/Users/{userSid}"; @@ -393,7 +389,7 @@ private static TokenRequest BuildFetchRequest(FetchUserOptions options, TwilioOr string PathUserSid = options.PathUserSid.ToString(); path = path.Replace("{"+"UserSid"+"}", PathUserSid); - return new TokenRequest( + return new Request( HttpMethod.Get, Rest.Domain.PreviewIam, path, @@ -406,9 +402,9 @@ private static TokenRequest BuildFetchRequest(FetchUserOptions options, TwilioOr /// Fetch User parameters /// Client to make requests to Twilio /// A single instance of User - public static UserResource Fetch(FetchUserOptions options, TwilioOrgsTokenRestClient client = null) + public static UserResource Fetch(FetchUserOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildFetchRequest(options, client)); return FromJson(response.Content); } @@ -418,9 +414,9 @@ public static UserResource Fetch(FetchUserOptions options, TwilioOrgsTokenRestCl /// Fetch User parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task FetchAsync(FetchUserOptions options, TwilioOrgsTokenRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(FetchUserOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildFetchRequest(options, client)); return FromJson(response.Content); } @@ -433,7 +429,7 @@ public static async System.Threading.Tasks.Task FetchAsync(FetchUs public static UserResource Fetch( string pathOrganizationSid, string pathUserSid, - TwilioOrgsTokenRestClient client = null) + ITwilioRestClient client = null) { var options = new FetchUserOptions(pathOrganizationSid, pathUserSid){ }; return Fetch(options, client); @@ -445,14 +441,14 @@ public static UserResource Fetch( /// /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task FetchAsync(string pathOrganizationSid, string pathUserSid, TwilioOrgsTokenRestClient client = null) + public static async System.Threading.Tasks.Task FetchAsync(string pathOrganizationSid, string pathUserSid, ITwilioRestClient client = null) { var options = new FetchUserOptions(pathOrganizationSid, pathUserSid){ }; return await FetchAsync(options, client); } #endif - private static TokenRequest BuildReadRequest(ReadUserOptions options, TwilioOrgsTokenRestClient client) + private static Request BuildReadRequest(ReadUserOptions options, ITwilioRestClient client) { string path = "/Organizations/{organizationSid}/scim/Users"; @@ -460,7 +456,7 @@ private static TokenRequest BuildReadRequest(ReadUserOptions options, TwilioOrgs string PathOrganizationSid = options.PathOrganizationSid.ToString(); path = path.Replace("{"+"OrganizationSid"+"}", PathOrganizationSid); - return new TokenRequest( + return new Request( HttpMethod.Get, Rest.Domain.PreviewIam, path, @@ -472,12 +468,12 @@ private static TokenRequest BuildReadRequest(ReadUserOptions options, TwilioOrgs /// Read User parameters /// Client to make requests to Twilio /// A single instance of User - public static TokenResourceSet Read(ReadUserOptions options, TwilioOrgsTokenRestClient client = null) + public static ResourceSet Read(ReadUserOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildReadRequest(options, client)); var page = Page.FromJson("Resources", response.Content); - return new TokenResourceSet(page, options, client); + return new ResourceSet(page, options, client); } #if !NET35 @@ -485,13 +481,13 @@ public static TokenResourceSet Read(ReadUserOptions options, Twili /// Read User parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task> ReadAsync(ReadUserOptions options, TwilioOrgsTokenRestClient client = null) + public static async System.Threading.Tasks.Task> ReadAsync(ReadUserOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildReadRequest(options, client)); var page = Page.FromJson("Resources", response.Content); - return new TokenResourceSet(page, options, client); + return new ResourceSet(page, options, client); } #endif /// read @@ -500,11 +496,11 @@ public static async System.Threading.Tasks.Task> /// Record limit /// Client to make requests to Twilio /// A single instance of User - public static TokenResourceSet Read( + public static ResourceSet Read( string pathOrganizationSid, string filter = null, long? limit = null, - TwilioOrgsTokenRestClient client = null) + ITwilioRestClient client = null) { var options = new ReadUserOptions(pathOrganizationSid){ Filter = filter, Limit = limit}; return Read(options, client); @@ -517,11 +513,11 @@ public static TokenResourceSet Read( /// Record limit /// Client to make requests to Twilio /// Task that resolves to A single instance of User - public static async System.Threading.Tasks.Task> ReadAsync( + public static async System.Threading.Tasks.Task> ReadAsync( string pathOrganizationSid, string filter = null, long? limit = null, - TwilioOrgsTokenRestClient client = null) + ITwilioRestClient client = null) { var options = new ReadUserOptions(pathOrganizationSid){ Filter = filter, Limit = limit}; return await ReadAsync(options, client); @@ -533,11 +529,11 @@ public static async System.Threading.Tasks.Task> /// API-generated URL for the requested results page /// Client to make requests to Twilio /// The target page of records - public static Page GetPage(string targetUrl, TwilioOrgsTokenRestClient client) + public static Page GetPage(string targetUrl, ITwilioRestClient client) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); - var request = new TokenRequest( + var request = new Request( HttpMethod.Get, targetUrl ); @@ -550,9 +546,9 @@ public static Page GetPage(string targetUrl, TwilioOrgsTokenRestCl /// current page of records /// Client to make requests to Twilio /// The next page of records - public static Page NextPage(Page page, TwilioOrgsTokenRestClient client) + public static Page NextPage(Page page, ITwilioRestClient client) { - var request = new TokenRequest( + var request = new Request( HttpMethod.Get, page.GetNextPageUrl(Rest.Domain.Api) ); @@ -565,9 +561,9 @@ public static Page NextPage(Page page, TwilioOrgsTok /// current page of records /// Client to make requests to Twilio /// The previous page of records - public static Page PreviousPage(Page page, TwilioOrgsTokenRestClient client) + public static Page PreviousPage(Page page, ITwilioRestClient client) { - var request = new TokenRequest( + var request = new Request( HttpMethod.Get, page.GetPreviousPageUrl(Rest.Domain.Api) ); @@ -577,7 +573,7 @@ public static Page PreviousPage(Page page, TwilioOrg } - private static TokenRequest BuildUpdateRequest(UpdateUserOptions options, TwilioOrgsTokenRestClient client) + private static Request BuildUpdateRequest(UpdateUserOptions options, ITwilioRestClient client) { string path = "/Organizations/{organizationSid}/scim/Users/{userSid}"; @@ -587,7 +583,7 @@ private static TokenRequest BuildUpdateRequest(UpdateUserOptions options, Twilio string PathUserSid = options.PathUserSid.ToString(); path = path.Replace("{"+"UserSid"+"}", PathUserSid); - return new TokenRequest( + return new Request( HttpMethod.Put, Rest.Domain.PreviewIam, path, @@ -602,9 +598,9 @@ private static TokenRequest BuildUpdateRequest(UpdateUserOptions options, Twilio /// Update User parameters /// Client to make requests to Twilio /// A single instance of User - public static UserResource Update(UpdateUserOptions options, TwilioOrgsTokenRestClient client = null) + public static UserResource Update(UpdateUserOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildUpdateRequest(options, client)); return FromJson(response.Content); } @@ -615,9 +611,9 @@ public static UserResource Update(UpdateUserOptions options, TwilioOrgsTokenRest /// Task that resolves to A single instance of User #if !NET35 public static async System.Threading.Tasks.Task UpdateAsync(UpdateUserOptions options, - TwilioOrgsTokenRestClient client = null) + ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetRestClient(); + client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildUpdateRequest(options, client)); return FromJson(response.Content); } @@ -635,7 +631,7 @@ public static UserResource Update( string pathUserSid, UserResource.ScimUser scimUser, string ifMatch = null, - TwilioOrgsTokenRestClient client = null) + ITwilioRestClient client = null) { var options = new UpdateUserOptions(pathOrganizationSid, pathUserSid, scimUser){ IfMatch = ifMatch }; return Update(options, client); @@ -654,7 +650,7 @@ public static async System.Threading.Tasks.Task UpdateAsync( string pathUserSid, UserResource.ScimUser scimUser, string ifMatch = null, - TwilioOrgsTokenRestClient client = null) + ITwilioRestClient client = null) { var options = new UpdateUserOptions(pathOrganizationSid, pathUserSid, scimUser){ IfMatch = ifMatch }; return await UpdateAsync(options, client); diff --git a/examples/csharp/src/Twilio/Rest/PreviewIam/V1/TokenResource.cs b/examples/csharp/src/Twilio/Rest/PreviewIam/V1/TokenResource.cs index 9f79ada3c..311407ac9 100644 --- a/examples/csharp/src/Twilio/Rest/PreviewIam/V1/TokenResource.cs +++ b/examples/csharp/src/Twilio/Rest/PreviewIam/V1/TokenResource.cs @@ -24,9 +24,6 @@ using Twilio.Http; -using Twilio.Clients.NoAuth; -using Twilio.Http.NoAuth; - namespace Twilio.Rest.PreviewIam.V1 { @@ -37,13 +34,13 @@ public class TokenResource : Resource - private static NoAuthRequest BuildCreateRequest(CreateTokenOptions options, TwilioNoAuthRestClient client) + private static Request BuildCreateRequest(CreateTokenOptions options, ITwilioRestClient client) { string path = "/v1/token"; - return new NoAuthRequest( + return new Request( HttpMethod.Post, Rest.Domain.PreviewIam, path, @@ -57,9 +54,9 @@ private static NoAuthRequest BuildCreateRequest(CreateTokenOptions options, Twil /// Create Token parameters /// Client to make requests to Twilio /// A single instance of Token - public static TokenResource Create(CreateTokenOptions options, TwilioNoAuthRestClient client = null) + public static TokenResource Create(CreateTokenOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetNoAuthRestClient(); + client = client ?? TwilioClient.GetNoAuthRestClient(); var response = client.Request(BuildCreateRequest(options, client)); return FromJson(response.Content); } @@ -69,9 +66,9 @@ public static TokenResource Create(CreateTokenOptions options, TwilioNoAuthRestC /// Create Token parameters /// Client to make requests to Twilio /// Task that resolves to A single instance of Token - public static async System.Threading.Tasks.Task CreateAsync(CreateTokenOptions options, TwilioNoAuthRestClient client = null) + public static async System.Threading.Tasks.Task CreateAsync(CreateTokenOptions options, ITwilioRestClient client = null) { - client = client ?? TwilioOrgsTokenAuthClient.GetNoAuthRestClient(); + client = client ?? TwilioClient.GetNoAuthRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return FromJson(response.Content); } @@ -97,7 +94,7 @@ public static TokenResource Create( string audience = null, string refreshToken = null, string scope = null, - TwilioNoAuthRestClient client = null) + ITwilioRestClient client = null) { var options = new CreateTokenOptions(grantType, clientId){ ClientSecret = clientSecret, Code = code, RedirectUri = redirectUri, Audience = audience, RefreshToken = refreshToken, Scope = scope }; return Create(options, client); @@ -124,7 +121,7 @@ public static async System.Threading.Tasks.Task CreateAsync( string audience = null, string refreshToken = null, string scope = null, - TwilioNoAuthRestClient client = null) + ITwilioRestClient client = null) { var options = new CreateTokenOptions(grantType, clientId){ ClientSecret = clientSecret, Code = code, RedirectUri = redirectUri, Audience = audience, RefreshToken = refreshToken, Scope = scope }; return await CreateAsync(options, client); diff --git a/examples/csharp/src/Twilio/Rest/Versionless/DeployedDevices/FleetResource.cs b/examples/csharp/src/Twilio/Rest/Versionless/DeployedDevices/FleetResource.cs index 3e418d40d..3a561a96a 100644 --- a/examples/csharp/src/Twilio/Rest/Versionless/DeployedDevices/FleetResource.cs +++ b/examples/csharp/src/Twilio/Rest/Versionless/DeployedDevices/FleetResource.cs @@ -25,8 +25,6 @@ - - namespace Twilio.Rest.Versionless.DeployedDevices { public class FleetResource : Resource diff --git a/examples/csharp/src/Twilio/Rest/Versionless/Understand/AssistantResource.cs b/examples/csharp/src/Twilio/Rest/Versionless/Understand/AssistantResource.cs index be48d22c3..e100edd37 100644 --- a/examples/csharp/src/Twilio/Rest/Versionless/Understand/AssistantResource.cs +++ b/examples/csharp/src/Twilio/Rest/Versionless/Understand/AssistantResource.cs @@ -25,8 +25,6 @@ - - namespace Twilio.Rest.Versionless.Understand { public class AssistantResource : Resource diff --git a/src/main/java/com/twilio/oai/TwilioCsharpGenerator.java b/src/main/java/com/twilio/oai/TwilioCsharpGenerator.java index 9d6a81eca..d44c537f3 100644 --- a/src/main/java/com/twilio/oai/TwilioCsharpGenerator.java +++ b/src/main/java/com/twilio/oai/TwilioCsharpGenerator.java @@ -133,36 +133,18 @@ public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, L final List opList = directoryStructureService.processOperations(results); CsharpApiResources apiResources = processCodegenOperations(opList); apiResources.setAuthMethod(processAuthMethods(opList)); - apiResources.setResourceSetPrefix(setResourceSetPrefix(apiResources.getAuthMethod())); - apiResources.setDomainClass(fetchDomainClass(apiResources.getAuthMethod())); apiResources.setRestClientMethodName(fetchRestClientClassName(apiResources.getAuthMethod())); apiResources.setClientName(fetchClientName(apiResources.getAuthMethod())); - apiResources.setRequestName(fetchRequestName(apiResources.getAuthMethod())); results.put("resources", apiResources); return results; } - private String fetchDomainClass(String authMethod) { - if(authMethod == BEARER_TOKEN_PREFIX || authMethod == NO_AUTH_PREFIX) return ORGS_TOKEN_CLIENT; - return BASIC_CLIENT; - } - - private String setResourceSetPrefix(String authMethod){ - return authMethod == BEARER_TOKEN_PREFIX ? "Token" : EMPTY_STRING; - } - private String fetchClientName(String authMethod){ if(authMethod == BEARER_TOKEN_PREFIX) return "TwilioOrgsTokenRestClient"; if(authMethod == NO_AUTH_PREFIX) return "TwilioNoAuthRestClient"; return "ITwilioRestClient"; } - private String fetchRequestName(String authMethod){ - if(authMethod == BEARER_TOKEN_PREFIX) return "Token"; - if(authMethod == NO_AUTH_PREFIX) return "NoAuth"; - return EMPTY_STRING; - } - private String fetchRestClientClassName(String authMethod){ return authMethod == NO_AUTH_PREFIX ? "GetNoAuthRestClient" : "GetRestClient"; } diff --git a/src/main/java/com/twilio/oai/api/CsharpApiResources.java b/src/main/java/com/twilio/oai/api/CsharpApiResources.java index 8920ac332..e790d8fbf 100644 --- a/src/main/java/com/twilio/oai/api/CsharpApiResources.java +++ b/src/main/java/com/twilio/oai/api/CsharpApiResources.java @@ -11,11 +11,8 @@ public class CsharpApiResources extends ApiResources { @Getter @Setter private String authMethod; - @Getter @Setter private String resourceSetPrefix; - @Getter @Setter private String domainClass; @Getter @Setter private String restClientMethodName; @Getter @Setter private String clientName; - @Getter @Setter private String requestName; List enums = new ArrayList<>(OperationStore.getInstance().getEnums().values()); public String resourceConstant = ApplicationConstants.RESOURCE; diff --git a/src/main/resources/twilio-csharp/Pagination.mustache b/src/main/resources/twilio-csharp/Pagination.mustache index 9d556062c..7e8cad60b 100644 --- a/src/main/resources/twilio-csharp/Pagination.mustache +++ b/src/main/resources/twilio-csharp/Pagination.mustache @@ -3,11 +3,11 @@ /// API-generated URL for the requested results page /// Client to make requests to Twilio /// The target page of records - public static Page<{{apiName}}{{resourceConstant}}> GetPage(string targetUrl, {{clientName}} client) + public static Page<{{apiName}}{{resourceConstant}}> GetPage(string targetUrl, ITwilioRestClient client) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); - var request = new {{requestName}}Request( + var request = new Request( HttpMethod.Get, targetUrl ); @@ -20,9 +20,9 @@ /// current page of records /// Client to make requests to Twilio /// The next page of records - public static Page<{{apiName}}{{resourceConstant}}> NextPage(Page<{{apiName}}{{resourceConstant}}> page, {{clientName}} client) + public static Page<{{apiName}}{{resourceConstant}}> NextPage(Page<{{apiName}}{{resourceConstant}}> page, ITwilioRestClient client) { - var request = new {{requestName}}Request( + var request = new Request( HttpMethod.Get, page.GetNextPageUrl(Rest.Domain.Api) ); @@ -35,9 +35,9 @@ /// current page of records /// Client to make requests to Twilio /// The previous page of records - public static Page<{{apiName}}{{resourceConstant}}> PreviousPage(Page<{{apiName}}{{resourceConstant}}> page, {{clientName}} client) + public static Page<{{apiName}}{{resourceConstant}}> PreviousPage(Page<{{apiName}}{{resourceConstant}}> page, ITwilioRestClient client) { - var request = new {{requestName}}Request( + var request = new Request( HttpMethod.Get, page.GetPreviousPageUrl(Rest.Domain.Api) ); diff --git a/src/main/resources/twilio-csharp/ResourceUsings.mustache b/src/main/resources/twilio-csharp/ResourceUsings.mustache index 5d8b87fed..62029cbac 100644 --- a/src/main/resources/twilio-csharp/ResourceUsings.mustache +++ b/src/main/resources/twilio-csharp/ResourceUsings.mustache @@ -7,9 +7,4 @@ using Twilio.Constant; using Twilio.Converters; using Twilio.Exceptions; using Twilio.Http; -{{#metaProperties}}{{#enum-exists-resource}}using Twilio.Types;{{/enum-exists-resource}}{{/metaProperties}} -{{#metaProperties}}{{#auth_method-bearer-token}}using Twilio.Base.BearerToken; -using Twilio.Clients.BearerToken; -using Twilio.Http.BearerToken;{{/auth_method-bearer-token}}{{/metaProperties}} -{{#metaProperties}}{{#auth_method-no-auth}}using Twilio.Clients.NoAuth; -using Twilio.Http.NoAuth;{{/auth_method-no-auth}}{{/metaProperties}} \ No newline at end of file +{{#metaProperties}}{{#enum-exists-resource}}using Twilio.Types;{{/enum-exists-resource}}{{/metaProperties}} \ No newline at end of file diff --git a/src/main/resources/twilio-csharp/resource/CreateResource.mustache b/src/main/resources/twilio-csharp/resource/CreateResource.mustache index 14e5feed4..7348e8e04 100644 --- a/src/main/resources/twilio-csharp/resource/CreateResource.mustache +++ b/src/main/resources/twilio-csharp/resource/CreateResource.mustache @@ -1,8 +1,8 @@ - private static {{requestName}}Request BuildCreateRequest(Create{{apiName}}Options options, {{clientName}} client) + private static Request BuildCreateRequest(Create{{apiName}}Options options, ITwilioRestClient client) { {{>resource/GeneratePath}} - return new {{requestName}}Request( + return new Request( {{vendorExtensions.x-http-method}}, Rest.Domain.{{domainPackage}}, path, @@ -21,9 +21,9 @@ /// Create {{apiName}} parameters /// Client to make requests to Twilio {{>resource/ReturnComments}} - public static {{apiName}}{{resourceConstant}} Create(Create{{apiName}}Options options, {{clientName}} client = null) + public static {{apiName}}{{resourceConstant}} Create(Create{{apiName}}Options options, ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = client.Request(BuildCreateRequest(options, client)); return FromJson(response.Content); } @@ -33,9 +33,9 @@ /// Create {{apiName}} parameters /// Client to make requests to Twilio {{>resource/ReturnCommentsAsync}} - public static async System.Threading.Tasks.Task<{{apiName}}{{resourceConstant}}> CreateAsync(Create{{apiName}}Options options, {{clientName}} client = null) + public static async System.Threading.Tasks.Task<{{apiName}}{{resourceConstant}}> CreateAsync(Create{{apiName}}Options options, ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return FromJson(response.Content); } @@ -45,7 +45,7 @@ {{>resource/ReturnComments}} public static {{apiName}}{{resourceConstant}} Create({{#vendorExtensions.x-request-body-param}} {{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}},{{/vendorExtensions.x-request-body-param}} - {{clientName}} client = null) + ITwilioRestClient client = null) { var options = new Create{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}){ {{#vendorExtensions.x-request-body-param}}{{^required}} {{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}},{{/-last}}{{/required}}{{/vendorExtensions.x-request-body-param}} }; return Create(options, client); @@ -56,7 +56,7 @@ {{>resource/ReturnCommentsAsync}} public static async System.Threading.Tasks.Task<{{apiName}}{{resourceConstant}}> CreateAsync({{#vendorExtensions.x-request-body-param}} {{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}},{{/vendorExtensions.x-request-body-param}} - {{clientName}} client = null) + ITwilioRestClient client = null) { var options = new Create{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}){ {{#vendorExtensions.x-request-body-param}}{{^required}} {{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}},{{/-last}}{{/required}}{{/vendorExtensions.x-request-body-param}} }; return await CreateAsync(options, client); diff --git a/src/main/resources/twilio-csharp/resource/DeleteResource.mustache b/src/main/resources/twilio-csharp/resource/DeleteResource.mustache index a21ca756b..062491f05 100644 --- a/src/main/resources/twilio-csharp/resource/DeleteResource.mustache +++ b/src/main/resources/twilio-csharp/resource/DeleteResource.mustache @@ -3,10 +3,10 @@ /// Delete {{apiName}} parameters /// Client to make requests to Twilio {{>resource/ReturnComments}} - private static {{requestName}}Request BuildDeleteRequest(Delete{{apiName}}Options options, {{clientName}} client) + private static Request BuildDeleteRequest(Delete{{apiName}}Options options, ITwilioRestClient client) { {{>resource/GeneratePath}} - return new {{requestName}}Request( + return new Request( {{vendorExtensions.x-http-method}}, Rest.Domain.{{domainPackage}}, path, @@ -19,9 +19,9 @@ /// Delete {{apiName}} parameters /// Client to make requests to Twilio {{>resource/ReturnComments}} - public static bool Delete(Delete{{apiName}}Options options, {{clientName}} client = null) + public static bool Delete(Delete{{apiName}}Options options, ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = client.Request(BuildDeleteRequest(options, client)); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } @@ -32,9 +32,9 @@ /// Client to make requests to Twilio {{>resource/ReturnCommentsAsync}} public static async System.Threading.Tasks.Task DeleteAsync(Delete{{apiName}}Options options, - {{clientName}} client = null) + ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = await client.RequestAsync(BuildDeleteRequest(options, client)); return response.StatusCode == System.Net.HttpStatusCode.NoContent; } @@ -42,7 +42,7 @@ {{>Summary}}{{>resource/MethodsComments}} {{>resource/ReturnComments}} - public static bool Delete({{#vendorExtensions.x-request-body-param}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}}, {{/vendorExtensions.x-request-body-param}}{{clientName}} client = null) + public static bool Delete({{#vendorExtensions.x-request-body-param}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}}, {{/vendorExtensions.x-request-body-param}}ITwilioRestClient client = null) { var options = new Delete{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}) {{#vendorExtensions.x-request-body-param}} {{^required}} { {{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}},{{/-last}} }{{/required}} {{/vendorExtensions.x-request-body-param}} ; return Delete(options, client); @@ -51,7 +51,7 @@ #if !NET35 {{>Summary}}{{>resource/MethodsComments}} {{>resource/ReturnCommentsAsync}} - public static async System.Threading.Tasks.Task DeleteAsync({{#vendorExtensions.x-request-body-param}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}}, {{/vendorExtensions.x-request-body-param}}{{clientName}} client = null) + public static async System.Threading.Tasks.Task DeleteAsync({{#vendorExtensions.x-request-body-param}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}}, {{/vendorExtensions.x-request-body-param}}ITwilioRestClient client = null) { var options = new Delete{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}) {{#vendorExtensions.x-request-body-param}}{{^required}} { {{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}},{{/-last}} }{{/required}}{{/vendorExtensions.x-request-body-param}}; return await DeleteAsync(options, client); diff --git a/src/main/resources/twilio-csharp/resource/FetchResource.mustache b/src/main/resources/twilio-csharp/resource/FetchResource.mustache index ede568d26..aebb634c5 100644 --- a/src/main/resources/twilio-csharp/resource/FetchResource.mustache +++ b/src/main/resources/twilio-csharp/resource/FetchResource.mustache @@ -1,8 +1,8 @@ - private static {{requestName}}Request BuildFetchRequest(Fetch{{apiName}}Options options, {{clientName}} client) + private static Request BuildFetchRequest(Fetch{{apiName}}Options options, ITwilioRestClient client) { {{>resource/GeneratePath}} - return new {{requestName}}Request( + return new Request( {{vendorExtensions.x-http-method}}, Rest.Domain.{{domainPackage}}, path, @@ -15,9 +15,9 @@ /// Fetch {{apiName}} parameters /// Client to make requests to Twilio {{>resource/ReturnComments}} - public static {{apiName}}Resource Fetch(Fetch{{apiName}}Options options, {{clientName}} client = null) + public static {{apiName}}Resource Fetch(Fetch{{apiName}}Options options, ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = client.Request(BuildFetchRequest(options, client)); return FromJson(response.Content); } @@ -27,9 +27,9 @@ /// Fetch {{apiName}} parameters /// Client to make requests to Twilio {{>resource/ReturnCommentsAsync}} - public static async System.Threading.Tasks.Task<{{apiName}}Resource> FetchAsync(Fetch{{apiName}}Options options, {{clientName}} client = null) + public static async System.Threading.Tasks.Task<{{apiName}}Resource> FetchAsync(Fetch{{apiName}}Options options, ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = await client.RequestAsync(BuildFetchRequest(options, client)); return FromJson(response.Content); } @@ -38,7 +38,7 @@ {{>resource/ReturnComments}} public static {{apiName}}{{resourceConstant}} Fetch({{#vendorExtensions.x-request-body-param}} {{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}}, {{/vendorExtensions.x-request-body-param}} - {{clientName}} client = null) + ITwilioRestClient client = null) { var options = new Fetch{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}){ {{#vendorExtensions.x-request-body-param}}{{^required}}{{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}},{{/-last}}{{/required}}{{/vendorExtensions.x-request-body-param}} }; return Fetch(options, client); @@ -47,7 +47,7 @@ #if !NET35 {{>Summary}}{{>resource/MethodsComments}} {{>resource/ReturnCommentsAsync}} - public static async System.Threading.Tasks.Task<{{apiName}}{{resourceConstant}}> FetchAsync({{#vendorExtensions.x-request-body-param}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}}, {{/vendorExtensions.x-request-body-param}}{{clientName}} client = null) + public static async System.Threading.Tasks.Task<{{apiName}}{{resourceConstant}}> FetchAsync({{#vendorExtensions.x-request-body-param}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}}, {{/vendorExtensions.x-request-body-param}}ITwilioRestClient client = null) { var options = new Fetch{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}){ {{#vendorExtensions.x-request-body-param}}{{^required}}{{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}},{{/-last}}{{/required}}{{/vendorExtensions.x-request-body-param}} }; return await FetchAsync(options, client); diff --git a/src/main/resources/twilio-csharp/resource/ReadResource.mustache b/src/main/resources/twilio-csharp/resource/ReadResource.mustache index a5ead39b4..eca96b6a3 100644 --- a/src/main/resources/twilio-csharp/resource/ReadResource.mustache +++ b/src/main/resources/twilio-csharp/resource/ReadResource.mustache @@ -1,8 +1,8 @@ - private static {{requestName}}Request BuildReadRequest(Read{{apiName}}Options options, {{clientName}} client) + private static Request BuildReadRequest(Read{{apiName}}Options options, ITwilioRestClient client) { {{>resource/GeneratePath}} - return new {{requestName}}Request( + return new Request( {{vendorExtensions.x-http-method}}, Rest.Domain.{{domainPackage}}, path, @@ -14,12 +14,12 @@ /// Read {{apiName}} parameters /// Client to make requests to Twilio {{>resource/ReturnComments}} - public static {{resourceSetPrefix}}ResourceSet<{{apiName}}{{resourceConstant}}> Read(Read{{apiName}}Options options, {{clientName}} client = null) + public static ResourceSet<{{apiName}}{{resourceConstant}}> Read(Read{{apiName}}Options options, ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = client.Request(BuildReadRequest(options, client)); var page = Page<{{apiName}}{{resourceConstant}}>.FromJson("{{recordKey}}", response.Content); - return new {{resourceSetPrefix}}ResourceSet<{{apiName}}{{resourceConstant}}>(page, options, client); + return new ResourceSet<{{apiName}}{{resourceConstant}}>(page, options, client); } #if !NET35 @@ -27,21 +27,21 @@ /// Read {{apiName}} parameters /// Client to make requests to Twilio {{>resource/ReturnCommentsAsync}} - public static async System.Threading.Tasks.Task<{{resourceSetPrefix}}ResourceSet<{{apiName}}{{resourceConstant}}>> ReadAsync(Read{{apiName}}Options options, {{clientName}} client = null) + public static async System.Threading.Tasks.Task> ReadAsync(Read{{apiName}}Options options, ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = await client.RequestAsync(BuildReadRequest(options, client)); var page = Page<{{apiName}}{{resourceConstant}}>.FromJson("{{recordKey}}", response.Content); - return new {{resourceSetPrefix}}ResourceSet<{{apiName}}{{resourceConstant}}>(page, options, client); + return new ResourceSet<{{apiName}}{{resourceConstant}}>(page, options, client); } #endif {{>Summary}}{{>resource/MethodsComments}} {{>resource/ReturnComments}} - public static {{resourceSetPrefix}}ResourceSet<{{apiName}}{{resourceConstant}}> Read({{#vendorExtensions.x-request-body-param}} + public static ResourceSet<{{apiName}}{{resourceConstant}}> Read({{#vendorExtensions.x-request-body-param}} {{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}},{{/vendorExtensions.x-request-body-param}} long? limit = null, - {{clientName}} client = null) + ITwilioRestClient client = null) { var options = new Read{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}){ {{#vendorExtensions.x-request-body-param}}{{^required}}{{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}, {{/required}}{{/vendorExtensions.x-request-body-param}}Limit = limit}; return Read(options, client); @@ -50,10 +50,10 @@ #if !NET35 {{>Summary}}{{>resource/MethodsComments}} {{>resource/ReturnCommentsAsync}} - public static async System.Threading.Tasks.Task<{{resourceSetPrefix}}ResourceSet<{{apiName}}{{resourceConstant}}>> ReadAsync({{#vendorExtensions.x-request-body-param}} + public static async System.Threading.Tasks.Task> ReadAsync({{#vendorExtensions.x-request-body-param}} {{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}},{{/vendorExtensions.x-request-body-param}} long? limit = null, - {{clientName}} client = null) + ITwilioRestClient client = null) { var options = new Read{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}){ {{#vendorExtensions.x-request-body-param}}{{^required}}{{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}, {{/required}}{{/vendorExtensions.x-request-body-param}}Limit = limit}; return await ReadAsync(options, client); diff --git a/src/main/resources/twilio-csharp/resource/UpdateResource.mustache b/src/main/resources/twilio-csharp/resource/UpdateResource.mustache index 9ce79f3c3..036ef5935 100644 --- a/src/main/resources/twilio-csharp/resource/UpdateResource.mustache +++ b/src/main/resources/twilio-csharp/resource/UpdateResource.mustache @@ -1,8 +1,8 @@ - private static {{requestName}}Request BuildUpdateRequest(Update{{apiName}}Options options, {{clientName}} client) + private static Request BuildUpdateRequest(Update{{apiName}}Options options, ITwilioRestClient client) { {{>resource/GeneratePath}} - return new {{requestName}}Request( + return new Request( {{vendorExtensions.x-http-method}}, Rest.Domain.{{domainPackage}}, path, @@ -21,9 +21,9 @@ /// Update {{apiName}} parameters /// Client to make requests to Twilio {{>resource/ReturnComments}} - public static {{apiName}}{{resourceConstant}} Update(Update{{apiName}}Options options, {{clientName}} client = null) + public static {{apiName}}{{resourceConstant}} Update(Update{{apiName}}Options options, ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = client.Request(BuildUpdateRequest(options, client)); return FromJson(response.Content); } @@ -34,9 +34,9 @@ {{>resource/ReturnCommentsAsync}} #if !NET35 public static async System.Threading.Tasks.Task<{{apiName}}{{resourceConstant}}> UpdateAsync(Update{{apiName}}Options options, - {{clientName}} client = null) + ITwilioRestClient client = null) { - client = client ?? {{domainClass}}.{{restClientMethodName}}(); + client = client ?? TwilioClient.{{restClientMethodName}}(); var response = await client.RequestAsync(BuildUpdateRequest(options, client)); return FromJson(response.Content); } @@ -46,7 +46,7 @@ {{>resource/ReturnComments}} public static {{apiName}}{{resourceConstant}} Update({{#vendorExtensions.x-request-body-param}} {{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}},{{/vendorExtensions.x-request-body-param}} - {{clientName}} client = null) + ITwilioRestClient client = null) { var options = new Update{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}){ {{#vendorExtensions.x-request-body-param}}{{^required}}{{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/required}}{{/vendorExtensions.x-request-body-param}} }; return Update(options, client); @@ -57,7 +57,7 @@ {{>resource/ReturnCommentsAsync}} public static async System.Threading.Tasks.Task<{{apiName}}{{resourceConstant}}> UpdateAsync({{#vendorExtensions.x-request-body-param}} {{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^required}} = null{{/required}},{{/vendorExtensions.x-request-body-param}} - {{clientName}} client = null) + ITwilioRestClient client = null) { var options = new Update{{apiName}}Options({{#requiredParams}}{{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}){ {{#vendorExtensions.x-request-body-param}}{{^required}}{{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/required}}{{/vendorExtensions.x-request-body-param}} }; return await UpdateAsync(options, client);