├── examples ├── test_spec │ ├── twilio_format_v1.yaml │ ├── twilio_nestedmodel_v1.yaml │ ├── twilio_response_v1.yaml │ ├── java │ │ └── twilio_customfeature_v1.yaml │ └── twilio_auth_v1.yaml ├── node │ ├── Dockerfile-prettier │ ├── sonar-project.properties │ ├── src │ │ └── rest │ │ │ ├── ApiBase.ts │ │ │ ├── FlexApiBase.ts │ │ │ ├── VersionlessBase.ts │ │ │ ├── Twilio.ts │ │ │ ├── OauthBase.ts │ │ │ ├── oauth │ │ │ └── V2.ts │ │ │ └── versionless │ │ │ ├── DeployedDevices.ts │ │ │ └── Understand.ts │ ├── Dockerfile │ └── spec │ │ └── unit │ │ └── call.spec.ts ├── python │ ├── setup.cfg │ ├── Dockerfile-prettier │ ├── sonar-project.properties │ ├── twilio │ │ └── rest │ │ │ ├── versionless │ │ │ └── __init__.py │ │ │ ├── flex_api │ │ │ └── __init__.py │ │ │ ├── api │ │ │ └── __init__.py │ │ │ ├── __init__.py │ │ │ └── oauth │ │ │ └── v2 │ │ │ └── __init__.py │ └── Dockerfile ├── ruby │ ├── lib │ │ └── twilio-ruby │ │ │ └── rest │ │ │ ├── oauth.rb │ │ │ ├── api.rb │ │ │ ├── flex_api.rb │ │ │ ├── preview_iam.rb │ │ │ ├── versionless.rb │ │ │ ├── api_base.rb │ │ │ ├── flex_api_base.rb │ │ │ ├── versionless_base.rb │ │ │ ├── oauth_base.rb │ │ │ ├── oauth │ │ │ └── v2.rb │ │ │ ├── preview_iam_base.rb │ │ │ ├── versionless │ │ │ └── understand.rb │ │ │ └── preview_iam │ │ │ └── v1.rb │ ├── Dockerfile-formatter │ ├── sonar-project.properties │ ├── Dockerfile │ └── spec │ │ └── integration │ │ ├── flex_spec.rb │ │ └── versionless_spec.rb ├── go │ ├── Dockerfile-goimports │ ├── go-client │ │ ├── helper │ │ │ ├── README.md │ │ │ ├── rest │ │ │ │ ├── api │ │ │ │ │ └── v2010 │ │ │ │ │ │ ├── model_list_health_check.go │ │ │ │ │ │ ├── model_test_response_object_test_object.go │ │ │ │ │ │ ├── api_service.go │ │ │ │ │ │ └── model_list_account_response.go │ │ │ │ ├── oauth │ │ │ │ │ └── v2 │ │ │ │ │ │ ├── model_auth0_refresh_token_response.go │ │ │ │ │ │ ├── model_auth0_test_login_request.go │ │ │ │ │ │ ├── model_auth0_login_email_request.go │ │ │ │ │ │ ├── model_auth0_test_login_response.go │ │ │ │ │ │ ├── model_auth0_authorize_response.go │ │ │ │ │ │ ├── model_auth0_token_response.go │ │ │ │ │ │ ├── model_auth0_refresh_scoped_token_request.go │ │ │ │ │ │ ├── model_error.go │ │ │ │ │ │ ├── model_auth0_signup_request.go │ │ │ │ │ │ ├── model_auth0_authentication_code_exchange_request.go │ │ │ │ │ │ ├── api_service.go │ │ │ │ │ │ └── model_v2_oauth2_token_response.go │ │ │ │ └── flex │ │ │ │ │ └── v1 │ │ │ │ │ ├── model_update_call_response.go │ │ │ │ │ ├── model_list_credential_aws_response.go │ │ │ │ │ ├── model_test_response_object.go │ │ │ │ │ ├── model_list_credential_aws_response_meta.go │ │ │ │ │ ├── api_service.go │ │ │ │ │ └── voice.go │ │ │ └── client │ │ │ │ └── test_client.go │ │ └── go.mod │ ├── sonar-project.properties │ └── Dockerfile ├── csharp │ ├── sonar-project.properties │ ├── test.sh │ ├── src │ │ └── Twilio │ │ │ └── Rest │ │ │ ├── Domain.cs │ │ │ ├── Versionless │ │ │ └── Understand │ │ │ │ └── AssistantOptions.cs │ │ │ └── FlexApi │ │ │ └── V1 │ │ │ └── CallOptions.cs │ ├── Dockerfile │ └── integrationTest │ │ └── Rest │ │ └── TestRestClient.cs ├── java │ ├── sonar-project.properties │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── twilio │ │ │ └── Domains.java │ ├── Dockerfile │ ├── integration-test │ │ └── rest │ │ │ └── TestRestClient.java │ └── unit-test │ │ └── rest │ │ └── TwilioNestedTest.java └── php │ ├── sonar-project.properties │ ├── tests │ └── Twilio │ │ └── Integration │ │ └── Rest │ │ └── TwilioRestFlexIntegrationTest.php │ ├── Dockerfile │ └── src │ └── Twilio │ └── Rest │ └── PreviewIam.php ├── specs_test └── test_spec │ ├── twilio_format_v1.yaml │ ├── twilio_nestedmodel_v1.yaml │ ├── twilio_response_v1.yaml │ ├── java │ └── twilio_customfeature_v1.yaml │ └── twilio_auth_v1.yaml ├── src ├── main │ ├── resources │ │ ├── twilio-java │ │ │ ├── Readme.md │ │ │ ├── reader │ │ │ │ ├── paginationMethods.mustache │ │ │ │ └── setters.mustache │ │ │ ├── common │ │ │ │ ├── constructors.mustache │ │ │ │ ├── addPostParamsJson.mustache │ │ │ │ ├── instanceVariables.mustache │ │ │ │ ├── addHeaderParams.mustache │ │ │ │ ├── addPostParams.mustache │ │ │ │ ├── generateUri.mustache │ │ │ │ └── setters.mustache │ │ │ ├── licenseInfo.mustache │ │ │ ├── api.mustache │ │ │ ├── enums.mustache │ │ │ ├── equalsAndHashcode.mustache │ │ │ ├── fetcher.mustache │ │ │ ├── modelEqualsAndHashCode.mustache │ │ │ ├── reader.mustache │ │ │ ├── deleter.mustache │ │ │ ├── creator.mustache │ │ │ ├── updater.mustache │ │ │ ├── response.mustache │ │ │ ├── creator │ │ │ │ └── setters.mustache │ │ │ ├── deleter │ │ │ │ └── setters.mustache │ │ │ ├── fetcher │ │ │ │ └── setters.mustache │ │ │ └── updater │ │ │ │ └── setters.mustache │ │ ├── twilio-java-legacy │ │ │ ├── api_doc.mustache │ │ │ ├── api_test.mustache │ │ │ ├── packageName.mustache │ │ │ ├── prefixedCollapsibleMapQParams.mustache │ │ │ ├── postParams_body.mustache │ │ │ ├── licenseInfo.mustache │ │ │ ├── dateParams.mustache │ │ │ ├── generate_uri.mustache │ │ │ ├── dateTimeGroupParams.mustache │ │ │ ├── enums.mustache │ │ │ └── headerParams.mustache │ │ ├── terraform-provider-twilio │ │ │ ├── api_doc.mustache │ │ │ ├── model_doc.mustache │ │ │ ├── model.mustache │ │ │ ├── README.mustache │ │ │ └── partial_header.mustache │ │ ├── twilio-csharp │ │ │ ├── resource │ │ │ │ ├── ReturnComments.mustache │ │ │ │ ├── ReturnCommentsAsync.mustache │ │ │ │ ├── MethodsComments.mustache │ │ │ │ ├── GeneratePath.mustache │ │ │ │ ├── ResponseModel.mustache │ │ │ │ └── Enum.mustache │ │ │ ├── Summary.mustache │ │ │ ├── options │ │ │ │ ├── MethodsComments.mustache │ │ │ │ ├── Params.mustache │ │ │ │ ├── GetBody.mustache │ │ │ │ ├── HeaderParams.mustache │ │ │ │ ├── ReadOptions.mustache │ │ │ │ ├── FetchOptions.mustache │ │ │ │ ├── DeleteOptions.mustache │ │ │ │ ├── CreateOptions.mustache │ │ │ │ └── UpdateOptions.mustache │ │ │ ├── OptionsUsings.mustache │ │ │ ├── ResourceUsings.mustache │ │ │ ├── ToJson.mustache │ │ │ ├── LicenseInfo.mustache │ │ │ ├── FromJson.mustache │ │ │ ├── Options.mustache │ │ │ └── Resource.mustache │ │ ├── twilio-ruby │ │ │ ├── params.mustache │ │ │ ├── parentContext.mustache │ │ │ ├── api.mustache │ │ │ ├── licenseInfo.mustache │ │ │ ├── modelClasses.mustache │ │ │ └── page.mustache │ │ ├── META-INF │ │ │ └── services │ │ │ │ ├── org.openapitools.codegen.api.TemplatingEngineAdapter │ │ │ │ └── org.openapitools.codegen.CodegenConfig │ │ ├── config │ │ │ └── toggles.json │ │ ├── twilio-python │ │ │ ├── model.handlebars │ │ │ ├── licenseInfo.handlebars │ │ │ ├── pagination.handlebars │ │ │ ├── modelClasses.handlebars │ │ │ └── contextMethods.handlebars │ │ ├── twilio-go │ │ │ ├── model.mustache │ │ │ ├── model_enum.mustache │ │ │ ├── partial_header.mustache │ │ │ ├── api_service.mustache │ │ │ └── model_doc.mustache │ │ ├── twilio-php │ │ │ ├── models │ │ │ │ ├── modelMethod.mustache │ │ │ │ └── modelClass.mustache │ │ │ ├── models.mustache │ │ │ ├── options.mustache │ │ │ ├── licenseInfo.mustache │ │ │ ├── imports.mustache │ │ │ ├── options │ │ │ │ ├── optionMethodArgs.mustache │ │ │ │ └── optionMethod.mustache │ │ │ └── magicGetterandCaller.mustache │ │ └── twilio-node │ │ │ ├── imports.mustache │ │ │ ├── licenseInfo.mustache │ │ │ ├── model.mustache │ │ │ ├── requestParam.mustache │ │ │ ├── version.mustache │ │ │ ├── pagination.mustache │ │ │ └── operationSignature.mustache │ └── java │ │ └── com │ │ └── twilio │ │ └── oai │ │ ├── common │ │ └── LanguageDataType.java │ │ ├── template │ │ ├── IApiActionTemplate.java │ │ ├── NodeApiActionTemplate.java │ │ ├── RubyApiActionTemplate.java │ │ ├── CsharpApiActionTemplate.java │ │ ├── JavaApiActionTemplate.java │ │ └── PythonApiActionTemplate.java │ │ ├── java │ │ ├── processor │ │ │ ├── PaginationStrategy.java │ │ │ ├── enums │ │ │ │ ├── EnumProcessor.java │ │ │ │ ├── property │ │ │ │ │ └── PropertyEnumProcessor.java │ │ │ │ └── parameter │ │ │ │ │ └── ParameterEnumProcessor.java │ │ │ ├── responsebody │ │ │ │ ├── ResponseProcessor.java │ │ │ │ └── ResponseProcessorFactory.java │ │ │ ├── requestbody │ │ │ │ ├── RequestBodyProcessor.java │ │ │ │ ├── RequestBodyProcessorFactory.java │ │ │ │ └── UrlEncodedProcessor.java │ │ │ ├── model │ │ │ │ ├── ModelProcessor.java │ │ │ │ ├── parameter │ │ │ │ │ ├── ModelProcessor.java │ │ │ │ │ └── ParamModelProcessorManager.java │ │ │ │ └── ModelProcessorFactory.java │ │ │ └── auth │ │ │ │ ├── SecuritySchemeProcessor.java │ │ │ │ ├── Auth.java │ │ │ │ └── NoAuth.java │ │ ├── format │ │ │ ├── Promotion.java │ │ │ └── Deserializer.java │ │ ├── feature │ │ │ ├── datamodels │ │ │ │ └── DataModel.java │ │ │ └── constructor │ │ ├── cache │ │ │ └── ResourceCacheContext.java │ │ └── nestedmodels │ │ │ ├── MustacheOneOfIface.java │ │ │ └── MustacheOneOf.java │ │ ├── resolver │ │ ├── DataSanitizer.java │ │ ├── CaseResolver.java │ │ ├── java │ │ │ ├── JavaIngressResolver.java │ │ │ └── JavaCaseResolver.java │ │ ├── IConventionMapper.java │ │ ├── go │ │ │ └── GoCaseResolver.java │ │ ├── csharp │ │ │ ├── CSharpCaseResolver.java │ │ │ ├── OperationStore.java │ │ │ └── ParameterFormat.java │ │ ├── ruby │ │ │ ├── RubyCaseResolver.java │ │ │ └── RubyPropertyResolver.java │ │ ├── php │ │ │ └── PhpCaseResolver.java │ │ ├── python │ │ │ └── PythonCaseResolver.java │ │ ├── node │ │ │ └── NodeCaseResolver.java │ │ ├── common │ │ │ ├── CodegenParameterDataTypeResolver.java │ │ │ └── CodegenModelComplexResolver.java │ │ └── README.md │ │ ├── templating │ │ ├── handlebars │ │ │ └── TwilioHelpers.java │ │ └── mustache │ │ │ ├── TitleCamelCaseLambda.java │ │ │ └── TitleCaseLambda.java │ │ ├── HttpMethod.java │ │ ├── Segments.java │ │ ├── api │ │ ├── PhpApiResources.java │ │ ├── RubyApiResources.java │ │ ├── CsharpApiResources.java │ │ ├── JavaApiResources.java │ │ └── IApiResourceBuilder.java │ │ ├── resource │ │ └── IResourceTree.java │ │ └── LoggerUtil.java └── test │ ├── resources │ └── config │ │ └── test_toggles.json │ └── java │ └── com │ └── twilio │ └── oai │ ├── HttpMethodTest.java │ ├── StringHelperTest.java │ ├── DirectoryStructureServiceTest.java │ └── InflectorTest.java ├── scripts ├── __init__.py └── prism.sh ├── .gitignore ├── Makefile ├── .github └── ISSUE_TEMPLATE │ └── config.yml ├── ISSUE_TEMPLATE.md └── LICENSE /examples/test_spec/twilio_format_v1.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /specs_test/test_spec/twilio_format_v1.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/Readme.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/api_doc.mustache: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/api_test.mustache: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/reader/paginationMethods.mustache: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/terraform-provider-twilio/api_doc.mustache: -------------------------------------------------------------------------------- 1 | TODO 2 | -------------------------------------------------------------------------------- /src/main/resources/terraform-provider-twilio/model_doc.mustache: -------------------------------------------------------------------------------- 1 | Ignore me 2 | -------------------------------------------------------------------------------- /src/main/resources/terraform-provider-twilio/model.mustache: -------------------------------------------------------------------------------- 1 | package openapi 2 | -------------------------------------------------------------------------------- /scripts/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | sys.path.append(os.path.dirname(os.path.realpath(__file__))) 5 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/resource/ReturnComments.mustache: -------------------------------------------------------------------------------- 1 | /// A single instance of {{apiName}} -------------------------------------------------------------------------------- /src/test/resources/config/test_toggles.json: -------------------------------------------------------------------------------- 1 | { 2 | "json_ingress": { 3 | "twilio-java-legacy": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /examples/node/Dockerfile-prettier: -------------------------------------------------------------------------------- 1 | FROM node:lts 2 | 3 | RUN npm i -g prettier 4 | 5 | CMD prettier -w /local '!local/coverage' 6 | -------------------------------------------------------------------------------- /examples/test_spec/twilio_nestedmodel_v1.yaml: -------------------------------------------------------------------------------- 1 | # This spec tests followings 2 | # 1. Nested model in request body and component schema -------------------------------------------------------------------------------- /specs_test/test_spec/twilio_nestedmodel_v1.yaml: -------------------------------------------------------------------------------- 1 | # This spec tests followings 2 | # 1. Nested model in request body and component schema -------------------------------------------------------------------------------- /examples/python/setup.cfg: -------------------------------------------------------------------------------- 1 | [coverage:run] 2 | relative_files = True 3 | 4 | [tool:pytest] 5 | addopts = --cov=twilio/rest/ --cov-report xml 6 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/oauth.rb: -------------------------------------------------------------------------------- 1 | module Twilio 2 | module REST 3 | class Oauth < OauthBase 4 | end 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /examples/test_spec/twilio_response_v1.yaml: -------------------------------------------------------------------------------- 1 | # This spec tests followings 2 | # 1. All types of response body(json) 3 | # 2. Tests paginated response. -------------------------------------------------------------------------------- /src/main/resources/twilio-ruby/params.mustache: -------------------------------------------------------------------------------- 1 | {{paramName}}: {{#required}}nil{{/required}}{{^required}}:unset{{/required}}{{^-last}}, {{/-last}} -------------------------------------------------------------------------------- /specs_test/test_spec/twilio_response_v1.yaml: -------------------------------------------------------------------------------- 1 | # This spec tests followings 2 | # 1. All types of response body(json) 3 | # 2. Tests paginated response. -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/resource/ReturnCommentsAsync.mustache: -------------------------------------------------------------------------------- 1 | /// Task that resolves to A single instance of {{apiName}} -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/packageName.mustache: -------------------------------------------------------------------------------- 1 | package com.twilio.rest.{{#lambda.lowercase}}{{domain}}.{{apiVersion}}{{/lambda.lowercase}}; 2 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/Summary.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-generate-comment}} 2 | /// {{{.}}} {{/vendorExtensions.x-generate-comment}} -------------------------------------------------------------------------------- /examples/go/Dockerfile-goimports: -------------------------------------------------------------------------------- 1 | FROM golang:1.18 2 | 3 | ENV GOPATH /go 4 | RUN go install golang.org/x/tools/cmd/goimports@v0.24.0 5 | 6 | CMD goimports -w /local 7 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/common/LanguageDataType.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.common; 2 | 3 | public interface LanguageDataType { 4 | String getValue(); 5 | } 6 | -------------------------------------------------------------------------------- /examples/csharp/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=twilio_twilio-oai-generator-csharp 2 | sonar.projectName=twilio-oai-generator-csharp 3 | sonar.organization=twilio 4 | -------------------------------------------------------------------------------- /examples/python/Dockerfile-prettier: -------------------------------------------------------------------------------- 1 | FROM python:3.7 2 | 3 | RUN pip install autoflake black 4 | 5 | CMD autoflake --remove-all-unused-imports -i -r /local && black /local 6 | -------------------------------------------------------------------------------- /examples/ruby/Dockerfile-formatter: -------------------------------------------------------------------------------- 1 | FROM ruby:3.0 2 | 3 | WORKDIR /local 4 | RUN gem install 'rubocop' 5 | 6 | CMD rubocop --fix-layout 2>&1 | tee /local/formatter-report.out 7 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/README.md: -------------------------------------------------------------------------------- 1 | Command to generate the mock client: 2 | 3 | ```sh 4 | mockgen -source=client/test_client.go -destination=client/mock_client.go -package=client 5 | ``` 6 | -------------------------------------------------------------------------------- /examples/test_spec/java/twilio_customfeature_v1.yaml: -------------------------------------------------------------------------------- 1 | # This spec is twilio-java specific and Tests following 2 | # 1. It tests custom feature for twilio-java examples: constructors, DateInequality -------------------------------------------------------------------------------- /specs_test/test_spec/java/twilio_customfeature_v1.yaml: -------------------------------------------------------------------------------- 1 | # This spec is twilio-java specific and Tests following 2 | # 1. It tests custom feature for twilio-java examples: constructors, DateInequality -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/org.openapitools.codegen.api.TemplatingEngineAdapter: -------------------------------------------------------------------------------- 1 | org.openapitools.codegen.templating.MustacheEngineAdapter 2 | com.twilio.oai.templating.TwilioHandlebarsEngineAdapter 3 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/api.rb: -------------------------------------------------------------------------------- 1 | module Twilio 2 | module REST 3 | class Api < ApiBase 4 | def v2010 5 | @v2010 ||= V2010.new self 6 | end 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/template/IApiActionTemplate.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.template; 2 | 3 | public interface IApiActionTemplate { 4 | void clean(); 5 | void add(String template); 6 | void addSupportVersion(); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/config/toggles.json: -------------------------------------------------------------------------------- 1 | { 2 | "json_ingress": { 3 | "twilio-java-legacy": true, 4 | "twilio-node": true, 5 | "twilio-python": true, 6 | "twilio-ruby": true, 7 | "twilio-php": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/PaginationStrategy.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor; 2 | 3 | /* 4 | There are 2 types pagination strategies are supported nextPrev and direct. 5 | */ 6 | public interface PaginationStrategy { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/twilio-python/model.handlebars: -------------------------------------------------------------------------------- 1 | {{#models}}{{#isEnum}} 2 | class {{name}}(object):{{#allowableValues}}{{#values}} 3 | {{{upper (snake_case (lower this))}}} = "{{{.}}}"{{/values}}{{/allowableValues}} 4 | {{/isEnum}}{{/models}} -------------------------------------------------------------------------------- /examples/node/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=twilio_twilio-oai-generator-node 2 | sonar.projectName=twilio-oai-generator-node 3 | sonar.organization=twilio 4 | sonar.exclusions=**/*spec.ts 5 | sonar.javascript.lcov.reportPaths=coverage/lcov.info 6 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/flex_api.rb: -------------------------------------------------------------------------------- 1 | require 'twilio-ruby/rest' 2 | 3 | module Twilio 4 | module REST 5 | class FlexApi < FlexApiBase 6 | def v1 7 | @v1 ||= V1.new self 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /examples/ruby/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=twilio_twilio-oai-generator-ruby 2 | sonar.organization=twilio 3 | sonar.projectName=twilio-oai-generator-ruby 4 | sonar.ruby.coverage.reportPaths=coverage/coverage.json 5 | sonar.exclusions=**/*spec.rb 6 | -------------------------------------------------------------------------------- /examples/java/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=twilio_twilio-oai-generator-java 2 | sonar.projectName=twilio-oai-generator-java 3 | sonar.organization=twilio 4 | sonar.exclusions=**/*Test*.java,**/messaging/*/*.java 5 | sonar.java.binaries=target/classes 6 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/DataSanitizer.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver; 2 | 3 | import org.openapitools.codegen.IJsonSchemaValidationProperties; 4 | 5 | public interface DataSanitizer { 6 | void sanitize(T data); 7 | } 8 | -------------------------------------------------------------------------------- /examples/test_spec/twilio_auth_v1.yaml: -------------------------------------------------------------------------------- 1 | components: 2 | securitySchemes: 3 | oAuth2ClientCredentials: 4 | type: oauth2 5 | flows: 6 | clientCredentials: 7 | tokenUrl: https://preview-iam.twilio.com/v1/token 8 | scopes: {} 9 | paths: 10 | -------------------------------------------------------------------------------- /specs_test/test_spec/twilio_auth_v1.yaml: -------------------------------------------------------------------------------- 1 | components: 2 | securitySchemes: 3 | oAuth2ClientCredentials: 4 | type: oauth2 5 | flows: 6 | clientCredentials: 7 | tokenUrl: https://preview-iam.twilio.com/v1/token 8 | scopes: {} 9 | paths: 10 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/options/MethodsComments.mustache: -------------------------------------------------------------------------------- 1 | /// Construct a new {{operationId}}Options 2 | {{#requiredParams}} 3 | /// {{{description}}} 4 | {{/requiredParams}} -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/CaseResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver; 2 | 3 | public interface CaseResolver { 4 | String productOperation(String product); 5 | 6 | String pathOperation(String pathPart); 7 | 8 | String filenameOperation(String filename); 9 | } 10 | -------------------------------------------------------------------------------- /examples/go/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=twilio_twilio-oai-generator-go 2 | sonar.projectName=twilio-oai-generator-go 3 | sonar.organization=twilio 4 | sonar.exclusions=**/*_test.go,**/mock_client.go 5 | sonar.go.tests.reportPaths=test-report.out 6 | sonar.go.coverage.reportPaths=coverage.out 7 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/format/Promotion.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.format; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | @AllArgsConstructor 7 | public class Promotion { 8 | @Getter 9 | String inputType; 10 | @Getter 11 | String promoter; 12 | } 13 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/preview_iam.rb: -------------------------------------------------------------------------------- 1 | module Twilio 2 | module REST 3 | class PreviewIam < PreviewIamBase 4 | def organizations(organization_sid = nil) 5 | @organizations ||= PreviewIam::Versionless.new(self).organization(organization_sid) 6 | end 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.jar 3 | codegen/ 4 | target/ 5 | __pycache__ 6 | tmp 7 | 8 | **/.openapi-generator* 9 | **/docs 10 | **/*.bak 11 | 12 | **/coverage* 13 | **/*-report.out 14 | **/lcov.net451.opencover.xml 15 | 16 | **/execution-result.xml 17 | **/php_coverage.xml 18 | *.iml 19 | generateFiles.py 20 | temp_specs/ 21 | -------------------------------------------------------------------------------- /examples/python/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=twilio_twilio-oai-generator-python 2 | sonar.projectName=twilio-oai-generator-python 3 | sonar.organization=twilio 4 | sonar.exclusions=**/*_test.py 5 | sonar.python.tests.reportPaths=test-report.out 6 | sonar.python.coverage.reportPaths=coverage.xml 7 | sonar.python.version=3 8 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: install test generate test-docker 2 | 3 | install: 4 | mvn clean package -DskipTests 5 | 6 | test: 7 | mvn clean test 8 | 9 | generate: install 10 | bash scripts/generate.sh 11 | 12 | # for specific language use LANGUAGES for ex: make test-docker LANGUAGES=node 13 | test-docker: generate 14 | bash scripts/prism.sh 15 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/enums/EnumProcessor.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.enums; 2 | 3 | import com.twilio.oai.common.EnumConstants.OpenApiEnumType; 4 | 5 | public interface EnumProcessor { 6 | boolean shouldProcess(T schema); 7 | void process(T schema); 8 | OpenApiEnumType getType(); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/enums/property/PropertyEnumProcessor.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.enums.property; 2 | 3 | import com.twilio.oai.java.processor.enums.EnumProcessor; 4 | import org.openapitools.codegen.CodegenProperty; 5 | 6 | public interface PropertyEnumProcessor extends EnumProcessor { 7 | } 8 | -------------------------------------------------------------------------------- /examples/node/src/rest/ApiBase.ts: -------------------------------------------------------------------------------- 1 | import Domain from "../base/Domain"; 2 | import V2010 from "./api/V2010"; 3 | 4 | class ApiBase extends Domain { 5 | constructor(twilio: any) { 6 | super(twilio, "http://api.twilio.com"); 7 | } 8 | 9 | get v2010(): V2010 { 10 | return new V2010(this); 11 | } 12 | } 13 | 14 | export = ApiBase; 15 | -------------------------------------------------------------------------------- /examples/node/src/rest/FlexApiBase.ts: -------------------------------------------------------------------------------- 1 | import Domain from "../base/Domain"; 2 | import V1 from "./flexApi/V1"; 3 | 4 | class FlexApiBase extends Domain { 5 | constructor(twilio: any) { 6 | super(twilio, "http://flex-api.twilio.com"); 7 | } 8 | 9 | get v1(): V1 { 10 | return new V1(this); 11 | } 12 | } 13 | 14 | export = FlexApiBase; 15 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/enums/parameter/ParameterEnumProcessor.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.enums.parameter; 2 | 3 | import com.twilio.oai.java.processor.enums.EnumProcessor; 4 | import org.openapitools.codegen.CodegenParameter; 5 | 6 | public interface ParameterEnumProcessor extends EnumProcessor { 7 | } 8 | -------------------------------------------------------------------------------- /examples/csharp/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | sleep 10 5 | 6 | if [ "$SONAR_TOKEN" = "" ]; then 7 | make test 8 | else 9 | make cover PROJECT_NAME=twilio_twilio-oai-generator-csharp \ 10 | SONAR_SOURCES="/d:sonar.inclusions=src/Twilio/Rest/**/* /d:sonar.cs.analyzeGeneratedCode=true /d:sonar.exclusions=test/Twilio.Test/**/*" 11 | fi -------------------------------------------------------------------------------- /src/main/resources/twilio-java/common/constructors.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-signature-list}} 2 | public {{resourceName}}{{vendorExtensions.x-common-action-type}}({{#.}}final {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/.}}) { 3 | {{#.}} 4 | this.{{paramName}} = {{paramName}}; 5 | {{/.}} 6 | } 7 | {{/vendorExtensions.x-signature-list}} -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/OptionsUsings.mustache: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Twilio.Base; 4 | using Twilio.Converters; 5 | {{#metaProperties}}{{#array-exists-options}}using System.Linq;{{/array-exists-options}}{{/metaProperties}} 6 | {{#metaProperties}}{{#enum-exists-options}}using Twilio.Types;{{/enum-exists-options}}{{/metaProperties}} -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/feature/datamodels/DataModel.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.feature.datamodels; 2 | 3 | import org.openapitools.codegen.CodegenModel; 4 | import org.openapitools.codegen.CodegenOperation; 5 | 6 | public interface DataModel { 7 | void apply(CodegenOperation codegenOperation); 8 | boolean shouldApply(CodegenModel codegenModel); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/common/addPostParamsJson.mustache: -------------------------------------------------------------------------------- 1 | private void addPostParams(final Request request, TwilioRestClient client) { 2 | ObjectMapper objectMapper = client.getObjectMapper(); 3 | {{#bodyParams}} 4 | if ({{paramName}} != null) { 5 | request.setBody({{resourceName}}.toJson({{paramName}}, objectMapper)); 6 | } 7 | {{/bodyParams}} 8 | } -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/versionless.rb: -------------------------------------------------------------------------------- 1 | require 'twilio-ruby/rest' 2 | 3 | module Twilio 4 | module REST 5 | class Versionless < VersionlessBase 6 | def deployed_devices 7 | @deployed_devices ||= DeployedDevices.new self 8 | end 9 | 10 | def understand 11 | @understand ||= Understand.new self 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/responsebody/ResponseProcessor.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.responsebody; 2 | 3 | import org.openapitools.codegen.CodegenOperation; 4 | 5 | public interface ResponseProcessor { 6 | void process(CodegenOperation codegenOperation); 7 | String getContentType(); 8 | boolean shouldProcess(CodegenOperation codegenOperation); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/java/JavaIngressResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.java; 2 | 3 | import org.openapitools.codegen.CodegenModel; 4 | 5 | import java.util.List; 6 | 7 | public class JavaIngressResolver { 8 | public JavaIngressResolver(List allModels) { 9 | 10 | } 11 | 12 | void resolve() { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/ResourceUsings.mustache: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using Twilio.Base; 5 | using Twilio.Clients; 6 | using Twilio.Constant; 7 | using Twilio.Converters; 8 | using Twilio.Exceptions; 9 | using Twilio.Http; 10 | {{#metaProperties}}{{#enum-exists-resource}}using Twilio.Types;{{/enum-exists-resource}}{{/metaProperties}} -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/requestbody/RequestBodyProcessor.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.requestbody; 2 | 3 | import org.openapitools.codegen.CodegenOperation; 4 | 5 | public interface RequestBodyProcessor { 6 | void process(CodegenOperation codegenOperation); 7 | String getContentType(); 8 | boolean shouldProcess(CodegenOperation codegenOperation); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/twilio-go/model.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | package {{packageName}} 3 | {{#models}} 4 | import ( 5 | "encoding/json" 6 | "github.com/twilio/twilio-go/client" 7 | {{#imports}} 8 | "{{import}}" 9 | {{/imports}} 10 | ) 11 | {{#model}} 12 | {{#isEnum}} 13 | {{>model_enum}} 14 | {{/isEnum}} 15 | {{^isEnum}} 16 | {{>model_simple}} 17 | {{/isEnum}} 18 | {{/model}} 19 | {{/models}} 20 | -------------------------------------------------------------------------------- /src/main/resources/twilio-php/models/modelMethod.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | {{#vars}} 3 | * @property {{{dataType}}} ${{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}{{#description}} {{{description}}}{{/description}} 4 | {{/vars}} 5 | */ 6 | public static function create{{classname}}(array $payload = []): {{classname}} 7 | { 8 | return new {{classname}}($payload); 9 | } 10 | -------------------------------------------------------------------------------- /examples/php/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=twilio_twilio-oai-generator-php 2 | sonar.projectName=twilio-oai-generator-php 3 | sonar.organization=twilio 4 | sonar.sources=src 5 | sonar.tests=tests 6 | sonar.inclusions=**/*List.php,**/*Instance.php,**/*Context.php 7 | sonar.coverage.exclusions=tests 8 | sonar.php.coverage.reportPaths=php_coverage.xml 9 | sonar.php.tests.reportPath=execution-result.xml 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: Twilio Support 3 | url: https://twilio.com/help/contact 4 | about: Get Support 5 | - name: Stack Overflow 6 | url: https://stackoverflow.com/questions/tagged/twilio-oai 7 | about: Ask questions on Stack Overflow 8 | - name: Documentation 9 | url: https://www.twilio.com/docs 10 | about: View Reference Documentation 11 | 12 | -------------------------------------------------------------------------------- /src/main/resources/twilio-php/models.mustache: -------------------------------------------------------------------------------- 1 | {{#resources}} 2 | licenseInfo}} 4 | namespace Twilio\Rest\{{domainName}}\{{version}}{{namespaceSubPart}}; 5 | 6 | use Twilio\Values; 7 | abstract class {{apiName}}Models 8 | { 9 | {{#nestedModels}} 10 | {{>models/modelMethod}} 11 | {{/nestedModels}} 12 | } 13 | 14 | {{#nestedModels}} 15 | {{>models/modelClass}} 16 | {{/nestedModels}} 17 | {{/resources}} 18 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/prefixedCollapsibleMapQParams.mustache: -------------------------------------------------------------------------------- 1 | if ({{paramName}} != null) { 2 | Map params = PrefixedCollapsibleMap.serialize({{{paramName}}}, "{{vendorExtensions.x-prefixed-collapsible-map}}"); 3 | for (Map.Entry entry : params.entrySet()) { 4 | request.addQueryParam(entry.getKey(), entry.getValue()); 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/twilio-php/options.mustache: -------------------------------------------------------------------------------- 1 | {{#resources}} 2 | licenseInfo}} 4 | namespace Twilio\Rest\{{domainName}}\{{version}}{{namespaceSubPart}}; 5 | 6 | {{>imports}} 7 | abstract class {{apiName}}Options 8 | { 9 | {{#apiOperations}} 10 | {{>options/optionMethod}} 11 | {{/apiOperations}} 12 | } 13 | 14 | {{#apiOperations}} 15 | {{>options/optionsClass}} 16 | {{/apiOperations}} 17 | {{/resources}} 18 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/IConventionMapper.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver; 2 | 3 | public interface IConventionMapper { 4 | ConfigurationSegment properties(); 5 | 6 | ConfigurationSegment serialize(); 7 | 8 | ConfigurationSegment deserialize(); 9 | 10 | ConfigurationSegment libraries(); 11 | 12 | ConfigurationSegment hydrate(); 13 | 14 | ConfigurationSegment promotions(); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig: -------------------------------------------------------------------------------- 1 | com.twilio.oai.TwilioCsharpGenerator 2 | com.twilio.oai.TwilioGoGenerator 3 | com.twilio.oai.TwilioJavaGenerator 4 | com.twilio.oai.TwilioJavaGeneratorModern 5 | com.twilio.oai.TwilioNodeGenerator 6 | com.twilio.oai.TwilioPhpGenerator 7 | com.twilio.oai.TwilioRubyGenerator 8 | com.twilio.oai.TwilioTerraformGenerator 9 | com.twilio.oai.TwilioPythonGenerator 10 | -------------------------------------------------------------------------------- /examples/node/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts 2 | 3 | WORKDIR /app 4 | RUN git clone https://github.com/twilio/twilio-node.git 5 | WORKDIR /app/twilio-node/ 6 | 7 | RUN rm -rf src/rest/ spec/ 8 | 9 | COPY src src 10 | COPY spec spec 11 | 12 | # pipefail prevents errors in a pipeline from being masked. 13 | CMD ["/bin/bash", "-c", "set -o pipefail && sleep 10 && make install test 2>&1 | tee /local/test-report.out && cp -r coverage /local"] 14 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/model/ModelProcessor.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.model; 2 | 3 | import org.openapitools.codegen.CodegenModel; 4 | import org.openapitools.codegen.CodegenProperty; 5 | 6 | public interface ModelProcessor { 7 | boolean shouldProcess(CodegenProperty codegenProperty, CodegenModel codegenModel); 8 | void process(CodegenProperty codegenProperty, CodegenModel codegenModel); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/options/Params.mustache: -------------------------------------------------------------------------------- 1 | 2 | {{#requiredParams}} 3 | {{#description}}/// {{{description}}} {{/description}} 4 | public {{{dataType}}} {{paramName}} { get; } 5 | 6 | {{/requiredParams}} 7 | {{#optionalParams}} 8 | {{#description}}/// {{{description}}} {{/description}} 9 | public {{{dataType}}} {{paramName}} { get; set; } 10 | 11 | {{/optionalParams}} 12 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/model/parameter/ModelProcessor.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.model.parameter; 2 | 3 | import org.openapitools.codegen.CodegenModel; 4 | import org.openapitools.codegen.CodegenParameter; 5 | 6 | public interface ModelProcessor { 7 | boolean shouldProcess(CodegenParameter codegenParameter, CodegenModel codegenModel); 8 | void process(CodegenParameter codegenParameter, CodegenModel codegenModel); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/twilio-ruby/parentContext.mustache: -------------------------------------------------------------------------------- 1 | {{#parentDir}} 2 | class {{0}} < {{1}} 3 | {{/parentDir}} 4 | 5 | {{>list}} 6 | {{#metaProperties.hasInstanceOperation}} 7 | {{>context}} 8 | {{/metaProperties.hasInstanceOperation}} 9 | {{>page}} 10 | {{>instance}} 11 | {{#parentDir}} 12 | end 13 | {{/parentDir}} 14 | end 15 | end 16 | end 17 | end 18 | 19 | -------------------------------------------------------------------------------- /examples/go/go-client/go.mod: -------------------------------------------------------------------------------- 1 | module go-client 2 | 3 | go 1.21 4 | 5 | require ( 6 | github.com/golang/mock v1.6.0 7 | github.com/stretchr/testify v1.7.0 8 | github.com/twilio/twilio-go v0.25.0 9 | ) 10 | 11 | require ( 12 | github.com/davecgh/go-spew v1.1.1 // indirect 13 | github.com/pkg/errors v0.9.1 // indirect 14 | github.com/pmezard/go-difflib v1.0.0 // indirect 15 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect 16 | gopkg.in/yaml.v3 v3.0.1 // indirect 17 | ) 18 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/common/instanceVariables.mustache: -------------------------------------------------------------------------------- 1 | {{#pathParams}} 2 | private {{{dataType}}} {{paramName}}; 3 | {{/pathParams}} 4 | {{#queryParams}} 5 | private {{{dataType}}} {{paramName}}; 6 | {{/queryParams}} 7 | {{#headerParams}} 8 | private {{{dataType}}} {{paramName}}; 9 | {{/headerParams}} 10 | {{#formParams}} 11 | private {{{dataType}}} {{paramName}}; 12 | {{/formParams}} 13 | {{#bodyParams}} 14 | private {{{dataType}}} {{paramName}}; 15 | {{/bodyParams}} -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/postParams_body.mustache: -------------------------------------------------------------------------------- 1 | private void addPostParams(final {{vendorExtensions.x-auth-attributes.x-http-class-prefix}}Request request, {{vendorExtensions.x-auth-attributes.x-http-class-prefix}}TwilioRestClient client) { 2 | ObjectMapper objectMapper = client.getObjectMapper(); 3 | {{#bodyParams}} 4 | if ({{paramName}} != null) { 5 | request.setBody({{apiName}}.toJson({{paramName}}, objectMapper)); 6 | } 7 | {{/bodyParams}} 8 | } -------------------------------------------------------------------------------- /examples/java/src/main/java/com/twilio/Domains.java: -------------------------------------------------------------------------------- 1 | package com.twilio.rest; 2 | 3 | public enum Domains { 4 | API("api"), 5 | FLEXAPI("flex-api"), 6 | VERSIONLESS("versionless"), 7 | MESSAGING("messaging"), 8 | PREVIEWIAM("preview-iam"), 9 | OAUTH("oauth"); 10 | 11 | private final String value; 12 | 13 | private Domains(final String value) { 14 | this.value = value; 15 | } 16 | 17 | public String toString() { 18 | return value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/templating/handlebars/TwilioHelpers.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.templating.handlebars; 2 | 3 | import com.twilio.oai.StringHelper; 4 | 5 | import com.github.jknack.handlebars.Helper; 6 | import com.github.jknack.handlebars.Options; 7 | 8 | public enum TwilioHelpers implements Helper { 9 | snake_case { 10 | public Object apply(final Object value, final Options options) { 11 | return StringHelper.toSnakeCase(value.toString()); 12 | } 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/ToJson.mustache: -------------------------------------------------------------------------------- 1 | /// 2 | /// Converts an object into a json string 3 | /// 4 | /// C# model 5 | /// JSON string 6 | public static string ToJson(object model) 7 | { 8 | try 9 | { 10 | return JsonConvert.SerializeObject(model); 11 | } 12 | catch (JsonException e) 13 | { 14 | throw new ApiException(e.Message, e); 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/resource/MethodsComments.mustache: -------------------------------------------------------------------------------- 1 | 2 | {{#vendorExtensions.x-request-body-param}} 3 | /// {{{description}}} 4 | {{/vendorExtensions.x-request-body-param}} 5 | {{#vendorExtensions.x-is-read-operation}} 6 | /// Record limit 7 | {{/vendorExtensions.x-is-read-operation}} 8 | /// Client to make requests to Twilio -------------------------------------------------------------------------------- /examples/go/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.21 2 | 3 | ENV GOPATH /go 4 | 5 | WORKDIR /go/src/twilio-go 6 | COPY go-client . 7 | 8 | # Initialize Go modules and download dependencies 9 | RUN go mod download && go mod verify 10 | 11 | # Install test dependencies 12 | RUN go get github.com/stretchr/testify@v1.7.0 13 | 14 | # pipefail prevents errors in a pipeline from being masked. 15 | CMD ["/bin/bash", "-c", "sleep 25 && set -o pipefail && go test -race ./... -coverprofile /local/coverage.out -json | tee /local/test-report.out"] 16 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/HttpMethod.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai; 2 | 3 | import java.util.Arrays; 4 | 5 | public enum HttpMethod { 6 | DELETE, 7 | GET, 8 | PATCH, 9 | POST, 10 | PUT; 11 | 12 | public static HttpMethod fromString(final String httpMethodString) { 13 | return Arrays 14 | .stream(HttpMethod.values()) 15 | .filter(httpMethod -> httpMethod.name().equalsIgnoreCase(httpMethodString)) 16 | .findFirst() 17 | .orElseThrow(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/twilio-node/imports.mustache: -------------------------------------------------------------------------------- 1 | {{#responseModel}} 2 | {{#vars}} 3 | {{#vendorExtensions.x-import}} 4 | {{#entrySet}} 5 | import { {{key}} } from "{{apiVersionPath}}/../../{{value}}"; 6 | {{/entrySet}} 7 | {{/vendorExtensions.x-import}} 8 | {{/vars}} 9 | {{/responseModel}} 10 | {{#operations}} 11 | {{#allParams}} 12 | {{#vendorExtensions.x-import}} 13 | {{#entrySet}} 14 | import {{key}} from "{{apiVersionPath}}/../../{{value}}"; 15 | {{/entrySet}} 16 | {{/vendorExtensions.x-import}} 17 | {{/allParams}} 18 | {{/operations}} 19 | -------------------------------------------------------------------------------- /src/main/resources/terraform-provider-twilio/README.mustache: -------------------------------------------------------------------------------- 1 | {{#apiInfo}}{{#apis}}{{#resources}} 2 | ## twilio_{{domainPackage}}_{{nameInSnakeCase}}{{#apiVersion}}_{{.}}{{/apiVersion}} 3 | 4 | ### Parameters 5 | 6 | Name | Type | Requirement | Description 7 | --- | --- | --- | --- 8 | {{#schema}} 9 | **{{{vendorExtensions.x-name-in-snake-case}}}** | {{{vendorExtensions.x-terraform-schema.fullType}}} | {{{vendorExtensions.x-terraform-schema.options.requirement}}} | {{{description}}} 10 | {{/schema}} 11 | {{/resources}}{{/apis}}{{/apiInfo}} 12 | -------------------------------------------------------------------------------- /examples/python/twilio/rest/versionless/__init__.py: -------------------------------------------------------------------------------- 1 | from twilio.base.domain import Domain 2 | from twilio.rest.versionless.deployed_devices import DeployedDevices 3 | 4 | 5 | class Preview(Domain): 6 | def __init__(self, twilio): 7 | super().__init__(twilio, "http://preview.twilio.com") 8 | self._deployed_devices = None 9 | 10 | @property 11 | def deployed_devices(self): 12 | if self._deployed_devices is None: 13 | self._deployed_devices = DeployedDevices(self) 14 | return self._deployed_devices 15 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/cache/ResourceCacheContext.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.cache; 2 | 3 | 4 | public class ResourceCacheContext { 5 | private static final ThreadLocal CACHE = new ThreadLocal<>(); 6 | 7 | public static void set(ResourceCache2 cache) { 8 | CACHE.set(cache); 9 | } 10 | 11 | public static ResourceCache2 get() { 12 | return CACHE.get(); 13 | } 14 | 15 | public static void clear() { 16 | if (CACHE.get() != null) CACHE.get().clear(); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/nestedmodels/MustacheOneOfIface.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.nestedmodels; 2 | 3 | public class MustacheOneOfIface { 4 | String interfaceClassName; 5 | String discriminator; 6 | 7 | public MustacheOneOfIface(String interfaceClassName) { 8 | this.interfaceClassName = interfaceClassName; 9 | } 10 | 11 | public MustacheOneOfIface(String interfaceClassName, String discriminator) { 12 | this.interfaceClassName = interfaceClassName; 13 | this.discriminator = discriminator; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/twilio-go/model_enum.mustache: -------------------------------------------------------------------------------- 1 | // {{{classname}}} {{#description}}{{{.}}}{{/description}}{{^description}}the model '{{{classname}}}'{{/description}} 2 | type {{{classname}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} 3 | 4 | // List of {{{name}}} 5 | const ( 6 | {{#allowableValues}} 7 | {{#enumVars}} 8 | {{^-first}} 9 | {{/-first}} 10 | {{#enumClassPrefix}}{{{classname.toUpperCase}}}_{{/enumClassPrefix}}{{name}} {{{classname}}} = {{{value}}} 11 | {{/enumVars}} 12 | {{/allowableValues}} 13 | ) 14 | -------------------------------------------------------------------------------- /src/main/resources/twilio-ruby/api.mustache: -------------------------------------------------------------------------------- 1 | {{#resources}} 2 | {{>licenseInfo}} 3 | 4 | module Twilio 5 | module REST 6 | class {{domainName}} < {{domainName}}Base 7 | class {{apiVersionClass}} < Version 8 | {{#hasParents}} 9 | {{>parentContext}} 10 | {{/hasParents}} 11 | {{^hasParents}} 12 | {{>list}} 13 | {{#metaProperties.hasInstanceOperation}} 14 | {{>context}} 15 | {{/metaProperties.hasInstanceOperation}} 16 | {{>page}} 17 | {{>instance}} 18 | end 19 | end 20 | end 21 | end 22 | {{/hasParents}} 23 | {{/resources}} 24 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * {{{appName}}} 8 | * {{{appDescription}}} 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | -------------------------------------------------------------------------------- /src/main/resources/twilio-node/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * {{{appName}}} 8 | * {{{appDescription}}} 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | -------------------------------------------------------------------------------- /src/main/resources/twilio-php/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * {{{appName}}} 8 | * {{{appDescription}}} 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | -------------------------------------------------------------------------------- /examples/node/src/rest/VersionlessBase.ts: -------------------------------------------------------------------------------- 1 | import Domain from "../base/Domain"; 2 | import DeployedDevices from "./versionless/DeployedDevices"; 3 | import Understand from "./versionless/Understand"; 4 | 5 | class VersionlessBase extends Domain { 6 | constructor(twilio: any) { 7 | super(twilio, "http://versionless.twilio.com"); 8 | } 9 | 10 | get deployed_devices(): DeployedDevices { 11 | return new DeployedDevices(this); 12 | } 13 | 14 | get understand(): Understand { 15 | return new Understand(this); 16 | } 17 | } 18 | 19 | export = VersionlessBase; 20 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/LicenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * {{{appName}}} 8 | * {{{appDescription}}} 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/api.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | {{#resources}} 3 | package com.twilio.rest.{{domainPackage}}.{{apiVersion}}{{namespaceSubPart}}; 4 | 5 | {{>common/imports}} 6 | import com.twilio.base.Resource; 7 | import java.io.IOException; 8 | import com.fasterxml.jackson.core.JsonParseException; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown = true) 11 | @ToString 12 | public class {{resourceName}} extends Resource { 13 | 14 | {{>allConstructors}} 15 | {{>enums}} 16 | {{>models}} 17 | {{>staticMethods}} 18 | {{>response}} 19 | } 20 | {{/resources}} 21 | 22 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/options/GetBody.mustache: -------------------------------------------------------------------------------- 1 | 2 | /// Generate the request body 3 | public string GetBody() 4 | { 5 | string body = ""; 6 | 7 | {{^isArray}} 8 | {{^vendorExtensions.x-parameter-map}} 9 | if ({{paramName}} != null) 10 | { 11 | body = {{apiName}}{{resourceConstant}}.ToJson({{paramName}}); 12 | } 13 | {{/vendorExtensions.x-parameter-map}} 14 | {{/isArray}} 15 | return body; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * {{{appName}}} 8 | * {{{appDescription}}} 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | -------------------------------------------------------------------------------- /src/main/resources/twilio-python/licenseInfo.handlebars: -------------------------------------------------------------------------------- 1 | r""" 2 | This code was generated by 3 | ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | 7 | {{{appName}}} 8 | {{{appDescription}}} 9 | 10 | NOTE: This class is auto generated by OpenAPI Generator. 11 | https://openapi-generator.tech 12 | Do not edit the class manually. 13 | """ 14 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/auth/SecuritySchemeProcessor.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.auth; 2 | 3 | import org.openapitools.codegen.CodegenOperation; 4 | 5 | // Orgs OAuth and Basic Auth has different RestClients. 6 | // Set "x-auth-attributes" for different type of authentication 7 | public interface SecuritySchemeProcessor { 8 | String authAttributesExtension = "x-auth-attributes"; 9 | String noAuth = "x-no-auth"; 10 | void process(CodegenOperation codegenOperation); 11 | boolean shouldProcess(CodegenOperation codegenOperation); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/twilio-ruby/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | ## 2 | # This code was generated by 3 | # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | # 7 | # {{{appName}}} 8 | # {{{appDescription}}} 9 | # 10 | # NOTE: This class is auto generated by OpenAPI Generator. 11 | # https://openapi-generator.tech 12 | # Do not edit the class manually. 13 | # 14 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/go/GoCaseResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.go; 2 | 3 | import com.twilio.oai.resolver.CaseResolver; 4 | 5 | public class GoCaseResolver implements CaseResolver { 6 | @Override 7 | public String productOperation(final String product) { 8 | return product; 9 | } 10 | 11 | @Override 12 | public String pathOperation(final String pathPart) { 13 | return pathPart; 14 | } 15 | 16 | @Override 17 | public String filenameOperation(final String filename) { 18 | return filename; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/Segments.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai; 2 | 3 | import lombok.Getter; 4 | import lombok.RequiredArgsConstructor; 5 | 6 | @Getter 7 | @RequiredArgsConstructor 8 | public enum Segments { 9 | SEGMENT_HYDRATE("hydrate"), 10 | SEGMENT_SERIALIZE("serialize"), 11 | SEGMENT_DESERIALIZE("deserialize"), 12 | SEGMENT_PROPERTIES("properties"), 13 | SEGMENT_LIBRARY("library"), 14 | //promotions is uses to provide support for different datatypes of same parameter 15 | SEGMENT_PROMOTIONS("promotions"); 16 | 17 | private final String segment; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/api/PhpApiResources.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.api; 2 | import org.openapitools.codegen.CodegenParameter; 3 | 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | public class PhpApiResources extends ApiResources{ 8 | private String apiListPath; 9 | private String apiContextPath; 10 | 11 | public PhpApiResources(PhpApiResourceBuilder apiResourceBuilder) { 12 | super(apiResourceBuilder); 13 | 14 | apiListPath = apiResourceBuilder.apiListPath; 15 | apiContextPath = apiResourceBuilder.apiContextPath; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/ruby/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:3.0 2 | 3 | RUN apt-get update -y && apt-get install -y git 4 | 5 | WORKDIR /app 6 | RUN git clone https://github.com/twilio/twilio-ruby.git 7 | WORKDIR /app/twilio-ruby/ 8 | 9 | RUN rm -rf lib/twilio-ruby/rest/ examples/ spec/rest spec/integration spec/framework 10 | 11 | COPY lib/twilio-ruby/rest/ lib/twilio-ruby/rest/ 12 | COPY spec spec 13 | RUN git add . 14 | 15 | # pipefail prevents errors in a pipeline from being masked. 16 | CMD ["/bin/bash", "-c", "set -o pipefail && sleep 10 && make install test 2>&1 | tee /local/test-report.out && cp -r coverage /local"] 17 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/enums.mustache: -------------------------------------------------------------------------------- 1 | {{#mustacheEnums}} 2 | public enum {{className}} { 3 | {{#enumValues}} 4 | {{name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} 5 | {{/enumValues}} 6 | 7 | private final String value; 8 | 9 | private {{className}}(final String value) { 10 | this.value = value; 11 | } 12 | 13 | public String toString() { 14 | return value; 15 | } 16 | 17 | @JsonCreator 18 | public static {{className}} forValue(final String value) { 19 | return Promoter.enumFromString(value, {{className}}.values()); 20 | } 21 | } 22 | {{/mustacheEnums}} -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/feature/constructor/ConstructorGenerator.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.feature.constructor; 2 | 3 | import com.twilio.oai.StringHelper; 4 | import org.openapitools.codegen.CodegenOperation; 5 | import org.openapitools.codegen.CodegenParameter; 6 | 7 | import java.util.ArrayList; 8 | import java.util.HashMap; 9 | import java.util.HashSet; 10 | import java.util.List; 11 | import java.util.stream.Collectors; 12 | 13 | public abstract class ConstructorGenerator { 14 | abstract void apply(CodegenOperation codegenOperation); 15 | abstract boolean shouldApply(CodegenOperation codegenOperation); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/twilio-node/model.mustache: -------------------------------------------------------------------------------- 1 | {{#models}} 2 | 3 | {{#description}} 4 | /** 5 | * {{{description}}} 6 | */ 7 | {{/description}} 8 | {{^isEnum}} 9 | export class {{name}} {{#parent}}extends {{{parent}}} {{/parent}}{ 10 | {{#vars}} 11 | {{#description}} 12 | /** 13 | * {{{description}}} 14 | */ 15 | {{/description}} 16 | "{{name}}"{{^required}}?{{/required}}: {{{dataType}}}{{#isNullable}} | null{{/isNullable}}; 17 | {{/vars}} 18 | } 19 | 20 | {{/isEnum}} 21 | {{#isEnum}} 22 | export type {{name}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}|{{/-last}}{{/enumVars}}{{/allowableValues}}; 23 | {{/isEnum}} 24 | {{/models}} 25 | -------------------------------------------------------------------------------- /src/main/resources/twilio-go/partial_header.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | {{#appName}} 8 | * {{{appName}}} 9 | {{/appName}} 10 | {{#appDescription}} 11 | * {{{appDescription}}} 12 | {{/appDescription}} 13 | * 14 | * NOTE: This class is auto generated by OpenAPI Generator. 15 | * https://openapi-generator.tech 16 | * Do not edit the class manually. 17 | */ 18 | -------------------------------------------------------------------------------- /examples/ruby/spec/integration/flex_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper.rb' 2 | describe 'Integration Test: flex api' do 3 | before(:each) do 4 | @account_sid = 'AC12345678123456781234567812345678' 5 | @auth_token = 'CR12345678123456781234567812345678' 6 | end 7 | it "can fetch aws credential" do 8 | @holodeck.mock(Twilio::Response.new(200, ' 9 | { 10 | "sid": "AC12345678123456781234567812345678" 11 | }')) 12 | createdFlex = @client.flex_api.v1.credentials.aws(@auth_token).fetch() 13 | expect(createdFlex).to_not eq(nil) 14 | expect(createdFlex.sid).to eq(@account_sid) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/csharp/CSharpCaseResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.csharp; 2 | 3 | import com.twilio.oai.StringHelper; 4 | import com.twilio.oai.resolver.CaseResolver; 5 | 6 | public class CSharpCaseResolver implements CaseResolver { 7 | @Override 8 | public String productOperation(final String product) { 9 | return StringHelper.camelize(product); 10 | } 11 | 12 | @Override 13 | public String pathOperation(final String pathPart) { 14 | return pathPart; 15 | } 16 | 17 | @Override 18 | public String filenameOperation(final String filename) { 19 | return filename; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/python/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.12 2 | 3 | ENV PYTHONBUFFERED 1 4 | 5 | WORKDIR /app 6 | RUN git clone https://github.com/twilio/twilio-python.git 7 | WORKDIR /app/twilio-python/ 8 | 9 | RUN rm -rf tests/ twilio/rest/ setup.cfg 10 | 11 | COPY twilio twilio 12 | COPY tests tests 13 | COPY setup.cfg setup.cfg 14 | 15 | # Install requirements 16 | RUN pip install --no-cache-dir -r requirements.txt 17 | RUN pip install pytest-cov 18 | RUN pip install pytz 19 | 20 | # pipefail prevents errors in a pipeline from being masked 21 | CMD ["/bin/bash", "-c", "set -o pipefail && sleep 10 && python -m pytest tests 2>&1 | tee /local/test-report.out && cp coverage.xml /local"] 22 | -------------------------------------------------------------------------------- /src/main/resources/terraform-provider-twilio/partial_header.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | {{#appName}} 8 | * {{{appName}}} 9 | {{/appName}} 10 | {{#appDescription}} 11 | * {{{appDescription}}} 12 | {{/appDescription}} 13 | * 14 | * NOTE: This class is auto generated by OpenAPI Generator. 15 | * https://openapi-generator.tech 16 | * Do not edit the class manually. 17 | */ 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/java/JavaCaseResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.java; 2 | 3 | import com.twilio.oai.StringHelper; 4 | import com.twilio.oai.resolver.CaseResolver; 5 | 6 | public class JavaCaseResolver implements CaseResolver { 7 | @Override 8 | public String productOperation(final String product) { 9 | return StringHelper.camelize(product, true); 10 | } 11 | 12 | @Override 13 | public String pathOperation(final String pathPart) { 14 | return pathPart.toLowerCase(); 15 | } 16 | 17 | @Override 18 | public String filenameOperation(final String filename) { 19 | return filename; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/equalsAndHashcode.mustache: -------------------------------------------------------------------------------- 1 | @Override 2 | public boolean equals(final Object o) { 3 | if (this == o) { 4 | return true; 5 | } 6 | 7 | if (o == null || getClass() != o.getClass()) { 8 | return false; 9 | } 10 | 11 | {{resourceName}} other = ({{resourceName}}) o; 12 | return ( 13 | {{#response}} 14 | Objects.equals({{name}}, other.{{name}}){{^-last}} && {{/-last}} 15 | {{/response}} 16 | ); 17 | } 18 | 19 | @Override 20 | public int hashCode() { 21 | return Objects.hash( 22 | {{#response}} 23 | {{name}}{{^-last}}, {{/-last}} 24 | {{/response}} 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /examples/python/twilio/rest/flex_api/__init__.py: -------------------------------------------------------------------------------- 1 | from twilio.base.domain import Domain 2 | from twilio.rest.flex_api.v1 import V1 3 | 4 | 5 | class FlexApi(Domain): 6 | def __init__(self, twilio): 7 | super().__init__(twilio, "http://flex-api.twilio.com") 8 | self._V1 = None 9 | 10 | @property 11 | def V1(self): 12 | if self._V1 is None: 13 | self._V1 = V1(self) 14 | return self._V1 15 | 16 | @property 17 | def calls(self): 18 | return self.v1.calls 19 | 20 | @property 21 | def credentials(self): 22 | return self.v1.credentials 23 | 24 | def __repr__(self): 25 | return "" 26 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/format/Deserializer.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.format; 2 | 3 | import org.openapitools.codegen.CodegenProperty; 4 | 5 | public class Deserializer { 6 | 7 | public static void addDeserializer(CodegenProperty codegenProperty) { 8 | if (codegenProperty.getFormat() != null && OpenApiSpecFormatFeatureConstants.DESERIALIZER.containsKey(codegenProperty.getFormat())) { 9 | String deserializer = OpenApiSpecFormatFeatureConstants.DESERIALIZER.get(codegenProperty.getFormat()); 10 | codegenProperty.vendorExtensions.put("x-deserializer", deserializer); 11 | System.out.println(deserializer); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/main/resources/twilio-php/imports.mustache: -------------------------------------------------------------------------------- 1 | use Twilio\Exceptions\TwilioException; 2 | use Twilio\ListResource; 3 | use Twilio\InstanceResource; 4 | use Twilio\Options; 5 | use Twilio\Stream; 6 | use Twilio\Values; 7 | use Twilio\Version; 8 | use Twilio\InstanceContext; 9 | use Twilio\Deserialize; 10 | use Twilio\Serialize; 11 | use Twilio\Base\PhoneNumberCapabilities; 12 | {{#metaProperties.listImportProperties}} 13 | use Twilio\Rest\{{domainName}}\{{apiVersionClass}}\{{parent}}List; 14 | {{/metaProperties.listImportProperties}} 15 | {{#metaProperties.contextImportProperties}} 16 | use Twilio\Rest\{{domainName}}\{{apiVersionClass}}\{{parent}}List; 17 | {{/metaProperties.contextImportProperties}} -------------------------------------------------------------------------------- /examples/python/twilio/rest/api/__init__.py: -------------------------------------------------------------------------------- 1 | from twilio.base.domain import Domain 2 | from twilio.rest.api.v2010 import V2010 3 | 4 | 5 | class Api(Domain): 6 | def __init__(self, twilio): 7 | super().__init__(twilio, "http://api.twilio.com") 8 | self._v2010 = None 9 | 10 | @property 11 | def v2010(self): 12 | if self._v2010 is None: 13 | self._v2010 = V2010(self) 14 | return self._v2010 15 | 16 | @property 17 | def accounts(self): 18 | return self.v2010.accounts 19 | 20 | @property 21 | def account(self): 22 | return self.v2010.account 23 | 24 | def __repr__(self): 25 | return "" 26 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/ruby/RubyCaseResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.ruby; 2 | 3 | import com.twilio.oai.StringHelper; 4 | import com.twilio.oai.resolver.CaseResolver; 5 | 6 | public class RubyCaseResolver implements CaseResolver { 7 | @Override 8 | public String productOperation(final String product) { 9 | return StringHelper.toSnakeCase(product); 10 | } 11 | 12 | @Override 13 | public String pathOperation(final String pathPart) { 14 | return StringHelper.toSnakeCase(pathPart); 15 | } 16 | 17 | @Override 18 | public String filenameOperation(final String filename) { 19 | return pathOperation(filename); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/com/twilio/oai/HttpMethodTest.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai; 2 | 3 | import java.util.NoSuchElementException; 4 | 5 | import org.junit.Test; 6 | 7 | import static org.junit.Assert.assertEquals; 8 | 9 | public class HttpMethodTest { 10 | 11 | @Test 12 | public void testFromString() { 13 | assertEquals(HttpMethod.GET, HttpMethod.fromString("Get")); 14 | assertEquals(HttpMethod.POST, HttpMethod.fromString("POST")); 15 | assertEquals(HttpMethod.DELETE, HttpMethod.fromString("delete")); 16 | } 17 | 18 | @Test(expected = NoSuchElementException.class) 19 | public void testFromStringThrows() { 20 | HttpMethod.fromString("YEET"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/php/PhpCaseResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.php; 2 | 3 | import com.twilio.oai.StringHelper; 4 | import com.twilio.oai.resolver.CaseResolver; 5 | 6 | public class PhpCaseResolver implements CaseResolver { 7 | @Override 8 | public String productOperation(final String product) { 9 | return StringHelper.toFirstLetterCaps(product); 10 | } 11 | 12 | @Override 13 | public String pathOperation(final String pathPart) { 14 | return StringHelper.toFirstLetterCaps(pathPart); 15 | } 16 | 17 | @Override 18 | public String filenameOperation(final String filename) { 19 | return pathOperation(filename); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/dateParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isDate}} 2 | {{#isFormParam}} 3 | request.addPostParam("{{baseName}}", DateConverter.dateStringFromLocalDate({{paramName}})); 4 | {{/isFormParam}} 5 | {{^isFormParam}} 6 | request.addQueryParam("{{baseName}}", DateConverter.dateStringFromLocalDate({{paramName}})); 7 | } 8 | {{/isFormParam}} 9 | {{/isDate}} 10 | {{#isDateTime}} 11 | {{#isFormParam}} 12 | request.addPostParam("{{baseName}}", {{paramName}}.toInstant().toString()); 13 | {{/isFormParam}} 14 | {{^isFormParam}} 15 | request.addQueryParam("{{baseName}}", {{paramName}}.toInstant().toString()); 16 | } 17 | {{/isFormParam}} 18 | {{/isDateTime}} -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/api/RubyApiResources.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.api; 2 | 3 | import org.openapitools.codegen.CodegenParameter; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | public class RubyApiResources extends FluentApiResources { 9 | 10 | private List readParams; 11 | List parentDir = new ArrayList<>(); 12 | boolean hasParents = false; 13 | 14 | public RubyApiResources(RubyApiResourceBuilder apiResourceBuilder) { 15 | super(apiResourceBuilder); 16 | this.readParams = apiResourceBuilder.readParams; 17 | this.parentDir = apiResourceBuilder.parentDir; 18 | this.hasParents = apiResourceBuilder.hasParents; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resource/IResourceTree.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resource; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import io.swagger.v3.oas.models.Operation; 7 | import io.swagger.v3.oas.models.PathItem; 8 | 9 | public interface IResourceTree { 10 | Iterable getResources(); 11 | 12 | List ancestors(String resourceName, Operation operation); 13 | 14 | List dependents(String name); 15 | 16 | Optional findResource(String name); 17 | 18 | Optional findResource(String name, boolean removeVersion); 19 | 20 | Optional getResourceByTag(String tag); 21 | 22 | String addResource(String name, PathItem pathItem); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/FromJson.mustache: -------------------------------------------------------------------------------- 1 | 2 | /// 3 | /// Converts a JSON string into a {{apiName}}{{resourceConstant}} object 4 | /// 5 | /// Raw JSON string 6 | /// {{apiName}}{{resourceConstant}} object represented by the provided JSON 7 | public static {{apiName}}{{resourceConstant}} FromJson(string json) 8 | { 9 | try 10 | { 11 | return JsonConvert.DeserializeObject<{{apiName}}{{resourceConstant}}>(json); 12 | } 13 | catch (JsonException e) 14 | { 15 | throw new ApiException(e.Message, e); 16 | } 17 | } -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/python/PythonCaseResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.python; 2 | 3 | import com.twilio.oai.resolver.CaseResolver; 4 | 5 | import org.openapitools.codegen.utils.StringUtils; 6 | 7 | public class PythonCaseResolver implements CaseResolver { 8 | @Override //not sure 9 | public String productOperation(final String product) { 10 | return StringUtils.underscore(product); 11 | } 12 | 13 | @Override //flex_flow.py 14 | public String pathOperation(final String pathPart) { 15 | return StringUtils.underscore(pathPart); 16 | } 17 | 18 | @Override 19 | public String filenameOperation(final String filename) { 20 | return pathOperation(filename); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/template/NodeApiActionTemplate.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.template; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.openapitools.codegen.CodegenConfig; 8 | 9 | public class NodeApiActionTemplate extends AbstractApiActionTemplate { 10 | public NodeApiActionTemplate(final CodegenConfig codegenConfig) { 11 | super(codegenConfig); 12 | } 13 | 14 | @Override 15 | public Map> mapping() { 16 | return Map.of(API_TEMPLATE, 17 | Arrays.asList("api-single.mustache", ".ts"), 18 | VERSION_TEMPLATE, 19 | Arrays.asList("version.mustache", ".ts")); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/node/NodeCaseResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.node; 2 | 3 | import com.twilio.oai.StringHelper; 4 | import com.twilio.oai.resolver.CaseResolver; 5 | 6 | import org.openapitools.codegen.utils.StringUtils; 7 | 8 | public class NodeCaseResolver implements CaseResolver { 9 | @Override 10 | public String productOperation(final String product) { 11 | return StringUtils.underscore(product); 12 | } 13 | 14 | @Override 15 | public String pathOperation(final String pathPart) { 16 | return StringHelper.camelize(pathPart, true); 17 | } 18 | 19 | @Override 20 | public String filenameOperation(final String filename) { 21 | return pathOperation(filename); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/generate_uri.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.parentUrl}} 2 | String path = "{{{vendorExtensions.parentUrl}}}"; 3 | {{/vendorExtensions.parentUrl}} 4 | {{^vendorExtensions.parentUrl}} 5 | String path = "{{{path}}}"; 6 | {{/vendorExtensions.parentUrl}} 7 | 8 | {{#allParams}} 9 | {{#vendorExtensions.x-is-account-sid}} 10 | this.{{paramName}} = this.{{paramName}} == null ? client.getAccountSid() : this.{{paramName}}; 11 | path = path.replace("{"+"{{baseName}}"+"}", this.{{paramName}}.toString()); 12 | {{/vendorExtensions.x-is-account-sid}} 13 | {{/allParams}} 14 | {{#requiredParams}} 15 | path = path.replace("{"+"{{baseName}}"+"}", this.{{paramName}}.toString()); 16 | {{/requiredParams}} 17 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/fetcher.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | {{#resources}} 3 | package com.twilio.rest.{{domainPackage}}.{{apiVersion}}{{namespaceSubPart}}; 4 | {{>common/imports}} 5 | 6 | {{#operations}} 7 | {{#vendorExtensions.x-fetch-operation}} 8 | public class {{resourceName}}Fetcher extends Fetcher<{{resourceName}}> { 9 | 10 | {{>common/instanceVariables}} 11 | {{>common/constructors}} 12 | {{>fetcher/setters}} 13 | {{>fetcher/operationMethod}} 14 | {{#queryParams.0}} 15 | {{>common/addQueryParams}} 16 | {{/queryParams.0}} 17 | {{#headerParams.0}} 18 | {{>common/addHeaderParams}} 19 | {{/headerParams.0}} 20 | } 21 | {{/vendorExtensions.x-fetch-operation}} 22 | {{/operations}} 23 | {{/resources}} -------------------------------------------------------------------------------- /examples/csharp/src/Twilio/Rest/Domain.cs: -------------------------------------------------------------------------------- 1 | using Twilio.Types; 2 | 3 | namespace Twilio.Rest 4 | { 5 | public sealed class Domain : StringEnum 6 | { 7 | private Domain(string value) : base(value) {} 8 | public Domain() {} 9 | public static implicit operator Domain(string value) 10 | { 11 | return new Domain(value); 12 | } 13 | 14 | public static readonly Domain Api = new Domain("api"); 15 | public static readonly Domain FlexApi = new Domain("flex-api"); 16 | public static readonly Domain Versionless = new Domain("versionless"); 17 | public static readonly Domain PreviewIam = new Domain("preview-iam"); 18 | public static readonly Domain Oauth = new Domain("oauth"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/api/v2010/model_list_health_check.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // ListHealthCheck struct for ListHealthCheck 18 | type ListHealthCheck struct { 19 | Status []string `json:"status,omitempty"` 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/twilio-go/api_service.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | package {{packageName}} 3 | 4 | import ( 5 | twilio "github.com/twilio/twilio-go/client" 6 | ) 7 | 8 | type ApiService struct { 9 | baseURL string 10 | requestHandler *twilio.RequestHandler 11 | } 12 | 13 | func (c *ApiService) RequestHandler() *twilio.RequestHandler { 14 | return c.requestHandler 15 | } 16 | 17 | func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { 18 | return &ApiService { 19 | requestHandler: requestHandler, 20 | baseURL: "{{#hasServers}}{{#servers}}{{url}}{{/servers}}{{/hasServers}}", 21 | } 22 | } 23 | 24 | func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { 25 | return NewApiService(twilio.NewRequestHandler(client)) 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/common/addHeaderParams.mustache: -------------------------------------------------------------------------------- 1 | private void addHeaderParams(final Request request) { 2 | {{#headerParams}} 3 | 4 | {{! -- case1 Normal Parameter (Non Array, Non equality parameter)}} 5 | {{^isArray}} 6 | {{^vendorExtensions.x-inequality-main}} 7 | if ({{paramName}} != null) { 8 | Serializer.toString(request, "{{{baseName}}}", {{paramName}}, ParameterType.HEADER); 9 | } 10 | {{/vendorExtensions.x-inequality-main}} 11 | {{/isArray}} 12 | {{! -- Case2: Array Parameter }} 13 | {{#isArray}} 14 | if ({{paramName}} != null) { 15 | for ({{baseType}} param: {{paramName}}) { 16 | Serializer.toString(request, "{{{baseName}}}", param, ParameterType.HEADER); 17 | } 18 | } 19 | {{/isArray}} 20 | 21 | {{/headerParams}} 22 | } -------------------------------------------------------------------------------- /src/main/resources/twilio-java/modelEqualsAndHashCode.mustache: -------------------------------------------------------------------------------- 1 | 2 | @Override 3 | public boolean equals(final Object o) { 4 | if (this == o) { 5 | return true; 6 | } 7 | 8 | if (o == null || getClass() != o.getClass()) { 9 | return false; 10 | } 11 | 12 | {{className}} other = ({{className}}) o; 13 | return ( 14 | {{#allProperties}} 15 | Objects.equals({{name}}, other.{{name}}){{^-last}} && {{/-last}} 16 | {{/allProperties}} 17 | ); 18 | } 19 | 20 | @Override 21 | public int hashCode() { 22 | return Objects.hash( 23 | {{#allProperties}} 24 | {{name}}{{^-last}}, {{/-last}} 25 | {{/allProperties}} 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_auth0_refresh_token_response.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Auth0RefreshTokenResponse struct for Auth0RefreshTokenResponse 18 | type Auth0RefreshTokenResponse struct { 19 | AccessToken string `json:"accessToken"` 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/common/addPostParams.mustache: -------------------------------------------------------------------------------- 1 | private void addPostParams(final Request request) { 2 | {{#formParams}} 3 | 4 | {{! -- case1 Normal Parameter (Non Array, Non equality parameter)}} 5 | {{^isArray}} 6 | {{^vendorExtensions.x-inequality-main}} 7 | if ({{paramName}} != null) { 8 | Serializer.toString(request, "{{{baseName}}}", {{paramName}}, ParameterType.URLENCODED); 9 | } 10 | {{/vendorExtensions.x-inequality-main}} 11 | {{/isArray}} 12 | 13 | {{! -- Case2: Array Parameter }} 14 | {{#isArray}} 15 | if ({{paramName}} != null) { 16 | for ({{baseType}} param: {{paramName}}) { 17 | Serializer.toString(request, "{{{baseName}}}", param, ParameterType.URLENCODED); 18 | } 19 | } 20 | {{/isArray}} 21 | 22 | {{/formParams}} 23 | } -------------------------------------------------------------------------------- /src/main/resources/twilio-java/common/generateUri.mustache: -------------------------------------------------------------------------------- 1 | 2 | {{#vendorExtensions.parentUrl}} 3 | String path = "{{{vendorExtensions.parentUrl}}}"; 4 | {{/vendorExtensions.parentUrl}} 5 | {{^vendorExtensions.parentUrl}} 6 | String path = "{{{path}}}"; 7 | {{/vendorExtensions.parentUrl}} 8 | 9 | {{#pathParams}} 10 | {{#vendorExtensions.x-is-account-sid}} 11 | this.{{paramName}} = this.{{paramName}} == null ? client.getAccountSid() : this.{{paramName}}; 12 | path = path.replace("{"+"{{baseName}}"+"}", this.{{paramName}}.toString()); 13 | {{/vendorExtensions.x-is-account-sid}} 14 | {{^vendorExtensions.x-is-account-sid}} 15 | path = path.replace("{"+"{{baseName}}"+"}", this.{{paramName}}.toString()); 16 | {{/vendorExtensions.x-is-account-sid}} 17 | {{/pathParams}} 18 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_auth0_test_login_request.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Auth0TestLoginRequest struct for Auth0TestLoginRequest 18 | type Auth0TestLoginRequest struct { 19 | Email string `json:"email"` 20 | Password string `json:"password"` 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/reader.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | {{#resources}} 3 | package com.twilio.rest.{{domainPackage}}.{{apiVersion}}{{namespaceSubPart}}; 4 | {{>common/imports}} 5 | import com.twilio.base.Page; 6 | import com.twilio.base.ResourceSet; 7 | 8 | {{#operations}} 9 | {{#vendorExtensions.x-list-operation}} 10 | public class {{resourceName}}Reader extends Reader<{{resourceName}}> { 11 | 12 | {{>common/instanceVariables}} 13 | {{>common/constructors}} 14 | {{>reader/setters}} 15 | {{>reader/operationMethod}} 16 | {{! Query is mandatory for list operations }} 17 | {{>common/addQueryParams}} 18 | 19 | {{#headerParams.0}} 20 | {{>common/addHeaderParams}} 21 | {{/headerParams.0}} 22 | } 23 | {{/vendorExtensions.x-list-operation}} 24 | {{/operations}} 25 | {{/resources}} -------------------------------------------------------------------------------- /examples/node/src/rest/Twilio.ts: -------------------------------------------------------------------------------- 1 | import { Client, ClientOpts } from "../base/BaseTwilio"; 2 | import ApiBase from "./ApiBase"; 3 | import FlexApiBase from "./FlexApiBase"; 4 | import VersionlessBase from "./VersionlessBase"; 5 | import OauthBase = require("./OauthBase"); 6 | 7 | class Twilio extends Client { 8 | constructor(username?: string, password?: string, opts?: ClientOpts) { 9 | super(username, password, opts); 10 | } 11 | 12 | get api(): ApiBase { 13 | return new ApiBase(this); 14 | } 15 | 16 | get flexApi(): FlexApiBase { 17 | return new FlexApiBase(this); 18 | } 19 | 20 | get versionless(): VersionlessBase { 21 | return new VersionlessBase(this); 22 | } 23 | 24 | get oauth(): OauthBase { 25 | return new OauthBase(this); 26 | } 27 | } 28 | 29 | export = Twilio; 30 | -------------------------------------------------------------------------------- /examples/ruby/spec/integration/versionless_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper.rb' 2 | describe 'Integration Test: versionless api' do 3 | before(:each) do 4 | @account_sid = 'AC12345678123456781234567812345678' 5 | @auth_token = 'CR12345678123456781234567812345678' 6 | end 7 | 8 | it "can make create call to Deployed Devices" do 9 | @holodeck.mock(Twilio::Response.new(200, ' 10 | { 11 | "name":"Fleet Name", 12 | "sid": "AC12345678123456781234567812345678", 13 | "friendlyName": "Friendly Fleet " 14 | } 15 | ')) 16 | createDeployedDevices = @client.versionless.deployed_devices.fleets.create() 17 | expect(createDeployedDevices.sid).to eq(@account_sid) 18 | expect(createDeployedDevices.name).to eq('Fleet Name') 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/templating/mustache/TitleCamelCaseLambda.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.templating.mustache; 2 | 3 | import com.samskivert.mustache.Mustache; 4 | import com.samskivert.mustache.Template; 5 | import com.twilio.oai.StringHelper; 6 | import lombok.RequiredArgsConstructor; 7 | 8 | import java.io.IOException; 9 | import java.io.Writer; 10 | 11 | @RequiredArgsConstructor 12 | public class TitleCamelCaseLambda implements Mustache.Lambda { 13 | private final String delimiter; 14 | 15 | public TitleCamelCaseLambda() { 16 | this(" "); 17 | } 18 | 19 | @Override 20 | public void execute(Template.Fragment fragment, Writer writer) throws IOException { 21 | final String text = StringHelper.camelize(fragment.execute(), true); 22 | writer.write(text); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/flex/v1/model_update_call_response.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // UpdateCallResponse struct for UpdateCallResponse 18 | type UpdateCallResponse struct { 19 | // Non-string path parameter in the response. 20 | Sid *int `json:"sid,omitempty"` 21 | } 22 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_auth0_login_email_request.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Auth0LoginEmailRequest struct for Auth0LoginEmailRequest 18 | type Auth0LoginEmailRequest struct { 19 | Email string `json:"email"` 20 | CallbackUri string `json:"callbackUri,omitempty"` 21 | } 22 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_auth0_test_login_response.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Auth0TestLoginResponse struct for Auth0TestLoginResponse 18 | type Auth0TestLoginResponse struct { 19 | AccessToken string `json:"accessToken"` 20 | IdToken string `json:"idToken,omitempty"` 21 | } 22 | -------------------------------------------------------------------------------- /examples/php/tests/Twilio/Integration/Rest/TwilioRestFlexIntegrationTest.php: -------------------------------------------------------------------------------- 1 | accountSid, $this->authToken); 16 | $response = $client->flexApi->v1->credentials->aws($this->authToken)->fetch(); 17 | $this->assertNotNull($response); 18 | $this->assertEquals("CR12345678123456781234567812345678", $response->sid); 19 | $this->assertEquals("Ahoy", $response->testString); 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/resources/twilio-node/requestParam.mustache: -------------------------------------------------------------------------------- 1 | {{^required}}if (params["{{paramName}}"] !== undefined){{/required}} 2 | {{#vendorExtensions.x-prefixed-collapsible-map}} 3 | data = {...data, ...{{vendorExtensions.x-serialize}}(params["{{paramName}}"], "{{.}}")}; 4 | {{/vendorExtensions.x-prefixed-collapsible-map}} 5 | {{^vendorExtensions.x-prefixed-collapsible-map}} 6 | {{#vendorExtensions.x-serialize}} 7 | data["{{{baseName}}}"] = {{.}}(params["{{paramName}}"]{{#vendorExtensions.x-transform}}, (e: {{datatypeWithEnum}}) => {{.}}{{/vendorExtensions.x-transform}}); 8 | {{/vendorExtensions.x-serialize}} 9 | {{^vendorExtensions.x-serialize}} 10 | data["{{{baseName}}}"] = params["{{paramName}}"]; 11 | {{/vendorExtensions.x-serialize}} 12 | {{/vendorExtensions.x-prefixed-collapsible-map}} 13 | -------------------------------------------------------------------------------- /src/main/resources/twilio-php/options/optionMethodArgs.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.optionFileParams}}{{#isString}} 2 | {{dataType}} ${{paramName}} = Values::NONE{{vendorExtensions.optionFileSeparator}}{{/isString}}{{^isArray}}{{^isDate}}{{^isDateTime}}{{^isString}} 3 | {{dataType}} ${{paramName}} = Values::{{#lambda.uppercase}}{{dataType}}{{/lambda.uppercase}}_NONE{{vendorExtensions.optionFileSeparator}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isArray}}{{#isArray}} 4 | array ${{paramName}} = Values::ARRAY_NONE{{vendorExtensions.optionFileSeparator}}{{/isArray}}{{#isDate}} 5 | ?{{dataType}} ${{paramName}} = null{{vendorExtensions.optionFileSeparator}}{{/isDate}}{{#isDateTime}} 6 | ?{{dataType}} ${{paramName}} = null{{vendorExtensions.optionFileSeparator}}{{/isDateTime}}{{/vendorExtensions.optionFileParams}} 7 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/LoggerUtil.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai; 2 | 3 | import java.util.logging.Logger; 4 | 5 | 6 | import java.util.logging.Logger; 7 | 8 | public class LoggerUtil { 9 | private static final Logger LOGGER = Logger.getLogger(LoggerUtil.class.getName()); 10 | 11 | private LoggerUtil() { 12 | // Private constructor to prevent instantiation 13 | } 14 | 15 | public static void logWarning(String className, String message) { 16 | LOGGER.warning("[" + className + "] " + message); 17 | } 18 | 19 | public static void logInfo(String className, String message) { 20 | LOGGER.info("[" + className + "] " + message); 21 | } 22 | 23 | public static void logSevere(String className, String message) { 24 | LOGGER.severe("[" + className + "] " + message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/twilio-python/pagination.handlebars: -------------------------------------------------------------------------------- 1 | {{#operations}} 2 | {{#vendorExtensions.x-is-read-operation}} 3 | class {{apiName}}Page(Page): 4 | 5 | def get_instance(self, payload: Dict[str, Any]) -> {{instanceName}}: 6 | """ 7 | Build an instance of {{instanceName}} 8 | 9 | :param payload: Payload response from the API 10 | """ 11 | return {{instanceName}}(self._version, payload{{#listPathParams}}, {{paramName}}=self._solution["{{paramName}}"]{{/listPathParams}}) 12 | 13 | def __repr__(self) -> str: 14 | """ 15 | Provide a friendly representation 16 | 17 | :returns: Machine friendly representation 18 | """ 19 | return "" 20 | 21 | {{/vendorExtensions.x-is-read-operation}} 22 | {{/operations}} 23 | -------------------------------------------------------------------------------- /examples/node/spec/unit/call.spec.ts: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | import nock from "nock"; 3 | import Twilio from "../../lib/rest/Twilio"; 4 | 5 | describe("flex-calls", () => { 6 | const accountSid: string = "AC12345678123456781234567812345678"; 7 | const authToken: string = "CR12345678123456781234567812345678"; 8 | const twilio = new Twilio(accountSid, authToken); 9 | 10 | afterAll(() => { 11 | nock.cleanAll(); 12 | }); 13 | 14 | it("should update a voice call", () => { 15 | const scope = nock("http://flex-api.twilio.com") 16 | .post("/v1/Voice/123") 17 | .reply(200, { sid: "123" }); 18 | 19 | return twilio.flexApi.v1.calls("123").update(() => scope.done()); 20 | }); 21 | 22 | it("should throw given an invalid path param", () => { 23 | expect(() => twilio.flexApi.v1.calls("?")).toThrow("not valid"); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_auth0_authorize_response.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Auth0AuthorizeResponse struct for Auth0AuthorizeResponse 18 | type Auth0AuthorizeResponse struct { 19 | Email string `json:"email,omitempty"` 20 | Redirect string `json:"redirect"` 21 | IsSso bool `json:"isSso,omitempty"` 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/deleter.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | {{#resources}} 3 | package com.twilio.rest.{{domainPackage}}.{{apiVersion}}{{namespaceSubPart}}; 4 | {{>common/imports}} 5 | 6 | {{#operations}} 7 | {{#vendorExtensions.x-delete-operation}} 8 | public class {{resourceName}}Deleter extends Deleter<{{resourceName}}> { 9 | 10 | {{>common/instanceVariables}} 11 | {{>common/constructors}} 12 | {{>deleter/setters}} 13 | {{>deleter/operationMethod}} 14 | {{#queryParams.0}} 15 | {{>common/addQueryParams}} 16 | {{/queryParams.0}} 17 | {{#headerParams.0}} 18 | {{>common/addHeaderParams}} 19 | {{/headerParams.0}} 20 | } 21 | {{/vendorExtensions.x-delete-operation}} 22 | {{/operations}} 23 | {{/resources}} -------------------------------------------------------------------------------- /src/main/resources/twilio-java/creator.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | {{#resources}} 3 | package com.twilio.rest.{{domainPackage}}.{{apiVersion}}{{namespaceSubPart}}; 4 | 5 | {{>common/imports}} 6 | 7 | {{#operations}} 8 | {{#vendorExtensions.x-create-operation}} 9 | public class {{resourceName}}Creator extends Creator<{{resourceName}}> { 10 | 11 | {{>common/instanceVariables}} 12 | {{>common/constructors}} 13 | {{>creator/setters}} 14 | {{>creator/operationMethod}} 15 | {{#queryParams.0}} 16 | {{>common/addQueryParams}} 17 | {{/queryParams.0}} 18 | {{#formParams.0}} 19 | {{>common/addPostParams}} 20 | {{/formParams.0}} 21 | {{#headerParams.0}} 22 | {{>common/addHeaderParams}} 23 | {{/headerParams.0}} 24 | {{#bodyParams.0}} 25 | {{>common/addPostParamsJson}} 26 | {{/bodyParams.0}} 27 | } 28 | {{/vendorExtensions.x-create-operation}} 29 | {{/operations}} 30 | {{/resources}} -------------------------------------------------------------------------------- /src/main/resources/twilio-php/options/optionMethod.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.hasOptionFileParams}} 2 | /**{{#vendorExtensions.optionFileParams}} 3 | * @param {{dataType}} ${{paramName}}{{#description}} {{{description}}}{{/description}}{{/vendorExtensions.optionFileParams}} 4 | * @return {{vendorExtensions.x-name}}{{apiName}}Options Options builder 5 | */ 6 | public static function {{#lambda.camelcase}}{{vendorExtensions.x-name}}{{/lambda.camelcase}}( 7 | {{>options/optionMethodArgs}} 8 | ): {{vendorExtensions.x-name}}{{apiName}}Options 9 | { 10 | return new {{vendorExtensions.x-name}}{{apiName}}Options({{#vendorExtensions.optionFileParams}} 11 | ${{paramName}}{{vendorExtensions.optionFileSeparator}}{{^-last}}{{/-last}}{{/vendorExtensions.optionFileParams}} 12 | ); 13 | } 14 | {{/vendorExtensions.hasOptionFileParams}} 15 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/template/RubyApiActionTemplate.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.template; 2 | 3 | import com.twilio.oai.StringHelper; 4 | import org.openapitools.codegen.CodegenConfig; 5 | 6 | import java.util.Arrays; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | public class RubyApiActionTemplate extends AbstractApiActionTemplate { 11 | 12 | public RubyApiActionTemplate(final CodegenConfig defaultCodegen) { 13 | super(defaultCodegen); 14 | } 15 | 16 | @Override 17 | protected Map> mapping() { 18 | return Map.of(API_TEMPLATE, Arrays.asList("api.mustache", ".rb"), VERSION_TEMPLATE, Arrays.asList("version.mustache", ".rb")); 19 | } 20 | 21 | @Override 22 | protected String getVersionFilename(final String apiVersionClass) { 23 | return StringHelper.toSnakeCase(apiVersionClass); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | ### Issue Summary 10 | A summary of the issue with the generated code, and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, or code examples. 11 | 12 | ### Steps to Reproduce 13 | 1. This is the first step 14 | 2. This is the second step 15 | 3. Further steps, etc. 16 | 17 | ### Code Snippet 18 | ```go 19 | # paste code here 20 | ``` 21 | 22 | ### Exception/Log 23 | ``` 24 | # paste exception/log here 25 | ``` 26 | 27 | ### Technical details: 28 | * twilio-go version: 29 | * go version: 30 | 31 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_auth0_token_response.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Auth0TokenResponse struct for Auth0TokenResponse 18 | type Auth0TokenResponse struct { 19 | AccessToken string `json:"accessToken"` 20 | IdToken string `json:"idToken"` 21 | AuthContext string `json:"authContext"` 22 | IsPurgatory bool `json:"isPurgatory"` 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/nestedmodels/MustacheOneOf.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.nestedmodels; 2 | 3 | // Implementation of OneOf interface for Mustache templates 4 | public class MustacheOneOf { 5 | String className; 6 | String discriminator; 7 | 8 | public MustacheOneOf(String className, String discriminator) { 9 | this.className = className; 10 | this.discriminator = discriminator; 11 | } 12 | 13 | @Override 14 | public boolean equals(Object obj) { 15 | if (this == obj) return true; 16 | if (obj == null || getClass() != obj.getClass()) return false; 17 | MustacheOneOf that = (MustacheOneOf) obj; 18 | return className != null && className.equals(that.className); 19 | } 20 | 21 | @Override 22 | public int hashCode() { 23 | return className != null ? className.hashCode() : 0; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/dateTimeGroupParams.mustache: -------------------------------------------------------------------------------- 1 | if ({{paramName}} != null) { 2 | {{#isDate}} 3 | request.addQueryParam("{{baseName}}", {{paramName}}.format(DateTimeFormatter.ofPattern(Request.QUERY_STRING_DATE_FORMAT))); 4 | {{/isDate}} 5 | {{#isDateTime}} 6 | request.addQueryParam("{{baseName}}", {{paramName}}.format(DateTimeFormatter.ofPattern(Request.QUERY_STRING_DATE_TIME_FORMAT))); 7 | {{/isDateTime}} 8 | } 9 | else if ({{paramName}}After != null || {{paramName}}Before != null) { 10 | {{#isDateTime}} 11 | request.addQueryDateTimeRange("{{baseName}}", {{paramName}}After, {{paramName}}Before); 12 | {{/isDateTime}} 13 | {{#isDate}} 14 | request.addQueryDateRange("{{baseName}}", {{paramName}}After, {{paramName}}Before); 15 | {{/isDate}} 16 | } -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/flex/v1/model_list_credential_aws_response.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // ListCredentialAwsResponse struct for ListCredentialAwsResponse 18 | type ListCredentialAwsResponse struct { 19 | Credentials []TestResponseObject `json:"credentials,omitempty"` 20 | Meta ListCredentialAwsResponseMeta `json:"meta,omitempty"` 21 | } 22 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/api_base.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # This code was generated by 3 | # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | # 7 | # NOTE: This class is auto generated by OpenAPI Generator. 8 | # https://openapi-generator.tech 9 | # Do not edit the class manually. 10 | # frozen_string_literal: true 11 | 12 | module Twilio 13 | module REST 14 | class ApiBase < Domain 15 | ## 16 | # Initialize api domain 17 | # 18 | # @param twilio - The twilio client 19 | # 20 | def initialize(twilio) 21 | super 22 | @base_url = 'https://api.twilio.com' 23 | @host = 'api' 24 | @port = 443 25 | end 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /examples/php/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.4 2 | COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer 3 | 4 | RUN apt-get update -y && apt-get install -y git zip 5 | 6 | ENV XDEBUG_MODE=coverage 7 | ENV PATH="vendor/bin:$PATH" 8 | 9 | RUN pecl install xdebug-2.9.0 10 | RUN pecl install pcov && docker-php-ext-enable pcov 11 | 12 | RUN git clone https://github.com/twilio/twilio-php.git twilio 13 | WORKDIR /twilio 14 | 15 | RUN rm -rf src/Twilio/Rest/* 16 | COPY src/Twilio/Rest src/Twilio/Rest 17 | 18 | RUN rm -rf tests/Twilio/Integration 19 | COPY tests/Twilio/Integration/Rest tests/Twilio/Integration/Rest 20 | 21 | RUN make install 22 | 23 | CMD ["/bin/bash", "-c", "phpunit -d memory_limit=512M --disallow-test-output --colors --configuration tests/phpunit.xml --coverage-clover=php_coverage.xml --log-junit=execution-result.xml 2>&1 | tee /local/test-report.out && cp php_coverage.xml execution-result.xml /local"] 24 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/ruby/RubyPropertyResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.ruby; 2 | 3 | import com.twilio.oai.resolver.IConventionMapper; 4 | import com.twilio.oai.resolver.LanguagePropertyResolver; 5 | import org.openapitools.codegen.CodegenProperty; 6 | 7 | 8 | import static com.twilio.oai.common.ApplicationConstants.DESERIALIZE_VEND_EXT; 9 | 10 | public class RubyPropertyResolver extends LanguagePropertyResolver { 11 | public RubyPropertyResolver(IConventionMapper mapper) { 12 | super(mapper); 13 | } 14 | 15 | @Override 16 | protected void resolveDeSerialize(CodegenProperty codegenProperty){ 17 | mapper 18 | .deserialize() 19 | .getString(getDataType(codegenProperty)) 20 | .ifPresent(deserialize -> codegenProperty.vendorExtensions.put(DESERIALIZE_VEND_EXT, 21 | deserialize)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/resource/GeneratePath.mustache: -------------------------------------------------------------------------------- 1 | 2 | {{#vendorExtensions.parentUrl}} 3 | string path = "{{{vendorExtensions.parentUrl}}}"; 4 | {{/vendorExtensions.parentUrl}} 5 | {{^vendorExtensions.parentUrl}} 6 | string path = "{{{path}}}"; 7 | {{/vendorExtensions.parentUrl}} 8 | 9 | {{#pathParams}} 10 | {{#vendorExtensions.x-is-account-sid}} 11 | string {{paramName}} = options.{{{vendorExtensions.x-param-to-string}}} ?? client.AccountSid; 12 | path = path.Replace("{"+"{{baseName}}"+"}", {{paramName}}); 13 | {{/vendorExtensions.x-is-account-sid}} 14 | {{^vendorExtensions.x-is-account-sid}} 15 | string {{paramName}} = options.{{{vendorExtensions.x-param-to-string}}}; 16 | path = path.Replace("{"+"{{baseName}}"+"}", {{paramName}}); 17 | {{/vendorExtensions.x-is-account-sid}} 18 | {{/pathParams}} 19 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/api/v2010/model_test_response_object_test_object.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // TestResponseObjectTestObject struct for TestResponseObjectTestObject 18 | type TestResponseObjectTestObject struct { 19 | Fax bool `json:"fax,omitempty"` 20 | Mms bool `json:"mms,omitempty"` 21 | Sms bool `json:"sms,omitempty"` 22 | Voice bool `json:"voice,omitempty"` 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/api/CsharpApiResources.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.api; 2 | 3 | import com.twilio.oai.common.ApplicationConstants; 4 | import com.twilio.oai.resolver.csharp.OperationStore; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import org.openapitools.codegen.IJsonSchemaValidationProperties; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public class CsharpApiResources extends ApiResources { 13 | @Getter @Setter private String authMethod; 14 | @Getter @Setter private String restClientMethodName; 15 | @Getter @Setter private String clientName; 16 | List enums = new ArrayList<>(OperationStore.getInstance().getEnums().values()); 17 | 18 | public String resourceConstant = ApplicationConstants.RESOURCE; 19 | 20 | public CsharpApiResources(ApiResourceBuilder apiResourceBuilder) { 21 | super(apiResourceBuilder); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/template/CsharpApiActionTemplate.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.template; 2 | 3 | import org.openapitools.codegen.CodegenConfig; 4 | 5 | import java.util.Arrays; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class CsharpApiActionTemplate extends AbstractApiActionTemplate { 10 | 11 | public static final String TEMPLATE_TYPE_OPTIONS = "Options"; 12 | public static final String TEMPLATE_TYPE_RESOURCE = "Resource"; 13 | 14 | public CsharpApiActionTemplate(CodegenConfig defaultCodegen) { 15 | super(defaultCodegen); 16 | } 17 | 18 | @Override 19 | public Map> mapping() { 20 | return Map.of(TEMPLATE_TYPE_RESOURCE, 21 | Arrays.asList(TEMPLATE_TYPE_RESOURCE + ".mustache", "Resource.cs"), 22 | TEMPLATE_TYPE_OPTIONS, 23 | Arrays.asList(TEMPLATE_TYPE_OPTIONS + ".mustache", "Options.cs")); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/flex/v1/model_test_response_object.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // TestResponseObject struct for TestResponseObject 18 | type TestResponseObject struct { 19 | AccountSid *string `json:"account_sid,omitempty"` 20 | Sid *string `json:"sid,omitempty"` 21 | TestString *string `json:"test_string,omitempty"` 22 | TestInteger *int `json:"test_integer,omitempty"` 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/Options.mustache: -------------------------------------------------------------------------------- 1 | {{>LicenseInfo}} 2 | 3 | {{#resources}} 4 | {{>OptionsUsings}} 5 | 6 | 7 | namespace Twilio.Rest.{{domainPackage}}.{{apiVersionClass}}{{namespaceSubPart}} 8 | { 9 | {{#apiOperations}} 10 | {{#vendorExtensions.x-is-create-operation}} 11 | {{>options/CreateOptions}} 12 | {{/vendorExtensions.x-is-create-operation}} 13 | {{#vendorExtensions.x-is-delete-operation}} 14 | {{>options/DeleteOptions}} 15 | {{/vendorExtensions.x-is-delete-operation}} 16 | {{#vendorExtensions.x-is-fetch-operation}} 17 | {{>options/FetchOptions}} 18 | {{/vendorExtensions.x-is-fetch-operation}} 19 | {{#vendorExtensions.x-is-read-operation}} 20 | {{>options/ReadOptions}} 21 | {{/vendorExtensions.x-is-read-operation}} 22 | {{#vendorExtensions.x-is-update-operation}} 23 | {{>options/UpdateOptions}} 24 | {{/vendorExtensions.x-is-update-operation}} 25 | {{/apiOperations}} 26 | } 27 | 28 | {{/resources}} 29 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/updater.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | {{#resources}} 3 | package com.twilio.rest.{{domainPackage}}.{{apiVersion}}{{namespaceSubPart}}; 4 | {{>common/imports}} 5 | 6 | {{#operations}} 7 | {{#vendorExtensions.x-update-operation}} 8 | public class {{resourceName}}Updater extends Updater<{{resourceName}}> { 9 | {{>common/instanceVariables}} 10 | {{>common/constructors}} 11 | {{>updater/setters}} 12 | {{>updater/operationMethod}} 13 | {{#queryParams.0}} 14 | {{>common/addQueryParams}} 15 | {{/queryParams.0}} 16 | {{#formParams.0}} 17 | {{>common/addPostParams}} 18 | {{/formParams.0}} 19 | {{#headerParams.0}} 20 | {{>common/addHeaderParams}} 21 | {{/headerParams.0}} 22 | {{#bodyParams.0}} 23 | {{>common/addPostParamsJson}} 24 | {{/bodyParams.0}} 25 | } 26 | {{/vendorExtensions.x-update-operation}} 27 | {{/operations}} 28 | {{/resources}} -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_auth0_refresh_scoped_token_request.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Auth0RefreshScopedTokenRequest struct for Auth0RefreshScopedTokenRequest 18 | type Auth0RefreshScopedTokenRequest struct { 19 | // The SID of the account to be authorized for the user. 20 | AccountSid string `json:"accountSid,omitempty"` 21 | AuthorizationContext string `json:"authorizationContext,omitempty"` 22 | } 23 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_error.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Error Generic error 18 | type Error struct { 19 | // Twilio-specific error code 20 | Code int `json:"code,omitempty"` 21 | // Error message 22 | Message string `json:"message,omitempty"` 23 | // Link to Error Code References 24 | MoreInfo string `json:"more_info,omitempty"` 25 | // HTTP response status code 26 | Status int `json:"status,omitempty"` 27 | } 28 | -------------------------------------------------------------------------------- /examples/node/src/rest/OauthBase.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * NOTE: This class is auto generated by OpenAPI Generator. 8 | * https://openapi-generator.tech 9 | * Do not edit the class manually. 10 | */ 11 | 12 | import Domain from "../base/Domain"; 13 | import V2 from "./oauth/V2"; 14 | 15 | class OauthBase extends Domain { 16 | _v2?: V2; 17 | 18 | /** 19 | * Initialize oauth domain 20 | * 21 | * @param twilio - The twilio client 22 | */ 23 | constructor(twilio: any) { 24 | super(twilio, "https://oauth.twilio.com"); 25 | } 26 | 27 | get v2(): V2 { 28 | this._v2 = this._v2 || new V2(this); 29 | return this._v2; 30 | } 31 | } 32 | 33 | export = OauthBase; 34 | -------------------------------------------------------------------------------- /src/test/java/com/twilio/oai/StringHelperTest.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | public class StringHelperTest { 8 | 9 | @Test 10 | public void testToSnakeCase() { 11 | assertEquals("some_a2p_thing", StringHelper.toSnakeCase("SomeA2PThing")); 12 | assertEquals("psd2_enabled", StringHelper.toSnakeCase("Psd2Enabled")); 13 | assertEquals("aws_s3_url", StringHelper.toSnakeCase("AwsS3Url")); 14 | assertEquals("callback_url", StringHelper.toSnakeCase("callbackURL")); 15 | } 16 | 17 | @Test 18 | public void testCamelize() { 19 | assertEquals("SomeA2PThing", StringHelper.camelize("some_a2p_thing")); 20 | assertEquals("Psd2Enabled", StringHelper.camelize("psd2_enabled")); 21 | assertEquals("AwsS3Url", StringHelper.camelize("aws_s3_url")); 22 | assertEquals("CallbackUrl", StringHelper.camelize("callback_url")); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/enums.mustache: -------------------------------------------------------------------------------- 1 | {{#enums}} 2 | public enum {{#lambda.titlecase}}{{{enumName}}}{{/lambda.titlecase}} { 3 | {{#allowableValues}} 4 | {{#values}} 5 | {{#lambda.uppercase}}{{#lambda.replacehyphen}}{{{.}}}{{/lambda.replacehyphen}}({{/lambda.uppercase}}"{{{.}}}"){{^-last}},{{/-last}}{{#-last}};{{/-last}} 6 | {{/values}} 7 | {{/allowableValues}} 8 | 9 | private final String value; 10 | 11 | private {{#lambda.titlecase}}{{{enumName}}}{{/lambda.titlecase}}(final String value) { 12 | this.value = value; 13 | } 14 | 15 | public String toString() { 16 | return value; 17 | } 18 | 19 | @JsonCreator 20 | public static {{#lambda.titlecase}}{{{enumName}}}{{/lambda.titlecase}} forValue(final String value) { 21 | return Promoter.enumFromString(value, {{#lambda.titlecase}}{{{enumName}}}{{/lambda.titlecase}}.values()); 22 | } 23 | } 24 | {{/enums}} -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_auth0_signup_request.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Auth0SignupRequest struct for Auth0SignupRequest 18 | type Auth0SignupRequest struct { 19 | Email string `json:"email"` 20 | Deeplink string `json:"deeplink,omitempty"` 21 | OrganizationSid string `json:"organizationSid,omitempty"` 22 | NotificationSid string `json:"notificationSid,omitempty"` 23 | OneConsole bool `json:"oneConsole,omitempty"` 24 | } 25 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/flex_api_base.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # This code was generated by 3 | # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | # 7 | # NOTE: This class is auto generated by OpenAPI Generator. 8 | # https://openapi-generator.tech 9 | # Do not edit the class manually. 10 | # frozen_string_literal: true 11 | 12 | module Twilio 13 | module REST 14 | class FlexApiBase < Domain 15 | ## 16 | # Initialize flexApi domain 17 | # 18 | # @param twilio - The twilio client 19 | # 20 | def initialize(twilio) 21 | super(twilio) 22 | @base_url = 'https://flex-api.twilio.com' 23 | @host = 'flex-api' 24 | @port = 443 25 | 26 | # Versions 27 | @v1 = nil 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /examples/java/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eclipse-temurin:8-jdk 2 | 3 | # Install Maven with proper error handling 4 | RUN apt-get update && \ 5 | apt-get install -y --no-install-recommends git maven && \ 6 | apt-get clean && \ 7 | rm -rf /var/lib/apt/lists/* 8 | 9 | WORKDIR /app 10 | # Install git 11 | RUN apt-get update && \ 12 | apt-get install -y --no-install-recommends git && \ 13 | apt-get clean && \ 14 | rm -rf /var/lib/apt/lists/* 15 | 16 | # Use HTTPS instead of SSH for git clone 17 | RUN git clone https://github.com/twilio/twilio-java.git 18 | WORKDIR /app/twilio-java/ 19 | 20 | RUN rm -rf src/main/java/com/twilio/rest/*/ \ 21 | src/main/java/com/twilio/example/ \ 22 | src/test/ 23 | 24 | COPY src/main/java/com/twilio src/main/java/com/twilio/ 25 | COPY unit-test/rest integration-test/rest src/test/java/com/twilio/ 26 | 27 | CMD ["/bin/bash", "-c", "set -o pipefail && mvn clean test --no-transfer-progress | tee /local/test-report.out && cp -r target /local"] 28 | -------------------------------------------------------------------------------- /src/test/java/com/twilio/oai/DirectoryStructureServiceTest.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai; 2 | 3 | import com.twilio.oai.common.ApplicationConstants; 4 | 5 | import org.junit.Test; 6 | 7 | import static org.junit.Assert.assertEquals; 8 | 9 | public class DirectoryStructureServiceTest { 10 | private static final String SEPARATOR = ApplicationConstants.PATH_SEPARATOR_PLACEHOLDER; 11 | 12 | @Test 13 | public void testGetRelativeRoot() { 14 | final DirectoryStructureService dirService = new DirectoryStructureService(null, null, null); 15 | 16 | assertEquals("..", dirService.getRelativeRoot("")); 17 | assertEquals("..", dirService.getRelativeRoot("autopilot")); 18 | assertEquals("..", dirService.getRelativeRoot("autopilot" + SEPARATOR)); 19 | assertEquals("../..", dirService.getRelativeRoot("autopilot" + SEPARATOR + "v1")); 20 | assertEquals("../../..", dirService.getRelativeRoot("autopilot" + SEPARATOR + "v1" + SEPARATOR + "services")); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/options/HeaderParams.mustache: -------------------------------------------------------------------------------- 1 | 2 | {{#vendorExtensions.x-header-param-exists}} 3 | /// Generate the necessary header parameters 4 | public List> GetHeaderParams() 5 | { 6 | var p = new List>(); 7 | {{#vendorExtensions.x-header-params}} 8 | {{#isArray}} 9 | if ({{paramName}} != null) 10 | { 11 | p.AddRange({{paramName}}.Select({{paramName}} => new KeyValuePair("{{{baseName}}}", {{{vendorExtensions.x-param-to-string}}}))); 12 | } 13 | {{/isArray}} 14 | {{^isArray}} 15 | if ({{paramName}} != null) 16 | { 17 | p.Add(new KeyValuePair("{{{baseName}}}", {{{vendorExtensions.x-param-to-string}}})); 18 | } 19 | {{/isArray}} 20 | {{/vendorExtensions.x-header-params}} 21 | return p; 22 | } 23 | {{/vendorExtensions.x-header-param-exists}} 24 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java-legacy/headerParams.mustache: -------------------------------------------------------------------------------- 1 | private void addHeaderParams(final {{vendorExtensions.x-auth-attributes.x-http-class-prefix}}Request request) { 2 | {{#headerParams}} 3 | if ({{paramName}} != null) { 4 | {{#vendorExtensions.x-is-other-data-type}} 5 | request.addHeaderParam("{{baseName}}", {{paramName}}.toString()); 6 | {{/vendorExtensions.x-is-other-data-type}} 7 | {{^vendorExtensions.x-is-other-data-type}} 8 | {{#isEnum}} 9 | request.addHeaderParam("{{baseName}}", {{paramName}}.toString()); 10 | {{/isEnum}} 11 | {{^isEnum}} 12 | {{#isString}} 13 | request.addHeaderParam("{{baseName}}", {{paramName}}); 14 | {{/isString}} 15 | {{^isString}} 16 | request.addHeaderParam("{{baseName}}", {{paramName}}.toString()); 17 | {{/isString}} 18 | {{/isEnum}} 19 | 20 | {{/vendorExtensions.x-is-other-data-type}} 21 | } 22 | {{/headerParams}} 23 | } -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/options/ReadOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>Summary}} 2 | public class Read{{apiName}}Options : ReadOptions<{{apiName}}{{resourceConstant}}> 3 | { 4 | {{>options/Params}} 5 | 6 | {{#vendorExtensions.x-required-param-exists}} 7 | {{>options/MethodsComments}} public Read{{apiName}}Options({{#requiredParams}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}) 8 | { 9 | {{#requiredParams}} 10 | {{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}; 11 | {{/requiredParams}} 12 | {{#allParams}} 13 | {{^required}} 14 | {{#isArray}} 15 | {{paramName}} = new {{{dataType}}}(); 16 | {{/isArray}} 17 | {{/required}} 18 | {{/allParams}} 19 | } 20 | {{/vendorExtensions.x-required-param-exists}} 21 | 22 | {{>options/GetParams}} 23 | {{>options/HeaderParams}} 24 | } 25 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/options/FetchOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>Summary}} 2 | public class Fetch{{apiName}}Options : IOptions<{{apiName}}{{resourceConstant}}> 3 | { 4 | {{>options/Params}} 5 | 6 | {{#vendorExtensions.x-required-param-exists}} 7 | {{>options/MethodsComments}} public Fetch{{apiName}}Options({{#requiredParams}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}) 8 | { 9 | {{#requiredParams}} 10 | {{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}; 11 | {{/requiredParams}} 12 | {{#allParams}} 13 | {{^required}} 14 | {{#isArray}} 15 | {{paramName}} = new {{{dataType}}}(); 16 | {{/isArray}} 17 | {{/required}} 18 | {{/allParams}} 19 | } 20 | {{/vendorExtensions.x-required-param-exists}} 21 | 22 | {{>options/GetParams}} 23 | {{>options/HeaderParams}} 24 | } 25 | 26 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_auth0_authentication_code_exchange_request.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // Auth0AuthenticationCodeExchangeRequest struct for Auth0AuthenticationCodeExchangeRequest 18 | type Auth0AuthenticationCodeExchangeRequest struct { 19 | AuthorizationCode string `json:"authorizationCode"` 20 | State string `json:"state,omitempty"` 21 | CodeVerifier string `json:"codeVerifier,omitempty"` 22 | Nonce string `json:"nonce,omitempty"` 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/options/DeleteOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>Summary}} 2 | public class Delete{{apiName}}Options : IOptions<{{apiName}}{{resourceConstant}}> 3 | { 4 | {{>options/Params}} 5 | 6 | {{#vendorExtensions.x-required-param-exists}} 7 | {{>options/MethodsComments}} public Delete{{apiName}}Options({{#requiredParams}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}) 8 | { 9 | {{#requiredParams}} 10 | {{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}; 11 | {{/requiredParams}} 12 | {{#allParams}} 13 | {{^required}} 14 | {{#isArray}} 15 | {{paramName}} = new {{{dataType}}}(); 16 | {{/isArray}} 17 | {{/required}} 18 | {{/allParams}} 19 | } 20 | {{/vendorExtensions.x-required-param-exists}} 21 | 22 | {{>options/GetParams}} 23 | {{>options/HeaderParams}} 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/responsebody/ResponseProcessorFactory.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.responsebody; 2 | 3 | import org.openapitools.codegen.CodegenOperation; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | public class ResponseProcessorFactory { 9 | private final List processors = new ArrayList<>(); 10 | private static final ResponseProcessorFactory INSTANCE = new ResponseProcessorFactory(); 11 | 12 | private ResponseProcessorFactory() { 13 | processors.add(new JsonResponseProcessor()); 14 | } 15 | 16 | public static ResponseProcessorFactory getInstance() { 17 | return INSTANCE; 18 | } 19 | public void process(final CodegenOperation codegenOperation) { 20 | for (ResponseProcessor responseProcessor : processors) { 21 | if (responseProcessor.shouldProcess(codegenOperation)) { 22 | responseProcessor.process(codegenOperation); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/response.mustache: -------------------------------------------------------------------------------- 1 | {{! -- Instance variables}} 2 | {{#responseFlag}} 3 | 4 | 5 | {{#response}} 6 | @Getter 7 | private final {{{dataType}}} {{name}}; 8 | {{/response}} 9 | 10 | {{! -- Private Constructor}} 11 | @JsonCreator 12 | private {{resourceName}}( 13 | {{#response}} 14 | @JsonProperty("{{baseName}}") 15 | {{#vendorExtensions.x-deserializer}} 16 | @JsonDeserialize(using = {{vendorExtensions.x-deserializer}}.class) 17 | {{/vendorExtensions.x-deserializer}} 18 | final {{{dataType}}} {{name}}{{^-last}}, {{/-last}} 19 | {{/response}} 20 | ){ 21 | {{#response}} 22 | this.{{name}} = {{name}}; 23 | {{/response}} 24 | } 25 | 26 | {{>equalsAndHashcode}} 27 | {{/responseFlag}} 28 | 29 | {{^responseFlag}} 30 | @JsonCreator 31 | private {{resourceName}}() {} 32 | 33 | @Override 34 | public boolean equals(Object obj) { 35 | return obj != null && obj.getClass() == this.getClass(); 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | return 1; 41 | } 42 | {{/responseFlag}} -------------------------------------------------------------------------------- /src/main/resources/twilio-ruby/modelClasses.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{^vendorExtensions.part-of-response-model}}{{#hasVars}} 2 | class {{classname}} 3 | {{#vars}} 4 | # @param [{{name}}]: [{{{dataType}}}] {{{description}}} 5 | {{/vars}} 6 | attr_accessor {{#vars}}:{{name}}{{^-last}}, {{/-last}}{{/vars}} 7 | def initialize(payload) 8 | {{#vars}} 9 | @{{name}} = payload["{{name}}"] 10 | {{/vars}} 11 | end 12 | def to_json(options = {}) 13 | { 14 | {{#vars}} 15 | "{{baseName}}": @{{name}}, 16 | {{/vars}} 17 | }.to_json(options) 18 | end 19 | end 20 | {{/hasVars}}{{/vendorExtensions.part-of-response-model}}{{/models}} 21 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/versionless_base.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # This code was generated by 3 | # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | # 7 | # NOTE: This class is auto generated by OpenAPI Generator. 8 | # https://openapi-generator.tech 9 | # Do not edit the class manually. 10 | # frozen_string_literal: true 11 | 12 | module Twilio 13 | module REST 14 | class VersionlessBase < Domain 15 | ## 16 | # Initialize versionless domain 17 | # 18 | # @param twilio - The twilio client 19 | # 20 | def initialize(twilio) 21 | super(twilio) 22 | @base_url = 'https://versionless.twilio.com' 23 | @host = 'versionless' 24 | @port = 443 25 | 26 | # Versions 27 | @deployed_devices = nil 28 | @understand = nil 29 | end 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /examples/php/src/Twilio/Rest/PreviewIam.php: -------------------------------------------------------------------------------- 1 | token instead. 15 | */ 16 | protected function getToken(): TokenList { 17 | return $this->v1->token; 18 | } 19 | 20 | /** 21 | * @deprecated Use v1->authorize instead. 22 | */ 23 | protected function getAuthorize(): AuthorizeList { 24 | return $this->v1->authorize; 25 | } 26 | 27 | protected function contextOrganization(string $orgSid): OrganizationContext { 28 | if ($this->_organization === null) { 29 | $versionless = new Versionless($this); 30 | $this->_organization = $versionless->organization($orgSid); 31 | } 32 | return $this->_organization; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/reader/setters.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-setter-methods}} 2 | 3 | public {{resourceName}}Reader set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{dataType}}} {{paramName}}){ 4 | this.{{paramName}} = {{paramName}}; 5 | return this; 6 | } 7 | 8 | {{! Optional setter-- Ideally this shouldn't exists, keeping it for backward compatibility }} 9 | {{#isArray}} 10 | public {{resourceName}}Reader set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{baseType}}} {{paramName}}){ 11 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(Promoter.listOfOne({{paramName}})); 12 | } 13 | {{/isArray}} 14 | {{! Optional setter, vendorExtensions.x-promotion stores promotion method}} 15 | {{#vendorExtensions.x-promotion}} 16 | public {{resourceName}}Reader set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final String {{paramName}}){ 17 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}({{vendorExtensions.x-promotion}}); 18 | } 19 | {{/vendorExtensions.x-promotion}} 20 | {{/vendorExtensions.x-setter-methods}} -------------------------------------------------------------------------------- /src/main/resources/twilio-java/creator/setters.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-setter-methods}} 2 | 3 | public {{resourceName}}Creator set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{dataType}}} {{paramName}}){ 4 | this.{{paramName}} = {{paramName}}; 5 | return this; 6 | } 7 | 8 | {{! Optional setter-- Ideally this shouldn't exists, keeping it for backward compatibility }} 9 | {{#isArray}} 10 | public {{resourceName}}Creator set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{baseType}}} {{paramName}}){ 11 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(Promoter.listOfOne({{paramName}})); 12 | } 13 | {{/isArray}} 14 | {{! Optional setter, vendorExtensions.x-promotion stores promotion method}} 15 | {{#vendorExtensions.x-promotion}} 16 | public {{resourceName}}Creator set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final String {{paramName}}){ 17 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}({{vendorExtensions.x-promotion}}); 18 | } 19 | {{/vendorExtensions.x-promotion}} 20 | {{/vendorExtensions.x-setter-methods}} -------------------------------------------------------------------------------- /src/main/resources/twilio-java/deleter/setters.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-setter-methods}} 2 | 3 | public {{resourceName}}Deleter set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{dataType}}} {{paramName}}){ 4 | this.{{paramName}} = {{paramName}}; 5 | return this; 6 | } 7 | 8 | {{! Optional setter-- Ideally this shouldn't exists, keeping it for backward compatibility }} 9 | {{#isArray}} 10 | public {{resourceName}}Deleter set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{baseType}}} {{paramName}}){ 11 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(Promoter.listOfOne({{paramName}})); 12 | } 13 | {{/isArray}} 14 | {{! Optional setter, vendorExtensions.x-promotion stores promotion method}} 15 | {{#vendorExtensions.x-promotion}} 16 | public {{resourceName}}Deleter set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final String {{paramName}}){ 17 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}({{vendorExtensions.x-promotion}}); 18 | } 19 | {{/vendorExtensions.x-promotion}} 20 | {{/vendorExtensions.x-setter-methods}} -------------------------------------------------------------------------------- /src/main/resources/twilio-java/fetcher/setters.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-setter-methods}} 2 | 3 | public {{resourceName}}Fetcher set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{dataType}}} {{paramName}}){ 4 | this.{{paramName}} = {{paramName}}; 5 | return this; 6 | } 7 | 8 | {{! Optional setter-- Ideally this shouldn't exists, keeping it for backward compatibility }} 9 | {{#isArray}} 10 | public {{resourceName}}Fetcher set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{baseType}}} {{paramName}}){ 11 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(Promoter.listOfOne({{paramName}})); 12 | } 13 | {{/isArray}} 14 | {{! Optional setter, vendorExtensions.x-promotion stores promotion method}} 15 | {{#vendorExtensions.x-promotion}} 16 | public {{resourceName}}Fetcher set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final String {{paramName}}){ 17 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}({{vendorExtensions.x-promotion}}); 18 | } 19 | {{/vendorExtensions.x-promotion}} 20 | {{/vendorExtensions.x-setter-methods}} -------------------------------------------------------------------------------- /src/main/resources/twilio-java/updater/setters.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-setter-methods}} 2 | 3 | public {{resourceName}}Updater set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{dataType}}} {{paramName}}){ 4 | this.{{paramName}} = {{paramName}}; 5 | return this; 6 | } 7 | 8 | {{! Optional setter-- Ideally this shouldn't exists, keeping it for backward compatibility }} 9 | {{#isArray}} 10 | public {{resourceName}}Updater set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{baseType}}} {{paramName}}){ 11 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(Promoter.listOfOne({{paramName}})); 12 | } 13 | {{/isArray}} 14 | {{! Optional setter, vendorExtensions.x-promotion stores promotion method}} 15 | {{#vendorExtensions.x-promotion}} 16 | public {{resourceName}}Updater set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final String {{paramName}}){ 17 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}({{vendorExtensions.x-promotion}}); 18 | } 19 | {{/vendorExtensions.x-promotion}} 20 | {{/vendorExtensions.x-setter-methods}} -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/auth/Auth.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.auth; 2 | 3 | import org.openapitools.codegen.CodegenOperation; 4 | import org.openapitools.codegen.CodegenSecurity; 5 | 6 | import java.util.HashMap; 7 | import java.util.List; 8 | 9 | import static com.twilio.oai.resolver.java.JavaConventionResolver.AUTH_IMPORT_CLASS; 10 | import static com.twilio.oai.resolver.java.JavaConventionResolver.HTTP_CLASS_PREFIX; 11 | 12 | public class Auth implements SecuritySchemeProcessor { 13 | @Override 14 | public void process(CodegenOperation codegenOperation) { 15 | } 16 | 17 | @Override 18 | public boolean shouldProcess(CodegenOperation codegenOperation) { 19 | List securities = codegenOperation.authMethods; 20 | if (securities == null || securities.isEmpty()) return false; // No Authentication 21 | return true; 22 | // if (securities.size() > 1) { 23 | // throw new RuntimeException("Multiple auth methods are not supported. Please use only one auth method per operation."); 24 | // } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/csharp/OperationStore.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.csharp; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import org.openapitools.codegen.IJsonSchemaValidationProperties; 6 | 7 | import java.util.HashMap; 8 | 9 | public final class OperationStore { 10 | 11 | private OperationStore() { } 12 | private static final ThreadLocal instance = ThreadLocal.withInitial(OperationStore::new); 13 | 14 | public static OperationStore getInstance() { 15 | return instance.get(); 16 | } 17 | 18 | public void clear() { 19 | className = ""; 20 | enums.clear(); 21 | isEnumPresentInResource = false; 22 | isEnumPresentInOptions = false; 23 | } 24 | 25 | @Getter 26 | @Setter 27 | private String className; 28 | @Getter 29 | @Setter 30 | private boolean isEnumPresentInResource; 31 | @Getter 32 | @Setter 33 | private boolean isEnumPresentInOptions; 34 | @Getter 35 | @Setter 36 | private HashMap enums = new HashMap<>(); 37 | } 38 | -------------------------------------------------------------------------------- /examples/csharp/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build 2 | ENV PATH="${PATH}:/root/.dotnet/tools" 3 | 4 | RUN apt-get update \ 5 | && apt-get install -y --no-install-recommends \ 6 | git \ 7 | build-essential \ 8 | mono-complete \ 9 | openjdk-17-jre 10 | 11 | RUN dotnet tool install --global dotnet-sonarscanner \ 12 | && dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.8.12 \ 13 | && dotnet tool list -g 14 | 15 | RUN mkdir /app 16 | WORKDIR /app 17 | RUN git clone --depth 1 https://github.com/twilio/twilio-csharp.git 18 | WORKDIR /app/twilio-csharp 19 | 20 | RUN rm -rf src/Twilio/Rest/*/ 21 | COPY src/Twilio/Rest src/Twilio/Rest 22 | 23 | RUN rm -rf test/Twilio.Test/*/ test/Twilio.Test/*Cluster* 24 | COPY unit-test/Rest integrationTest/Rest test/Twilio.Test/ 25 | 26 | RUN make install 27 | 28 | COPY test.sh . 29 | ARG SONAR_TOKEN 30 | ENV SONAR_TOKEN=$SONAR_TOKEN 31 | 32 | # pipefail prevents errors in a pipeline from being masked. 33 | CMD ["/bin/bash", "-c", "set -o pipefail && /app/twilio-csharp/test.sh 2>&1 | tee /local/test-report.out"] 34 | -------------------------------------------------------------------------------- /src/main/resources/twilio-node/version.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | import {{domainName}}Base from "../{{domainName}}Base"; 3 | import Version from "../../base/Version"; 4 | {{#versionResources}} 5 | import { {{importName}} } from "./{{apiVersion}}/{{filename}}"; 6 | {{/versionResources}} 7 | 8 | export default class {{apiVersionClass}} extends Version { 9 | /** 10 | * Initialize the {{apiVersionClass}} version of {{domainName}} 11 | * 12 | * @param domain - The Twilio (Twilio.{{domainName}}) domain 13 | */ 14 | constructor(domain: {{domainName}}Base) { 15 | super(domain, "{{version}}"); 16 | } 17 | 18 | {{#versionResources}} 19 | /** {{mountName}} - { Twilio.{{domainName}}.{{apiVersionClass}}.{{type}} } resource */ 20 | protected _{{mountName}}?: {{type}}; 21 | {{/versionResources}} 22 | 23 | {{#versionResources}} 24 | /** Getter for {{mountName}} resource */ 25 | get {{mountName}}(): {{type}} { 26 | this._{{mountName}} = this._{{mountName}} || {{className}}(this){{#param}}(this.domain.twilio.{{.}}){{/param}}; 27 | return this._{{mountName}}; 28 | } 29 | 30 | {{/versionResources}} 31 | } 32 | -------------------------------------------------------------------------------- /src/main/resources/twilio-python/modelClasses.handlebars: -------------------------------------------------------------------------------- 1 | {{#models}}{{^vendorExtensions.part-of-response-model}}{{#hasVars}} 2 | class {{classname}}(object): 3 | """{{#vars}} 4 | :ivar {{name}}: {{{description}}}{{/vars}} 5 | """ 6 | 7 | def __init__(self, payload: Dict[str, Any]): 8 | 9 | {{#vars}} 10 | self.{{name}}: Optional[{{{dataType}}}] = {{#if vendorExtensions.x-deserialize}}{{vendorExtensions.x-deserialize}}(payload.get("{{{name}}}")){{else}}payload.get("{{{name}}}"){{/if}}{{/vars}} 11 | 12 | def to_dict(self): 13 | return { 14 | {{#vars}} 15 | "{{{vendorExtensions.json-name}}}": {{#if complexType}}{{#containerType}}[{{name}}.to_dict() for {{name}} in self.{{name}}] if self.{{name}} is not None else None{{/containerType}}{{^containerType}}self.{{name}}{{^vendorExtensions.x-enum-object}}.to_dict() if self.{{name}} is not None else None {{/vendorExtensions.x-enum-object}}{{/containerType}}{{else}}self.{{name}}{{/if}},{{/vars}} 16 | } 17 | {{/hasVars}}{{/vendorExtensions.part-of-response-model}}{{/models}} 18 | -------------------------------------------------------------------------------- /src/main/resources/twilio-go/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}# {{classname}} 2 | 3 | {{^isEnum}} 4 | ## Properties 5 | 6 | Name | Type | Description | Notes 7 | ------------ | ------------- | ------------- | ------------- 8 | {{#allVars}}**{{name}}** | {{#isNullable}}Pointer to {{/isNullable}}{{#isPrimitiveType}}**{{{vendorExtensions.x-go-base-type}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{vendorExtensions.x-go-base-type}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{{description}}} |{{^required}}{{^isNullable}}[optional] {{/isNullable}}{{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} 9 | {{/allVars}} 10 | {{/isEnum}} 11 | {{#isEnum}} 12 | ## Enum 13 | 14 | Name | Type | Notes 15 | ------------ | ------------- | ------------- 16 | {{#allowableValues}}{{#enumVars}}**{{name}}** | {{dataType}} | (value: `{{{value}}}`) 17 | {{/enumVars}}{{/allowableValues}} 18 | {{/isEnum}} 19 | 20 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) 21 | 22 | {{/model}}{{/models}} 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (C) 2023, Twilio, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/options/CreateOptions.mustache: -------------------------------------------------------------------------------- 1 | 2 | {{>Summary}} 3 | public class Create{{apiName}}Options : IOptions<{{apiName}}{{resourceConstant}}> 4 | { 5 | {{>options/Params}} 6 | {{#vendorExtensions.x-required-param-exists}} 7 | {{>options/MethodsComments}} public Create{{apiName}}Options({{#requiredParams}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}) 8 | { 9 | {{#requiredParams}} 10 | {{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}; 11 | {{/requiredParams}} 12 | {{#allParams}} 13 | {{^required}} 14 | {{#isArray}} 15 | {{paramName}} = new {{{dataType}}}(); 16 | {{/isArray}} 17 | {{/required}} 18 | {{/allParams}} 19 | } 20 | {{/vendorExtensions.x-required-param-exists}} 21 | 22 | {{^bodyParams.0}} 23 | {{>options/GetParams}} 24 | {{/bodyParams.0}} 25 | {{#bodyParams.0}} 26 | {{>options/GetBody}} 27 | {{/bodyParams.0}} 28 | {{>options/HeaderParams}} 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/options/UpdateOptions.mustache: -------------------------------------------------------------------------------- 1 | {{>Summary}} 2 | public class Update{{apiName}}Options : IOptions<{{apiName}}{{resourceConstant}}> 3 | { 4 | {{>options/Params}} 5 | 6 | {{#vendorExtensions.x-required-param-exists}} 7 | {{>options/MethodsComments}} public Update{{apiName}}Options({{#requiredParams}}{{{dataType}}} {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}{{^-last}}, {{/-last}}{{/requiredParams}}) 8 | { 9 | {{#requiredParams}} 10 | {{paramName}} = {{#lambda.camelcase}}{{paramName}}{{/lambda.camelcase}}; 11 | {{/requiredParams}} 12 | {{#allParams}} 13 | {{^required}} 14 | {{#isArray}} 15 | {{paramName}} = new {{{dataType}}}(); 16 | {{/isArray}} 17 | {{/required}} 18 | {{/allParams}} 19 | } 20 | {{/vendorExtensions.x-required-param-exists}} 21 | 22 | {{^bodyParams.0}} 23 | {{>options/GetParams}} 24 | {{/bodyParams.0}} 25 | {{#bodyParams.0}} 26 | {{>options/GetBody}} 27 | {{/bodyParams.0}} 28 | {{>options/HeaderParams}} 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/resource/ResponseModel.mustache: -------------------------------------------------------------------------------- 1 | 2 | {{#responseModels}} 3 | {{#isEnum}} 4 | {{#description}}/// {{{description}}} {{/description}} 5 | [JsonProperty("{{baseName}}")] 6 | {{^required}} 7 | public {{{dataType}}} {{nameInCamelCase}} { get; private set; } 8 | {{/required}} 9 | {{#required}} 10 | public {{{dataType}}} {{nameInCamelCase}} { get; } 11 | {{/required}} 12 | {{/isEnum}} 13 | {{^isEnum}} 14 | {{#description}}/// {{{description}}} {{/description}}{{^description}}/// The {{baseName}} {{/description}} 15 | [JsonProperty("{{baseName}}")] 16 | {{#vendorExtensions.x-jsonConverter}} 17 | [JsonConverter(typeof({{vendorExtensions.x-jsonConverter}}))] 18 | {{/vendorExtensions.x-jsonConverter}} 19 | {{^required}} 20 | public {{{dataType}}} {{nameInCamelCase}} { get; private set; } 21 | {{/required}} 22 | {{#required}} 23 | public {{{dataType}}} {{nameInCamelCase}} { get; } 24 | {{/required}} 25 | {{/isEnum}} 26 | 27 | {{/responseModels}} -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/flex/v1/model_list_credential_aws_response_meta.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // ListCredentialAwsResponseMeta struct for ListCredentialAwsResponseMeta 18 | type ListCredentialAwsResponseMeta struct { 19 | FirstPageUrl string `json:"first_page_url,omitempty"` 20 | Key string `json:"key,omitempty"` 21 | NextPageUrl string `json:"next_page_url,omitempty"` 22 | Page int `json:"page,omitempty"` 23 | PageSize int `json:"page_size,omitempty"` 24 | PreviousPageUrl string `json:"previous_page_url,omitempty"` 25 | Url string `json:"url,omitempty"` 26 | } 27 | -------------------------------------------------------------------------------- /examples/java/integration-test/rest/TestRestClient.java: -------------------------------------------------------------------------------- 1 | package com.twilio.rest; 2 | 3 | import com.twilio.http.Request; 4 | import com.twilio.http.Response; 5 | import com.twilio.http.TwilioRestClient; 6 | 7 | public class TestRestClient extends TwilioRestClient { 8 | String scheme; 9 | 10 | TestRestClient(final Builder b, final String scheme) { 11 | super(b); 12 | this.scheme = scheme; 13 | } 14 | 15 | @Override 16 | public Response request(final Request request) { 17 | StringBuilder sb = new StringBuilder(request.getUrl()); 18 | // manipulate string for mock server url 19 | sb.replace(0, 5, scheme); 20 | Request testRequest = new Request(request.getMethod(), sb.toString()); 21 | testRequest.setContentType(request.getContentType()); 22 | // updating the query and post params 23 | request.getPostParams().forEach((key, value) -> value.forEach(listValue -> testRequest.addPostParam(key, listValue))); 24 | request.getQueryParams().forEach((key, value) -> value.forEach(listValue -> testRequest.addPostParam(key, listValue))); 25 | return super.request(testRequest); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/oauth_base.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # This code was generated by 3 | # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | # 7 | # NOTE: This class is auto generated by OpenAPI Generator. 8 | # https://openapi-generator.tech 9 | # Do not edit the class manually. 10 | # frozen_string_literal: true 11 | 12 | module Twilio 13 | module REST 14 | class OauthBase < Domain 15 | ## 16 | # Initialize oauth domain 17 | # 18 | # @param twilio - The twilio client 19 | # 20 | def initialize(twilio) 21 | super(twilio) 22 | @base_url = "https://oauth.twilio.com" 23 | @host = "oauth.twilio.com" 24 | @port = 443 25 | @v1 = nil 26 | end 27 | 28 | def v2 29 | @v2 ||= Oauth::V2.new(self) 30 | end 31 | 32 | ## 33 | # Provide a user friendly representation 34 | def to_s 35 | ''; 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /src/main/resources/twilio-node/pagination.mustache: -------------------------------------------------------------------------------- 1 | {{#operations}} 2 | {{#vendorExtensions.x-is-read-operation}} 3 | export class {{apiName}}Page extends Page<{{apiVersionClass}}, {{apiName}}Payload, {{apiName}}Resource, {{instanceName}}> { 4 | /** 5 | * Initialize the {{apiName}}Page 6 | * 7 | * @param version - Version of the resource 8 | * @param response - Response from the API 9 | * @param solution - Path solution 10 | */ 11 | constructor(version: {{apiVersionClass}}, response: Response, solution: {{apiName}}Solution) { 12 | super(version, response, solution); 13 | } 14 | 15 | /** 16 | * Build an instance of {{instanceName}} 17 | * 18 | * @param payload - Payload response from the API 19 | */ 20 | getInstance(payload: {{apiName}}Resource): {{instanceName}} { 21 | return new {{instanceName}}( 22 | this._version, 23 | payload, 24 | {{#listPathParams}} 25 | this._solution.{{paramName}}, 26 | {{/listPathParams}} 27 | ); 28 | } 29 | 30 | [inspect.custom](depth: any, options: InspectOptions) { 31 | return inspect(this.toJSON(), options); 32 | } 33 | } 34 | {{/vendorExtensions.x-is-read-operation}} 35 | {{/operations}} 36 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/templating/mustache/TitleCaseLambda.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.templating.mustache; 2 | 3 | import com.twilio.oai.StringHelper; 4 | 5 | import java.io.IOException; 6 | import java.io.Writer; 7 | import java.util.Arrays; 8 | import java.util.stream.Collectors; 9 | 10 | import com.samskivert.mustache.Mustache; 11 | import com.samskivert.mustache.Template; 12 | import lombok.RequiredArgsConstructor; 13 | 14 | @RequiredArgsConstructor 15 | public class TitleCaseLambda implements Mustache.Lambda { 16 | private final String delimiter; 17 | 18 | public TitleCaseLambda() { 19 | this(" "); 20 | } 21 | 22 | @Override 23 | public void execute(Template.Fragment fragment, Writer writer) throws IOException { 24 | final String text = fragment.execute().toLowerCase(); 25 | 26 | // Split accepts regex. \Q and \E wrap the delimiter to create a literal regex, 27 | // so things like "." and "|" aren't treated as their regex equivalents. 28 | final String[] parts = text.split("\\Q" + delimiter + "\\E"); 29 | writer.write(Arrays.stream(parts).map(StringHelper::camelize).collect(Collectors.joining(delimiter))); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/resources/twilio-java/common/setters.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-setter-methods}} 2 | 3 | public {{resourceName}}{{vendorExtensions.x-common-action-type}} set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{dataType}}} {{paramName}}){ 4 | this.{{paramName}} = {{paramName}}; 5 | return this; 6 | } 7 | 8 | {{! Optional setter-- Ideally this shouldn't exists, keeping it for backward compatibility }} 9 | {{#isArray}} 10 | public {{resourceName}}{{vendorExtensions.x-common-action-type}} set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final {{{baseType}}} {{paramName}}){ 11 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(Promoter.listOfOne({{paramName}})); 12 | } 13 | {{/isArray}} 14 | {{! Optional setter, vendorExtensions.x-promotion stores promotion method}} 15 | {{#vendorExtensions.x-promotion}} 16 | public {{resourceName}}{{vendorExtensions.x-common-action-type}} set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}(final String {{paramName}}){ 17 | return set{{#lambda.titlecase}}{{paramName}}{{/lambda.titlecase}}({{vendorExtensions.x-promotion}}); 18 | } 19 | {{/vendorExtensions.x-promotion}} 20 | {{/vendorExtensions.x-setter-methods}} -------------------------------------------------------------------------------- /examples/go/go-client/helper/client/test_client.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "net/http" 5 | "net/url" 6 | "time" 7 | 8 | "github.com/twilio/twilio-go/client" 9 | ) 10 | 11 | type BaseClient interface { 12 | AccountSid() string 13 | SetTimeout(timeout time.Duration) 14 | SendRequest(method string, rawURL string, data url.Values, 15 | headers map[string]interface{}) (*http.Response, error) 16 | } 17 | 18 | type TestClient struct { 19 | client.Client 20 | scheme string 21 | } 22 | 23 | func NewTestClient(username string, password string, scheme string) *TestClient { 24 | c := &TestClient{ 25 | Client: client.Client{ 26 | Credentials: client.NewCredentials(username, password), 27 | }, 28 | scheme: scheme, 29 | } 30 | c.SetAccountSid(username) 31 | return c 32 | } 33 | 34 | func (tc *TestClient) getParsedUrl(path string) *url.URL { 35 | parsedUrl, _ := url.Parse(path) 36 | parsedUrl.Scheme = tc.scheme 37 | return parsedUrl 38 | } 39 | 40 | func (tc *TestClient) SendRequest(method string, rawURL string, data url.Values, headers map[string]interface{}) (*http.Response, error) { 41 | return tc.Client.SendRequest(method, tc.getParsedUrl(rawURL).String(), data, headers) 42 | } 43 | -------------------------------------------------------------------------------- /examples/java/unit-test/rest/TwilioNestedTest.java: -------------------------------------------------------------------------------- 1 | package com.twilio.rest; 2 | 3 | //import com.twilio.base.Page; 4 | //import com.twilio.http.HttpMethod; 5 | //import com.twilio.http.Request; 6 | //import com.twilio.http.Response; 7 | //import com.twilio.http.TwilioRestClient; 8 | //import com.fasterxml.jackson.databind.ObjectMapper; 9 | //import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; 10 | // 11 | //import com.twilio.rest.messaging.v1.*; 12 | //import org.junit.Before; 13 | //import org.junit.Test; 14 | //import org.junit.Ignore; 15 | //import org.mockito.Mock; 16 | //import org.mockito.MockitoAnnotations; 17 | // 18 | //import java.util.Arrays; 19 | // 20 | //import static org.junit.Assert.*; 21 | //import static org.mockito.Mockito.when; 22 | 23 | public class TwilioNestedTest { 24 | 25 | // @Mock 26 | // private TwilioRestClient twilioRestClient; 27 | // private final ObjectMapper objectMapper = new ObjectMapper(); 28 | // 29 | // @Before 30 | // public void setUp() { 31 | // MockitoAnnotations.initMocks(this); 32 | // when(twilioRestClient.getObjectMapper()).thenReturn(objectMapper); 33 | // objectMapper.registerModule(new JavaTimeModule()); 34 | // } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/oauth/v2.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # This code was generated by 3 | # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | # 7 | # User OAuth API 8 | # User OAuth API 9 | # 10 | # NOTE: This class is auto generated by OpenAPI Generator. 11 | # https://openapi-generator.tech 12 | # Do not edit the class manually. 13 | # 14 | 15 | module Twilio 16 | module REST 17 | class Oauth 18 | class V2 < Version 19 | ## 20 | # Initialize the V2 version of Oauth 21 | def initialize(domain) 22 | super 23 | @version = 'v2' 24 | @token = nil 25 | end 26 | 27 | ## 28 | # @return [Twilio::REST::Oauth::V2::TokenList] 29 | def token 30 | @token ||= TokenList.new self 31 | end 32 | 33 | ## 34 | # Provide a user friendly representation 35 | def to_s 36 | ''; 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/auth/NoAuth.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.auth; 2 | 3 | import org.openapitools.codegen.CodegenOperation; 4 | import org.openapitools.codegen.CodegenSecurity; 5 | 6 | import java.util.HashMap; 7 | import java.util.List; 8 | 9 | import static com.twilio.oai.resolver.java.JavaConventionResolver.AUTH_IMPORT_CLASS; 10 | import static com.twilio.oai.resolver.java.JavaConventionResolver.HTTP_CLASS_PREFIX; 11 | import static com.twilio.oai.resolver.java.JavaConventionResolver.NOAUTH_HTTP_CLASS_PREFIX; 12 | import static com.twilio.oai.resolver.java.JavaConventionResolver.NOAUTH_IMPORT_CLASS; 13 | 14 | public class NoAuth implements SecuritySchemeProcessor { 15 | 16 | @Override 17 | public void process(CodegenOperation codegenOperation) { 18 | codegenOperation.vendorExtensions.put(noAuth, true); 19 | } 20 | 21 | @Override 22 | public boolean shouldProcess(CodegenOperation codegenOperation) { 23 | // This processor is for operations that do not require authentication 24 | List securities = codegenOperation.authMethods; 25 | if (securities == null || securities.isEmpty()) return true; 26 | return false; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/twilio-node/operationSignature.mustache: -------------------------------------------------------------------------------- 1 | {{^hasRequiredParams}} 2 | /** 3 | * {{vendorExtensions.x-name}} a {{instanceName}} 4 | * 5 | * @param callback - Callback to handle processed record 6 | * 7 | * @returns Resolves to processed {{returnType}} 8 | */ 9 | {{vendorExtensions.x-name-lower}}(callback?: (error: Error | null, item?: {{returnType}}) => any): Promise<{{returnType}}>{{#hasParams}};{{/hasParams}} 10 | {{/hasRequiredParams}} 11 | {{#hasParams}} 12 | /** 13 | * {{vendorExtensions.x-name}} a {{instanceName}} 14 | * 15 | {{#bodyParam}} 16 | * @param params - Body for request 17 | * @param headers - header params for request 18 | {{/bodyParam}} 19 | {{^bodyParam}} 20 | * @param params - Parameter for request 21 | {{/bodyParam}} 22 | * @param callback - Callback to handle processed record 23 | * 24 | * @returns Resolves to processed {{instanceName}} 25 | */ 26 | {{vendorExtensions.x-name-lower}}(params: {{#bodyParam}}{{dataType}}, headers?: any{{/bodyParam}}{{^bodyParam}}{{vendorExtensions.x-resource-name}}{{vendorExtensions.x-name}}Options{{/bodyParam}}, callback?: (error: Error | null, item?: {{returnType}}) => any): Promise<{{returnType}}>; 27 | {{/hasParams}} 28 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/api_service.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | import ( 18 | twilio "github.com/twilio/twilio-go/client" 19 | ) 20 | 21 | type ApiService struct { 22 | baseURL string 23 | requestHandler *twilio.RequestHandler 24 | } 25 | 26 | func (c *ApiService) RequestHandler() *twilio.RequestHandler { 27 | return c.requestHandler 28 | } 29 | 30 | func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { 31 | return &ApiService{ 32 | requestHandler: requestHandler, 33 | baseURL: "https://oauth.twilio.com", 34 | } 35 | } 36 | 37 | func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { 38 | return NewApiService(twilio.NewRequestHandler(client)) 39 | } 40 | -------------------------------------------------------------------------------- /examples/csharp/integrationTest/Rest/TestRestClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using Twilio.Http; 5 | using Twilio.Clients; 6 | using Twilio.Converters; 7 | 8 | namespace Twilio.Tests.Rest 9 | { 10 | public class TestRestClient : TwilioRestClient, ITwilioRestClient 11 | { 12 | string baseURL; 13 | 14 | public TestRestClient( string username, string password, string url) : base(username,password) { 15 | this.baseURL = url; 16 | } 17 | 18 | public new Response Request(Request request) { 19 | StringBuilder sb = new StringBuilder(request.Uri.ToString()); 20 | // manipulate string for mock server url 21 | sb.Remove(0, request.Uri.ToString().IndexOf("twilio.com") + 10); 22 | sb.Insert(0, baseURL); 23 | Request testRequest = new Request(request.Method, sb.ToString()); 24 | // updating the query and post params 25 | request.PostParams.ForEach(val => testRequest.AddPostParam(val.Key, val.Value)); 26 | request.QueryParams.ForEach(val => testRequest.AddPostParam(val.Key, val.Value)); 27 | return base.Request(testRequest); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/test/java/com/twilio/oai/InflectorTest.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | public class InflectorTest { 8 | private final Inflector inflector = new Inflector(); 9 | 10 | @Test 11 | public void shouldReturnSingularWhenPluralIsProvided() { 12 | assertEquals("sweet", inflector.singular("sweets")); 13 | assertEquals("summary", inflector.singular("summaries")); 14 | assertEquals("address", inflector.singular("addresses")); 15 | assertEquals("MyShoe", inflector.singular("MyShoes")); 16 | assertEquals("Hero", inflector.singular("Heroes")); 17 | assertEquals("YourData", inflector.singular("YourData")); 18 | assertEquals("Ox", inflector.singular("Oxen")); 19 | assertEquals("Primitive", inflector.singular("Primitives")); 20 | } 21 | 22 | @Test 23 | public void shouldReturnSingularWhenSingularIsProvided() { 24 | assertEquals("FIFAS", inflector.singular("FIFAS")); 25 | assertEquals("Aws", inflector.singular("Aws")); 26 | assertEquals("BuildStatus", inflector.singular("BuildStatus")); 27 | assertEquals("media", inflector.singular("media")); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/oauth/v2/model_v2_oauth2_token_response.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // V2Oauth2TokenResponse struct for V2Oauth2TokenResponse 18 | type V2Oauth2TokenResponse struct { 19 | // Token which carries the necessary information to access a Twilio resource directly. 20 | AccessToken *string `json:"access_token,omitempty"` 21 | // Token which carries the information necessary to get a new access token. 22 | RefreshToken *string `json:"refresh_token,omitempty"` 23 | // Token which carries the information necessary of user profile. 24 | IdToken *string `json:"id_token,omitempty"` 25 | // Token type 26 | TokenType *string `json:"token_type,omitempty"` 27 | ExpiresIn *int64 `json:"expires_in,omitempty"` 28 | } 29 | -------------------------------------------------------------------------------- /examples/node/src/rest/oauth/V2.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * User OAuth API 8 | * User OAuth API 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | import OauthBase from "../OauthBase"; 16 | import Version from "../../base/Version"; 17 | import { TokenListInstance } from "./v2/token"; 18 | 19 | export default class V2 extends Version { 20 | /** 21 | * Initialize the V2 version of Oauth 22 | * 23 | * @param domain - The Twilio (Twilio.Oauth) domain 24 | */ 25 | constructor(domain: OauthBase) { 26 | super(domain, "v2"); 27 | } 28 | 29 | /** token - { Twilio.Oauth.V2.TokenListInstance } resource */ 30 | protected _token?: TokenListInstance; 31 | 32 | /** Getter for token resource */ 33 | get token(): TokenListInstance { 34 | this._token = this._token || TokenListInstance(this); 35 | return this._token; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/api/v2010/api_service.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | import ( 18 | twilio "github.com/twilio/twilio-go/client" 19 | ) 20 | 21 | type ApiService struct { 22 | baseURL string 23 | requestHandler *twilio.RequestHandler 24 | } 25 | 26 | func (c *ApiService) RequestHandler() *twilio.RequestHandler { 27 | return c.requestHandler 28 | } 29 | 30 | func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { 31 | return &ApiService{ 32 | requestHandler: requestHandler, 33 | baseURL: "https://api.twilio.com", 34 | } 35 | } 36 | 37 | func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { 38 | return NewApiService(twilio.NewRequestHandler(client)) 39 | } 40 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/flex/v1/api_service.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | import ( 18 | twilio "github.com/twilio/twilio-go/client" 19 | ) 20 | 21 | type ApiService struct { 22 | baseURL string 23 | requestHandler *twilio.RequestHandler 24 | } 25 | 26 | func (c *ApiService) RequestHandler() *twilio.RequestHandler { 27 | return c.requestHandler 28 | } 29 | 30 | func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { 31 | return &ApiService{ 32 | requestHandler: requestHandler, 33 | baseURL: "https://flex-api.twilio.com", 34 | } 35 | } 36 | 37 | func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { 38 | return NewApiService(twilio.NewRequestHandler(client)) 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/common/CodegenParameterDataTypeResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.common; 2 | 3 | import com.twilio.oai.api.ApiResourceBuilder; 4 | import com.twilio.oai.resolver.IConventionMapper; 5 | import com.twilio.oai.resolver.Resolver; 6 | 7 | import lombok.Setter; 8 | import org.openapitools.codegen.CodegenParameter; 9 | 10 | public class CodegenParameterDataTypeResolver extends Resolver { 11 | 12 | protected final IConventionMapper mapper; 13 | 14 | public CodegenParameterDataTypeResolver(IConventionMapper mapper) { 15 | this.mapper = mapper; 16 | } 17 | public CodegenParameter resolve(CodegenParameter parameter, ApiResourceBuilder apiResourceBuilder) { 18 | assignDataType(parameter); 19 | return parameter; 20 | } 21 | 22 | private void assignDataType(CodegenParameter parameter) { 23 | if(parameter.vendorExtensions.get("x-is-anytype") == null) { 24 | mapper 25 | .properties() 26 | .getString(parameter.dataFormat) 27 | .or(() -> mapper.properties().getString(parameter.dataType)) 28 | .ifPresent(dataType -> parameter.dataType = dataType); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/python/twilio/rest/__init__.py: -------------------------------------------------------------------------------- 1 | from twilio.base.client_base import ClientBase 2 | 3 | 4 | class Client(ClientBase): 5 | """A client for accessing the Twilio API.""" 6 | 7 | def __init__( 8 | self, 9 | username=None, 10 | password=None, 11 | account_sid=None, 12 | region=None, 13 | http_client=None, 14 | environment=None, 15 | edge=None, 16 | user_agent_extensions=None, 17 | ): 18 | super().__init__( 19 | username, 20 | password, 21 | account_sid, 22 | region, 23 | http_client, 24 | environment, 25 | edge, 26 | user_agent_extensions, 27 | ) 28 | 29 | @property 30 | def api(self): 31 | from twilio.rest.api import Api 32 | 33 | return Api(self) 34 | 35 | @property 36 | def flex_api(self): 37 | from twilio.rest.flex_api import FlexApi 38 | 39 | return FlexApi(self) 40 | 41 | @property 42 | def preview(self): 43 | from twilio.rest.versionless import Preview 44 | 45 | return Preview(self) 46 | 47 | def preview_iam(self): 48 | from twilio.rest.preview.iam import PreviewIam 49 | 50 | return PreviewIam(self) 51 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/preview_iam_base.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ## 4 | # This code was generated by 5 | # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 6 | # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 7 | # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 8 | # 9 | # NOTE: This class is auto generated by OpenAPI Generator. 10 | # https://openapi-generator.tech 11 | # Do not edit the class manually. 12 | # frozen_string_literal: true 13 | 14 | module Twilio 15 | module REST 16 | class PreviewIamBase < Domain 17 | ## 18 | # Initialize preview domain 19 | # 20 | # @param twilio - The twilio client 21 | # 22 | def initialize(twilio) 23 | super(twilio) 24 | @base_url = "https://preview-iam.twilio.com" 25 | @host = "preview-iam.twilio.com" 26 | @port = 443 27 | @organizations = nil 28 | @v1 = nil 29 | end 30 | 31 | def v1 32 | @v1 ||= PreviewIam::V1.new(self) 33 | end 34 | 35 | ## 36 | # Provide a user friendly representation 37 | def to_s 38 | ''; 39 | end 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /src/main/resources/twilio-php/magicGetterandCaller.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | * Magic getter to lazy load subresources 3 | * 4 | * @param string $name Subresource to return 5 | * @return ListResource The requested subresource 6 | * @throws TwilioException For unknown subresources 7 | */ 8 | public function __get(string $name): ListResource 9 | { 10 | if (\property_exists($this, '_' . $name)) { 11 | $method = 'get' . \ucfirst($name); 12 | return $this->$method(); 13 | } 14 | 15 | throw new TwilioException('Unknown subresource ' . $name); 16 | } 17 | 18 | /** 19 | * Magic caller to get resource contexts 20 | * 21 | * @param string $name Resource to return 22 | * @param array $arguments Context parameters 23 | * @return InstanceContext The requested resource context 24 | * @throws TwilioException For unknown resource 25 | */ 26 | public function __call(string $name, array $arguments): InstanceContext 27 | { 28 | $property = $this->$name; 29 | if (\method_exists($property, 'getContext')) { 30 | return \call_user_func_array(array($property, 'getContext'), $arguments); 31 | } 32 | 33 | throw new TwilioException('Resource does not have a context'); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/template/JavaApiActionTemplate.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.template; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.openapitools.codegen.CodegenConfig; 8 | 9 | public class JavaApiActionTemplate extends AbstractApiActionTemplate { 10 | public JavaApiActionTemplate(CodegenConfig defaultCodegen) { 11 | super(defaultCodegen); 12 | } 13 | 14 | @Override 15 | public Map> mapping() { 16 | return Map.of("create", 17 | Arrays.asList("creator.mustache", "Creator.java"), 18 | "fetch", 19 | Arrays.asList("fetcher.mustache", "Fetcher.java"), 20 | "delete", 21 | Arrays.asList("deleter.mustache", "Deleter.java"), 22 | "read", 23 | Arrays.asList("reader.mustache", "Reader.java"), 24 | "update", 25 | Arrays.asList("updater.mustache", "Updater.java"), 26 | API_TEMPLATE, 27 | Arrays.asList("api.mustache", ".java"), 28 | NESTED_MODELS, 29 | Arrays.asList("models.mustache", "Model.java") 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/Resource.mustache: -------------------------------------------------------------------------------- 1 | {{>LicenseInfo}} 2 | 3 | {{#resources}} 4 | {{>ResourceUsings}} 5 | 6 | 7 | namespace Twilio.Rest.{{domainPackage}}.{{apiVersionClass}}{{namespaceSubPart}} 8 | { 9 | public class {{apiName}}{{resourceConstant}} : {{resourceConstant}} 10 | { 11 | {{>models}} 12 | {{>resource/Enum}} 13 | {{#apiOperations}} 14 | {{#vendorExtensions.x-is-create-operation}} 15 | {{>resource/CreateResource}} 16 | {{/vendorExtensions.x-is-create-operation}} 17 | {{#vendorExtensions.x-is-delete-operation}} 18 | {{>resource/DeleteResource}} 19 | {{/vendorExtensions.x-is-delete-operation}} 20 | {{#vendorExtensions.x-is-fetch-operation}} 21 | {{>resource/FetchResource}} 22 | {{/vendorExtensions.x-is-fetch-operation}} 23 | {{#vendorExtensions.x-is-read-operation}} 24 | {{>resource/ReadResource}} 25 | {{/vendorExtensions.x-is-read-operation}} 26 | {{#vendorExtensions.x-is-update-operation}} 27 | {{>resource/UpdateResource}} 28 | {{/vendorExtensions.x-is-update-operation}} 29 | {{/apiOperations}} 30 | {{>FromJson}} 31 | {{>ToJson}} 32 | 33 | {{>resource/ResponseModel}} 34 | 35 | private {{apiName}}{{resourceConstant}}() { 36 | 37 | } 38 | } 39 | } 40 | 41 | {{/resources}} 42 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/flex/v1/voice.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | import ( 18 | "encoding/json" 19 | "net/url" 20 | "strings" 21 | ) 22 | 23 | func (c *ApiService) UpdateCall(Sid string) (*UpdateCallResponse, error) { 24 | path := "/v1/Voice/{Sid}" 25 | path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) 26 | 27 | data := url.Values{} 28 | headers := map[string]interface{}{ 29 | "Content-Type": "application/x-www-form-urlencoded", 30 | } 31 | 32 | resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 33 | if err != nil { 34 | return nil, err 35 | } 36 | 37 | defer resp.Body.Close() 38 | 39 | ps := &UpdateCallResponse{} 40 | if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 41 | return nil, err 42 | } 43 | 44 | return ps, err 45 | } 46 | -------------------------------------------------------------------------------- /src/main/resources/twilio-csharp/resource/Enum.mustache: -------------------------------------------------------------------------------- 1 | 2 | {{#enums}} 3 | {{#vendorExtensions.x-jsonConverter}} 4 | [JsonConverter(typeof({{vendorExtensions.x-jsonConverter}}))] 5 | {{/vendorExtensions.x-jsonConverter}} 6 | public sealed class {{{enumName}}} : StringEnum 7 | { 8 | private {{{enumName}}}(string value) : base(value) {} 9 | public {{{enumName}}}() {} 10 | public static implicit operator {{{enumName}}}(string value) 11 | { 12 | return new {{{enumName}}}(value); 13 | } 14 | {{^isArray}} 15 | {{#allowableValues}} 16 | {{#values}} 17 | public static readonly {{{enumName}}} {{#lambda.titlecasewithnumbers}}{{{.}}}{{/lambda.titlecasewithnumbers}} = new {{{enumName}}}("{{{.}}}"); 18 | {{/values}} 19 | {{/allowableValues}} 20 | {{/isArray}} 21 | 22 | {{#isArray}} 23 | {{#items}} 24 | {{#allowableValues}} 25 | {{#values}} 26 | public static readonly {{{enumName}}} {{#lambda.titlecasewithnumbers}}{{{.}}}{{/lambda.titlecasewithnumbers}} = new {{{enumName}}}("{{{.}}}"); 27 | {{/values}} 28 | {{/allowableValues}} 29 | {{/items}} 30 | {{/isArray}} 31 | } 32 | {{/enums}} -------------------------------------------------------------------------------- /src/main/resources/twilio-python/contextMethods.handlebars: -------------------------------------------------------------------------------- 1 | def get(self{{#instancePathParams}}{{#if vendorExtensions.x-is-parent-param}}{{else}}, {{paramName}}: {{{dataType}}}{{/if}}{{/instancePathParams}}) -> {{apiName}}Context: 2 | """ 3 | Constructs a {{apiName}}Context 4 | {{#instancePathParams}}{{#if vendorExtensions.x-is-parent-param}}{{else}} 5 | :param {{paramName}}: {{{description}}}{{/if}}{{/instancePathParams}} 6 | """ 7 | return {{apiName}}Context(self._version{{#instancePathParams}}{{#if vendorExtensions.x-is-parent-param}}, {{paramName}}=self._solution['{{paramName}}']{{else}}, {{paramName}}={{paramName}}{{/if}}{{/instancePathParams}}) 8 | 9 | def __call__(self{{#instancePathParams}}{{#if vendorExtensions.x-is-parent-param}}{{else}}, {{paramName}}: {{{dataType}}}{{/if}}{{/instancePathParams}}) -> {{apiName}}Context: 10 | """ 11 | Constructs a {{apiName}}Context 12 | {{#instancePathParams}}{{#if vendorExtensions.x-is-parent-param}}{{else}} 13 | :param {{paramName}}: {{{description}}}{{/if}}{{/instancePathParams}} 14 | """ 15 | return {{apiName}}Context(self._version{{#instancePathParams}}{{#if vendorExtensions.x-is-parent-param}}, {{paramName}}=self._solution['{{paramName}}']{{else}}, {{paramName}}={{paramName}}{{/if}}{{/instancePathParams}}) 16 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/csharp/ParameterFormat.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.csharp; 2 | 3 | import com.twilio.oai.common.ApplicationConstants; 4 | import com.twilio.oai.common.EnumConstants; 5 | import com.twilio.oai.resolver.DataSanitizer; 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.openapitools.codegen.CodegenParameter; 8 | 9 | import java.util.ArrayList; 10 | import java.util.Arrays; 11 | import java.util.List; 12 | 13 | public class ParameterFormat implements DataSanitizer { 14 | public void sanitize(CodegenParameter parameter) { 15 | if (parameter.dataFormat == null) return; 16 | if (parameter.isMap && StringUtils.isNotBlank(parameter.dataFormat) 17 | && parameter.dataFormat.startsWith(ApplicationConstants.PREFIXED_COLLAPSIBLE_MAP)) { 18 | // Example: dataformat = prefixed-collapsible-map-AddOns 19 | List splitDataFormat = new ArrayList<>(List.of(parameter.dataFormat.split("-"))); 20 | parameter.vendorExtensions.put("x-map-value", splitDataFormat.get(splitDataFormat.size()-1)); 21 | splitDataFormat.remove(splitDataFormat.size()-1); 22 | parameter.dataFormat = String.join("-", splitDataFormat); 23 | parameter.vendorExtensions.put("x-parameter-map", true); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/common/CodegenModelComplexResolver.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.resolver.common; 2 | 3 | import com.twilio.oai.api.ApiResourceBuilder; 4 | import com.twilio.oai.resolver.IConventionMapper; 5 | import com.twilio.oai.resolver.Resolver; 6 | 7 | import java.util.Map; 8 | 9 | import lombok.RequiredArgsConstructor; 10 | import org.openapitools.codegen.CodegenProperty; 11 | 12 | @RequiredArgsConstructor 13 | public class CodegenModelComplexResolver extends Resolver { 14 | private final IConventionMapper mapper; 15 | private final Map modelFormatMap; 16 | 17 | public CodegenProperty resolve(CodegenProperty property, ApiResourceBuilder apiResourceBuilder) { 18 | if (this.modelFormatMap.isEmpty()) { 19 | return property; 20 | } 21 | 22 | if (modelFormatMap.containsKey(property.complexType)) { 23 | String complexType = modelFormatMap.get(property.complexType); 24 | 25 | mapper.properties().getString(complexType).ifPresent(dataType -> { 26 | property.dataType = dataType; 27 | property.complexType = null; 28 | 29 | property.vendorExtensions.put("x-import", mapper.libraries().get(complexType).orElseThrow()); 30 | }); 31 | } 32 | return property; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/twilio-php/models/modelClass.mustache: -------------------------------------------------------------------------------- 1 | class {{classname}} implements \JsonSerializable 2 | { 3 | /** 4 | {{#vars}} 5 | * @property {{{dataType}}} ${{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}{{#description}} {{{description}}}{{/description}} 6 | {{/vars}} 7 | */ 8 | {{#vars}} 9 | protected ${{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}; 10 | {{/vars}} 11 | public function __construct(array $payload = []) { 12 | {{#vars}} 13 | $this->{{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}} = Values::array_get($payload, '{{baseName}}'); 14 | {{/vars}} 15 | } 16 | 17 | public function toArray(): array 18 | { 19 | return $this->jsonSerialize(); 20 | } 21 | 22 | public function jsonSerialize(): array 23 | { 24 | $jsonString = [ 25 | {{#requiredVars}} 26 | '{{baseName}}' => $this->{{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}{{^-last}},{{/-last}} 27 | {{/requiredVars}} 28 | ]; 29 | {{#optionalVars}} 30 | if (isset($this->{{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}})) { 31 | $jsonString['{{baseName}}'] = $this->{{#lambda.camelcase}}{{baseName}}{{/lambda.camelcase}}; 32 | } 33 | {{/optionalVars}} 34 | return $jsonString; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/go/go-client/helper/rest/api/v2010/model_list_account_response.go: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | package openapi 16 | 17 | // ListAccountResponse struct for ListAccountResponse 18 | type ListAccountResponse struct { 19 | End int `json:"end,omitempty"` 20 | FirstPageUri string `json:"first_page_uri,omitempty"` 21 | NextPageUri string `json:"next_page_uri,omitempty"` 22 | Page int `json:"page,omitempty"` 23 | PageSize int `json:"page_size,omitempty"` 24 | PreviousPageUri string `json:"previous_page_uri,omitempty"` 25 | Accounts []TestResponseObject `json:"accounts,omitempty"` 26 | Start int `json:"start,omitempty"` 27 | Uri string `json:"uri,omitempty"` 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/api/JavaApiResources.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.api; 2 | 3 | import org.openapitools.codegen.CodegenModel; 4 | import org.openapitools.codegen.CodegenProperty; 5 | import org.openapitools.codegen.IJsonSchemaValidationProperties; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import java.util.Set; 10 | 11 | public class JavaApiResources extends ApiResources{ 12 | public long serialVersionUID; 13 | public CodegenModel responseModel; 14 | 15 | public List enums; 16 | 17 | public ArrayList> modelParameters; 18 | 19 | public boolean hasNestedRequestBody; 20 | public String authMethodPackage = ""; 21 | 22 | public JavaApiResources(JavaApiResourceBuilder apiResourceBuilder) { 23 | super(apiResourceBuilder); 24 | this.responseModel = apiResourceBuilder.responseModel; 25 | this.serialVersionUID = apiResourceBuilder.serialVersionUID; 26 | this.enums = new ArrayList<>(apiResourceBuilder.enums); 27 | // TODO: Need to improve, if there are requestBody in create and update operation. 28 | this.modelParameters = apiResourceBuilder.modelParameters; 29 | this.hasNestedRequestBody = apiResourceBuilder.hasNestedRequestBody; 30 | this.authMethodPackage = apiResourceBuilder.authMethodPackage; 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/api/IApiResourceBuilder.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.api; 2 | 3 | import com.twilio.oai.DirectoryStructureService; 4 | import com.twilio.oai.resolver.Resolver; 5 | import com.twilio.oai.resolver.common.CodegenModelResolver; 6 | import com.twilio.oai.resolver.java.JavaPropertyResolver; 7 | import org.openapitools.codegen.CodegenModel; 8 | import org.openapitools.codegen.CodegenParameter; 9 | import org.openapitools.codegen.CodegenProperty; 10 | 11 | import java.util.List; 12 | 13 | public interface IApiResourceBuilder { 14 | IApiResourceBuilder updateTemplate(); 15 | IApiResourceBuilder updateOperations(Resolver codegenParameterIResolver); 16 | IApiResourceBuilder updateResponseModel(Resolver codegenPropertyIResolver); 17 | 18 | default IApiResourceBuilder updateResponseModel(Resolver codegenPropertyIResolver, Resolver codegenModelResolver){ 19 | return updateResponseModel( codegenPropertyIResolver); 20 | } 21 | IApiResourceBuilder updateAdditionalProps(DirectoryStructureService directoryStructureService); 22 | IApiResourceBuilder updateApiPath(); 23 | IApiResourceBuilder setImports(DirectoryStructureService directoryStructureService); 24 | T build(); 25 | 26 | IApiResourceBuilder updateModel(Resolver codegenModelResolver); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/template/PythonApiActionTemplate.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.template; 2 | 3 | import java.io.File; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.openapitools.codegen.CodegenConfig; 9 | import org.openapitools.codegen.utils.StringUtils; 10 | 11 | public class PythonApiActionTemplate extends AbstractApiActionTemplate { 12 | public static final String INIT_FILENAME = "__init__"; 13 | 14 | public PythonApiActionTemplate(final CodegenConfig codegenConfig) { 15 | super(codegenConfig); 16 | } 17 | 18 | @Override 19 | public Map> mapping() { 20 | return Map.of(API_TEMPLATE, 21 | Arrays.asList("api-single.mustache", ".py"), 22 | VERSION_TEMPLATE, 23 | Arrays.asList("version.mustache", ".py")); 24 | } 25 | 26 | @Override 27 | protected String getVersionFilename(final String apiVersionClass) { 28 | if (apiVersionClass.startsWith("V")) { 29 | return INIT_FILENAME; 30 | } 31 | 32 | return StringUtils.underscore(apiVersionClass) + File.separator + INIT_FILENAME; 33 | } 34 | 35 | @Override 36 | protected String getDestinationFilename(final String apiVersionClass, final String fileExtension) { 37 | return INIT_FILENAME + fileExtension; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/feature/constructor/ConstructorFactory.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.feature.constructor; 2 | 3 | import org.openapitools.codegen.CodegenOperation; 4 | 5 | import java.util.List; 6 | 7 | public class ConstructorFactory { 8 | public static ConstructorFactory instance; 9 | 10 | public static synchronized ConstructorFactory getInstance() { 11 | if (instance == null) { 12 | synchronized (ConstructorFactory.class) { 13 | if (instance == null) { 14 | instance = new ConstructorFactory(); 15 | } 16 | } 17 | } 18 | return instance; 19 | } 20 | 21 | private final List constructorGenerators; 22 | 23 | private ConstructorFactory() { 24 | constructorGenerators = List.of( 25 | new JsonConstructorGenerator(), 26 | new UrlencodedBodyConstructorGenerator() 27 | ); 28 | } 29 | 30 | public void applyFeature(CodegenOperation codegenOperation) { 31 | for (ConstructorGenerator constructorGenerator: constructorGenerators) { 32 | if (constructorGenerator.shouldApply(codegenOperation)) { 33 | constructorGenerator.apply(codegenOperation); 34 | return; // Exit after the first processor that applies 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/resolver/README.md: -------------------------------------------------------------------------------- 1 | This section explains the relationship between a parameter, property, model 2 | 1. Request type: urlencoded 3 | application/x-www-form-urlencoded: 4 | schema: 5 | type: object 6 | title: CreateMessageRequest 7 | properties: 8 | To: 9 | StatusCallback: 10 | ApplicationSid: 11 | MaxPrice: 12 | 13 | 2: Request type: json 14 | application/json: 15 | schema: 16 | type: object 17 | title: CreateMessageRequest 18 | properties: 19 | To: 20 | StatusCallback: 21 | ApplicationSid: 22 | MaxPrice: 23 | 24 | 1. Parameter 25 | In case of Request type is urlencoded, then each item inside request body is considered as codegenparameter(To, 26 | StatusCallback, ApplicationSid,MaxPrice). 27 | In case of Request type is json, then there will be only one codegenparameter(CreateMessageRequest) 28 | Each property will be present as codegenproperty(To, StatusCallback, ApplicationSid,MaxPrice). 29 | A parameter can have multiple properties. 30 | A parameter can be a model if it is referenced in component section. 31 | 32 | 2. Property 33 | A parameter can have multiple properties. A property can be a model if it is referenced in component section. 34 | 35 | 3. Model 36 | Any object defined inside component schema is a model. Now a model can have multiple properties. 37 | Parameter can be a model 38 | Property can be a model 39 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/versionless/understand.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # This code was generated by 3 | # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | # 7 | # Twilio - Versionless 8 | # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 9 | # 10 | # NOTE: This class is auto generated by OpenAPI Generator. 11 | # https://openapi-generator.tech 12 | # Do not edit the class manually. 13 | # 14 | 15 | module Twilio 16 | module REST 17 | class Versionless 18 | class Understand < Version 19 | ## 20 | # Initialize the Understand version of Versionless 21 | def initialize(domain) 22 | super 23 | @version = 'understand' 24 | @assistants = nil 25 | end 26 | 27 | ## 28 | # @return [Twilio::REST::Versionless::Understand::AssistantList] 29 | def assistants 30 | @assistants ||= AssistantList.new self 31 | end 32 | 33 | ## 34 | # Provide a user friendly representation 35 | def to_s 36 | ''; 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/model/ModelProcessorFactory.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.model; 2 | 3 | import org.openapitools.codegen.CodegenModel; 4 | import org.openapitools.codegen.CodegenProperty; 5 | 6 | import java.util.List; 7 | 8 | public class ModelProcessorFactory { 9 | 10 | private static ModelProcessorFactory instance; 11 | private final List modelProcessors; 12 | public static synchronized ModelProcessorFactory getInstance() { 13 | if (instance == null) { 14 | synchronized (ModelProcessorFactory.class) { 15 | if (instance == null) { 16 | instance = new ModelProcessorFactory(); 17 | } 18 | } 19 | } 20 | return instance; 21 | } 22 | 23 | private ModelProcessorFactory() { 24 | modelProcessors = List.of( 25 | new SingleModelStrategy(), 26 | new ListModelStrategy() 27 | ); 28 | } 29 | 30 | public void applyProcessor(CodegenProperty codegenProperty, CodegenModel codegenModel) { 31 | 32 | // Process 33 | for (ModelProcessor modelProcessor : modelProcessors) { 34 | if (modelProcessor.shouldProcess(codegenProperty, codegenModel)) { 35 | modelProcessor.process(codegenProperty, codegenModel); 36 | return; 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /examples/python/twilio/rest/oauth/v2/__init__.py: -------------------------------------------------------------------------------- 1 | r""" 2 | This code was generated by 3 | ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | 7 | User OAuth API 8 | User OAuth API 9 | 10 | NOTE: This class is auto generated by OpenAPI Generator. 11 | https://openapi-generator.tech 12 | Do not edit the class manually. 13 | """ 14 | 15 | from typing import Optional 16 | from twilio.base.version import Version 17 | from twilio.base.domain import Domain 18 | from twilio.rest.oauth.v2.token import TokenList 19 | 20 | 21 | class V2(Version): 22 | def __init__(self, domain: Domain): 23 | """ 24 | Initialize the V2 version of Oauth 25 | 26 | :param domain: The Twilio.oauth domain 27 | """ 28 | super().__init__(domain, "v2") 29 | self._token: Optional[TokenList] = None 30 | 31 | @property 32 | def token(self) -> TokenList: 33 | if self._token is None: 34 | self._token = TokenList(self) 35 | return self._token 36 | 37 | def __repr__(self) -> str: 38 | """ 39 | Provide a friendly representation 40 | :returns: Machine friendly representation 41 | """ 42 | return "" 43 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/requestbody/RequestBodyProcessorFactory.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.requestbody; 2 | 3 | import org.openapitools.codegen.CodegenOperation; 4 | 5 | import java.util.List; 6 | 7 | public class RequestBodyProcessorFactory { 8 | private static RequestBodyProcessorFactory instance; 9 | private final List requestBodyProcessors; 10 | 11 | private RequestBodyProcessorFactory() { 12 | this.requestBodyProcessors = List.of( 13 | new UrlEncodedProcessor(), 14 | new JsonRequestProcessor() 15 | ); 16 | } 17 | 18 | public static synchronized RequestBodyProcessorFactory getInstance() { 19 | if (instance == null) { 20 | synchronized (RequestBodyProcessorFactory.class) { 21 | if (instance == null) { 22 | instance = new RequestBodyProcessorFactory(); 23 | } 24 | } 25 | } 26 | return instance; 27 | } 28 | 29 | public void process(final CodegenOperation codegenOperation) { 30 | for (RequestBodyProcessor requestBodyProcessor : requestBodyProcessors) { 31 | if (requestBodyProcessor.shouldProcess(codegenOperation)) { 32 | requestBodyProcessor.process(codegenOperation); 33 | return; // Exit after the first processor that applies 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/resources/twilio-ruby/page.mustache: -------------------------------------------------------------------------------- 1 | class {{apiName}}Page < Page 2 | ## 3 | # Initialize the {{apiName}}Page 4 | # @param [Version] version Version that contains the resource 5 | # @param [Response] response Response from the API 6 | # @param [Hash] solution Path solution for the resource 7 | # @return [{{apiName}}Page] {{apiName}}Page 8 | def initialize(version, response, solution) 9 | super(version, response) 10 | 11 | # Path Solution 12 | @solution = solution 13 | end 14 | 15 | ## 16 | # Build an instance of {{apiName}}Instance 17 | # @param [Hash] payload Payload response from the API 18 | # @return [{{apiName}}Instance] {{apiName}}Instance 19 | def get_instance(payload) 20 | {{apiName}}Instance.new(@version, payload{{#listPathParams}}, {{paramName}}: @solution[:{{paramName}}]{{/listPathParams}}) 21 | end 22 | 23 | ## 24 | # Provide a user friendly representation 25 | def to_s 26 | '' 27 | end 28 | end -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/requestbody/UrlEncodedProcessor.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.requestbody; 2 | 3 | import com.twilio.oai.java.processor.enums.EnumProcessorFactory; 4 | import org.openapitools.codegen.CodegenOperation; 5 | 6 | import static com.twilio.oai.common.ApplicationConstants.X_REQUEST_CONTENT_TYPE; 7 | import static com.twilio.oai.java.constants.MustacheConstants.X_REQUEST_LANGUAGE_CONTENT_TYPE_CONSTANT; 8 | 9 | public class UrlEncodedProcessor implements RequestBodyProcessor { 10 | final EnumProcessorFactory enumFactory = EnumProcessorFactory.getInstance(); 11 | @Override 12 | public void process(CodegenOperation codegenOperation) { 13 | codegenOperation.vendorExtensions.put(X_REQUEST_CONTENT_TYPE, getContentType()); 14 | codegenOperation.vendorExtensions.put(X_REQUEST_LANGUAGE_CONTENT_TYPE_CONSTANT, "FORM_URLENCODED"); 15 | codegenOperation.formParams.forEach(parameter -> { 16 | enumFactory.applyProcessor(parameter); 17 | //Promoter.addPromoter(parameter); 18 | }); 19 | } 20 | 21 | @Override 22 | public String getContentType() { 23 | return "application/x-www-form-urlencoded"; 24 | } 25 | 26 | @Override 27 | public boolean shouldProcess(final CodegenOperation codegenOperation) { 28 | if (codegenOperation.formParams != null && !codegenOperation.formParams.isEmpty()) return true; 29 | return false; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/node/src/rest/versionless/DeployedDevices.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Versionless 8 | * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | import VersionlessBase from "../VersionlessBase"; 16 | import Version from "../../base/Version"; 17 | import { FleetListInstance } from "./deployed_devices/fleet"; 18 | 19 | export default class DeployedDevices extends Version { 20 | /** 21 | * Initialize the DeployedDevices version of Versionless 22 | * 23 | * @param domain - The Twilio (Twilio.Versionless) domain 24 | */ 25 | constructor(domain: VersionlessBase) { 26 | super(domain, "DeployedDevices"); 27 | } 28 | 29 | /** fleets - { Twilio.Versionless.DeployedDevices.FleetListInstance } resource */ 30 | protected _fleets?: FleetListInstance; 31 | 32 | /** Getter for fleets resource */ 33 | get fleets(): FleetListInstance { 34 | this._fleets = this._fleets || FleetListInstance(this); 35 | return this._fleets; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/node/src/rest/versionless/Understand.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Versionless 8 | * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | import VersionlessBase from "../VersionlessBase"; 16 | import Version from "../../base/Version"; 17 | import { AssistantListInstance } from "./understand/assistant"; 18 | 19 | export default class Understand extends Version { 20 | /** 21 | * Initialize the Understand version of Versionless 22 | * 23 | * @param domain - The Twilio (Twilio.Versionless) domain 24 | */ 25 | constructor(domain: VersionlessBase) { 26 | super(domain, "understand"); 27 | } 28 | 29 | /** assistants - { Twilio.Versionless.Understand.AssistantListInstance } resource */ 30 | protected _assistants?: AssistantListInstance; 31 | 32 | /** Getter for assistants resource */ 33 | get assistants(): AssistantListInstance { 34 | this._assistants = this._assistants || AssistantListInstance(this); 35 | return this._assistants; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/twilio/oai/java/processor/model/parameter/ParamModelProcessorManager.java: -------------------------------------------------------------------------------- 1 | package com.twilio.oai.java.processor.model.parameter; 2 | 3 | 4 | import com.twilio.oai.java.processor.model.ModelProcessorFactory; 5 | import org.openapitools.codegen.CodegenModel; 6 | import org.openapitools.codegen.CodegenParameter; 7 | 8 | import java.util.List; 9 | 10 | public class ParamModelProcessorManager { 11 | private static ParamModelProcessorManager instance; 12 | private final List modelProcessors; 13 | public static synchronized ParamModelProcessorManager getInstance() { 14 | if (instance == null) { 15 | synchronized (ModelProcessorFactory.class) { 16 | if (instance == null) { 17 | instance = new ParamModelProcessorManager(); 18 | } 19 | } 20 | } 21 | return instance; 22 | } 23 | 24 | private ParamModelProcessorManager() { 25 | modelProcessors = List.of( 26 | new SingleModelStrategy() 27 | ); 28 | } 29 | 30 | public void applyProcessor(CodegenParameter codegenParameter, CodegenModel codegenModel) { 31 | 32 | // Process 33 | for (ModelProcessor modelProcessor : modelProcessors) { 34 | if (modelProcessor.shouldProcess(codegenParameter, codegenModel)) { 35 | modelProcessor.process(codegenParameter, codegenModel); 36 | return; 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /examples/csharp/src/Twilio/Rest/Versionless/Understand/AssistantOptions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Versionless 8 | * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using Twilio.Base; 19 | using Twilio.Converters; 20 | 21 | 22 | 23 | 24 | namespace Twilio.Rest.Versionless.Understand 25 | { 26 | /// read 27 | public class ReadAssistantOptions : ReadOptions 28 | { 29 | 30 | 31 | 32 | 33 | 34 | /// Generate the necessary parameters 35 | public List> GetParams() 36 | { 37 | var p = new List>(); 38 | 39 | if (PageSize != null) 40 | { 41 | p.Add(new KeyValuePair("PageSize", PageSize.ToString())); 42 | } 43 | return p; 44 | } 45 | 46 | 47 | 48 | } 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /scripts/prism.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | LANGUAGES=${LANGUAGES:-go java node csharp php ruby python} 5 | 6 | for language in ${LANGUAGES}; do 7 | testing_services+=("${language}-test") 8 | done 9 | 10 | cd examples/prism 11 | docker compose build --pull "${testing_services[@]}" 12 | docker compose up -d --force-recreate --remove-orphans "${testing_services[@]}" 13 | 14 | function wait_for() { 15 | echo -n "Waiting for tests to complete" 16 | for language in ${LANGUAGES}; do 17 | while true; do 18 | if [[ "$(docker compose ps -q -a "${language}-test" | xargs docker inspect -f "{{.State.Status}}")" != "exited" ]]; then 19 | echo -n "." 20 | sleep 10 21 | else 22 | break 23 | fi 24 | done 25 | done 26 | echo 27 | } 28 | 29 | EXIT_CODE=0 30 | function check_status() { 31 | for language in ${LANGUAGES}; do 32 | docker_test_service="${language}-test" 33 | if [[ $(docker compose ps -q -a "$docker_test_service" | xargs docker inspect -f "{{.State.ExitCode}}") -ne 0 ]]; then 34 | EXIT_CODE=$(($EXIT_CODE || $(docker compose ps -q -a "$docker_test_service" | xargs docker inspect -f "{{.State.ExitCode}}"))) 35 | echo "Failed $language with EXIT code $(docker compose ps -q -a "$docker_test_service" | xargs docker inspect -f "{{.State.ExitCode}}")" 36 | cat "../${language}/test-report.out" 37 | else 38 | echo "$language completed successfully" 39 | fi 40 | done 41 | } 42 | 43 | wait_for 44 | check_status 45 | docker compose down 46 | exit $EXIT_CODE 47 | -------------------------------------------------------------------------------- /examples/csharp/src/Twilio/Rest/FlexApi/V1/CallOptions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This code was generated by 3 | * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | * 7 | * Twilio - Accounts 8 | * This is the public Twilio REST API. 9 | * 10 | * NOTE: This class is auto generated by OpenAPI Generator. 11 | * https://openapi-generator.tech 12 | * Do not edit the class manually. 13 | */ 14 | 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using Twilio.Base; 19 | using Twilio.Converters; 20 | 21 | 22 | 23 | 24 | namespace Twilio.Rest.FlexApi.V1 25 | { 26 | /// update 27 | public class UpdateCallOptions : IOptions 28 | { 29 | 30 | 31 | public string PathSid { get; } 32 | 33 | 34 | 35 | /// Construct a new UpdateCallOptions 36 | /// 37 | public UpdateCallOptions(string pathSid) 38 | { 39 | PathSid = pathSid; 40 | } 41 | 42 | 43 | /// Generate the necessary parameters 44 | public List> GetParams() 45 | { 46 | var p = new List>(); 47 | 48 | return p; 49 | } 50 | 51 | 52 | 53 | } 54 | 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /examples/ruby/lib/twilio-ruby/rest/preview_iam/v1.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # This code was generated by 3 | # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 | # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 | # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 | # 7 | # Organization Public API 8 | # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 9 | # 10 | # NOTE: This class is auto generated by OpenAPI Generator. 11 | # https://openapi-generator.tech 12 | # Do not edit the class manually. 13 | # 14 | 15 | module Twilio 16 | module REST 17 | class PreviewIam 18 | class V1 < Version 19 | ## 20 | # Initialize the V1 version of PreviewIam 21 | def initialize(domain) 22 | super 23 | @version = 'v1' 24 | @authorize = nil 25 | @token = nil 26 | end 27 | 28 | ## 29 | # @return [Twilio::REST::PreviewIam::V1::AuthorizeList] 30 | def authorize 31 | @authorize ||= AuthorizeList.new self 32 | end 33 | 34 | ## 35 | # @return [Twilio::REST::PreviewIam::V1::TokenList] 36 | def token 37 | @token ||= TokenList.new self 38 | end 39 | 40 | ## 41 | # Provide a user friendly representation 42 | def to_s 43 | ''; 44 | end 45 | end 46 | end 47 | end 48 | end 49 | --------------------------------------------------------------------------------