├── .clabot ├── .env.example ├── .github ├── ISSUE_TEMPLATE │ ├── MARKETING-ISSUE-FORM.yml │ ├── TRANSACTIONAL-ISSUE-FORM.yml │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── build-dev-site.yml │ ├── create-release-marketing.yml │ ├── create-release-transactional.yml │ ├── test-marketing.yml │ ├── test-transactional.yml │ ├── validate-and-generate-marketing.yml │ └── validate-and-generate-transactional.yml ├── .gitignore ├── .prettierrc ├── CHANGELOG.md ├── CODEOWNERS ├── LICENSE ├── README.md ├── code-of-conduct.md ├── codegen ├── swagger-codegen-cli-2.4.12.jar └── swagger-codegen-cli-2.4.7.jar ├── generate-sdks ├── package-lock.json ├── package.json ├── resources ├── docs │ └── advanced-setup.md ├── images │ ├── lang_csharp.png │ ├── lang_java.png │ ├── lang_javascript.png │ ├── lang_net.png │ ├── lang_node.png │ ├── lang_php.png │ ├── lang_python.png │ ├── lang_ruby.png │ ├── lang_typescript.png │ └── mcdev-banner.png ├── swagger-config-help │ ├── csharp.md │ ├── java.md │ ├── javascript.md │ ├── php.md │ ├── python.md │ └── ruby.md ├── swagger-original-templates │ ├── csharp │ │ ├── ApiClient.mustache │ │ ├── ApiException.mustache │ │ ├── ApiResponse.mustache │ │ ├── AssemblyInfo.mustache │ │ ├── Configuration.mustache │ │ ├── ExceptionFactory.mustache │ │ ├── FodyWeavers.xml │ │ ├── GlobalConfiguration.mustache │ │ ├── IApiAccessor.mustache │ │ ├── IReadableConfiguration.mustache │ │ ├── JsonSubTypesTests.mustache │ │ ├── Project.mustache │ │ ├── README.mustache │ │ ├── ReadOnlyDictionary.mustache │ │ ├── Solution.mustache │ │ ├── SwaggerDateConverter.mustache │ │ ├── TestProject.mustache │ │ ├── api.mustache │ │ ├── api_doc.mustache │ │ ├── api_test.mustache │ │ ├── compile-mono.sh.mustache │ │ ├── compile.mustache │ │ ├── enumClass.mustache │ │ ├── git_push.sh.mustache │ │ ├── gitignore.mustache │ │ ├── model.mustache │ │ ├── modelEnum.mustache │ │ ├── modelGeneric.mustache │ │ ├── modelInnerEnum.mustache │ │ ├── model_doc.mustache │ │ ├── model_test.mustache │ │ ├── mono_nunit_test.mustache │ │ ├── netcore_project.mustache │ │ ├── netcore_testproject.mustache │ │ ├── nuspec.mustache │ │ ├── packages.config.mustache │ │ ├── packages_test.config.mustache │ │ ├── partial_header.mustache │ │ ├── project.json.mustache │ │ ├── travis.mustache │ │ └── visibility.mustache │ ├── java │ │ ├── ApiClient.mustache │ │ ├── BeanValidationException.mustache │ │ ├── Configuration.mustache │ │ ├── CustomInstantDeserializer.mustache │ │ ├── JSON.mustache │ │ ├── Pair.mustache │ │ ├── README.mustache │ │ ├── RFC3339DateFormat.mustache │ │ ├── StringUtil.mustache │ │ ├── api.mustache │ │ ├── apiException.mustache │ │ ├── api_doc.mustache │ │ ├── api_test.mustache │ │ ├── auth │ │ │ ├── ApiKeyAuth.mustache │ │ │ ├── Authentication.mustache │ │ │ ├── HttpBasicAuth.mustache │ │ │ ├── OAuth.mustache │ │ │ └── OAuthFlow.mustache │ │ ├── beanValidation.mustache │ │ ├── beanValidationCore.mustache │ │ ├── beanValidationQueryParams.mustache │ │ ├── build.gradle.mustache │ │ ├── build.sbt.mustache │ │ ├── enum_outer_doc.mustache │ │ ├── generatedAnnotation.mustache │ │ ├── git_push.sh.mustache │ │ ├── gitignore.mustache │ │ ├── gradle-wrapper.jar │ │ ├── gradle-wrapper.properties.mustache │ │ ├── gradle.properties.mustache │ │ ├── gradlew.bat.mustache │ │ ├── gradlew.mustache │ │ ├── libraries │ │ │ ├── feign │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── EncodingUtils.mustache │ │ │ │ ├── ParamExpander.mustache │ │ │ │ ├── README.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── api_test.mustache │ │ │ │ ├── auth │ │ │ │ │ ├── ApiKeyAuth.mustache │ │ │ │ │ ├── HttpBasicAuth.mustache │ │ │ │ │ └── OAuth.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── build.sbt.mustache │ │ │ │ └── pom.mustache │ │ │ ├── google-api-client │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── api_test.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── build.sbt.mustache │ │ │ │ └── pom.mustache │ │ │ ├── jersey2 │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── ApiResponse.mustache │ │ │ │ ├── JSON.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── build.sbt.mustache │ │ │ │ └── pom.mustache │ │ │ ├── okhttp-gson │ │ │ │ ├── ApiCallback.mustache │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── ApiResponse.mustache │ │ │ │ ├── GzipRequestInterceptor.mustache │ │ │ │ ├── ProgressRequestBody.mustache │ │ │ │ ├── ProgressResponseBody.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── auth │ │ │ │ │ └── HttpBasicAuth.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── build.sbt.mustache │ │ │ │ └── pom.mustache │ │ │ ├── rest-assured │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── GsonObjectMapper.mustache │ │ │ │ ├── README.mustache │ │ │ │ ├── ResponseSpecBuilders.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── api_doc.mustache │ │ │ │ ├── api_test.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── build.sbt.mustache │ │ │ │ └── pom.mustache │ │ │ ├── resteasy │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── JSON.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── build.sbt.mustache │ │ │ │ └── pom.mustache │ │ │ ├── resttemplate │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── api_test.mustache │ │ │ │ ├── auth │ │ │ │ │ ├── ApiKeyAuth.mustache │ │ │ │ │ ├── Authentication.mustache │ │ │ │ │ ├── HttpBasicAuth.mustache │ │ │ │ │ ├── OAuth.mustache │ │ │ │ │ └── OAuthFlow.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ └── pom.mustache │ │ │ ├── retrofit │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── CollectionFormats.mustache │ │ │ │ ├── README.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── api_test.mustache │ │ │ │ ├── auth │ │ │ │ │ ├── ApiKeyAuth.mustache │ │ │ │ │ ├── HttpBasicAuth.mustache │ │ │ │ │ ├── OAuth.mustache │ │ │ │ │ └── OAuthOkHttpClient.mustache │ │ │ │ ├── bodyParams.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── build.sbt.mustache │ │ │ │ ├── formParams.mustache │ │ │ │ ├── headerParams.mustache │ │ │ │ ├── pathParams.mustache │ │ │ │ ├── pom.mustache │ │ │ │ └── queryParams.mustache │ │ │ ├── retrofit2 │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── CollectionFormats.mustache │ │ │ │ ├── JSON.mustache │ │ │ │ ├── README.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── api_test.mustache │ │ │ │ ├── auth │ │ │ │ │ ├── ApiKeyAuth.mustache │ │ │ │ │ ├── HttpBasicAuth.mustache │ │ │ │ │ ├── OAuth.mustache │ │ │ │ │ └── OAuthOkHttpClient.mustache │ │ │ │ ├── bodyParams.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── build.sbt.mustache │ │ │ │ ├── formParams.mustache │ │ │ │ ├── formParams.mustache.save │ │ │ │ ├── headerParams.mustache │ │ │ │ ├── pathParams.mustache │ │ │ │ ├── play-common │ │ │ │ │ └── auth │ │ │ │ │ │ └── ApiKeyAuth.mustache │ │ │ │ ├── play24 │ │ │ │ │ ├── ApiClient.mustache │ │ │ │ │ ├── Play24CallAdapterFactory.mustache │ │ │ │ │ ├── Play24CallFactory.mustache │ │ │ │ │ └── api.mustache │ │ │ │ ├── play25 │ │ │ │ │ ├── ApiClient.mustache │ │ │ │ │ ├── Play25CallAdapterFactory.mustache │ │ │ │ │ ├── Play25CallFactory.mustache │ │ │ │ │ └── api.mustache │ │ │ │ ├── pom.mustache │ │ │ │ └── queryParams.mustache │ │ │ └── vertx │ │ │ │ ├── ApiClient.mustache │ │ │ │ ├── Configuration.mustache │ │ │ │ ├── api.mustache │ │ │ │ ├── apiException.mustache │ │ │ │ ├── apiImpl.mustache │ │ │ │ ├── api_test.mustache │ │ │ │ ├── auth │ │ │ │ ├── ApiKeyAuth.mustache │ │ │ │ ├── Authentication.mustache │ │ │ │ ├── HttpBasicAuth.mustache │ │ │ │ ├── OAuth.mustache │ │ │ │ └── OAuthFlow.mustache │ │ │ │ ├── build.gradle.mustache │ │ │ │ ├── pom.mustache │ │ │ │ └── rxApiImpl.mustache │ │ ├── licenseInfo.mustache │ │ ├── manifest.mustache │ │ ├── model.mustache │ │ ├── modelEnum.mustache │ │ ├── modelInnerEnum.mustache │ │ ├── model_doc.mustache │ │ ├── pojo.mustache │ │ ├── pojo_doc.mustache │ │ ├── pom.mustache │ │ ├── settings.gradle.mustache │ │ ├── travis.mustache │ │ ├── typeInfoAnnotation.mustache │ │ └── xmlAnnotation.mustache │ ├── javascript │ │ ├── ApiClient.mustache │ │ ├── README.mustache │ │ ├── api-test-param-complex.mustache │ │ ├── api-test-param.mustache │ │ ├── api-test-property.mustache │ │ ├── api-test-response-complex.mustache │ │ ├── api-test-response-property.mustache │ │ ├── api-test-response.mustache │ │ ├── api.mustache │ │ ├── api_doc.mustache │ │ ├── api_test.mustache │ │ ├── assert-equals.js │ │ ├── enumClass.mustache │ │ ├── es6 │ │ │ ├── .babelrc.mustache │ │ │ ├── ApiClient.mustache │ │ │ ├── README.mustache │ │ │ ├── api-test-param-complex.mustache │ │ │ ├── api-test-param.mustache │ │ │ ├── api-test-property.mustache │ │ │ ├── api-test-response-complex.mustache │ │ │ ├── api-test-response-property.mustache │ │ │ ├── api-test-response.mustache │ │ │ ├── api.mustache │ │ │ ├── api_doc.mustache │ │ │ ├── api_test.mustache │ │ │ ├── assert-equals.js │ │ │ ├── enumClass.mustache │ │ │ ├── git_push.sh.mustache │ │ │ ├── gitignore.mustache │ │ │ ├── index.mustache │ │ │ ├── licenseInfo.mustache │ │ │ ├── mocha.opts │ │ │ ├── model.mustache │ │ │ ├── model_doc.mustache │ │ │ ├── model_test.mustache │ │ │ ├── package.mustache │ │ │ ├── partial_model_enum_class.mustache │ │ │ ├── partial_model_generic.mustache │ │ │ ├── partial_model_inner_enum.mustache │ │ │ └── travis.yml │ │ ├── git_push.sh.mustache │ │ ├── gitignore.mustache │ │ ├── index.mustache │ │ ├── licenseInfo.mustache │ │ ├── mocha.opts │ │ ├── model.mustache │ │ ├── model_doc.mustache │ │ ├── model_test.mustache │ │ ├── package.mustache │ │ ├── partial_model_enum_class.mustache │ │ ├── partial_model_generic.mustache │ │ ├── partial_model_inner_enum.mustache │ │ └── travis.yml │ ├── php │ │ ├── .php_cs │ │ ├── .travis.yml │ │ ├── ApiException.mustache │ │ ├── Configuration.mustache │ │ ├── HeaderSelector.mustache │ │ ├── ModelInterface.mustache │ │ ├── ObjectSerializer.mustache │ │ ├── README.mustache │ │ ├── api.mustache │ │ ├── api_doc.mustache │ │ ├── api_test.mustache │ │ ├── composer copy.mustache │ │ ├── composer.mustache │ │ ├── git_push.sh.mustache │ │ ├── model.mustache │ │ ├── model_doc.mustache │ │ ├── model_enum.mustache │ │ ├── model_generic.mustache │ │ ├── model_test.mustache │ │ ├── partial_header.mustache │ │ └── phpunit.xml.mustache │ ├── python │ │ ├── README.mustache │ │ ├── __init__api.mustache │ │ ├── __init__model.mustache │ │ ├── __init__package.mustache │ │ ├── __init__test.mustache │ │ ├── api.mustache │ │ ├── api_client.mustache │ │ ├── api_doc.mustache │ │ ├── api_test.mustache │ │ ├── asyncio │ │ │ └── rest.mustache │ │ ├── configuration.mustache │ │ ├── git_push.sh.mustache │ │ ├── gitignore.mustache │ │ ├── model.mustache │ │ ├── model_doc.mustache │ │ ├── model_test.mustache │ │ ├── partial_header.mustache │ │ ├── requirements.mustache │ │ ├── rest.mustache │ │ ├── setup.mustache │ │ ├── test-requirements.mustache │ │ ├── tornado │ │ │ └── rest.mustache │ │ ├── tox.mustache │ │ └── travis.mustache │ └── ruby │ │ ├── Gemfile.mustache │ │ ├── README.mustache │ │ ├── Rakefile.mustache │ │ ├── api.mustache │ │ ├── api_client.mustache │ │ ├── api_client_spec.mustache │ │ ├── api_doc.mustache │ │ ├── api_error.mustache │ │ ├── api_info.mustache │ │ ├── api_test.mustache │ │ ├── base_object.mustache │ │ ├── base_object_spec.mustache │ │ ├── configuration.mustache │ │ ├── configuration_spec.mustache │ │ ├── gem.mustache │ │ ├── gemspec.mustache │ │ ├── git_push.sh.mustache │ │ ├── gitignore.mustache │ │ ├── model.mustache │ │ ├── model_doc.mustache │ │ ├── model_test.mustache │ │ ├── partial_model_enum_class.mustache │ │ ├── partial_model_generic.mustache │ │ ├── rspec.mustache │ │ ├── rubocop.mustache │ │ ├── spec_helper.mustache │ │ └── version.mustache └── tools │ └── scan_spec.js ├── sdk_pull_request_template.md ├── spec ├── README.md ├── marketing.json └── transactional.json ├── swagger-config ├── marketing │ ├── csharp │ │ ├── config.json │ │ └── templates │ │ │ └── .swagger-codegen-ignore │ ├── java │ │ ├── config.json │ │ └── templates │ │ │ └── .swagger-codegen-ignore │ ├── javascript │ │ ├── config.json │ │ └── templates │ │ │ ├── .swagger-codegen-ignore │ │ │ ├── ApiClient.mustache │ │ │ ├── README.mustache │ │ │ ├── api.mustache │ │ │ ├── index.mustache │ │ │ └── package.mustache │ ├── php │ │ ├── config.json │ │ └── templates │ │ │ ├── .swagger-codegen-ignore │ │ │ ├── ApiClient.php │ │ │ ├── Configuration.mustache │ │ │ ├── README.mustache │ │ │ ├── api.mustache │ │ │ └── composer.mustache │ ├── python │ │ ├── config.json │ │ └── templates │ │ │ ├── .swagger-codegen-ignore │ │ │ ├── README.mustache │ │ │ ├── __init__api.mustache │ │ │ ├── __init__model.mustache │ │ │ ├── __init__package.mustache │ │ │ ├── api.mustache │ │ │ ├── api_client.mustache │ │ │ ├── api_doc.mustache │ │ │ ├── api_test.mustache │ │ │ ├── configuration.mustache │ │ │ ├── git_push.sh.mustache │ │ │ ├── gitignore.mustache │ │ │ ├── model.mustache │ │ │ ├── model_doc.mustache │ │ │ ├── model_test.mustache │ │ │ ├── partial_header.mustache │ │ │ ├── requirements.mustache │ │ │ ├── rest.mustache │ │ │ └── setup.mustache │ └── ruby │ │ ├── config.json │ │ └── templates │ │ ├── .swagger-codegen-ignore │ │ ├── Gemfile.mustache │ │ ├── README.mustache │ │ ├── api.mustache │ │ ├── api_client.mustache │ │ ├── api_error.mustache │ │ ├── gem.mustache │ │ └── gemspec.mustache └── transactional │ ├── csharp │ ├── config.json │ └── templates │ │ └── .swagger-codegen-ignore │ ├── java │ ├── config.json │ └── templates │ │ └── .swagger-codegen-ignore │ ├── javascript │ ├── config.json │ └── templates │ │ ├── .swagger-codegen-ignore │ │ ├── ApiClient.mustache │ │ ├── README.mustache │ │ ├── api.mustache │ │ ├── index.mustache │ │ └── package.mustache │ ├── php │ ├── config.json │ └── templates │ │ ├── .swagger-codegen-ignore │ │ ├── ApiClient.php │ │ ├── Configuration.mustache │ │ ├── README.mustache │ │ ├── api.mustache │ │ └── composer.mustache │ ├── python │ ├── config.json │ └── templates │ │ ├── .swagger-codegen-ignore │ │ ├── README.mustache │ │ ├── __init__api.mustache │ │ ├── __init__model.mustache │ │ ├── __init__package.mustache │ │ ├── api.mustache │ │ ├── api_client.mustache │ │ ├── api_doc.mustache │ │ ├── api_test.mustache │ │ ├── configuration.mustache │ │ ├── model.mustache │ │ ├── model_doc.mustache │ │ ├── model_test.mustache │ │ ├── requirements.mustache │ │ ├── rest.mustache │ │ └── setup.mustache │ └── ruby │ ├── config.json │ └── templates │ ├── .swagger-codegen-ignore │ ├── Gemfile.mustache │ ├── README.mustache │ ├── api.mustache │ ├── api_client.mustache │ ├── api_doc.mustache │ ├── api_error.mustache │ ├── api_info.mustache │ ├── api_test.mustache │ ├── base_object.mustache │ ├── gem.mustache │ ├── gemspec.mustache │ ├── model.mustache │ ├── model_doc.mustache │ ├── partial_model_generic.mustache │ └── version.mustache ├── tests ├── _tools │ └── phpunit-9.2.6.phar ├── marketing-javascript │ └── MarketingTest.test.js ├── marketing-php │ └── MarketingTest.php ├── marketing-python │ └── MarketingTest.py ├── marketing-ruby │ └── MarketingTest_spec.rb ├── transactional-javascript │ └── TransactionalTest.test.js ├── transactional-php │ └── TransactionalTest.php ├── transactional-python │ └── TransactionalTest.py └── transactional-ruby │ └── TransactionalTest_spec.rb └── utils ├── actions ├── setVersionVar.js └── updateLangConfig.js └── sdk ├── javascript ├── package-lock.json ├── package.json ├── useMarketing.js └── useTransactional.js ├── php ├── composer.json ├── composer.lock ├── useMarketing.php └── useTransactional.php ├── python ├── useMarketing.py └── useTransactional.py └── ruby ├── env.example.rb ├── useMarketing.rb └── useTransactional.rb /.env.example: -------------------------------------------------------------------------------- 1 | MARKETING_API_KEY= 2 | MARKETING_ACCESS_TOKEN= 3 | MARKETING_SERVER= 4 | TRANSACTIONAL_API_KEY= 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/MARKETING-ISSUE-FORM.yml: -------------------------------------------------------------------------------- 1 | name: Marketing SDK Issue Report 2 | description: File an issue with one of the Marketing SDKs 3 | labels: [marketing] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thanks for using the Mailchimp Marketing API! 9 | 10 | If your issue is with the behavior of the API, and not the SDK itself, we recommend reaching out to [Mailchimp Support](https://mailchimp.com/help/mailchimp-support-options/). They're best equipped to troubleshoot API issues in your account. 11 | 12 | We recommend using this issue form for: 13 | - Reporting bugs in the SDKs 14 | - Proposing changes to the Swagger spec 15 | 16 | By submitting you agree to the [Code of Conduct](https://github.com/mailchimp/mailchimp-client-lib-codegen/blob/main/code-of-conduct.md). 17 | 18 | - type: textarea 19 | id: what-issue 20 | attributes: 21 | label: What issue did you have? 22 | description: Also tell us, what did you expect to happen? 23 | placeholder: 24 | value: 25 | validations: 26 | required: true 27 | - type: dropdown 28 | id: language 29 | attributes: 30 | label: Language 31 | description: Which client are you using? 32 | options: 33 | - PHP 34 | - Node 35 | - Python 36 | - Ruby 37 | validations: 38 | required: false 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/TRANSACTIONAL-ISSUE-FORM.yml: -------------------------------------------------------------------------------- 1 | name: Transactional SDK Issue Report 2 | description: File an issue with one of the Transactional SDKs 3 | labels: [transactional] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thanks for using the Mailchimp Transactional API! 9 | 10 | If your issue is with the behavior of the API, and not the SDK itself, we recommend reaching out to Mailchimp Support. Email support is available Monday through Friday between 9am and 5pm EST. When you’re logged in, click on the Support link at the bottom of any page to submit your request. 11 | 12 | We recommend using this issue form for: 13 | - Reporting bugs in the SDKs 14 | - Proposing changes to the Swagger spec 15 | 16 | By submitting you agree to the [Code of Conduct](https://github.com/mailchimp/mailchimp-client-lib-codegen/blob/main/code-of-conduct.md). 17 | 18 | - type: textarea 19 | id: what-issue 20 | attributes: 21 | label: What issue did you have? 22 | description: Also tell us, what did you expect to happen? 23 | placeholder: 24 | value: 25 | validations: 26 | required: true 27 | - type: dropdown 28 | id: language 29 | attributes: 30 | label: Language 31 | description: Which client are you using? 32 | options: 33 | - PHP 34 | - Node 35 | - Python 36 | - Ruby 37 | validations: 38 | required: false 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Mailchimp Support 4 | url: https://mailchimp.com/help/mailchimp-support-options/ 5 | about: Mailchimp Support can help with API issues related to your account 6 | - name: Discussions 7 | url: https://github.com/mailchimp/mailchimp-client-lib-codegen/discussions 8 | about: Use Discussions to make suggestions or get help from the community 9 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | 3 | ### Known Issues 4 | -------------------------------------------------------------------------------- /.github/workflows/build-dev-site.yml: -------------------------------------------------------------------------------- 1 | name: 🌐 Build Developer Site 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'spec/marketing.json' 7 | - 'spec/transactional.json' 8 | branches: 9 | - main 10 | 11 | env: 12 | REBUILD_PROD: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # true iff push to main 13 | 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: POST Prod Build Hook 19 | run: curl -X POST -d {} ${{ env.NETLIFY_PROD_BUILD_HOOK }} 20 | if: env.REBUILD_PROD == 'true' 21 | env: 22 | NETLIFY_PROD_BUILD_HOOK: ${{ secrets.NETLIFY_PROD_BUILD_HOOK }} 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | swagger-out 3 | .cache 4 | .env 5 | node_modules 6 | utils/example 7 | .phpunit.result.cache 8 | .idea/ 9 | 10 | # PHP 11 | utils/sdk/php/vendor 12 | 13 | # Ruby 14 | utils/sdk/ruby/env.rb 15 | 16 | # Python 17 | utils/sdk/python/env.py 18 | __pycache__/ 19 | venv/ 20 | venv*/ 21 | dist/ 22 | *.egg-info/ 23 | .vscode/settings.json 24 | *~ 25 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo unless a later match takes precedence. 3 | * @Moishe @bipol-mc @mcshanti @mc-hannah-morrison 4 | -------------------------------------------------------------------------------- /codegen/swagger-codegen-cli-2.4.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/codegen/swagger-codegen-cli-2.4.12.jar -------------------------------------------------------------------------------- /codegen/swagger-codegen-cli-2.4.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/codegen/swagger-codegen-cli-2.4.7.jar -------------------------------------------------------------------------------- /resources/docs/advanced-setup.md: -------------------------------------------------------------------------------- 1 | #### Node 2 | 3 | ``` 4 | # in sdk project root 5 | npm install 6 | npm link 7 | 8 | # verify local package is available 9 | npm ls --global 10 | 11 | # in test project root 12 | npm link 13 | npm install 14 | 15 | # You should now be able to use the local package just like a normal NPM package 16 | require 'MailchimpMarketing' 17 | ``` 18 | 19 | #### Ruby 20 | 21 | ``` 22 | # install ruby 23 | brew install ruby 24 | 25 | # build the gem, a new *.gem file is created w/ the version number 26 | gem build MailchimpMarketing.gemspec 27 | 28 | # install it locally (may need sudo) 29 | gem install ./MailchimpMarketing-1.0.0.gem 30 | 31 | # add dependency to the Gemfile: 32 | gem 'MailchimpMarketing', '~> 1.0.0' 33 | 34 | # you should now be able to use the gem 35 | require 'MailchimpMarketing' 36 | 37 | ``` 38 | 39 | #### Python 40 | 41 | ``` 42 | # Install python3 43 | brew install python3 44 | 45 | # Update $PATH 46 | export PATH="/usr/local/opt/python3/libexec/bin:$PATH" 47 | 48 | # Verify brew version is running 49 | python3 --version 50 | 51 | # In SDK project folder, install the package locally via setuptools: 52 | python3 setup.py install --user 53 | 54 | # You should now be able to import and use the local python SDK 55 | import mailchimp_marketing 56 | ``` 57 | -------------------------------------------------------------------------------- /resources/images/lang_csharp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/lang_csharp.png -------------------------------------------------------------------------------- /resources/images/lang_java.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/lang_java.png -------------------------------------------------------------------------------- /resources/images/lang_javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/lang_javascript.png -------------------------------------------------------------------------------- /resources/images/lang_net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/lang_net.png -------------------------------------------------------------------------------- /resources/images/lang_node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/lang_node.png -------------------------------------------------------------------------------- /resources/images/lang_php.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/lang_php.png -------------------------------------------------------------------------------- /resources/images/lang_python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/lang_python.png -------------------------------------------------------------------------------- /resources/images/lang_ruby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/lang_ruby.png -------------------------------------------------------------------------------- /resources/images/lang_typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/lang_typescript.png -------------------------------------------------------------------------------- /resources/images/mcdev-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/images/mcdev-banner.png -------------------------------------------------------------------------------- /resources/swagger-config-help/python.md: -------------------------------------------------------------------------------- 1 | # CONFIG OPTIONS — Python 2 | 3 | packageName 4 | python package name (convention: snake_case). (Default: swagger_client) 5 | 6 | projectName 7 | python project name in setup.py (e.g. petstore-api). 8 | 9 | packageVersion 10 | python package version. (Default: 1.0.0) 11 | 12 | packageUrl 13 | python package URL. 14 | 15 | sortParamsByRequiredFlag 16 | Sort method arguments to place required parameters before optional parameters. (Default: true) 17 | 18 | hideGenerationTimestamp 19 | Hides the generation timestamp when files are generated. (Default: true) 20 | 21 | library 22 | library template (sub-template) to use (Default: urllib3) 23 | -------------------------------------------------------------------------------- /resources/swagger-config-help/ruby.md: -------------------------------------------------------------------------------- 1 | # CONFIG OPTIONS — Ruby 2 | 3 | sortParamsByRequiredFlag 4 | Sort method arguments to place required parameters before optional parameters. (Default: true) 5 | 6 | ensureUniqueParams 7 | Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) 8 | 9 | allowUnicodeIdentifiers 10 | boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) 11 | 12 | gemName 13 | gem name (convention: underscore_case). (Default: swagger_client) 14 | 15 | moduleName 16 | top module name (convention: CamelCase, usually corresponding to gem name). (Default: SwaggerClient) 17 | 18 | gemVersion 19 | gem version. (Default: 1.0.0) 20 | 21 | gemLicense 22 | gem license. (Default: proprietary) 23 | 24 | gemRequiredRubyVersion 25 | gem required Ruby version. (Default: >= 1.9) 26 | 27 | gemHomepage 28 | gem homepage. (Default: http://swagger.io) 29 | 30 | gemSummary 31 | gem summary. (Default: A ruby wrapper for the swagger APIs) 32 | 33 | gemDescription 34 | gem description. (Default: This gem maps to a swagger API) 35 | 36 | gemAuthor 37 | gem author (only one is supported). 38 | 39 | gemAuthorEmail 40 | gem author email (only one is supported). 41 | 42 | hideGenerationTimestamp 43 | Hides the generation timestamp when files are generated. (Default: true) 44 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/ApiResponse.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace {{packageName}}.Client 6 | { 7 | /// 8 | /// API Response 9 | /// 10 | {{>visibility}} class ApiResponse 11 | { 12 | /// 13 | /// Gets or sets the status code (HTTP status code) 14 | /// 15 | /// The status code. 16 | public int StatusCode { get; private set; } 17 | 18 | /// 19 | /// Gets or sets the HTTP headers 20 | /// 21 | /// HTTP headers 22 | public IDictionary Headers { get; private set; } 23 | 24 | /// 25 | /// Gets or sets the data (parsed HTTP body) 26 | /// 27 | /// The data. 28 | public T Data { get; private set; } 29 | 30 | /// 31 | /// Initializes a new instance of the class. 32 | /// 33 | /// HTTP status code. 34 | /// HTTP headers. 35 | /// Data (parsed HTTP body) 36 | public ApiResponse(int statusCode, IDictionary headers, T data) 37 | { 38 | this.StatusCode= statusCode; 39 | this.Headers = headers; 40 | this.Data = data; 41 | } 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/AssemblyInfo.mustache: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("{{packageTitle}}")] 8 | [assembly: AssemblyDescription("{{packageDescription}}")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("{{packageCompany}}")] 11 | [assembly: AssemblyProduct("{{packageProductName}}")] 12 | [assembly: AssemblyCopyright("{{packageCopyright}}")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // Version information for an assembly consists of the following four values: 22 | // 23 | // Major Version 24 | // Minor Version 25 | // Build Number 26 | // Revision 27 | // 28 | // You can specify all the values or you can default the Build and Revision Numbers 29 | // by using the '*' as shown below: 30 | // [assembly: AssemblyVersion("1.0.*")] 31 | [assembly: AssemblyVersion("{{packageVersion}}")] 32 | [assembly: AssemblyFileVersion("{{packageVersion}}")] 33 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/ExceptionFactory.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using System; 4 | {{#netStandard}} 5 | using RestSharp.Portable; 6 | {{/netStandard}} 7 | {{^netStandard}} 8 | using RestSharp; 9 | {{/netStandard}} 10 | 11 | namespace {{packageName}}.Client 12 | { 13 | /// 14 | /// A delegate to ExceptionFactory method 15 | /// 16 | /// Method name 17 | /// Response 18 | /// Exceptions 19 | {{>visibility}} delegate Exception ExceptionFactory(string methodName, IRestResponse response); 20 | } 21 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/GlobalConfiguration.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading; 10 | 11 | namespace {{packageName}}.Client 12 | { 13 | /// 14 | /// provides a compile-time extension point for globally configuring 15 | /// API Clients. 16 | /// 17 | /// 18 | /// A customized implementation via partial class may reside in another file and may 19 | /// be excluded from automatic generation via a .swagger-codegen-ignore file. 20 | /// 21 | public partial class GlobalConfiguration : Configuration 22 | { 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/IApiAccessor.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using System.Linq; 7 | {{#netStandard}} 8 | using RestSharp.Portable; 9 | {{/netStandard}} 10 | {{^netStandard}} 11 | using RestSharp; 12 | {{/netStandard}} 13 | 14 | namespace {{packageName}}.Client 15 | { 16 | /// 17 | /// Represents configuration aspects required to interact with the API endpoints. 18 | /// 19 | {{>visibility}} interface IApiAccessor 20 | { 21 | /// 22 | /// Gets or sets the configuration object 23 | /// 24 | /// An instance of the Configuration 25 | Configuration Configuration {get; set;} 26 | 27 | /// 28 | /// Gets the base path of the API client. 29 | /// 30 | /// The base path 31 | String GetBasePath(); 32 | 33 | /// 34 | /// Provides a factory method hook for the creation of exceptions. 35 | /// 36 | ExceptionFactory ExceptionFactory { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/Solution.mustache: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio {{^netStandard}}2012{{/netStandard}}{{#netStandard}}14{{/netStandard}} 3 | VisualStudioVersion = {{^netStandard}}12.0.0.0{{/netStandard}}{{#netStandard}}14.0.25420.1{{/netStandard}} 4 | MinimumVisualStudioVersion = {{^netStandard}}10.0.0.1{{/netStandard}}{{#netStandard}}10.0.40219.1{{/netStandard}} 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "{{packageName}}", "src\{{packageName}}\{{packageName}}.csproj", "{{packageGuid}}" 6 | EndProject 7 | {{^excludeTests}}Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "{{testPackageName}}", "src\{{testPackageName}}\{{testPackageName}}.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" 8 | EndProject 9 | {{/excludeTests}}Global 10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 11 | Debug|Any CPU = Debug|Any CPU 12 | Release|Any CPU = Release|Any CPU 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {{packageGuid}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 16 | {{packageGuid}}.Debug|Any CPU.Build.0 = Debug|Any CPU 17 | {{packageGuid}}.Release|Any CPU.ActiveCfg = Release|Any CPU 18 | {{packageGuid}}.Release|Any CPU.Build.0 = Release|Any CPU 19 | {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/SwaggerDateConverter.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace {{packageName}}.Client 5 | { 6 | /// 7 | /// Formatter for 'date' swagger formats ss defined by full-date - RFC3339 8 | /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types 9 | /// 10 | public class SwaggerDateConverter : IsoDateTimeConverter 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public SwaggerDateConverter() 16 | { 17 | // full-date = date-fullyear "-" date-month "-" date-mday 18 | DateTimeFormat = "yyyy-MM-dd"; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/compile.mustache: -------------------------------------------------------------------------------- 1 | :: Generated by: https://github.com/swagger-api/swagger-codegen.git 2 | :: 3 | 4 | @echo off 5 | 6 | {{#supportsAsync}} 7 | SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 8 | {{/supportsAsync}} 9 | {{^supportsAsync}} 10 | SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v3.5 11 | {{/supportsAsync}} 12 | 13 | if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')" 14 | .\nuget.exe install src\{{packageName}}\packages.config -o packages 15 | 16 | if not exist ".\bin" mkdir bin 17 | 18 | copy packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll 19 | copy packages\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll bin\JsonSubTypes.dll 20 | copy packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll bin\RestSharp.dll 21 | {{#generatePropertyChanged}} 22 | copy packages\Fody.1.29.4\Fody.dll bin\Fody.dll 23 | copy packages\PropertyChanged.Fody.1.51.3\PropertyChanged.Fody.dll bin\PropertyChanged.Fody.dll 24 | copy packages\PropertyChanged.Fody.1.51.3\Lib\dotnet\PropertyChanged.dll bin\PropertyChanged.dll 25 | {{/generatePropertyChanged}} 26 | %CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\JsonSubTypes.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll {{#generatePropertyChanged}}/r:bin\Fody.dll;bin\PropertyChanged.Fody.dll;bin\PropertyChanged.dll{{/generatePropertyChanged}} /target:library /out:bin\{{packageName}}.dll /recurse:src\{{packageName}}\*.cs /doc:bin\{{packageName}}.xml 27 | 28 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/enumClass.mustache: -------------------------------------------------------------------------------- 1 | /// 2 | /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} 3 | /// 4 | {{#description}} 5 | /// {{description}} 6 | {{/description}} 7 | [JsonConverter(typeof(StringEnumConverter))] 8 | {{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} 9 | { 10 | {{#allowableValues}}{{#enumVars}} 11 | /// 12 | /// Enum {{name}} for {{{value}}} 13 | /// 14 | [EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})] 15 | {{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}}, 16 | {{/-last}}{{/enumVars}}{{/allowableValues}} 17 | } 18 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/model.mustache: -------------------------------------------------------------------------------- 1 | {{>partial_header}} 2 | using System; 3 | using System.Linq; 4 | using System.IO; 5 | using System.Text; 6 | {{^netStandard}} 7 | using System.Text.RegularExpressions; 8 | {{/netStandard}} 9 | using System.Collections; 10 | using System.Collections.Generic; 11 | using System.Collections.ObjectModel; 12 | using System.Runtime.Serialization; 13 | using Newtonsoft.Json; 14 | using Newtonsoft.Json.Converters; 15 | {{#models}} 16 | {{#model}} 17 | {{#discriminator}} 18 | using JsonSubTypes; 19 | {{/discriminator}} 20 | {{/model}} 21 | {{/models}} 22 | {{^netStandard}} 23 | {{#generatePropertyChanged}} 24 | using PropertyChanged; 25 | using System.ComponentModel; 26 | {{/generatePropertyChanged}} 27 | using System.ComponentModel.DataAnnotations; 28 | {{/netStandard}} 29 | using SwaggerDateConverter = {{packageName}}.Client.SwaggerDateConverter; 30 | 31 | {{#models}} 32 | {{#model}} 33 | namespace {{packageName}}.{{modelPackage}} 34 | { 35 | {{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}} 36 | {{/model}} 37 | {{/models}} 38 | } 39 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/modelEnum.mustache: -------------------------------------------------------------------------------- 1 | /// 2 | /// {{^description}}Defines {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} 3 | /// 4 | {{#description}} 5 | /// {{description}} 6 | {{/description}} 7 | {{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}} 8 | [JsonConverter(typeof(StringEnumConverter))] 9 | {{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}} 10 | {{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}} 11 | { 12 | {{#allowableValues}}{{#enumVars}} 13 | /// 14 | /// Enum {{name}} for value: {{{value}}} 15 | /// 16 | {{#isString}}[EnumMember(Value = "{{{value}}}")]{{/isString}} 17 | {{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}}, 18 | {{/-last}}{{/enumVars}}{{/allowableValues}} 19 | }{{! NOTE: This model's enumVars is modified to look like CodegenProperty}} 20 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/modelInnerEnum.mustache: -------------------------------------------------------------------------------- 1 | {{^isContainer}} 2 | /// 3 | /// {{^description}}Defines {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} 4 | /// 5 | {{#description}} 6 | /// {{description}} 7 | {{/description}} 8 | {{#isString}} 9 | [JsonConverter(typeof(StringEnumConverter))] 10 | {{/isString}} 11 | {{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}} 12 | { 13 | {{#allowableValues}}{{#enumVars}} 14 | /// 15 | /// Enum {{name}} for value: {{{value}}} 16 | /// 17 | {{#isString}}[EnumMember(Value = "{{{value}}}")]{{/isString}} 18 | {{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}}, 19 | {{/-last}}{{/enumVars}}{{/allowableValues}} 20 | } 21 | {{/isContainer}} 22 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}} 2 | {{#model}} 3 | # {{{packageName}}}.{{modelPackage}}.{{{classname}}} 4 | ## Properties 5 | 6 | Name | Type | Description | Notes 7 | ------------ | ------------- | ------------- | ------------- 8 | {{#parent}} 9 | {{#parentVars}} 10 | **{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} 11 | {{/parentVars}} 12 | {{/parent}} 13 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} 14 | {{/vars}} 15 | 16 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) 17 | 18 | {{/model}} 19 | {{/models}} 20 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/mono_nunit_test.mustache: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Generated by: https://github.com/swagger-api/swagger-codegen.git 4 | # 5 | 6 | wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe 7 | mozroots --import --sync 8 | 9 | echo "[INFO] remove bin/Debug/SwaggerClientTest.dll" 10 | rm src/{{{packageName}}}.Test/bin/Debug/{{{packageName}}}.Test.dll 2> /dev/null 11 | 12 | echo "[INFO] install NUnit runners via NuGet" 13 | wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe 14 | mozroots --import --sync 15 | mono nuget.exe install src/{{{packageName}}}.Test/packages.config -o packages 16 | 17 | echo "[INFO] Install NUnit runners via NuGet" 18 | mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages 19 | 20 | echo "[INFO] Build the solution and run the unit test" 21 | xbuild {{{packageName}}}.sln && \ 22 | mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/{{{packageName}}}.Test/bin/Debug/{{{packageName}}}.Test.dll 23 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/packages.config.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{#generatePropertyChanged}} 7 | 8 | 9 | {{/generatePropertyChanged}} 10 | 11 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/packages_test.config.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/partial_header.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | {{#appName}} 3 | * {{{appName}}} 4 | * 5 | {{/appName}} 6 | {{#appDescription}} 7 | * {{{appDescription}}} 8 | * 9 | {{/appDescription}} 10 | * {{#version}}OpenAPI spec version: {{{version}}}{{/version}} 11 | * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} 12 | * Generated by: https://github.com/swagger-api/swagger-codegen.git 13 | */ 14 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/project.json.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "supports": {}, 3 | "dependencies": { 4 | "FubarCoder.RestSharp.Portable.Core": "4.0.7", 5 | "FubarCoder.RestSharp.Portable.HttpClient": "4.0.7", 6 | "Newtonsoft.Json": "10.0.3", 7 | "JsonSubTypes": "1.2.0" 8 | }, 9 | "frameworks": { 10 | "{{targetFrameworkNuget}}": {} 11 | } 12 | } -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/travis.mustache: -------------------------------------------------------------------------------- 1 | # 2 | # Generated by: https://github.com/swagger-api/swagger-codegen.git 3 | # 4 | language: csharp 5 | mono: 6 | - latest 7 | solution: {{{packageName}}}.sln 8 | script: 9 | - /bin/sh ./mono_nunit_test.sh 10 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/csharp/visibility.mustache: -------------------------------------------------------------------------------- 1 | {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/BeanValidationException.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}; 2 | 3 | import java.util.Set; 4 | 5 | import javax.validation.ConstraintViolation; 6 | import javax.validation.ValidationException; 7 | 8 | public class BeanValidationException extends ValidationException { 9 | /** 10 | * 11 | */ 12 | private static final long serialVersionUID = -5294733947409491364L; 13 | Set> violations; 14 | 15 | public BeanValidationException(Set> violations) { 16 | this.violations = violations; 17 | } 18 | 19 | public Set> getViolations() { 20 | return violations; 21 | } 22 | 23 | public void setViolations(Set> violations) { 24 | this.violations = violations; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/Configuration.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}; 4 | 5 | {{>generatedAnnotation}} 6 | public class Configuration { 7 | private static ApiClient defaultApiClient = new ApiClient(); 8 | 9 | /** 10 | * Get the default API client, which would be used when creating API 11 | * instances without providing an API client. 12 | * 13 | * @return Default API client 14 | */ 15 | public static ApiClient getDefaultApiClient() { 16 | return defaultApiClient; 17 | } 18 | 19 | /** 20 | * Set the default API client, which would be used when creating API 21 | * instances without providing an API client. 22 | * 23 | * @param apiClient API client 24 | */ 25 | public static void setDefaultApiClient(ApiClient apiClient) { 26 | defaultApiClient = apiClient; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/Pair.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}; 4 | 5 | {{>generatedAnnotation}} 6 | public class Pair { 7 | private String name = ""; 8 | private String value = ""; 9 | 10 | public Pair (String name, String value) { 11 | setName(name); 12 | setValue(value); 13 | } 14 | 15 | private void setName(String name) { 16 | if (!isValidString(name)) return; 17 | 18 | this.name = name; 19 | } 20 | 21 | private void setValue(String value) { 22 | if (!isValidString(value)) return; 23 | 24 | this.value = value; 25 | } 26 | 27 | public String getName() { 28 | return this.name; 29 | } 30 | 31 | public String getValue() { 32 | return this.value; 33 | } 34 | 35 | private boolean isValidString(String arg) { 36 | if (arg == null) return false; 37 | if (arg.trim().isEmpty()) return false; 38 | 39 | return true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/RFC3339DateFormat.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | package {{invokerPackage}}; 3 | 4 | import com.fasterxml.jackson.databind.util.ISO8601DateFormat; 5 | import com.fasterxml.jackson.databind.util.ISO8601Utils; 6 | 7 | import java.text.FieldPosition; 8 | import java.util.Date; 9 | 10 | 11 | public class RFC3339DateFormat extends ISO8601DateFormat { 12 | 13 | // Same as ISO8601DateFormat but serializing milliseconds. 14 | @Override 15 | public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { 16 | String value = ISO8601Utils.format(date, true); 17 | toAppendTo.append(value); 18 | return toAppendTo; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/StringUtil.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}; 4 | 5 | {{>generatedAnnotation}} 6 | public class StringUtil { 7 | /** 8 | * Check if the given array contains the given value (with case-insensitive comparison). 9 | * 10 | * @param array The array 11 | * @param value The value to search 12 | * @return true if the array contains the value 13 | */ 14 | public static boolean containsIgnoreCase(String[] array, String value) { 15 | for (String str : array) { 16 | if (value == null && str == null) return true; 17 | if (value != null && value.equalsIgnoreCase(str)) return true; 18 | } 19 | return false; 20 | } 21 | 22 | /** 23 | * Join an array of strings with the given separator. 24 | *

25 | * Note: This might be replaced by utility method from commons-lang or guava someday 26 | * if one of those libraries is added as dependency. 27 | *

28 | * 29 | * @param array The array of strings 30 | * @param separator The separator 31 | * @return the resulting string 32 | */ 33 | public static String join(String[] array, String separator) { 34 | int len = array.length; 35 | if (len == 0) return ""; 36 | 37 | StringBuilder out = new StringBuilder(); 38 | out.append(array[0]); 39 | for (int i = 1; i < len; i++) { 40 | out.append(separator).append(array[i]); 41 | } 42 | return out.toString(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/api_test.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{package}}; 4 | 5 | import {{invokerPackage}}.ApiException; 6 | {{#imports}}import {{import}}; 7 | {{/imports}} 8 | import org.junit.Test; 9 | import org.junit.Ignore; 10 | 11 | {{^fullJavaUtil}} 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | {{/fullJavaUtil}} 17 | 18 | /** 19 | * API tests for {{classname}} 20 | */ 21 | @Ignore 22 | public class {{classname}}Test { 23 | 24 | private final {{classname}} api = new {{classname}}(); 25 | 26 | {{#operations}}{{#operation}} 27 | /** 28 | * {{summary}} 29 | * 30 | * {{notes}} 31 | * 32 | * @throws ApiException 33 | * if the Api call fails 34 | */ 35 | @Test 36 | public void {{operationId}}Test() throws ApiException { 37 | {{#allParams}} 38 | {{{dataType}}} {{paramName}} = null; 39 | {{/allParams}} 40 | {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); 41 | 42 | // TODO: test validations 43 | } 44 | {{/operation}}{{/operations}} 45 | } 46 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/auth/ApiKeyAuth.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | 7 | import java.util.Map; 8 | import java.util.List; 9 | 10 | {{>generatedAnnotation}} 11 | public class ApiKeyAuth implements Authentication { 12 | private final String location; 13 | private final String paramName; 14 | 15 | private String apiKey; 16 | private String apiKeyPrefix; 17 | 18 | public ApiKeyAuth(String location, String paramName) { 19 | this.location = location; 20 | this.paramName = paramName; 21 | } 22 | 23 | public String getLocation() { 24 | return location; 25 | } 26 | 27 | public String getParamName() { 28 | return paramName; 29 | } 30 | 31 | public String getApiKey() { 32 | return apiKey; 33 | } 34 | 35 | public void setApiKey(String apiKey) { 36 | this.apiKey = apiKey; 37 | } 38 | 39 | public String getApiKeyPrefix() { 40 | return apiKeyPrefix; 41 | } 42 | 43 | public void setApiKeyPrefix(String apiKeyPrefix) { 44 | this.apiKeyPrefix = apiKeyPrefix; 45 | } 46 | 47 | @Override 48 | public void applyToParams(List queryParams, Map headerParams) { 49 | if (apiKey == null) { 50 | return; 51 | } 52 | String value; 53 | if (apiKeyPrefix != null) { 54 | value = apiKeyPrefix + " " + apiKey; 55 | } else { 56 | value = apiKey; 57 | } 58 | if ("query".equals(location)) { 59 | queryParams.add(new Pair(paramName, value)); 60 | } else if ("header".equals(location)) { 61 | headerParams.put(paramName, value); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/auth/Authentication.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | 7 | import java.util.Map; 8 | import java.util.List; 9 | 10 | public interface Authentication { 11 | /** 12 | * Apply authentication settings to header and query params. 13 | * 14 | * @param queryParams List of query parameters 15 | * @param headerParams Map of header parameters 16 | */ 17 | void applyToParams(List queryParams, Map headerParams); 18 | } 19 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/auth/HttpBasicAuth.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | 7 | {{^java8}} 8 | import com.migcomponents.migbase64.Base64; 9 | {{/java8}} 10 | {{#java8}} 11 | import java.util.Base64; 12 | import java.nio.charset.StandardCharsets; 13 | {{/java8}} 14 | 15 | import java.util.Map; 16 | import java.util.List; 17 | 18 | {{^java8}} 19 | import java.io.UnsupportedEncodingException; 20 | {{/java8}} 21 | 22 | {{>generatedAnnotation}} 23 | public class HttpBasicAuth implements Authentication { 24 | private String username; 25 | private String password; 26 | 27 | public String getUsername() { 28 | return username; 29 | } 30 | 31 | public void setUsername(String username) { 32 | this.username = username; 33 | } 34 | 35 | public String getPassword() { 36 | return password; 37 | } 38 | 39 | public void setPassword(String password) { 40 | this.password = password; 41 | } 42 | 43 | @Override 44 | public void applyToParams(List queryParams, Map headerParams) { 45 | if (username == null && password == null) { 46 | return; 47 | } 48 | String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); 49 | {{^java8}} 50 | try { 51 | headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); 52 | } catch (UnsupportedEncodingException e) { 53 | throw new RuntimeException(e); 54 | } 55 | {{/java8}} 56 | {{#java8}} 57 | headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); 58 | {{/java8}} 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/auth/OAuth.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | 7 | import java.util.Map; 8 | import java.util.List; 9 | 10 | {{>generatedAnnotation}} 11 | public class OAuth implements Authentication { 12 | private String accessToken; 13 | 14 | public String getAccessToken() { 15 | return accessToken; 16 | } 17 | 18 | public void setAccessToken(String accessToken) { 19 | this.accessToken = accessToken; 20 | } 21 | 22 | @Override 23 | public void applyToParams(List queryParams, Map headerParams) { 24 | if (accessToken != null) { 25 | headerParams.put("Authorization", "Bearer " + accessToken); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/auth/OAuthFlow.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | public enum OAuthFlow { 6 | accessCode, implicit, password, application 7 | } 8 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/beanValidation.mustache: -------------------------------------------------------------------------------- 1 | {{#required}} 2 | @NotNull 3 | {{/required}} 4 | {{#isContainer}} 5 | {{^isPrimitiveType}} 6 | {{^isEnum}} 7 | @Valid 8 | {{/isEnum}} 9 | {{/isPrimitiveType}} 10 | {{/isContainer}} 11 | {{#isNotContainer}} 12 | {{^isPrimitiveType}} 13 | @Valid 14 | {{/isPrimitiveType}} 15 | {{/isNotContainer}} 16 | {{>beanValidationCore}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/beanValidationCore.mustache: -------------------------------------------------------------------------------- 1 | {{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! 2 | minLength && maxLength set 3 | }}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! 4 | minLength set, maxLength not 5 | }}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{! 6 | minLength not set, maxLength set 7 | }}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{! 8 | @Size: minItems && maxItems set 9 | }}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{! 10 | @Size: minItems set, maxItems not 11 | }}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{! 12 | @Size: minItems not set && maxItems set 13 | }}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{! 14 | check for integer or long / all others=decimal type with @Decimal* 15 | isInteger set 16 | }}{{#isInteger}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isInteger}}{{! 17 | isLong set 18 | }}{{#isLong}}{{#minimum}} @Min({{minimum}}L){{/minimum}}{{#maximum}} @Max({{maximum}}L){{/maximum}}{{/isLong}}{{! 19 | Not Integer, not Long => we have a decimal value! 20 | }}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/beanValidationQueryParams.mustache: -------------------------------------------------------------------------------- 1 | {{#required}} @NotNull{{/required}}{{>beanValidationCore}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/build.sbt.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/swagger-original-templates/java/build.sbt.mustache -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/enum_outer_doc.mustache: -------------------------------------------------------------------------------- 1 | # {{classname}} 2 | 3 | ## Enum 4 | 5 | {{#allowableValues}}{{#enumVars}} 6 | * `{{name}}` (value: `{{{value}}}`) 7 | {{/enumVars}}{{/allowableValues}} 8 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/generatedAnnotation.mustache: -------------------------------------------------------------------------------- 1 | {{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/gitignore.mustache: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # exclude jar for gradle wrapper 12 | !gradle/wrapper/*.jar 13 | 14 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 15 | hs_err_pid* 16 | 17 | # build files 18 | **/target 19 | target 20 | .gradle 21 | build 22 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/swagger-original-templates/java/gradle-wrapper.jar -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/gradle-wrapper.properties.mustache: -------------------------------------------------------------------------------- 1 | #Tue May 17 23:08:05 CST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip 7 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/gradle.properties.mustache: -------------------------------------------------------------------------------- 1 | # Uncomment to build for Android 2 | #target = android -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/feign/ParamExpander.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}; 2 | 3 | import feign.Param; 4 | 5 | import java.text.DateFormat; 6 | import java.util.Date; 7 | 8 | /** 9 | * Param Expander to convert {@link Date} to RFC3339 10 | */ 11 | public class ParamExpander implements Param.Expander { 12 | 13 | private static final DateFormat dateformat = new RFC3339DateFormat(); 14 | 15 | @Override 16 | public String expand(Object value) { 17 | if (value instanceof Date) { 18 | return dateformat.format(value); 19 | } 20 | return value.toString(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/feign/README.mustache: -------------------------------------------------------------------------------- 1 | # {{artifactId}} 2 | 3 | ## Requirements 4 | 5 | Building the API client library requires [Maven](https://maven.apache.org/) to be installed. 6 | 7 | ## Installation & Usage 8 | 9 | To install the API client library to your local Maven repository, simply execute: 10 | 11 | ```shell 12 | mvn install 13 | ``` 14 | 15 | To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: 16 | 17 | ```shell 18 | mvn deploy 19 | ``` 20 | 21 | Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. 22 | 23 | After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: 24 | 25 | ```xml 26 | 27 | {{groupId}} 28 | {{artifactId}} 29 | {{artifactVersion}} 30 | compile 31 | 32 | 33 | ``` 34 | 35 | ## Recommendation 36 | 37 | It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. 38 | 39 | ## Author 40 | 41 | {{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} 42 | {{/hasMore}}{{/apis}}{{/apiInfo}} 43 | 44 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/feign/auth/ApiKeyAuth.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}.auth; 2 | 3 | import feign.RequestInterceptor; 4 | import feign.RequestTemplate; 5 | 6 | public class ApiKeyAuth implements RequestInterceptor { 7 | private final String location; 8 | private final String paramName; 9 | 10 | private String apiKey; 11 | 12 | public ApiKeyAuth(String location, String paramName) { 13 | this.location = location; 14 | this.paramName = paramName; 15 | } 16 | 17 | public String getLocation() { 18 | return location; 19 | } 20 | 21 | public String getParamName() { 22 | return paramName; 23 | } 24 | 25 | public String getApiKey() { 26 | return apiKey; 27 | } 28 | 29 | public void setApiKey(String apiKey) { 30 | this.apiKey = apiKey; 31 | } 32 | 33 | @Override 34 | public void apply(RequestTemplate template) { 35 | if ("query".equals(location)) { 36 | template.query(paramName, apiKey); 37 | } else if ("header".equals(location)) { 38 | template.header(paramName, apiKey); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/feign/auth/HttpBasicAuth.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}.auth; 2 | 3 | import feign.RequestInterceptor; 4 | import feign.RequestTemplate; 5 | import feign.auth.BasicAuthRequestInterceptor; 6 | 7 | /** 8 | * An interceptor that adds the request header needed to use HTTP basic authentication. 9 | */ 10 | public class HttpBasicAuth implements RequestInterceptor { 11 | 12 | private String username; 13 | private String password; 14 | 15 | public String getUsername() { 16 | return username; 17 | } 18 | 19 | public void setUsername(String username) { 20 | this.username = username; 21 | } 22 | 23 | public String getPassword() { 24 | return password; 25 | } 26 | 27 | public void setPassword(String password) { 28 | this.password = password; 29 | } 30 | 31 | public void setCredentials(String username, String password) { 32 | this.username = username; 33 | this.password = password; 34 | } 35 | 36 | @Override 37 | public void apply(RequestTemplate template) { 38 | RequestInterceptor requestInterceptor = new BasicAuthRequestInterceptor(username, password); 39 | requestInterceptor.apply(template); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/feign/build.sbt.mustache: -------------------------------------------------------------------------------- 1 | lazy val root = (project in file(".")). 2 | settings( 3 | organization := "{{groupId}}", 4 | name := "{{artifactId}}", 5 | version := "{{artifactVersion}}", 6 | scalaVersion := "2.11.4", 7 | scalacOptions ++= Seq("-feature"), 8 | javacOptions in compile ++= Seq("-Xlint:deprecation"), 9 | publishArtifact in (Compile, packageDoc) := false, 10 | resolvers += Resolver.mavenLocal, 11 | libraryDependencies ++= Seq( 12 | "io.swagger" % "swagger-annotations" % "1.5.9" % "compile", 13 | "io.github.openfeign" % "feign-core" % "9.4.0" % "compile", 14 | "io.github.openfeign" % "feign-jackson" % "9.4.0" % "compile", 15 | "io.github.openfeign" % "feign-slf4j" % "9.4.0" % "compile", 16 | "io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile", 17 | "com.fasterxml.jackson.core" % "jackson-core" % "2.10.1" % "compile", 18 | "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.1" % "compile", 19 | "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.1" % "compile", 20 | "com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.10.1" % "compile", 21 | "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", 22 | "com.brsanthu" % "migbase64" % "2.2" % "compile", 23 | "junit" % "junit" % "4.12" % "test", 24 | "com.novocode" % "junit-interface" % "0.10" % "test" 25 | ) 26 | ) 27 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/google-api-client/api_test.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{package}}; 4 | 5 | {{#imports}}import {{import}}; 6 | {{/imports}} 7 | import org.junit.Test; 8 | import org.junit.Ignore; 9 | 10 | import java.io.IOException; 11 | {{^fullJavaUtil}} 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | {{/fullJavaUtil}} 17 | 18 | /** 19 | * API tests for {{classname}} 20 | */ 21 | @Ignore 22 | public class {{classname}}Test { 23 | 24 | private final {{classname}} api = new {{classname}}(); 25 | 26 | {{#operations}}{{#operation}} 27 | /** 28 | * {{summary}} 29 | * 30 | * {{notes}} 31 | * 32 | * @throws IOException 33 | * if the Api call fails 34 | */ 35 | @Test 36 | public void {{operationId}}Test() throws IOException { 37 | {{#allParams}} 38 | {{{dataType}}} {{paramName}} = null; 39 | {{/allParams}} 40 | {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); 41 | 42 | // TODO: test validations 43 | } 44 | {{/operation}}{{/operations}} 45 | } 46 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/google-api-client/build.sbt.mustache: -------------------------------------------------------------------------------- 1 | lazy val root = (project in file(".")). 2 | settings( 3 | organization := "{{groupId}}", 4 | name := "{{artifactId}}", 5 | version := "{{artifactVersion}}", 6 | scalaVersion := "2.11.4", 7 | scalacOptions ++= Seq("-feature"), 8 | javacOptions in compile ++= Seq("-Xlint:deprecation"), 9 | publishArtifact in (Compile, packageDoc) := false, 10 | resolvers += Resolver.mavenLocal, 11 | libraryDependencies ++= Seq( 12 | "io.swagger" % "swagger-annotations" % "1.5.17", 13 | "com.google.api-client" % "google-api-client" % "1.23.0", 14 | "org.glassfish.jersey.core" % "jersey-common" % "2.29.1", 15 | "com.fasterxml.jackson.core" % "jackson-core" % "2.10.1" % "compile", 16 | "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.1" % "compile", 17 | "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.1" % "compile", 18 | {{#withXml}} 19 | "com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.10.1" % "compile", 20 | {{/withXml}} 21 | {{#joda}} 22 | "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.10.1" % "compile", 23 | {{/joda}} 24 | {{#java8}} 25 | "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.10.1" % "compile", 26 | {{/java8}} 27 | {{#threetenbp}} 28 | "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", 29 | {{/threetenbp}} 30 | "junit" % "junit" % "4.12" % "test", 31 | "com.novocode" % "junit-interface" % "0.10" % "test" 32 | ) 33 | ) 34 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/jersey2/ApiResponse.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}; 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | /** 9 | * API response returned by API call. 10 | * 11 | * @param The type of data that is deserialized from response body 12 | */ 13 | public class ApiResponse { 14 | private final int statusCode; 15 | private final Map> headers; 16 | private final T data; 17 | 18 | /** 19 | * @param statusCode The status code of HTTP response 20 | * @param headers The headers of HTTP response 21 | */ 22 | public ApiResponse(int statusCode, Map> headers) { 23 | this(statusCode, headers, null); 24 | } 25 | 26 | /** 27 | * @param statusCode The status code of HTTP response 28 | * @param headers The headers of HTTP response 29 | * @param data The object deserialized from response bod 30 | */ 31 | public ApiResponse(int statusCode, Map> headers, T data) { 32 | this.statusCode = statusCode; 33 | this.headers = headers; 34 | this.data = data; 35 | } 36 | 37 | public int getStatusCode() { 38 | return statusCode; 39 | } 40 | 41 | public Map> getHeaders() { 42 | return headers; 43 | } 44 | 45 | public T getData() { 46 | return data; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/okhttp-gson/ApiResponse.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}; 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | /** 9 | * API response returned by API call. 10 | * 11 | * @param The type of data that is deserialized from response body 12 | */ 13 | public class ApiResponse { 14 | final private int statusCode; 15 | final private Map> headers; 16 | final private T data; 17 | 18 | /** 19 | * @param statusCode The status code of HTTP response 20 | * @param headers The headers of HTTP response 21 | */ 22 | public ApiResponse(int statusCode, Map> headers) { 23 | this(statusCode, headers, null); 24 | } 25 | 26 | /** 27 | * @param statusCode The status code of HTTP response 28 | * @param headers The headers of HTTP response 29 | * @param data The object deserialized from response bod 30 | */ 31 | public ApiResponse(int statusCode, Map> headers, T data) { 32 | this.statusCode = statusCode; 33 | this.headers = headers; 34 | this.data = data; 35 | } 36 | 37 | public int getStatusCode() { 38 | return statusCode; 39 | } 40 | 41 | public Map> getHeaders() { 42 | return headers; 43 | } 44 | 45 | public T getData() { 46 | return data; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | 7 | import com.squareup.okhttp.Credentials; 8 | 9 | import java.util.Map; 10 | import java.util.List; 11 | 12 | import java.io.UnsupportedEncodingException; 13 | 14 | public class HttpBasicAuth implements Authentication { 15 | private String username; 16 | private String password; 17 | 18 | public String getUsername() { 19 | return username; 20 | } 21 | 22 | public void setUsername(String username) { 23 | this.username = username; 24 | } 25 | 26 | public String getPassword() { 27 | return password; 28 | } 29 | 30 | public void setPassword(String password) { 31 | this.password = password; 32 | } 33 | 34 | @Override 35 | public void applyToParams(List queryParams, Map headerParams) { 36 | if (username == null && password == null) { 37 | return; 38 | } 39 | headerParams.put("Authorization", Credentials.basic( 40 | username == null ? "" : username, 41 | password == null ? "" : password)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/okhttp-gson/build.sbt.mustache: -------------------------------------------------------------------------------- 1 | lazy val root = (project in file(".")). 2 | settings( 3 | organization := "{{groupId}}", 4 | name := "{{artifactId}}", 5 | version := "{{artifactVersion}}", 6 | scalaVersion := "2.11.4", 7 | scalacOptions ++= Seq("-feature"), 8 | javacOptions in compile ++= Seq("-Xlint:deprecation"), 9 | publishArtifact in (Compile, packageDoc) := false, 10 | resolvers += Resolver.mavenLocal, 11 | libraryDependencies ++= Seq( 12 | "io.swagger" % "swagger-annotations" % "1.5.17", 13 | "com.squareup.okhttp" % "okhttp" % "2.7.5", 14 | "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", 15 | "com.google.code.gson" % "gson" % "2.8.1", 16 | {{#joda}} 17 | "joda-time" % "joda-time" % "2.9.9" % "compile", 18 | {{/joda}} 19 | {{#threetenbp}} 20 | "org.threeten" % "threetenbp" % "1.3.5" % "compile", 21 | {{/threetenbp}} 22 | "io.gsonfire" % "gson-fire" % "1.8.0" % "compile", 23 | "junit" % "junit" % "4.12" % "test", 24 | "com.novocode" % "junit-interface" % "0.10" % "test" 25 | ) 26 | ) 27 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/rest-assured/ApiClient.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}; 4 | 5 | import {{apiPackage}}.*; 6 | 7 | {{#imports}}import {{import}}; 8 | {{/imports}} 9 | 10 | {{^fullJavaUtil}} 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | import io.restassured.RestAssured; 16 | import io.restassured.builder.RequestSpecBuilder; 17 | import io.restassured.builder.ResponseSpecBuilder; 18 | import io.restassured.response.Response; 19 | import java.util.function.Consumer; 20 | import java.util.function.Function; 21 | import java.util.function.Supplier; 22 | {{/fullJavaUtil}} 23 | 24 | public class ApiClient { 25 | 26 | private final Config config; 27 | 28 | private ApiClient(Config config) { 29 | this.config = config; 30 | } 31 | 32 | public static ApiClient api(Config config) { 33 | return new ApiClient(config); 34 | } 35 | 36 | {{#apiInfo}} 37 | {{#apis}} 38 | public {{classname}} {{classVarName}}() { 39 | return {{classname}}.{{classVarName}}(config.baseReqSpec.get()); 40 | } 41 | {{/apis}} 42 | {{/apiInfo}} 43 | 44 | public static class Config { 45 | private Supplier baseReqSpec; 46 | 47 | /** 48 | * Use common specification for all operations 49 | */ 50 | public Config reqSpecSupplier(Supplier supplier) { 51 | this.baseReqSpec = supplier; 52 | return this; 53 | } 54 | 55 | public static Config apiConfig() { 56 | return new Config(); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/rest-assured/GsonObjectMapper.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}; 4 | 5 | import io.restassured.mapper.ObjectMapper; 6 | import io.restassured.mapper.ObjectMapperDeserializationContext; 7 | import io.restassured.mapper.ObjectMapperSerializationContext; 8 | 9 | public class GsonObjectMapper implements ObjectMapper { 10 | 11 | private JSON json; 12 | 13 | private GsonObjectMapper() { 14 | this.json = new JSON(); 15 | } 16 | 17 | public static GsonObjectMapper gson() { 18 | return new GsonObjectMapper(); 19 | } 20 | 21 | @Override 22 | public Object deserialize(ObjectMapperDeserializationContext context) { 23 | return json.deserialize(context.getDataToDeserialize().asString(), context.getType()); 24 | } 25 | 26 | @Override 27 | public Object serialize(ObjectMapperSerializationContext context) { 28 | return json.serialize(context.getObjectToSerialize()); 29 | } 30 | } -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/rest-assured/README.mustache: -------------------------------------------------------------------------------- 1 | # {{artifactId}} 2 | 3 | ## Requirements 4 | 5 | Building the API client library requires [Maven](https://maven.apache.org/) to be installed. 6 | 7 | ## Installation & Usage 8 | 9 | To install the API client library to your local Maven repository, simply execute: 10 | 11 | ```shell 12 | mvn install 13 | ``` 14 | 15 | To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: 16 | 17 | ```shell 18 | mvn deploy 19 | ``` 20 | 21 | Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. 22 | 23 | After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: 24 | 25 | ```xml 26 | 27 | {{groupId}} 28 | {{artifactId}} 29 | {{artifactVersion}} 30 | compile 31 | 32 | 33 | ``` 34 | 35 | ## Recommendation 36 | 37 | It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. 38 | 39 | ## Author 40 | 41 | {{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} 42 | {{/hasMore}}{{/apis}}{{/apiInfo}} 43 | 44 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/rest-assured/ResponseSpecBuilders.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}; 4 | 5 | import io.restassured.builder.ResponseSpecBuilder; 6 | import io.restassured.response.Response; 7 | import io.restassured.specification.ResponseSpecification; 8 | 9 | import java.util.function.Function; 10 | 11 | public class ResponseSpecBuilders { 12 | 13 | private ResponseSpecBuilders() { 14 | } 15 | 16 | public static Function validatedWith(ResponseSpecification respSpec) { 17 | return response -> response.then().spec(respSpec).extract().response(); 18 | } 19 | 20 | public static Function validatedWith(ResponseSpecBuilder respSpec) { 21 | return validatedWith(respSpec.build()); 22 | } 23 | 24 | /** 25 | * @param code expected status code 26 | * @return ResponseSpecBuilder 27 | */ 28 | public static ResponseSpecBuilder shouldBeCode(int code) { 29 | return new ResponseSpecBuilder().expectStatusCode(code); 30 | } 31 | } -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/rest-assured/build.sbt.mustache: -------------------------------------------------------------------------------- 1 | lazy val root = (project in file(".")). 2 | settings( 3 | organization := "{{groupId}}", 4 | name := "{{artifactId}}", 5 | version := "{{artifactVersion}}", 6 | scalaVersion := "2.11.4", 7 | scalacOptions ++= Seq("-feature"), 8 | javacOptions in compile ++= Seq("-Xlint:deprecation"), 9 | publishArtifact in (Compile, packageDoc) := false, 10 | resolvers += Resolver.mavenLocal, 11 | libraryDependencies ++= Seq( 12 | "io.swagger" % "swagger-annotations" % "1.5.15", 13 | "io.rest-assured" % "scala-support" % "3.1.0", 14 | "com.google.code.gson" % "gson" % "2.6.1", 15 | "io.gsonfire" % "gson-fire" % "1.8.2" % "compile", 16 | {{#joda}} 17 | "joda-time" % "joda-time" % "2.9.9" % "compile", 18 | {{/joda}} 19 | {{#threetenbp}} 20 | "org.threeten" % "threetenbp" % "1.3.5" % "compile", 21 | {{/threetenbp}} 22 | "com.squareup.okio" % "okio" % "1.13.0" % "compile", 23 | "junit" % "junit" % "4.12" % "test", 24 | "com.novocode" % "junit-interface" % "0.10" % "test" 25 | ) 26 | ) 27 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/resteasy/JSON.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}; 2 | 3 | import com.fasterxml.jackson.annotation.*; 4 | import com.fasterxml.jackson.databind.*; 5 | {{#java8}} 6 | import com.fasterxml.jackson.datatype.jsr310.*; 7 | {{/java8}} 8 | {{^java8}} 9 | import com.fasterxml.jackson.datatype.joda.*; 10 | {{/java8}} 11 | 12 | import java.text.DateFormat; 13 | 14 | import javax.ws.rs.ext.ContextResolver; 15 | 16 | {{>generatedAnnotation}} 17 | public class JSON implements ContextResolver { 18 | private ObjectMapper mapper; 19 | 20 | public JSON() { 21 | mapper = new ObjectMapper(); 22 | mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); 23 | mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); 24 | mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); 25 | mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); 26 | mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); 27 | mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); 28 | mapper.setDateFormat(new RFC3339DateFormat()); 29 | {{#java8}} 30 | mapper.registerModule(new JavaTimeModule()); 31 | {{/java8}} 32 | {{^java8}} 33 | mapper.registerModule(new JodaModule()); 34 | {{/java8}} 35 | } 36 | 37 | /** 38 | * Set the date format for JSON (de)serialization with Date properties. 39 | */ 40 | public void setDateFormat(DateFormat dateFormat) { 41 | mapper.setDateFormat(dateFormat); 42 | } 43 | 44 | @Override 45 | public ObjectMapper getContext(Class type) { 46 | return mapper; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/resteasy/build.sbt.mustache: -------------------------------------------------------------------------------- 1 | lazy val root = (project in file(".")). 2 | settings( 3 | organization := "{{groupId}}", 4 | name := "{{artifactId}}", 5 | version := "{{artifactVersion}}", 6 | scalaVersion := "2.11.4", 7 | scalacOptions ++= Seq("-feature"), 8 | javacOptions in compile ++= Seq("-Xlint:deprecation"), 9 | publishArtifact in (Compile, packageDoc) := false, 10 | resolvers += Resolver.mavenLocal, 11 | libraryDependencies ++= Seq( 12 | "io.swagger" % "swagger-annotations" % "1.5.8", 13 | "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", 14 | "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", 15 | "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", 16 | "com.fasterxml.jackson.core" % "jackson-core" % "2.10.1", 17 | "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.1", 18 | "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.1", 19 | {{#java8}} 20 | "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.10.1", 21 | {{/java8}} 22 | {{^java8}} 23 | "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.10.1", 24 | "joda-time" % "joda-time" % "2.9.4", 25 | "com.brsanthu" % "migbase64" % "2.2", 26 | {{/java8}} 27 | {{#supportJava6}} 28 | "org.apache.commons" % "commons-lang3" % "3.5", 29 | "commons-io" % "commons-io" % "2.5", 30 | {{/supportJava6}} 31 | "junit" % "junit" % "4.12" % "test", 32 | "com.novocode" % "junit-interface" % "0.10" % "test" 33 | ) 34 | ) 35 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/resttemplate/api_test.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{package}}; 4 | 5 | {{#imports}}import {{import}}; 6 | {{/imports}} 7 | import org.junit.Test; 8 | import org.junit.Ignore; 9 | 10 | {{^fullJavaUtil}} 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | {{/fullJavaUtil}} 16 | 17 | /** 18 | * API tests for {{classname}} 19 | */ 20 | @Ignore 21 | public class {{classname}}Test { 22 | 23 | private final {{classname}} api = new {{classname}}(); 24 | 25 | {{#operations}}{{#operation}} 26 | /** 27 | * {{summary}} 28 | * 29 | * {{notes}} 30 | * 31 | * @throws ApiException 32 | * if the Api call fails 33 | */ 34 | @Test 35 | public void {{operationId}}Test() { 36 | {{#allParams}} 37 | {{{dataType}}} {{paramName}} = null; 38 | {{/allParams}} 39 | {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); 40 | 41 | // TODO: test validations 42 | } 43 | {{/operation}}{{/operations}} 44 | } 45 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/resttemplate/auth/ApiKeyAuth.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}.auth; 2 | 3 | import org.springframework.http.HttpHeaders; 4 | import org.springframework.util.MultiValueMap; 5 | 6 | {{>generatedAnnotation}} 7 | public class ApiKeyAuth implements Authentication { 8 | private final String location; 9 | private final String paramName; 10 | 11 | private String apiKey; 12 | private String apiKeyPrefix; 13 | 14 | public ApiKeyAuth(String location, String paramName) { 15 | this.location = location; 16 | this.paramName = paramName; 17 | } 18 | 19 | public String getLocation() { 20 | return location; 21 | } 22 | 23 | public String getParamName() { 24 | return paramName; 25 | } 26 | 27 | public String getApiKey() { 28 | return apiKey; 29 | } 30 | 31 | public void setApiKey(String apiKey) { 32 | this.apiKey = apiKey; 33 | } 34 | 35 | public String getApiKeyPrefix() { 36 | return apiKeyPrefix; 37 | } 38 | 39 | public void setApiKeyPrefix(String apiKeyPrefix) { 40 | this.apiKeyPrefix = apiKeyPrefix; 41 | } 42 | 43 | @Override 44 | public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams) { 45 | if (apiKey == null) { 46 | return; 47 | } 48 | String value; 49 | if (apiKeyPrefix != null) { 50 | value = apiKeyPrefix + " " + apiKey; 51 | } else { 52 | value = apiKey; 53 | } 54 | if (location.equals("query")) { 55 | queryParams.add(paramName, value); 56 | } else if (location.equals("header")) { 57 | headerParams.add(paramName, value); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/resttemplate/auth/Authentication.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}.auth; 2 | 3 | import org.springframework.http.HttpHeaders; 4 | import org.springframework.util.MultiValueMap; 5 | 6 | public interface Authentication { 7 | /** 8 | * Apply authentication settings to header and / or query parameters. 9 | * @param queryParams The query parameters for the request 10 | * @param headerParams The header parameters for the request 11 | */ 12 | public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams); 13 | } 14 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/resttemplate/auth/HttpBasicAuth.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}.auth; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.nio.charset.StandardCharsets; 5 | 6 | import org.springframework.http.HttpHeaders; 7 | import org.springframework.util.Base64Utils; 8 | import org.springframework.util.MultiValueMap; 9 | 10 | {{>generatedAnnotation}} 11 | public class HttpBasicAuth implements Authentication { 12 | private String username; 13 | private String password; 14 | 15 | public String getUsername() { 16 | return username; 17 | } 18 | 19 | public void setUsername(String username) { 20 | this.username = username; 21 | } 22 | 23 | public String getPassword() { 24 | return password; 25 | } 26 | 27 | public void setPassword(String password) { 28 | this.password = password; 29 | } 30 | 31 | @Override 32 | public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams) { 33 | if (username == null && password == null) { 34 | return; 35 | } 36 | String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); 37 | headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8))); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/resttemplate/auth/OAuth.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}.auth; 2 | 3 | import org.springframework.http.HttpHeaders; 4 | import org.springframework.util.MultiValueMap; 5 | 6 | {{>generatedAnnotation}} 7 | public class OAuth implements Authentication { 8 | private String accessToken; 9 | 10 | public String getAccessToken() { 11 | return accessToken; 12 | } 13 | 14 | public void setAccessToken(String accessToken) { 15 | this.accessToken = accessToken; 16 | } 17 | 18 | @Override 19 | public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams) { 20 | if (accessToken != null) { 21 | headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/resttemplate/auth/OAuthFlow.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}.auth; 2 | 3 | public enum OAuthFlow { 4 | accessCode, implicit, password, application 5 | } -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit/README.mustache: -------------------------------------------------------------------------------- 1 | # {{artifactId}} 2 | 3 | ## Requirements 4 | 5 | Building the API client library requires [Maven](https://maven.apache.org/) to be installed. 6 | 7 | ## Installation & Usage 8 | 9 | To install the API client library to your local Maven repository, simply execute: 10 | 11 | ```shell 12 | mvn install 13 | ``` 14 | 15 | To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: 16 | 17 | ```shell 18 | mvn deploy 19 | ``` 20 | 21 | Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. 22 | 23 | After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: 24 | 25 | ```xml 26 | 27 | {{groupId}} 28 | {{artifactId}} 29 | {{artifactVersion}} 30 | compile 31 | 32 | 33 | ``` 34 | 35 | ## Recommendation 36 | 37 | It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. 38 | 39 | ## Author 40 | 41 | {{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} 42 | {{/hasMore}}{{/apis}}{{/apiInfo}} 43 | 44 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit/api_test.mustache: -------------------------------------------------------------------------------- 1 | package {{package}}; 2 | 3 | import {{invokerPackage}}.ApiClient; 4 | {{#imports}}import {{import}}; 5 | {{/imports}} 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | {{^fullJavaUtil}} 10 | import java.util.ArrayList; 11 | import java.util.HashMap; 12 | import java.util.List; 13 | import java.util.Map; 14 | {{/fullJavaUtil}} 15 | 16 | /** 17 | * API tests for {{classname}} 18 | */ 19 | public class {{classname}}Test { 20 | 21 | private {{classname}} api; 22 | 23 | @Before 24 | public void setup() { 25 | api = new ApiClient().createService({{classname}}.class); 26 | } 27 | 28 | {{#operations}}{{#operation}} 29 | /** 30 | * {{summary}} 31 | * 32 | * {{notes}} 33 | */ 34 | @Test 35 | public void {{operationId}}Test() { 36 | {{#allParams}} 37 | {{{dataType}}} {{paramName}} = null; 38 | {{/allParams}} 39 | // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); 40 | 41 | // TODO: test validations 42 | } 43 | {{/operation}}{{/operations}} 44 | } 45 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit/auth/HttpBasicAuth.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}.auth; 2 | 3 | import java.io.IOException; 4 | 5 | import com.squareup.okhttp.Credentials; 6 | import com.squareup.okhttp.Interceptor; 7 | import com.squareup.okhttp.Request; 8 | import com.squareup.okhttp.Response; 9 | 10 | public class HttpBasicAuth implements Interceptor { 11 | 12 | private String username; 13 | private String password; 14 | 15 | public String getUsername() { 16 | return username; 17 | } 18 | 19 | public void setUsername(String username) { 20 | this.username = username; 21 | } 22 | 23 | public String getPassword() { 24 | return password; 25 | } 26 | 27 | public void setPassword(String password) { 28 | this.password = password; 29 | } 30 | 31 | public void setCredentials(String username, String password) { 32 | this.username = username; 33 | this.password = password; 34 | } 35 | 36 | @Override 37 | public Response intercept(Chain chain) throws IOException { 38 | Request request = chain.request(); 39 | 40 | // If the request already have an authorization (eg. Basic auth), do nothing 41 | if (request.header("Authorization") == null) { 42 | String credentials = Credentials.basic(username, password); 43 | request = request.newBuilder() 44 | .addHeader("Authorization", credentials) 45 | .build(); 46 | } 47 | return chain.proceed(request); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit/bodyParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isBodyParam}}@retrofit.http.Body {{{dataType}}} {{paramName}}{{/isBodyParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit/build.sbt.mustache: -------------------------------------------------------------------------------- 1 | lazy val root = (project in file(".")). 2 | settings( 3 | organization := "{{groupId}}", 4 | name := "{{artifactId}}", 5 | version := "{{artifactVersion}}", 6 | scalaVersion := "2.11.4", 7 | scalacOptions ++= Seq("-feature"), 8 | javacOptions in compile ++= Seq("-Xlint:deprecation"), 9 | publishArtifact in (Compile, packageDoc) := false, 10 | resolvers += Resolver.mavenLocal, 11 | libraryDependencies ++= Seq( 12 | "com.squareup.okhttp" % "okhttp" % "2.7.5" % "compile", 13 | "com.squareup.retrofit" % "retrofit" % "1.9.0" % "compile", 14 | "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", 15 | "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", 16 | "joda-time" % "joda-time" % "2.9.3" % "compile", 17 | "junit" % "junit" % "4.12" % "test", 18 | "com.novocode" % "junit-interface" % "0.10" % "test" 19 | ) 20 | ) 21 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit/formParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isFormParam}}{{#notFile}}{{#isMultipart}}@retrofit.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit.http.Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}{{#isMultipart}}@retrofit.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit.http.Field{{/isMultipart}}("{{baseName}}") TypedFile {{paramName}}{{/isFile}}{{/isFormParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit/headerParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isHeaderParam}}@retrofit.http.Header("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit/pathParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isPathParam}}@retrofit.http.Path("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit/queryParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isQueryParam}}@retrofit.http.Query("{{baseName}}") {{#collectionFormat}}{{#isCollectionFormatMulti}}{{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{{dataType}}}{{/collectionFormat}} {{paramName}}{{/isQueryParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/README.mustache: -------------------------------------------------------------------------------- 1 | # {{artifactId}} 2 | 3 | ## Requirements 4 | 5 | Building the API client library requires [Maven](https://maven.apache.org/) to be installed. 6 | 7 | ## Installation & Usage 8 | 9 | To install the API client library to your local Maven repository, simply execute: 10 | 11 | ```shell 12 | mvn install 13 | ``` 14 | 15 | To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: 16 | 17 | ```shell 18 | mvn deploy 19 | ``` 20 | 21 | Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. 22 | 23 | After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: 24 | 25 | ```xml 26 | 27 | {{groupId}} 28 | {{artifactId}} 29 | {{artifactVersion}} 30 | compile 31 | 32 | 33 | ``` 34 | 35 | ## Author 36 | 37 | {{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} 38 | {{/hasMore}}{{/apis}}{{/apiInfo}} 39 | 40 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/api_test.mustache: -------------------------------------------------------------------------------- 1 | package {{package}}; 2 | 3 | import {{invokerPackage}}.ApiClient; 4 | {{#imports}}import {{import}}; 5 | {{/imports}} 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | {{^fullJavaUtil}} 10 | import java.util.ArrayList; 11 | import java.util.HashMap; 12 | import java.util.List; 13 | import java.util.Map; 14 | {{/fullJavaUtil}} 15 | 16 | /** 17 | * API tests for {{classname}} 18 | */ 19 | public class {{classname}}Test { 20 | 21 | private {{classname}} api; 22 | 23 | @Before 24 | public void setup() { 25 | api = new ApiClient().createService({{classname}}.class); 26 | } 27 | 28 | {{#operations}} 29 | {{#operation}} 30 | /** 31 | * {{summary}} 32 | * 33 | * {{notes}} 34 | */ 35 | @Test 36 | public void {{operationId}}Test() { 37 | {{#allParams}} 38 | {{{dataType}}} {{paramName}} = null; 39 | {{/allParams}} 40 | // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); 41 | 42 | // TODO: test validations 43 | } 44 | {{/operation}} 45 | {{/operations}} 46 | } 47 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/auth/HttpBasicAuth.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}.auth; 2 | 3 | import java.io.IOException; 4 | 5 | import okhttp3.Interceptor; 6 | import okhttp3.OkHttpClient; 7 | import okhttp3.Request; 8 | import okhttp3.Response; 9 | import okhttp3.Credentials; 10 | 11 | public class HttpBasicAuth implements Interceptor { 12 | 13 | private String username; 14 | private String password; 15 | 16 | public String getUsername() { 17 | return username; 18 | } 19 | 20 | public void setUsername(String username) { 21 | this.username = username; 22 | } 23 | 24 | public String getPassword() { 25 | return password; 26 | } 27 | 28 | public void setPassword(String password) { 29 | this.password = password; 30 | } 31 | 32 | public void setCredentials(String username, String password) { 33 | this.username = username; 34 | this.password = password; 35 | } 36 | 37 | @Override 38 | public Response intercept(Chain chain) throws IOException { 39 | Request request = chain.request(); 40 | 41 | // If the request already have an authorization (eg. Basic auth), do nothing 42 | if (request.header("Authorization") == null) { 43 | String credentials = Credentials.basic(username, password); 44 | request = request.newBuilder() 45 | .addHeader("Authorization", credentials) 46 | .build(); 47 | } 48 | return chain.proceed(request); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/bodyParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isBodyParam}}@retrofit2.http.Body {{{dataType}}} {{paramName}}{{/isBodyParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/formParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isFormParam}}{{#notFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}} MultipartBody.Part {{paramName}}{{/isFile}}{{/isFormParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/formParams.mustache.save: -------------------------------------------------------------------------------- 1 | {{#isFormParam}}{{#notFile}}{{#isMultipart}}retrofit.http@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}{{#isMultipart}}@Part{{/isMultipart}}{{^isMultipart}}@Field{{/isMultipart}} okhttp3.MultipartBody.Part {{paramName}}{{/isFile}}{{/isFormParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/headerParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isHeaderParam}}@retrofit2.http.Header("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/pathParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isPathParam}}@retrofit2.http.Path("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/play-common/auth/ApiKeyAuth.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | 7 | import java.util.Map; 8 | import java.util.List; 9 | 10 | /** 11 | * Holds ApiKey auth info 12 | */ 13 | {{>generatedAnnotation}} 14 | public class ApiKeyAuth implements Authentication { 15 | private final String location; 16 | private final String paramName; 17 | 18 | private String apiKey; 19 | private String apiKeyPrefix; 20 | 21 | public ApiKeyAuth(String location, String paramName) { 22 | this.location = location; 23 | this.paramName = paramName; 24 | } 25 | 26 | public String getLocation() { 27 | return location; 28 | } 29 | 30 | public String getParamName() { 31 | return paramName; 32 | } 33 | 34 | public String getApiKey() { 35 | return apiKey; 36 | } 37 | 38 | public void setApiKey(String apiKey) { 39 | this.apiKey = apiKey; 40 | } 41 | 42 | public String getApiKeyPrefix() { 43 | return apiKeyPrefix; 44 | } 45 | 46 | public void setApiKeyPrefix(String apiKeyPrefix) { 47 | this.apiKeyPrefix = apiKeyPrefix; 48 | } 49 | 50 | @Override 51 | public void applyToParams(List queryParams, Map headerParams) { 52 | if (apiKey == null) { 53 | return; 54 | } 55 | String value; 56 | if (apiKeyPrefix != null) { 57 | value = apiKeyPrefix + " " + apiKey; 58 | } else { 59 | value = apiKey; 60 | } 61 | if ("query".equals(location)) { 62 | queryParams.add(new Pair(paramName, value)); 63 | } else if ("header".equals(location)) { 64 | headerParams.put(paramName, value); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/retrofit2/queryParams.mustache: -------------------------------------------------------------------------------- 1 | {{#isQueryParam}}@retrofit2.http.Query("{{baseName}}") {{#collectionFormat}}{{#isCollectionFormatMulti}}{{{dataType}}}{{/isCollectionFormatMulti}}{{^isCollectionFormatMulti}}{{{collectionFormat.toUpperCase}}}Params{{/isCollectionFormatMulti}}{{/collectionFormat}}{{^collectionFormat}}{{{dataType}}}{{/collectionFormat}} {{paramName}}{{/isQueryParam}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/vertx/Configuration.mustache: -------------------------------------------------------------------------------- 1 | package {{invokerPackage}}; 2 | 3 | import io.vertx.core.Vertx; 4 | import io.vertx.core.json.JsonObject; 5 | 6 | import java.util.Objects; 7 | 8 | public class Configuration { 9 | 10 | private static ApiClient defaultApiClient = null; 11 | 12 | /** 13 | * Setup the default API client. 14 | * Will be used by API instances when a client is not provided. 15 | * 16 | * @return Default API client 17 | */ 18 | public synchronized static ApiClient setupDefaultApiClient(Vertx vertx, JsonObject config) { 19 | defaultApiClient = new ApiClient(vertx, config); 20 | return defaultApiClient; 21 | } 22 | 23 | /** 24 | * Get the default API client, which would be used when creating API 25 | * instances without providing an API client. 26 | * 27 | * @return Default API client 28 | */ 29 | public synchronized static ApiClient getDefaultApiClient() { 30 | return defaultApiClient; 31 | } 32 | 33 | /** 34 | * Set the default API client, which would be used when creating API 35 | * instances without providing an API client. 36 | * 37 | * @param apiClient API client 38 | */ 39 | public synchronized static void setDefaultApiClient(ApiClient apiClient) { 40 | defaultApiClient = apiClient; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/vertx/api.mustache: -------------------------------------------------------------------------------- 1 | package {{package}}; 2 | 3 | {{#imports}}import {{import}}; 4 | {{/imports}} 5 | import io.vertx.core.AsyncResult; 6 | import io.vertx.core.Handler; 7 | import io.vertx.core.json.JsonObject; 8 | 9 | import java.util.*; 10 | 11 | public interface {{classname}} { 12 | 13 | {{#operations}} 14 | {{#operation}} 15 | void {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}Handler> handler); 16 | 17 | {{/operation}} 18 | {{/operations}} 19 | } 20 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/vertx/auth/ApiKeyAuth.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | import io.vertx.core.MultiMap; 7 | 8 | import java.util.List; 9 | 10 | {{>generatedAnnotation}} 11 | public class ApiKeyAuth implements Authentication { 12 | private final String location; 13 | private final String paramName; 14 | 15 | private String apiKey; 16 | private String apiKeyPrefix; 17 | 18 | public ApiKeyAuth(String location, String paramName) { 19 | this.location = location; 20 | this.paramName = paramName; 21 | } 22 | 23 | public String getLocation() { 24 | return location; 25 | } 26 | 27 | public String getParamName() { 28 | return paramName; 29 | } 30 | 31 | public String getApiKey() { 32 | return apiKey; 33 | } 34 | 35 | public void setApiKey(String apiKey) { 36 | this.apiKey = apiKey; 37 | } 38 | 39 | public String getApiKeyPrefix() { 40 | return apiKeyPrefix; 41 | } 42 | 43 | public void setApiKeyPrefix(String apiKeyPrefix) { 44 | this.apiKeyPrefix = apiKeyPrefix; 45 | } 46 | 47 | @Override 48 | public void applyToParams(List queryParams, MultiMap headerParams) { 49 | if (apiKey == null) { 50 | return; 51 | } 52 | String value; 53 | if (apiKeyPrefix != null) { 54 | value = apiKeyPrefix + " " + apiKey; 55 | } else { 56 | value = apiKey; 57 | } 58 | if ("query".equals(location)) { 59 | queryParams.add(new Pair(paramName, value)); 60 | } else if ("header".equals(location)) { 61 | headerParams.add(paramName, value); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/vertx/auth/Authentication.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | import io.vertx.core.MultiMap; 7 | 8 | import java.util.List; 9 | 10 | public interface Authentication { 11 | /** 12 | * Apply authentication settings to header and query params. 13 | * 14 | * @param queryParams List of query parameters 15 | * @param headerParams Map of header parameters 16 | */ 17 | void applyToParams(List queryParams, MultiMap headerParams); 18 | } 19 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/vertx/auth/HttpBasicAuth.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | import io.vertx.core.MultiMap; 7 | import java.util.Base64; 8 | import java.nio.charset.StandardCharsets; 9 | import java.util.List; 10 | 11 | {{>generatedAnnotation}} 12 | public class HttpBasicAuth implements Authentication { 13 | private String username; 14 | private String password; 15 | 16 | public String getUsername() { 17 | return username; 18 | } 19 | 20 | public void setUsername(String username) { 21 | this.username = username; 22 | } 23 | 24 | public String getPassword() { 25 | return password; 26 | } 27 | 28 | public void setPassword(String password) { 29 | this.password = password; 30 | } 31 | 32 | @Override 33 | public void applyToParams(List queryParams, MultiMap headerParams) { 34 | if (username == null && password == null) { 35 | return; 36 | } 37 | String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); 38 | headerParams.add("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/vertx/auth/OAuth.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | import {{invokerPackage}}.Pair; 6 | import io.vertx.core.MultiMap; 7 | 8 | import java.util.List; 9 | 10 | {{>generatedAnnotation}} 11 | public class OAuth implements Authentication { 12 | private String accessToken; 13 | 14 | public String getAccessToken() { 15 | return accessToken; 16 | } 17 | 18 | public void setAccessToken(String accessToken) { 19 | this.accessToken = accessToken; 20 | } 21 | 22 | @Override 23 | public void applyToParams(List queryParams, MultiMap headerParams) { 24 | if (accessToken != null) { 25 | headerParams.add("Authorization", "Bearer " + accessToken); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/libraries/vertx/auth/OAuthFlow.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{invokerPackage}}.auth; 4 | 5 | public enum OAuthFlow { 6 | accessCode, implicit, password, application 7 | } 8 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * {{{appName}}} 3 | * {{{appDescription}}} 4 | * 5 | * {{#version}}OpenAPI spec version: {{{version}}}{{/version}} 6 | * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} 7 | * 8 | * NOTE: This class is auto generated by the swagger code generator program. 9 | * https://github.com/swagger-api/swagger-codegen.git 10 | * Do not edit the class manually. 11 | */ 12 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/manifest.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/model.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | 3 | package {{package}}; 4 | 5 | {{^supportJava6}} 6 | import java.util.Objects; 7 | import java.util.Arrays; 8 | {{/supportJava6}} 9 | {{#supportJava6}} 10 | import org.apache.commons.lang3.ObjectUtils; 11 | {{/supportJava6}} 12 | {{#imports}} 13 | import {{import}}; 14 | {{/imports}} 15 | {{#serializableModel}} 16 | import java.io.Serializable; 17 | {{/serializableModel}} 18 | {{#jackson}} 19 | {{#withXml}} 20 | import com.fasterxml.jackson.dataformat.xml.annotation.*; 21 | {{/withXml}} 22 | {{/jackson}} 23 | {{#withXml}} 24 | import javax.xml.bind.annotation.*; 25 | {{/withXml}} 26 | {{#parcelableModel}} 27 | import android.os.Parcelable; 28 | import android.os.Parcel; 29 | {{/parcelableModel}} 30 | {{#useBeanValidation}} 31 | import javax.validation.constraints.*; 32 | import javax.validation.Valid; 33 | {{/useBeanValidation}} 34 | 35 | {{#models}} 36 | {{#model}} 37 | {{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}} 38 | {{/model}} 39 | {{/models}} 40 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}} 2 | {{#isEnum}}{{>enum_outer_doc}}{{/isEnum}}{{^isEnum}}{{>pojo_doc}}{{/isEnum}} 3 | {{/model}}{{/models}} 4 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/pojo_doc.mustache: -------------------------------------------------------------------------------- 1 | # {{classname}} 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | {{#vars}}**{{name}}** | {{#isEnum}}[**{{datatypeWithEnum}}**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}}{{/isEnum}} | {{description}} | {{^required}} [optional]{{/required}}{{#readOnly}} [readonly]{{/readOnly}} 7 | {{/vars}} 8 | {{#vars}}{{#isEnum}} 9 | 10 | 11 | ## Enum: {{datatypeWithEnum}} 12 | Name | Value 13 | ---- | -----{{#allowableValues}}{{#enumVars}} 14 | {{name}} | {{value}}{{/enumVars}}{{/allowableValues}} 15 | {{/isEnum}}{{/vars}} 16 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/settings.gradle.mustache: -------------------------------------------------------------------------------- 1 | rootProject.name = "{{artifactId}}" -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/travis.mustache: -------------------------------------------------------------------------------- 1 | # 2 | # Generated by: https://github.com/swagger-api/swagger-codegen.git 3 | # 4 | language: java 5 | jdk: 6 | - oraclejdk8 7 | - oraclejdk7 8 | before_install: 9 | # ensure gradlew has proper permission 10 | - chmod a+x ./gradlew 11 | script: 12 | # test using maven 13 | - mvn test 14 | # uncomment below to test using gradle 15 | # - gradle test 16 | # uncomment below to test using sbt 17 | # - sbt test 18 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/typeInfoAnnotation.mustache: -------------------------------------------------------------------------------- 1 | {{#jackson}} 2 | @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{discriminator}}", visible = true ) 3 | @JsonSubTypes({ 4 | {{#children}} 5 | @JsonSubTypes.Type(value = {{classname}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"), 6 | {{/children}} 7 | }){{/jackson}} 8 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/java/xmlAnnotation.mustache: -------------------------------------------------------------------------------- 1 | {{#withXml}} 2 | 3 | @XmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}") 4 | @XmlAccessorType(XmlAccessType.FIELD) 5 | {{#jackson}} 6 | @JacksonXmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}"){{/jackson}}{{/withXml}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/api-test-param-complex.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-codegen-model}}{{#allVars}}{{^isReadOnly}}{{#vendorExtensions.x-cache-current-context}} 2 | {{^vendorExtensions.x-is-param-required}}opts.{{/vendorExtensions.x-is-param-required}}{{paramName}}{{! 3 | }}{{#vendorExtensions.x-is-param-list-container}}[0]{{/vendorExtensions.x-is-param-list-container}}{{#vendorExtensions.x-is-param-map-container}}.key{{/vendorExtensions.x-is-param-map-container}}{{! 4 | }}{{#vendorExtensions.x-execute-for-cached-contexts}}{{#this}}{{#vendorExtensions.x-execute-for-cached-parent-context}}{{#isListContainer}}[0]{{/isListContainer}}{{#isMapContainer}}.key{{/isMapContainer}}{{/vendorExtensions.x-execute-for-cached-parent-context}}.{{name}}{{/this}}{{/vendorExtensions.x-execute-for-cached-contexts}} = {{! 5 | }}{{>api-test-property}}{{#isPrimitiveType}};{{/isPrimitiveType}}{{! 6 | }}{{/vendorExtensions.x-cache-current-context}}{{/isReadOnly}}{{/allVars}}{{/vendorExtensions.x-codegen-model}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/api-test-param.mustache: -------------------------------------------------------------------------------- 1 | {{#testExample}}{{{testExample}}}{{/testExample}}{{! 2 | }}{{^testExample}}{{! 3 | }}{{#example}}{{{example}}}{{/example}}{{! 4 | }}{{^example}}{{! 5 | }}{{#isListContainer}}[{{#items}}{{>api-test-param}}{{/items}}]{{/isListContainer}}{{! 6 | }}{{#isMapContainer}}{key: {{#items}}{{>api-test-param}}{{/items}}}{{/isMapContainer}}{{! 7 | }}{{#isString}}""{{/isString}}{{! 8 | }}{{#isInteger}}0{{/isInteger}}{{! 9 | }}{{#isLong}}"0"{{/isLong}}{{! 10 | }}{{#isFloat}}0.0{{/isFloat}}{{! 11 | }}{{#isDouble}}0.0{{/isDouble}}{{! 12 | }}{{#isByteArray}}undefined{{/isByteArray}}{{! 13 | }}{{#isBinary}}undefined{{/isBinary}}{{! 14 | }}{{#isBoolean}}false{{/isBoolean}}{{! 15 | }}{{#isDate}}new Date(){{/isDate}}{{! 16 | }}{{#isDateTime}}new Date(){{/isDateTime}}{{! 17 | }}{{#isUuid}}"00000000-0000-0000-0000-000000000000"{{/isUuid}}{{! 18 | }}{{#isFile}}undefined{{/isFile}}{{! 19 | }}{{#isEnum}}{{vendorExtensions.x-first-enum-value}}{{/isEnum}}{{! 20 | }}{{#isConstEnumParam}}{{/isConstEnumParam}}{{! 21 | }}{{#complexType}}new {{moduleName}}.{{className}}();{{/complexType}}{{! 22 | }}{{/example}}{{! 23 | }}{{/testExample}}{{! 24 | }}{{^isPrimitiveType}};{{>api-test-param-complex}}{{/isPrimitiveType}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/api-test-property.mustache: -------------------------------------------------------------------------------- 1 | {{#example}}{{{example}}}{{/example}}{{! 2 | }}{{^example}}{{! 3 | }}{{#isListContainer}}[{{#items}}{{>api-test-property}}{{/items}}]{{/isListContainer}}{{! 4 | }}{{#isMapContainer}}{key: {{#items}}{{>api-test-property}}{{/items}}}{{/isMapContainer}}{{! 5 | }}{{^isEnum}}{{! 6 | }}{{#isString}}""{{/isString}}{{! 7 | }}{{#isInteger}}0{{/isInteger}}{{! 8 | }}{{#isLong}}"0"{{/isLong}}{{! 9 | }}{{#isFloat}}0.0{{/isFloat}}{{! 10 | }}{{#isDouble}}0.0{{/isDouble}}{{! 11 | }}{{#isByteArray}}undefined{{/isByteArray}}{{! 12 | }}{{#isBinary}}undefined{{/isBinary}}{{! 13 | }}{{#isBoolean}}false{{/isBoolean}}{{! 14 | }}{{#isDate}}new Date(){{/isDate}}{{! 15 | }}{{#isDateTime}}new Date(){{/isDateTime}}{{! 16 | }}{{#isUuid}}"00000000-0000-0000-0000-000000000000"{{/isUuid}}{{! 17 | }}{{#isFile}}undefined{{/isFile}}{{! 18 | }}{{^isListContainer}}{{#complexType}}new {{moduleName}}.{{complexType}}(){{/complexType}}{{/isListContainer}}{{! 19 | }}{{/isEnum}}{{! 20 | }}{{#isEnum}}{{vendorExtensions.x-first-enum-value}}{{/isEnum}}{{! 21 | }}{{/example}}{{! 22 | }}{{#complexType}}{{^vendorExtensions.x-is-prop-item}};{{>api-test-param-complex}}{{/vendorExtensions.x-is-prop-item}}{{/complexType}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/api-test-response-complex.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-codegen-model}} 2 | {{#allVars}} 3 | {{#vendorExtensions.x-cache-current-context}} 4 | {{>api-test-response-property}}{{! 5 | }}{{/vendorExtensions.x-cache-current-context}}{{! 6 | }}{{/allVars}}{{! 7 | }}{{/vendorExtensions.x-codegen-model}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/api-test-response.mustache: -------------------------------------------------------------------------------- 1 | {{! NOTE: unlike parameters and properties there is no way to switch on operation response data type, so use null here: 2 | }}{{#returnTypeIsPrimitive}}null{{/returnTypeIsPrimitive}}{{! 3 | }}{{^returnTypeIsPrimitive}};{{>api-test-response-complex}}{{/returnTypeIsPrimitive}}{{! 4 | }} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/enumClass.mustache: -------------------------------------------------------------------------------- 1 | {{#emitJSDoc}} /** 2 | * Allowed values for the {{baseName}} property. 3 | * @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%> 4 | * @readonly 5 | */{{/emitJSDoc}} 6 | exports.{{datatypeWithEnum}} = { 7 | {{#allowableValues}} 8 | {{#enumVars}} 9 | {{#emitJSDoc}} 10 | /** 11 | * value: {{{value}}} 12 | * @const 13 | */ 14 | {{/emitJSDoc}} 15 | "{{name}}": {{{value}}}{{^-last}}, 16 | {{/-last}} 17 | {{/enumVars}} 18 | {{/allowableValues}} 19 | }; 20 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/.babelrc.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | ["babel-plugin-transform-builtin-extend", { 4 | globals: ["Error", "Array"] 5 | }] 6 | ], 7 | "presets": ["env", "stage-0"] 8 | } 9 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/api-test-param-complex.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-codegen-model}}{{#allVars}}{{^isReadOnly}}{{#vendorExtensions.x-cache-current-context}} 2 | {{^vendorExtensions.x-is-param-required}}opts.{{/vendorExtensions.x-is-param-required}}{{paramName}}{{! 3 | }}{{#vendorExtensions.x-is-param-list-container}}[0]{{/vendorExtensions.x-is-param-list-container}}{{#vendorExtensions.x-is-param-map-container}}.key{{/vendorExtensions.x-is-param-map-container}}{{! 4 | }}{{#vendorExtensions.x-execute-for-cached-contexts}}{{#this}}{{#vendorExtensions.x-execute-for-cached-parent-context}}{{#isListContainer}}[0]{{/isListContainer}}{{#isMapContainer}}.key{{/isMapContainer}}{{/vendorExtensions.x-execute-for-cached-parent-context}}.{{name}}{{/this}}{{/vendorExtensions.x-execute-for-cached-contexts}} = {{! 5 | }}{{>api-test-property}}{{#isPrimitiveType}};{{/isPrimitiveType}}{{! 6 | }}{{/vendorExtensions.x-cache-current-context}}{{/isReadOnly}}{{/allVars}}{{/vendorExtensions.x-codegen-model}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/api-test-param.mustache: -------------------------------------------------------------------------------- 1 | {{#testExample}}{{{testExample}}}{{/testExample}}{{! 2 | }}{{^testExample}}{{! 3 | }}{{#example}}{{{example}}}{{/example}}{{! 4 | }}{{^example}}{{! 5 | }}{{#isListContainer}}[{{#items}}{{>api-test-param}}{{/items}}]{{/isListContainer}}{{! 6 | }}{{#isMapContainer}}{key: {{#items}}{{>api-test-param}}{{/items}}}{{/isMapContainer}}{{! 7 | }}{{#isString}}""{{/isString}}{{! 8 | }}{{#isInteger}}0{{/isInteger}}{{! 9 | }}{{#isLong}}"0"{{/isLong}}{{! 10 | }}{{#isFloat}}0.0{{/isFloat}}{{! 11 | }}{{#isDouble}}0.0{{/isDouble}}{{! 12 | }}{{#isByteArray}}undefined{{/isByteArray}}{{! 13 | }}{{#isBinary}}undefined{{/isBinary}}{{! 14 | }}{{#isBoolean}}false{{/isBoolean}}{{! 15 | }}{{#isDate}}new Date(){{/isDate}}{{! 16 | }}{{#isDateTime}}new Date(){{/isDateTime}}{{! 17 | }}{{#isUuid}}"00000000-0000-0000-0000-000000000000"{{/isUuid}}{{! 18 | }}{{#isFile}}undefined{{/isFile}}{{! 19 | }}{{#isEnum}}{{vendorExtensions.x-first-enum-value}}{{/isEnum}}{{! 20 | }}{{#isConstEnumParam}}{{/isConstEnumParam}}{{! 21 | }}{{#complexType}}new {{moduleName}}.{{className}}();{{/complexType}}{{! 22 | }}{{/example}}{{! 23 | }}{{/testExample}}{{! 24 | }}{{^isPrimitiveType}};{{>api-test-param-complex}}{{/isPrimitiveType}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/api-test-property.mustache: -------------------------------------------------------------------------------- 1 | {{#example}}{{{example}}}{{/example}}{{! 2 | }}{{^example}}{{! 3 | }}{{#isListContainer}}[{{#items}}{{>api-test-property}}{{/items}}]{{/isListContainer}}{{! 4 | }}{{#isMapContainer}}{key: {{#items}}{{>api-test-property}}{{/items}}}{{/isMapContainer}}{{! 5 | }}{{^isEnum}}{{! 6 | }}{{#isString}}""{{/isString}}{{! 7 | }}{{#isInteger}}0{{/isInteger}}{{! 8 | }}{{#isLong}}"0"{{/isLong}}{{! 9 | }}{{#isFloat}}0.0{{/isFloat}}{{! 10 | }}{{#isDouble}}0.0{{/isDouble}}{{! 11 | }}{{#isByteArray}}undefined{{/isByteArray}}{{! 12 | }}{{#isBinary}}undefined{{/isBinary}}{{! 13 | }}{{#isBoolean}}false{{/isBoolean}}{{! 14 | }}{{#isDate}}new Date(){{/isDate}}{{! 15 | }}{{#isDateTime}}new Date(){{/isDateTime}}{{! 16 | }}{{#isUuid}}"00000000-0000-0000-0000-000000000000"{{/isUuid}}{{! 17 | }}{{#isFile}}undefined{{/isFile}}{{! 18 | }}{{^isListContainer}}{{#complexType}}new {{moduleName}}.{{complexType}}(){{/complexType}}{{/isListContainer}}{{! 19 | }}{{/isEnum}}{{! 20 | }}{{#isEnum}}{{vendorExtensions.x-first-enum-value}}{{/isEnum}}{{! 21 | }}{{/example}}{{! 22 | }}{{#complexType}}{{^vendorExtensions.x-is-prop-item}};{{>api-test-param-complex}}{{/vendorExtensions.x-is-prop-item}}{{/complexType}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/api-test-response-complex.mustache: -------------------------------------------------------------------------------- 1 | {{#vendorExtensions.x-codegen-model}} 2 | {{#allVars}} 3 | {{#vendorExtensions.x-cache-current-context}} 4 | {{>api-test-response-property}}{{! 5 | }}{{/vendorExtensions.x-cache-current-context}}{{! 6 | }}{{/allVars}}{{! 7 | }}{{/vendorExtensions.x-codegen-model}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/api-test-response.mustache: -------------------------------------------------------------------------------- 1 | {{! NOTE: unlike parameters and properties there is no way to switch on operation response data type, so use null here: 2 | }}{{#returnTypeIsPrimitive}}null{{/returnTypeIsPrimitive}}{{! 3 | }}{{^returnTypeIsPrimitive}};{{>api-test-response-complex}}{{/returnTypeIsPrimitive}}{{! 4 | }} -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/enumClass.mustache: -------------------------------------------------------------------------------- 1 | {{#emitJSDoc}} /** 2 | * Allowed values for the {{baseName}} property. 3 | * @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%> 4 | * @readonly 5 | */{{/emitJSDoc}} 6 | export {{datatypeWithEnum}} = { 7 | {{#allowableValues}} 8 | {{#enumVars}} 9 | {{#emitJSDoc}} 10 | /** 11 | * value: {{{value}}} 12 | * @const 13 | */ 14 | {{/emitJSDoc}} 15 | "{{name}}": {{{value}}}{{^-last}}, 16 | {{/-last}} 17 | {{/enumVars}} 18 | {{/allowableValues}} 19 | }; 20 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/gitignore.mustache: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * {{{appName}}} 3 | * {{{appDescription}}} 4 | * 5 | {{#version}} 6 | * OpenAPI spec version: {{{version}}} 7 | {{/version}} 8 | {{#infoEmail}} 9 | * Contact: {{{infoEmail}}} 10 | {{/infoEmail}} 11 | * 12 | * NOTE: This class is auto generated by the swagger code generator program. 13 | * https://github.com/swagger-api/swagger-codegen.git 14 | * 15 | * Swagger Codegen version: {{{generatorVersion}}} 16 | * 17 | * Do not edit the class manually. 18 | * 19 | */ 20 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/mocha.opts: -------------------------------------------------------------------------------- 1 | --timeout 10000 2 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/model.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | {{=< >=}} 3 | import {ApiClient} from '../ApiClient'; 4 | <#imports> 5 | import {} from './'; 6 | 7 | <={{ }}=> 8 | 9 | {{#models}} 10 | {{#model}} 11 | {{#isEnum}} 12 | {{>partial_model_enum_class}} 13 | {{/isEnum}} 14 | {{^isEnum}} 15 | {{>partial_model_generic}} 16 | {{/isEnum}} 17 | {{/model}} 18 | {{/models}} 19 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}{{#isEnum}}# {{moduleName}}.{{classname}} 2 | 3 | ## Enum 4 | 5 | {{#allowableValues}}{{#enumVars}} 6 | * `{{name}}` (value: `{{{value}}}`) 7 | {{/enumVars}}{{/allowableValues}} 8 | {{/isEnum}}{{^isEnum}}# {{moduleName}}.{{classname}} 9 | 10 | ## Properties 11 | Name | Type | Description | Notes 12 | ------------ | ------------- | ------------- | ------------- 13 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} 14 | {{/vars}} 15 | {{#vars}}{{#isEnum}} 16 | 17 | 18 | ## Enum: {{datatypeWithEnum}} 19 | 20 | {{#allowableValues}}{{#enumVars}} 21 | * `{{name}}` (value: `{{{value}}}`) 22 | {{/enumVars}}{{/allowableValues}} 23 | 24 | {{/isEnum}}{{/vars}} 25 | {{/isEnum}}{{/model}}{{/models}} 26 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/package.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{{projectName}}}", 3 | "version": "{{{projectVersion}}}", 4 | "description": "{{{projectDescription}}}", 5 | "license": "{{licenseName}}", 6 | "main": "{{sourceFolder}}{{#invokerPackage}}/{{invokerPackage}}{{/invokerPackage}}/index.js", 7 | "scripts": { 8 | "test": "mocha --compilers js:babel-core/register --recursive" 9 | }, 10 | "browser": { 11 | "fs": false 12 | }, 13 | "dependencies": { 14 | "babel": "^6.23.0", 15 | "babel-cli": "^6.26.0", 16 | "babel-plugin-transform-builtin-extend": "^1.1.2", 17 | "superagent": "^8.1.2", 18 | "querystring": "0.2.0" 19 | }, 20 | "devDependencies": { 21 | "babel-core": "6.26.0", 22 | "babel-preset-env": "^1.6.1", 23 | "babel-preset-stage-0": "^6.24.1", 24 | "mocha": "~2.3.4", 25 | "sinon": "1.17.3", 26 | "expect.js": "~0.3.1" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/partial_model_enum_class.mustache: -------------------------------------------------------------------------------- 1 | {{#emitJSDoc}} 2 | /** 3 | * Enum class {{classname}}. 4 | * @enum {{=<% %>=}}{<%dataType%>}<%={{ }}=%> 5 | * @readonly 6 | */ 7 | {{/emitJSDoc}} 8 | const {{classname}} = { 9 | {{#allowableValues}} 10 | {{#enumVars}} 11 | {{#emitJSDoc}} 12 | /** 13 | * value: {{{value}}} 14 | * @const 15 | */ 16 | {{/emitJSDoc}} 17 | {{name}}: {{{value}}}, 18 | 19 | {{/enumVars}} 20 | {{/allowableValues}} 21 | {{#emitJSDoc}} 22 | /** 23 | * Returns a {{classname}} enum value from a JavaScript object name. 24 | * @param {Object} data The plain JavaScript object containing the name of the enum value. 25 | * @return {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> The enum {{classname}} value. 26 | */ 27 | {{/emitJSDoc}} 28 | constructFromObject: function(object) { 29 | return object; 30 | } 31 | }; 32 | 33 | export {{=<% %>=}}{<%classname%>}<%={{ }}=%>; -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/partial_model_inner_enum.mustache: -------------------------------------------------------------------------------- 1 | {{#emitJSDoc}} 2 | /** 3 | * Allowed values for the {{name}} property. 4 | * @enum {{=< >=}}{}<={{ }}=> 5 | * @readonly 6 | */ 7 | {{/emitJSDoc}} 8 | {{classname}}.{{datatypeWithEnum}} = { 9 | {{#allowableValues}} 10 | {{#enumVars}} 11 | {{#emitJSDoc}} 12 | /** 13 | * value: {{{value}}} 14 | * @const 15 | */ 16 | {{/emitJSDoc}} 17 | {{name}}: {{{value}}}{{^-last}}, 18 | 19 | {{/-last}} 20 | {{/enumVars}} 21 | {{/allowableValues}} 22 | 23 | }; 24 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/es6/travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "6" 4 | - "6.1" 5 | - "5" 6 | - "5.11" 7 | 8 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/gitignore.mustache: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * {{{appName}}} 3 | * {{{appDescription}}} 4 | * 5 | {{#version}} 6 | * OpenAPI spec version: {{{version}}} 7 | {{/version}} 8 | {{#infoEmail}} 9 | * Contact: {{{infoEmail}}} 10 | {{/infoEmail}} 11 | * 12 | * NOTE: This class is auto generated by the swagger code generator program. 13 | * https://github.com/swagger-api/swagger-codegen.git 14 | * 15 | * Swagger Codegen version: {{{generatorVersion}}} 16 | * 17 | * Do not edit the class manually. 18 | * 19 | */ 20 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/mocha.opts: -------------------------------------------------------------------------------- 1 | --timeout 10000 2 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/model.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}} 2 | (function(root, factory) { 3 | if (typeof define === 'function' && define.amd) { 4 | // AMD. Register as an anonymous module. 5 | define(['{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient'{{#imports}}, '{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{import}}'{{/imports}}], factory); 6 | } else if (typeof module === 'object' && module.exports) { 7 | // CommonJS-like environments that support module.exports, like Node. 8 | module.exports = factory(require('../ApiClient'){{#imports}}, require('./{{import}}'){{/imports}}); 9 | } else { 10 | // Browser globals (root is window) 11 | if (!root.{{moduleName}}) { 12 | root.{{moduleName}} = {}; 13 | } 14 | root.{{moduleName}}.{{classname}} = factory(root.{{moduleName}}.ApiClient{{#imports}}, root.{{moduleName}}.{{import}}{{/imports}}); 15 | } 16 | }(this, function(ApiClient{{#imports}}, {{import}}{{/imports}}) { 17 | 'use strict'; 18 | 19 | {{#models}} 20 | {{#model}} 21 | {{#isEnum}} 22 | {{>partial_model_enum_class}} 23 | {{/isEnum}} 24 | {{^isEnum}} 25 | {{>partial_model_generic}} 26 | {{/isEnum}} 27 | {{/model}} 28 | {{/models}} 29 | })); 30 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}{{#isEnum}}# {{moduleName}}.{{classname}} 2 | 3 | ## Enum 4 | 5 | {{#allowableValues}}{{#enumVars}} 6 | * `{{name}}` (value: `{{{value}}}`) 7 | {{/enumVars}}{{/allowableValues}} 8 | {{/isEnum}}{{^isEnum}}# {{moduleName}}.{{classname}} 9 | 10 | ## Properties 11 | Name | Type | Description | Notes 12 | ------------ | ------------- | ------------- | ------------- 13 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} 14 | {{/vars}} 15 | {{#vars}}{{#isEnum}} 16 | 17 | 18 | ## Enum: {{datatypeWithEnum}} 19 | 20 | {{#allowableValues}}{{#enumVars}} 21 | * `{{name}}` (value: `{{{value}}}`) 22 | {{/enumVars}}{{/allowableValues}} 23 | 24 | {{/isEnum}}{{/vars}} 25 | {{/isEnum}}{{/model}}{{/models}} 26 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/package.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{{projectName}}}", 3 | "version": "{{{projectVersion}}}", 4 | "description": "{{{projectDescription}}}", 5 | "license": "{{licenseName}}", 6 | "main": "{{sourceFolder}}{{#invokerPackage}}/{{invokerPackage}}{{/invokerPackage}}/index.js", 7 | "scripts": { 8 | "test": "mocha --recursive" 9 | }, 10 | "browser": { 11 | "fs": false 12 | }, 13 | "dependencies": { 14 | "superagent": "^8.1.2", 15 | "querystring": "0.2.0" 16 | }, 17 | "devDependencies": { 18 | "mocha": "~2.3.4", 19 | "sinon": "1.17.3", 20 | "expect.js": "~0.3.1"{{#loadTestDataFromFile}}, 21 | "json-pointer": "0.6.0"{{/loadTestDataFromFile}} 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/partial_model_enum_class.mustache: -------------------------------------------------------------------------------- 1 | {{#emitJSDoc}} 2 | /** 3 | * Enum class {{classname}}. 4 | * @enum {{=<% %>=}}{<%dataType%>}<%={{ }}=%> 5 | * @readonly 6 | */ 7 | {{/emitJSDoc}} 8 | var exports = { 9 | {{#allowableValues}} 10 | {{#enumVars}} 11 | {{#emitJSDoc}} 12 | /** 13 | * value: {{{value}}} 14 | * @const 15 | */ 16 | {{/emitJSDoc}} 17 | {{name}}: {{{value}}}{{^-last}}, 18 | 19 | {{/-last}} 20 | {{/enumVars}} 21 | {{/allowableValues}} 22 | 23 | }; 24 | 25 | {{#emitJSDoc}} 26 | /** 27 | * Returns a {{classname}} enum value from a JavaScript object name. 28 | * @param {Object} data The plain JavaScript object containing the name of the enum value. 29 | * @return {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> The enum {{classname}} value. 30 | */ 31 | {{/emitJSDoc}} 32 | exports.constructFromObject = function(object) { 33 | return object; 34 | } 35 | 36 | return exports; -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/partial_model_inner_enum.mustache: -------------------------------------------------------------------------------- 1 | {{#emitJSDoc}} 2 | /** 3 | * Allowed values for the {{name}} property. 4 | * @enum {{=< >=}}{}<={{ }}=> 5 | * @readonly 6 | */ 7 | {{/emitJSDoc}} 8 | exports.{{datatypeWithEnum}} = { 9 | {{#allowableValues}} 10 | {{#enumVars}} 11 | {{#emitJSDoc}} 12 | /** 13 | * value: {{{value}}} 14 | * @const 15 | */ 16 | {{/emitJSDoc}} 17 | {{name}}: {{{value}}}{{^-last}}, 18 | 19 | {{/-last}} 20 | {{/enumVars}} 21 | {{/allowableValues}} 22 | 23 | }; 24 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/javascript/travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "6" 4 | - "6.1" 5 | - "5" 6 | - "5.11" 7 | 8 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/php/.php_cs: -------------------------------------------------------------------------------- 1 | setUsingCache(true) 5 | ->setRules([ 6 | '@PSR2' => true, 7 | 'ordered_imports' => true, 8 | 'phpdoc_order' => true, 9 | 'array_syntax' => [ 'syntax' => 'short' ], 10 | 'strict_comparison' => true, 11 | 'strict_param' => true, 12 | 'no_trailing_whitespace' => false, 13 | 'no_trailing_whitespace_in_comment' => false, 14 | 'braces' => false, 15 | 'single_blank_line_at_eof' => false, 16 | 'blank_line_after_namespace' => false, 17 | ]) 18 | ->setFinder( 19 | PhpCsFixer\Finder::create() 20 | ->exclude('test') 21 | ->exclude('tests') 22 | ->in(__DIR__) 23 | ); 24 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/php/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | sudo: false 3 | php: 4 | - 5.4 5 | - 5.5 6 | - 5.6 7 | - 7.0 8 | - hhvm 9 | before_install: "composer install" 10 | script: "vendor/bin/phpunit" 11 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/php/composer copy.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{#composerVendorName}}{{.}}{{/composerVendorName}}{{^composerVendorName}}{{gitUserId}}{{/composerVendorName}}/{{#composerProjectName}}{{.}}{{/composerProjectName}}{{^composerProjectName}}{{gitRepoId}}{{/composerProjectName}}", 3 | {{#artifactVersion}} 4 | "version": "{{artifactVersion}}", 5 | {{/artifactVersion}} 6 | "description": "{{description}}", 7 | "keywords": [ 8 | "swagger", 9 | "php", 10 | "sdk", 11 | "api" 12 | ], 13 | "homepage": "http://swagger.io", 14 | "license": "proprietary", 15 | "authors": [ 16 | { 17 | "name": "Swagger and contributors", 18 | "homepage": "https://github.com/swagger-api/swagger-codegen" 19 | } 20 | ], 21 | "require": { 22 | "php": ">=5.5", 23 | "ext-curl": "*", 24 | "ext-json": "*", 25 | "ext-mbstring": "*", 26 | "guzzlehttp/guzzle": "^6.2" 27 | }, 28 | "require-dev": { 29 | "phpunit/phpunit": "^4.8", 30 | "squizlabs/php_codesniffer": "~2.6", 31 | "friendsofphp/php-cs-fixer": "~2.12" 32 | }, 33 | "autoload": { 34 | "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } 35 | }, 36 | "autoload-dev": { 37 | "psr-4": { "{{escapedInvokerPackage}}\\" : "{{testBasePath}}/" } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/php/composer.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{#composerVendorName}}{{.}}{{/composerVendorName}}{{^composerVendorName}}{{gitUserId}}{{/composerVendorName}}/{{#composerProjectName}}{{.}}{{/composerProjectName}}{{^composerProjectName}}{{gitRepoId}}{{/composerProjectName}}", 3 | {{#artifactVersion}} 4 | "version": "{{artifactVersion}}", 5 | {{/artifactVersion}} 6 | "description": "{{description}}", 7 | "keywords": [ 8 | "swagger", 9 | "php", 10 | "sdk", 11 | "api" 12 | ], 13 | "homepage": "http://swagger.io", 14 | "license": "proprietary", 15 | "authors": [ 16 | { 17 | "name": "Swagger and contributors", 18 | "homepage": "https://github.com/swagger-api/swagger-codegen" 19 | } 20 | ], 21 | "require": { 22 | "php": ">=5.5", 23 | "ext-curl": "*", 24 | "ext-json": "*", 25 | "ext-mbstring": "*", 26 | "guzzlehttp/guzzle": "^6.2" 27 | }, 28 | "require-dev": { 29 | "phpunit/phpunit": "^4.8", 30 | "squizlabs/php_codesniffer": "~2.6", 31 | "friendsofphp/php-cs-fixer": "~2.12" 32 | }, 33 | "autoload": { 34 | "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } 35 | }, 36 | "autoload-dev": { 37 | "psr-4": { "{{escapedInvokerPackage}}\\" : "{{testBasePath}}/" } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/php/model.mustache: -------------------------------------------------------------------------------- 1 | partial_header}} 16 | /** 17 | * NOTE: This class is auto generated by the swagger code generator program. 18 | * https://github.com/swagger-api/swagger-codegen 19 | * Do not edit the class manually. 20 | */ 21 | 22 | namespace {{modelPackage}}; 23 | {{^isEnum}} 24 | {{^parentSchema}} 25 | 26 | use \ArrayAccess; 27 | {{/parentSchema}} 28 | {{/isEnum}} 29 | use \{{invokerPackage}}\ObjectSerializer; 30 | 31 | /** 32 | * {{classname}} Class Doc Comment 33 | * 34 | * @category Class 35 | {{#description}} 36 | * @description {{description}} 37 | {{/description}} 38 | * @package {{invokerPackage}} 39 | * @author Swagger Codegen team 40 | * @link https://github.com/swagger-api/swagger-codegen 41 | */ 42 | {{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}} 43 | {{/model}}{{/models}} 44 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/php/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}# {{classname}} 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} 7 | {{/vars}} 8 | 9 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) 10 | 11 | {{/model}}{{/models}} 12 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/php/model_enum.mustache: -------------------------------------------------------------------------------- 1 | class {{classname}} 2 | { 3 | /** 4 | * Possible values of this enum 5 | */ 6 | {{#allowableValues}}{{#enumVars}}const {{{name}}} = {{{value}}}; 7 | {{/enumVars}}{{/allowableValues}} 8 | /** 9 | * Gets allowable values of the enum 10 | * @return string[] 11 | */ 12 | public static function getAllowableEnumValues() 13 | { 14 | return [ 15 | {{#allowableValues}}{{#enumVars}}self::{{{name}}},{{^-last}} 16 | {{/-last}}{{/enumVars}}{{/allowableValues}} 17 | ]; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/php/partial_header.mustache: -------------------------------------------------------------------------------- 1 | /** 2 | {{#appName}} 3 | * {{{appName}}} 4 | * 5 | {{/appName}} 6 | {{#appDescription}} 7 | * {{{appDescription}}} 8 | * 9 | {{/appDescription}} 10 | * {{#version}}OpenAPI spec version: {{{version}}}{{/version}} 11 | * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} 12 | * Generated by: https://github.com/swagger-api/swagger-codegen.git 13 | * Swagger Codegen version: {{{generatorVersion}}} 14 | */ 15 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/php/phpunit.xml.mustache: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | {{apiTestPath}} 11 | {{modelTestPath}} 12 | 13 | 14 | 15 | 16 | 17 | {{apiSrcPath}} 18 | {{modelSrcPath}} 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/__init__api.mustache: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | # flake8: noqa 4 | 5 | # import apis into api package 6 | {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classVarName}} import {{classname}} 7 | {{/apis}}{{/apiInfo}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/__init__model.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | {{>partial_header}} 5 | 6 | from __future__ import absolute_import 7 | 8 | # import models into model package 9 | {{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}}{{/model}} 10 | {{/models}} 11 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/__init__package.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | 5 | {{>partial_header}} 6 | 7 | from __future__ import absolute_import 8 | 9 | # import apis into sdk package 10 | {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classVarName}} import {{classname}} 11 | {{/apis}}{{/apiInfo}} 12 | # import ApiClient 13 | from {{packageName}}.api_client import ApiClient 14 | from {{packageName}}.configuration import Configuration 15 | # import models into sdk package 16 | {{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}} 17 | {{/model}}{{/models}} -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/__init__test.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/resources/swagger-original-templates/python/__init__test.mustache -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/api_test.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | {{>partial_header}} 4 | 5 | from __future__ import absolute_import 6 | 7 | import unittest 8 | 9 | import {{packageName}} 10 | from {{apiPackage}}.{{classVarName}} import {{classname}} # noqa: E501 11 | from {{packageName}}.rest import ApiException 12 | 13 | 14 | class {{#operations}}Test{{classname}}(unittest.TestCase): 15 | """{{classname}} unit test stubs""" 16 | 17 | def setUp(self): 18 | self.api = {{apiPackage}}.{{classVarName}}.{{classname}}() # noqa: E501 19 | 20 | def tearDown(self): 21 | pass 22 | 23 | {{#operation}} 24 | def test_{{operationId}}(self): 25 | """Test case for {{{operationId}}} 26 | 27 | {{#summary}} 28 | {{{summary}}} # noqa: E501 29 | {{/summary}} 30 | """ 31 | pass 32 | 33 | {{/operation}} 34 | {{/operations}} 35 | 36 | if __name__ == '__main__': 37 | unittest.main() 38 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/gitignore.mustache: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | venv/ 48 | .python-version 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | 57 | # Sphinx documentation 58 | docs/_build/ 59 | 60 | # PyBuilder 61 | target/ 62 | 63 | #Ipython Notebook 64 | .ipynb_checkpoints 65 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}# {{classname}} 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} 7 | {{/vars}} 8 | 9 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) 10 | 11 | {{/model}}{{/models}} 12 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/model_test.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | {{>partial_header}} 4 | 5 | from __future__ import absolute_import 6 | 7 | import unittest 8 | 9 | {{#models}} 10 | {{#model}} 11 | import {{packageName}} 12 | from {{modelPackage}}.{{classFilename}} import {{classname}} # noqa: E501 13 | from {{packageName}}.rest import ApiException 14 | 15 | 16 | class Test{{classname}}(unittest.TestCase): 17 | """{{classname}} unit test stubs""" 18 | 19 | def setUp(self): 20 | pass 21 | 22 | def tearDown(self): 23 | pass 24 | 25 | def test{{classname}}(self): 26 | """Test {{classname}}""" 27 | # FIXME: construct object with mandatory attributes with example values 28 | # model = {{packageName}}.models.{{classFilename}}.{{classname}}() # noqa: E501 29 | pass 30 | 31 | {{/model}} 32 | {{/models}} 33 | 34 | if __name__ == '__main__': 35 | unittest.main() 36 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/partial_header.mustache: -------------------------------------------------------------------------------- 1 | """ 2 | {{#appName}} 3 | {{{appName}}} 4 | {{/appName}} 5 | 6 | {{#appDescription}} 7 | {{{appDescription}}} # noqa: E501 8 | {{/appDescription}} 9 | 10 | {{#version}}OpenAPI spec version: {{{version}}}{{/version}} 11 | {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} 12 | Generated by: https://github.com/swagger-api/swagger-codegen.git 13 | """ 14 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/requirements.mustache: -------------------------------------------------------------------------------- 1 | certifi >= 14.05.14 2 | six >= 1.10 3 | python_dateutil >= 2.5.3 4 | setuptools >= 21.0.0 5 | urllib3 >= 1.15.1 6 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/setup.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | {{>partial_header}} 4 | 5 | from setuptools import setup, find_packages # noqa: H301 6 | 7 | NAME = "{{{projectName}}}" 8 | VERSION = "{{packageVersion}}" 9 | {{#apiInfo}} 10 | {{#apis}} 11 | {{^hasMore}} 12 | # To install the library, run the following 13 | # 14 | # python setup.py install 15 | # 16 | # prerequisite: setuptools 17 | # http://pypi.python.org/pypi/setuptools 18 | 19 | REQUIRES = [ 20 | "certifi>=2017.4.17", 21 | "python-dateutil>=2.1", 22 | "six>=1.10", 23 | "urllib3>=1.23" 24 | ] 25 | 26 | {{#asyncio}} 27 | REQUIRES.append("aiohttp") 28 | {{/asyncio}} 29 | {{#tornado}} 30 | REQUIRES.append("tornado") 31 | {{/tornado}} 32 | 33 | setup( 34 | name=NAME, 35 | version=VERSION, 36 | description="{{appName}}", 37 | author_email="{{infoEmail}}", 38 | url="{{packageUrl}}", 39 | keywords=["Swagger", "{{appName}}"], 40 | install_requires=REQUIRES, 41 | packages=find_packages(), 42 | include_package_data=True, 43 | long_description="""\ 44 | {{appDescription}} # noqa: E501 45 | """ 46 | ) 47 | {{/hasMore}} 48 | {{/apis}} 49 | {{/apiInfo}} 50 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/test-requirements.mustache: -------------------------------------------------------------------------------- 1 | {{^asyncio}} 2 | coverage>=4.0.3 3 | nose>=1.3.7 4 | {{/asyncio}} 5 | {{#asyncio}} 6 | pytest>=3.3.1 7 | pytest-cov>=2.5.1 8 | {{/asyncio}} 9 | pluggy>=0.3.1 10 | py>=1.4.31 11 | randomize>=0.13 12 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/tox.mustache: -------------------------------------------------------------------------------- 1 | [tox] 2 | {{^asyncio}} 3 | envlist = py27, py3 4 | {{/asyncio}} 5 | {{#asyncio}} 6 | envlist = py3 7 | {{/asyncio}} 8 | 9 | [testenv] 10 | deps=-r{toxinidir}/requirements.txt 11 | -r{toxinidir}/test-requirements.txt 12 | 13 | commands= 14 | {{^asyncio}} 15 | nosetests \ 16 | [] 17 | {{/asyncio}} 18 | {{#asyncio}} 19 | pytest -v --cov petstore_api 20 | {{/asyncio}} 21 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/python/travis.mustache: -------------------------------------------------------------------------------- 1 | # ref: https://docs.travis-ci.com/user/languages/python 2 | language: python 3 | python: 4 | - "2.7" 5 | - "3.2" 6 | - "3.3" 7 | - "3.4" 8 | - "3.5" 9 | #- "3.5-dev" # 3.5 development branch 10 | #- "nightly" # points to the latest development branch e.g. 3.6-dev 11 | # command to install dependencies 12 | install: "pip install -r requirements.txt" 13 | # command to run tests 14 | script: nosetests 15 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/Gemfile.mustache: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | 5 | group :development, :test do 6 | gem 'rake', '~> 12.3.3' 7 | end 8 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/Rakefile.mustache: -------------------------------------------------------------------------------- 1 | begin 2 | require 'rspec/core/rake_task' 3 | 4 | RSpec::Core::RakeTask.new(:spec) 5 | task default: :spec 6 | rescue LoadError 7 | # no rspec available 8 | end 9 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/api_error.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | module {{moduleName}} 6 | class ApiError < StandardError 7 | attr_reader :code, :response_headers, :response_body 8 | 9 | # Usage examples: 10 | # ApiError.new 11 | # ApiError.new("message") 12 | # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") 13 | # ApiError.new(:code => 404, :message => "Not Found") 14 | def initialize(arg = nil) 15 | if arg.is_a? Hash 16 | if arg.key?(:message) || arg.key?('message') 17 | super(arg[:message] || arg['message']) 18 | else 19 | super arg 20 | end 21 | 22 | arg.each do |k, v| 23 | instance_variable_set "@#{k}", v 24 | end 25 | else 26 | super arg 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/api_info.mustache: -------------------------------------------------------------------------------- 1 | {{#appName}} 2 | #{{{appName}}} 3 | 4 | {{/appName}} 5 | {{#appDescription}} 6 | #{{{appDescription}}} 7 | 8 | {{/appDescription}} 9 | {{#version}}OpenAPI spec version: {{version}}{{/version}} 10 | {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} 11 | Generated by: https://github.com/swagger-api/swagger-codegen.git 12 | Swagger Codegen version: {{{generatorVersion}}} 13 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/api_test.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | require 'spec_helper' 6 | require 'json' 7 | 8 | # Unit tests for {{moduleName}}::{{classname}} 9 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 10 | # Please update as you see appropriate 11 | {{#operations}}describe '{{classname}}' do 12 | before do 13 | # run before each test 14 | @instance = {{moduleName}}::{{classname}}.new 15 | end 16 | 17 | after do 18 | # run after each test 19 | end 20 | 21 | describe 'test an instance of {{classname}}' do 22 | it 'should create an instance of {{classname}}' do 23 | expect(@instance).to be_instance_of({{moduleName}}::{{classname}}) 24 | end 25 | end 26 | 27 | {{#operation}} 28 | # unit tests for {{operationId}} 29 | {{#summary}} 30 | # {{summary}} 31 | {{/summary}} 32 | {{#notes}} 33 | # {{notes}} 34 | {{/notes}} 35 | {{#allParams}}{{#required}} # @param {{paramName}} {{description}} 36 | {{/required}}{{/allParams}} # @param [Hash] opts the optional parameters 37 | {{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}} 38 | {{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}] 39 | describe '{{operationId}} test' do 40 | it 'should work' do 41 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 42 | end 43 | end 44 | 45 | {{/operation}} 46 | end 47 | {{/operations}} 48 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/configuration_spec.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | require 'spec_helper' 6 | 7 | describe {{moduleName}}::Configuration do 8 | let(:config) { {{moduleName}}::Configuration.default } 9 | 10 | before(:each) do 11 | # uncomment below to setup host and base_path 12 | # require 'URI' 13 | # uri = URI.parse("{{{basePath}}}") 14 | # {{moduleName}}.configure do |c| 15 | # c.host = uri.host 16 | # c.base_path = uri.path 17 | # end 18 | end 19 | 20 | describe '#base_url' do 21 | it 'should have the default value' do 22 | # uncomment below to test default value of the base path 23 | # expect(config.base_url).to eq("{{{basePath}}}") 24 | end 25 | 26 | it 'should remove trailing slashes' do 27 | [nil, '', '/', '//'].each do |base_path| 28 | config.base_path = base_path 29 | # uncomment below to test trailing slashes 30 | # expect(config.base_url).to eq("{{{basePath}}}") 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/gem.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | # Common files 6 | require '{{gemName}}/api_client' 7 | require '{{gemName}}/api_error' 8 | require '{{gemName}}/version' 9 | require '{{gemName}}/configuration' 10 | 11 | # Models 12 | {{#models}} 13 | {{#model}} 14 | require '{{gemName}}/{{modelPackage}}/{{classFilename}}'{{/model}} 15 | {{/models}} 16 | 17 | # APIs 18 | {{#apiInfo}} 19 | {{#apis}} 20 | require '{{importPath}}' 21 | {{/apis}} 22 | {{/apiInfo}} 23 | 24 | module {{moduleName}} 25 | class << self 26 | # Customize default settings for the SDK using block. 27 | # {{moduleName}}.configure do |config| 28 | # config.username = "xxx" 29 | # config.password = "xxx" 30 | # end 31 | # If no block given, return the default Configuration object. 32 | def configure 33 | if block_given? 34 | yield(Configuration.default) 35 | else 36 | Configuration.default 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/gitignore.mustache: -------------------------------------------------------------------------------- 1 | # Generated by: https://github.com/swagger-api/swagger-codegen.git 2 | # 3 | 4 | *.gem 5 | *.rbc 6 | /.config 7 | /coverage/ 8 | /InstalledFiles 9 | /pkg/ 10 | /spec/reports/ 11 | /spec/examples.txt 12 | /test/tmp/ 13 | /test/version_tmp/ 14 | /tmp/ 15 | 16 | ## Specific to RubyMotion: 17 | .dat* 18 | .repl_history 19 | build/ 20 | 21 | ## Documentation cache and generated files: 22 | /.yardoc/ 23 | /_yardoc/ 24 | /doc/ 25 | /rdoc/ 26 | 27 | ## Environment normalization: 28 | /.bundle/ 29 | /vendor/bundle 30 | /lib/bundler/man/ 31 | 32 | # for a library or gem, you might want to ignore these files since the code is 33 | # intended to run in multiple environments; otherwise, check them in: 34 | # Gemfile.lock 35 | # .ruby-version 36 | # .ruby-gemset 37 | 38 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 39 | .rvmrc 40 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/model.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | require 'date' 6 | 7 | module {{moduleName}} 8 | {{#models}} 9 | {{#model}} 10 | {{#isEnum}} 11 | {{>partial_model_enum_class}} 12 | {{/isEnum}} 13 | {{^isEnum}} 14 | {{>partial_model_generic}} 15 | {{/isEnum}} 16 | {{/model}} 17 | {{/models}} 18 | end 19 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}# {{moduleName}}::{{classname}} 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} 7 | {{/vars}} 8 | 9 | {{/model}}{{/models}} 10 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/model_test.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | require 'spec_helper' 6 | require 'json' 7 | require 'date' 8 | 9 | # Unit tests for {{moduleName}}::{{classname}} 10 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 11 | # Please update as you see appropriate 12 | {{#models}} 13 | {{#model}} 14 | describe '{{classname}}' do 15 | before do 16 | # run before each test 17 | @instance = {{moduleName}}::{{classname}}.new 18 | end 19 | 20 | after do 21 | # run after each test 22 | end 23 | 24 | describe 'test an instance of {{classname}}' do 25 | it 'should create an instance of {{classname}}' do 26 | expect(@instance).to be_instance_of({{moduleName}}::{{classname}}) 27 | end 28 | end 29 | {{#vars}} 30 | describe 'test attribute "{{{name}}}"' do 31 | it 'should work' do 32 | {{#isEnum}} 33 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 34 | # validator = Petstore::EnumTest::EnumAttributeValidator.new('{{{datatype}}}', [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]) 35 | # validator.allowable_values.each do |value| 36 | # expect { @instance.{{name}} = value }.not_to raise_error 37 | # end 38 | {{/isEnum}} 39 | {{^isEnum}} 40 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 41 | {{/isEnum}} 42 | end 43 | end 44 | 45 | {{/vars}} 46 | end 47 | {{/model}} 48 | {{/models}} 49 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/partial_model_enum_class.mustache: -------------------------------------------------------------------------------- 1 | class {{classname}} 2 | {{#allowableValues}}{{#enumVars}} 3 | {{{name}}} = {{{value}}}.freeze{{/enumVars}}{{/allowableValues}} 4 | 5 | # Builds the enum from string 6 | # @param [String] The enum value in the form of the string 7 | # @return [String] The enum value 8 | def build_from_hash(value) 9 | constantValues = {{classname}}.constants.select { |c| {{classname}}::const_get(c) == value } 10 | raise "Invalid ENUM value #{value} for class #{{{classname}}}" if constantValues.empty? 11 | value 12 | end 13 | end -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/rspec.mustache: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /resources/swagger-original-templates/ruby/version.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | module {{moduleName}} 6 | VERSION = '{{gemVersion}}' 7 | end 8 | -------------------------------------------------------------------------------- /sdk_pull_request_template.md: -------------------------------------------------------------------------------- 1 | Note: This repository is auto-generated, and does not accept pull requests. 2 | 3 | To make changes or open issues for this SDK, use the [code generation repository](https://github.com/mailchimp/mailchimp-client-lib-codegen). 4 | -------------------------------------------------------------------------------- /spec/README.md: -------------------------------------------------------------------------------- 1 | # The spec directory 2 | 3 | This directory contains spec files used to generate SDKs and documentation. 4 | 5 | ## Updating the Marketing Spec 6 | 7 | To update the marketing spec, follow these steps. 8 | 9 | Check the current version of the spec file: 10 | 11 | `cat spec/marketing.json |jq ".info.version"` 12 | 13 | Remember this number, it'll be something like `3.0.xx` 14 | 15 | Fetch the current spec file from production: 16 | 17 | `curl "https://api.mailchimp.com/schema/3.0/Swagger.json?expand" >spec/marketing.json` 18 | 19 | Using the editor of your choice, update the version in this file to the old version (that you got above) + 1. 20 | 21 | Create a PR. 22 | 23 | *Optional* When the PR is created, Github actions will run that create artifacts for each of the new SDKs. Pick an SDK .zip file and download it, then unzip it over an (empty) cloned SDK repo. Diff the unzipped files against HEAD of the SDK repo, but don't create a PR or push it -- this is just a check that the new SDKs will be reasonable and nothing's gone haywire. The changes you see in the SDK should mirror the changes you see in the spec file. 24 | 25 | Get approval, then push the PR. 26 | 27 | Ideally, update the version of the spec in production. This lives in Swagger.json in the monolith (only Mailchimp engineers can do this piece). 28 | 29 | ## Updating the Transactional Spec 30 | 31 | _tbd_ -------------------------------------------------------------------------------- /swagger-config/marketing/csharp/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packageName": "Mailchimp.Marketing" 3 | } 4 | -------------------------------------------------------------------------------- /swagger-config/marketing/csharp/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # mailchimp-marketing-csharp 3 | -------------------------------------------------------------------------------- /swagger-config/marketing/java/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "modelPackage": "com.mailchimp.marketing.models", 3 | "apiPackage": "com.mailchimp.marketing.api", 4 | "invokerPackage": "com.mailchimp.marketing", 5 | "groupId": "com.mailchimp", 6 | "artifactId": "marketing", 7 | "artifactUrl": "https://github.com/mailchimp/mailchimp-marketing-java", 8 | "artifactDescription": "Mailchimp Marketing Java SDK" 9 | } 10 | -------------------------------------------------------------------------------- /swagger-config/marketing/java/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # mailchimp-marketing-java 3 | -------------------------------------------------------------------------------- /swagger-config/marketing/javascript/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "@mailchimp/mailchimp_marketing", 3 | "projectDescription": "The official Node client library for the Mailchimp Marketing API", 4 | "projectLicenseName": "Apache-2.0", 5 | "moduleName": "MailchimpMarketing", 6 | "usePromises": true, 7 | "licenseName": "Apache 2.0" 8 | } 9 | -------------------------------------------------------------------------------- /swagger-config/marketing/javascript/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # marketing-node 3 | 4 | docs/** 5 | src/model/** 6 | test/** 7 | *.opts 8 | -------------------------------------------------------------------------------- /swagger-config/marketing/javascript/templates/index.mustache: -------------------------------------------------------------------------------- 1 | var ApiClient = require('./ApiClient'); 2 | 3 | module.exports = ApiClient.instance; 4 | -------------------------------------------------------------------------------- /swagger-config/marketing/javascript/templates/package.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{{projectName}}}", 3 | "version": "{{{projectVersion}}}", 4 | "description": "{{{projectDescription}}}", 5 | "license": "{{projectLicenseName}}", 6 | "main": "{{sourceFolder}}{{#invokerPackage}}/{{invokerPackage}}{{/invokerPackage}}/index.js", 7 | "scripts": { 8 | "test": "jest --setupFiles dotenv/config" 9 | }, 10 | "browser": { 11 | "fs": false 12 | }, 13 | "dependencies": { 14 | "superagent": "^8.1.2", 15 | "dotenv": "^8.2.0" 16 | }, 17 | "devDependencies": { 18 | "mocha": "~2.3.4", 19 | "sinon": "1.17.3", 20 | "jest": "^26.2.2" 21 | }, 22 | "homepage": "https://github.com/mailchimp/mailchimp-marketing-node", 23 | "repository": { 24 | "type": "git", 25 | "url": "git+https://github.com/mailchimp/mailchimp-marketing-node.git" 26 | }, 27 | "bugs": { 28 | "url": "https://github.com/mailchimp/mailchimp-client-lib-codegen/issues" 29 | }, 30 | "keywords": [ 31 | "mailchimp", 32 | "api", 33 | "v3" 34 | ], 35 | "engines": { 36 | "node": ">=10.0.0" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /swagger-config/marketing/php/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packagePath": "MailchimpMarketing", 3 | "invokerPackage": "MailchimpMarketing", 4 | "modelPackage": "Model", 5 | "apiPackage": "Api", 6 | "composerVendorName": "mailchimp", 7 | "composerProjectName": "marketing", 8 | "gitUserId": "mailchimp", 9 | "gitRepoId": "mailchimp-marketing-php" 10 | } 11 | -------------------------------------------------------------------------------- /swagger-config/marketing/php/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # mailchimp-marketing-php 3 | 4 | **/docs/** 5 | **/lib/Model/** 6 | **/test/** 7 | -------------------------------------------------------------------------------- /swagger-config/marketing/php/templates/ApiClient.php: -------------------------------------------------------------------------------- 1 | =7.2", 23 | "ext-curl": "*", 24 | "ext-json": "*", 25 | "ext-mbstring": "*", 26 | "guzzlehttp/psr7": "^1.7 || ^2.0", 27 | "guzzlehttp/guzzle": "^6.4 || ^7.2" 28 | }, 29 | "require-dev": { 30 | "phpunit/phpunit": "^7", 31 | "squizlabs/php_codesniffer": "~2.6", 32 | "friendsofphp/php-cs-fixer": "~2.12" 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" 37 | } 38 | }, 39 | "autoload-dev": { 40 | "psr-4": { "{{escapedInvokerPackage}}\\" : "{{testBasePath}}/" } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packageName": "mailchimp_marketing", 3 | "projectName": "mailchimp_marketing", 4 | "gitUserId": "mailchimp", 5 | "gitRepoId": "mailchimp-marketing-python" 6 | } 7 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # mailchimp-marketing-python 3 | 4 | docs/** 5 | mailchimp_marketing/models 6 | mailchimp_marketing/models/** 7 | # mailchimp_marketing/configuration.py 8 | # mailchimp_marketing/rest.py 9 | test/** 10 | git_push.sh 11 | tox.ini 12 | .travis.yml 13 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/__init__api.mustache: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | # flake8: noqa 4 | 5 | # import apis into api package 6 | {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classVarName}} import {{classname}} 7 | {{/apis}}{{/apiInfo}} -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/__init__model.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | {{>partial_header}} 5 | 6 | from __future__ import absolute_import 7 | 8 | # import models into model package 9 | {{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}}{{/model}} 10 | {{/models}} 11 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/__init__package.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | 5 | {{>partial_header}} 6 | 7 | from __future__ import absolute_import 8 | 9 | # import apis into sdk package 10 | {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classVarName}} import {{classname}} 11 | {{/apis}}{{/apiInfo}} 12 | 13 | from {{packageName}}.api_client import ApiClient 14 | from {{packageName}}.configuration import Configuration 15 | 16 | class Client(object): 17 | def __init__(self, config = {}): 18 | self.api_client = ApiClient(config) 19 | 20 | {{#apiInfo}}{{#apis}}self.{{baseName}} = {{classname}}(self.api_client) 21 | {{/apis}}{{/apiInfo}} 22 | 23 | def set_config(self, config = {}): 24 | self.api_client.set_config(config) 25 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/api_test.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | {{>partial_header}} 4 | 5 | from __future__ import absolute_import 6 | 7 | import unittest 8 | 9 | import {{packageName}} 10 | from {{apiPackage}}.{{classVarName}} import {{classname}} # noqa: E501 11 | from {{packageName}}.rest import ApiException 12 | 13 | 14 | class {{#operations}}Test{{classname}}(unittest.TestCase): 15 | """{{classname}} unit test stubs""" 16 | 17 | def setUp(self): 18 | self.api = {{apiPackage}}.{{classVarName}}.{{classname}}() # noqa: E501 19 | 20 | def tearDown(self): 21 | pass 22 | 23 | {{#operation}} 24 | def test_{{operationId}}(self): 25 | """Test case for {{{operationId}}} 26 | 27 | {{#summary}} 28 | {{{summary}}} # noqa: E501 29 | {{/summary}} 30 | """ 31 | pass 32 | 33 | {{/operation}} 34 | {{/operations}} 35 | 36 | if __name__ == '__main__': 37 | unittest.main() 38 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/gitignore.mustache: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | venv/ 48 | .python-version 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | 57 | # Sphinx documentation 58 | docs/_build/ 59 | 60 | # PyBuilder 61 | target/ 62 | 63 | #Ipython Notebook 64 | .ipynb_checkpoints 65 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}# {{classname}} 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} 7 | {{/vars}} 8 | 9 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) 10 | 11 | {{/model}}{{/models}} 12 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/model_test.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | {{>partial_header}} 4 | 5 | from __future__ import absolute_import 6 | 7 | import unittest 8 | 9 | {{#models}} 10 | {{#model}} 11 | import {{packageName}} 12 | from {{modelPackage}}.{{classFilename}} import {{classname}} # noqa: E501 13 | from {{packageName}}.rest import ApiException 14 | 15 | 16 | class Test{{classname}}(unittest.TestCase): 17 | """{{classname}} unit test stubs""" 18 | 19 | def setUp(self): 20 | pass 21 | 22 | def tearDown(self): 23 | pass 24 | 25 | def test{{classname}}(self): 26 | """Test {{classname}}""" 27 | # FIXME: construct object with mandatory attributes with example values 28 | # model = {{packageName}}.models.{{classFilename}}.{{classname}}() # noqa: E501 29 | pass 30 | 31 | {{/model}} 32 | {{/models}} 33 | 34 | if __name__ == '__main__': 35 | unittest.main() 36 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/partial_header.mustache: -------------------------------------------------------------------------------- 1 | """ 2 | {{#appName}} 3 | {{{appName}}} 4 | {{/appName}} 5 | 6 | {{#appDescription}} 7 | {{{appDescription}}} # noqa: E501 8 | {{/appDescription}} 9 | 10 | {{#version}}OpenAPI spec version: {{{version}}}{{/version}} 11 | {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} 12 | Generated by: https://github.com/swagger-api/swagger-codegen.git 13 | """ 14 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/requirements.mustache: -------------------------------------------------------------------------------- 1 | certifi >= 14.05.14 2 | six >= 1.10 3 | python_dateutil >= 2.5.3 4 | setuptools >= 21.0.0 5 | urllib3 >= 1.15.1 6 | requests>=2.23 7 | -------------------------------------------------------------------------------- /swagger-config/marketing/python/templates/setup.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | {{>partial_header}} 4 | 5 | from setuptools import setup, find_packages # noqa: H301 6 | 7 | NAME = "{{{projectName}}}" 8 | VERSION = "{{packageVersion}}" 9 | {{#apiInfo}} 10 | {{#apis}} 11 | {{^hasMore}} 12 | # To install the library, run the following 13 | # 14 | # python setup.py install 15 | # 16 | # prerequisite: setuptools 17 | # http://pypi.python.org/pypi/setuptools 18 | 19 | REQUIRES = [ 20 | "certifi>=2017.4.17", 21 | "python-dateutil>=2.1", 22 | "requests>=2.23", 23 | "six>=1.10", 24 | "urllib3>=1.23" 25 | ] 26 | 27 | setup( 28 | name=NAME, 29 | version=VERSION, 30 | description="{{appName}}", 31 | author_email="{{infoEmail}}", 32 | url="{{packageUrl}}", 33 | keywords=["Swagger", "{{appName}}"], 34 | install_requires=REQUIRES, 35 | packages=find_packages(), 36 | include_package_data=True, 37 | long_description="""\ 38 | {{appDescription}} # noqa: E501 39 | """ 40 | ) 41 | {{/hasMore}} 42 | {{/apis}} 43 | {{/apiInfo}} 44 | -------------------------------------------------------------------------------- /swagger-config/marketing/ruby/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "gemName": "MailchimpMarketing", 3 | "moduleName": "MailchimpMarketing", 4 | "gemDescription": "The official Ruby client library for the Mailchimp Marketing API", 5 | "gemLicense": "Apache-2.0", 6 | "gitUserId": "mailchimp", 7 | "gitRepoId": "mailchimp-marketing-ruby" 8 | } 9 | -------------------------------------------------------------------------------- /swagger-config/marketing/ruby/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # mailchimp-marketing-ruby 3 | 4 | docs/** 5 | spec/** 6 | lib/**/models/** 7 | Rakefile 8 | .rspec 9 | git_push.sh 10 | -------------------------------------------------------------------------------- /swagger-config/marketing/ruby/templates/Gemfile.mustache: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | 5 | group :development, :test do 6 | gem 'rake', '~> 12.3.3' 7 | end 8 | -------------------------------------------------------------------------------- /swagger-config/marketing/ruby/templates/api_error.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | require 'json' 6 | 7 | module MailchimpMarketing 8 | class ApiError < StandardError 9 | attr_reader :status, :type, :title, :detail, :instance, :errors 10 | 11 | attr_reader :response_headers, :response_body 12 | 13 | # Usage examples: 14 | # ApiError.new 15 | # ApiError.new("message") 16 | # ApiError.new(:status => 500, :response_headers => {}, :response_body => "") 17 | # ApiError.new(:status => 404, :message => "Not Found") 18 | def initialize(arguments = nil) 19 | @arguments = arguments 20 | return super(@arguments) unless @arguments.is_a?(Hash) 21 | 22 | @arguments.transform_keys!(&:to_sym) 23 | 24 | expand_response_body_into_arguments 25 | 26 | super(@arguments[:title] || @arguments[:message]) 27 | 28 | @arguments.each do |key, value| 29 | instance_variable_set("@#{key}", value) 30 | end 31 | end 32 | 33 | private 34 | 35 | def expand_response_body_into_arguments 36 | @arguments.merge!(parsed_response_body) unless parsed_response_body.nil? 37 | end 38 | 39 | def parsed_response_body 40 | @parsed_response_body ||= begin 41 | parsed_response_body = JSON.parse(@arguments[:response_body]).transform_keys(&:to_sym) 42 | 43 | if parsed_response_body[:errors].is_a?(Array) 44 | parsed_response_body[:errors].map do |error| 45 | error.transform_keys!(&:to_sym) 46 | end 47 | end 48 | 49 | parsed_response_body 50 | rescue 51 | nil 52 | end 53 | end 54 | 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /swagger-config/marketing/ruby/templates/gem.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | # Common files 6 | require '{{gemName}}/api_client' 7 | require '{{gemName}}/api_error' 8 | require '{{gemName}}/version' 9 | 10 | # APIs 11 | {{#apiInfo}} 12 | {{#apis}} 13 | require '{{importPath}}' 14 | {{/apis}} 15 | {{/apiInfo}} 16 | 17 | module {{moduleName}} 18 | class Client 19 | def initialize(config = {}) 20 | @api_client = ApiClient.new(config) 21 | 22 | {{#apiInfo}} 23 | {{#apis}} 24 | @{{baseName}} = {{classname}}.new(@api_client) 25 | {{/apis}} 26 | {{/apiInfo}} 27 | end 28 | 29 | def set_config(config = {}) 30 | @api_client.set_config(config) 31 | end 32 | 33 | {{#apiInfo}} 34 | {{#apis}} 35 | def {{classVarName}} 36 | @{{baseName}} 37 | end 38 | {{/apis}} 39 | {{/apiInfo}} 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /swagger-config/transactional/csharp/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packageName": "Mailchimp.Transactional" 3 | } 4 | -------------------------------------------------------------------------------- /swagger-config/transactional/csharp/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # transactional-csharp 3 | -------------------------------------------------------------------------------- /swagger-config/transactional/java/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "modelPackage": "com.mailchimp.transactional.models", 3 | "apiPackage": "com.mailchimp.transactional.api", 4 | "invokerPackage": "com.mailchimp.transactional", 5 | "groupId": "com.mailchimp", 6 | "artifactId": "transactional", 7 | "artifactUrl": "https://github.com/mailchimp/mailchimp-transactional-java", 8 | "artifactDescription": "Mailchimp Transactional Java SDK" 9 | } 10 | -------------------------------------------------------------------------------- /swagger-config/transactional/java/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # transactional-java 3 | -------------------------------------------------------------------------------- /swagger-config/transactional/javascript/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "@mailchimp/mailchimp_transactional", 3 | "projectDescription": "The official Node client library for the Mailchimp Transactional API", 4 | "projectLicenseName": "Apache-2.0", 5 | "moduleName": "MailchimpTransactional", 6 | "usePromises": true, 7 | "licenseName": "Apache 2.0" 8 | } 9 | -------------------------------------------------------------------------------- /swagger-config/transactional/javascript/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # transactional-node 3 | 4 | docs/** 5 | src/model/** 6 | test/** 7 | *.opts 8 | -------------------------------------------------------------------------------- /swagger-config/transactional/javascript/templates/api.mustache: -------------------------------------------------------------------------------- 1 | var ApiClient = require('../ApiClient'); 2 | 3 | module.exports = function (apiClient) { 4 | this.apiClient = apiClient || ApiClient.instance(); 5 | {{#operations}}{{#operation}} 6 | /** 7 | * {{#summary}}{{summary}}{{/summary}} 8 | * {{#notes}}{{notes}}{{/notes}} 9 | */ 10 | this.{{vendorExtensions.x-custom-config.methodNameCamel}} = function (body) { 11 | return this.apiClient.post('{{&path}}', body); 12 | }; 13 | {{/operation}}{{/operations}} 14 | }; 15 | -------------------------------------------------------------------------------- /swagger-config/transactional/javascript/templates/index.mustache: -------------------------------------------------------------------------------- 1 | var ApiClient = require('./ApiClient'); 2 | 3 | module.exports = function(apiKey) { 4 | return ApiClient.instance(apiKey); 5 | }; 6 | -------------------------------------------------------------------------------- /swagger-config/transactional/javascript/templates/package.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{{projectName}}}", 3 | "version": "{{{projectVersion}}}", 4 | "description": "{{{projectDescription}}}", 5 | "license": "{{projectLicenseName}}", 6 | "main": "{{sourceFolder}}{{#invokerPackage}}/{{invokerPackage}}{{/invokerPackage}}/index.js", 7 | "browser": { 8 | "fs": false 9 | }, 10 | "dependencies": { 11 | "axios": "^1.7.7" 12 | }, 13 | "homepage": "https://github.com/mailchimp/mailchimp-transactional-node", 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/mailchimp/mailchimp-transactional-node.git" 17 | }, 18 | "bugs": { 19 | "url": "https://github.com/mailchimp/mailchimp-client-lib-codegen/issues" 20 | }, 21 | "keywords": [ 22 | "mailchimp", 23 | "api", 24 | "v3", 25 | "transactional" 26 | ], 27 | "engines": { 28 | "node": ">=10.0.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /swagger-config/transactional/php/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packagePath": "MailchimpTransactional", 3 | "invokerPackage": "MailchimpTransactional", 4 | "modelPackage": "Model", 5 | "apiPackage": "Api", 6 | "composerVendorName": "mailchimp", 7 | "composerProjectName": "transactional" 8 | } 9 | -------------------------------------------------------------------------------- /swagger-config/transactional/php/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # transactional-php 3 | 4 | **/docs/** 5 | **/lib/Model/** 6 | **/test/** 7 | -------------------------------------------------------------------------------- /swagger-config/transactional/php/templates/ApiClient.php: -------------------------------------------------------------------------------- 1 | partial_header}} 14 | /** 15 | * NOTE: This class is auto generated by the swagger code generator program. 16 | * https://github.com/swagger-api/swagger-codegen 17 | * Do not edit the class manually. 18 | */ 19 | 20 | namespace {{apiPackage}}; 21 | 22 | use {{invokerPackage}}\ApiException; 23 | use {{invokerPackage}}\Configuration; 24 | use {{invokerPackage}}\HeaderSelector; 25 | use {{invokerPackage}}\ObjectSerializer; 26 | 27 | /** 28 | * {{classname}} Class Doc Comment 29 | * 30 | * @category Class 31 | * @package {{invokerPackage}} 32 | * @author Swagger Codegen team 33 | * @link https://github.com/swagger-api/swagger-codegen 34 | */ 35 | {{#operations}}class {{classname}} 36 | { 37 | protected $config; 38 | 39 | public function __construct(?Configuration $config = null) 40 | { 41 | $this->config = $config ?: new Configuration(); 42 | } 43 | 44 | {{#operation}} 45 | /** 46 | * {{#summary}}{{{summary}}}{{/summary}} 47 | * {{#notes}}{{notes}}{{/notes}} 48 | */ 49 | public function {{vendorExtensions.x-custom-config.methodNameCamel}}($body = []) 50 | { 51 | return $this->config->post('{{path}}', $body); 52 | } 53 | {{/operation}} 54 | } 55 | {{/operations}} 56 | -------------------------------------------------------------------------------- /swagger-config/transactional/php/templates/composer.mustache: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{#composerVendorName}}{{.}}{{/composerVendorName}}{{^composerVendorName}}{{gitUserId}}{{/composerVendorName}}/{{#composerProjectName}}{{.}}{{/composerProjectName}}{{^composerProjectName}}{{gitRepoId}}{{/composerProjectName}}", 3 | {{#artifactVersion}} 4 | "version": "{{artifactVersion}}", 5 | {{/artifactVersion}} 6 | "description": "{{description}}", 7 | "keywords": [ 8 | "swagger", 9 | "php", 10 | "sdk", 11 | "api" 12 | ], 13 | "homepage": "http://swagger.io", 14 | "license": "proprietary", 15 | "authors": [ 16 | { 17 | "name": "Mailchimp", 18 | "homepage": "https://github.com/mailchimp/mailchimp-transactional-php" 19 | } 20 | ], 21 | "require": { 22 | "php": ">=7.2", 23 | "ext-curl": "*", 24 | "ext-json": "*", 25 | "ext-mbstring": "*", 26 | "guzzlehttp/guzzle": "^6.4 || ^7.2" 27 | }, 28 | "require-dev": { 29 | "phpunit/phpunit": "^7", 30 | "squizlabs/php_codesniffer": "~2.6", 31 | "friendsofphp/php-cs-fixer": "~2.12" 32 | }, 33 | "autoload": { 34 | "psr-4": { 35 | "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" 36 | } 37 | }, 38 | "autoload-dev": { 39 | "psr-4": { "{{escapedInvokerPackage}}\\" : "{{testBasePath}}/" } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /swagger-config/transactional/python/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packageName": "mailchimp_transactional", 3 | "projectName": "mailchimp_transactional", 4 | "gitUserId": "mailchimp", 5 | "gitRepoId": "mailchimp-transactional-python" 6 | } 7 | -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # transactional-python 3 | 4 | docs/** 5 | mailchimp_transactional/models 6 | mailchimp_transactional/models/** 7 | mailchimp_transactional/configuration.py 8 | mailchimp_transactional/rest.py 9 | test 10 | test/** 11 | git_push.sh 12 | tox.ini 13 | .travis.yml 14 | -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/__init__api.mustache: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | # flake8: noqa 4 | 5 | # import apis into api package 6 | {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classVarName}} import {{classname}} 7 | {{/apis}}{{/apiInfo}} -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/__init__model.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/swagger-config/transactional/python/templates/__init__model.mustache -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/__init__package.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | 5 | {{>partial_header}} 6 | 7 | from __future__ import absolute_import 8 | 9 | # import apis into sdk package 10 | {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classVarName}} import {{classname}} 11 | {{/apis}}{{/apiInfo}} 12 | 13 | from {{packageName}}.api_client import ApiClient 14 | 15 | class Client(object): 16 | def __init__(self, api_key = ''): 17 | self.api_key = api_key 18 | self.api_client = ApiClient() 19 | 20 | {{#apiInfo}}{{#apis}}self.{{baseName}} = {{classname}}(self.api_key, self.api_client) 21 | {{/apis}}{{/apiInfo}} 22 | 23 | def set_api_key(self, api_key = ''): 24 | self.api_key = api_key 25 | {{#apiInfo}}{{#apis}}self.{{baseName}} = {{classname}}(self.api_key, self.api_client) 26 | {{/apis}}{{/apiInfo}} 27 | 28 | def set_default_output_format(self, output_format): 29 | self.api_client.set_default_output_format(output_format) 30 | 31 | def set_timeout(self, timeout): 32 | self.api_client.set_timeout(timeout) -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/api_test.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | {{>partial_header}} 4 | 5 | from __future__ import absolute_import 6 | 7 | import unittest 8 | 9 | import {{packageName}} 10 | from {{apiPackage}}.{{classVarName}} import {{classname}} # noqa: E501 11 | from {{packageName}}.rest import ApiException 12 | 13 | 14 | class {{#operations}}Test{{classname}}(unittest.TestCase): 15 | """{{classname}} unit test stubs""" 16 | 17 | def setUp(self): 18 | self.api = {{apiPackage}}.{{classVarName}}.{{classname}}() # noqa: E501 19 | 20 | def tearDown(self): 21 | pass 22 | 23 | {{#operation}} 24 | def test_{{operationId}}(self): 25 | """Test case for {{{operationId}}} 26 | 27 | {{#summary}} 28 | {{{summary}}} # noqa: E501 29 | {{/summary}} 30 | """ 31 | pass 32 | 33 | {{/operation}} 34 | {{/operations}} 35 | 36 | if __name__ == '__main__': 37 | unittest.main() 38 | -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/configuration.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/swagger-config/transactional/python/templates/configuration.mustache -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/model.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/swagger-config/transactional/python/templates/model.mustache -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/model_doc.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/swagger-config/transactional/python/templates/model_doc.mustache -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/model_test.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/swagger-config/transactional/python/templates/model_test.mustache -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/requirements.mustache: -------------------------------------------------------------------------------- 1 | certifi >= 14.05.14 2 | six >= 1.10 3 | python_dateutil >= 2.5.3 4 | setuptools >= 21.0.0 5 | urllib3 >= 1.15.1 6 | requests>=2.23 -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/rest.mustache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/swagger-config/transactional/python/templates/rest.mustache -------------------------------------------------------------------------------- /swagger-config/transactional/python/templates/setup.mustache: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | {{>partial_header}} 4 | 5 | from setuptools import setup, find_packages # noqa: H301 6 | 7 | NAME = "{{{projectName}}}" 8 | VERSION = "{{packageVersion}}" 9 | {{#apiInfo}} 10 | {{#apis}} 11 | {{^hasMore}} 12 | # To install the library, run the following 13 | # 14 | # python setup.py install 15 | # 16 | # prerequisite: setuptools 17 | # http://pypi.python.org/pypi/setuptools 18 | 19 | REQUIRES = [ 20 | "certifi>=2017.4.17", 21 | "python-dateutil>=2.1", 22 | "requests>=2.23", 23 | "six>=1.10", 24 | "urllib3>=1.23" 25 | ] 26 | 27 | setup( 28 | name=NAME, 29 | version=VERSION, 30 | description="{{appName}}", 31 | author_email="{{infoEmail}}", 32 | url="{{packageUrl}}", 33 | keywords=["Swagger", "{{appName}}"], 34 | install_requires=REQUIRES, 35 | packages=find_packages(), 36 | include_package_data=True, 37 | long_description="""\ 38 | {{appDescription}} # noqa: E501 39 | """ 40 | ) 41 | {{/hasMore}} 42 | {{/apis}} 43 | {{/apiInfo}} 44 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "gemName": "MailchimpTransactional", 3 | "moduleName": "MailchimpTransactional", 4 | "gemDescription": "The official Ruby client library for the Mailchimp Trainsactional API", 5 | "gemLicense": "Apache-2.0", 6 | "gitUserId": "mailchimp", 7 | "gitRepoId": "mailchimp-transactional-ruby" 8 | } 9 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # mandrill-ruby 3 | 4 | docs/** 5 | spec/** 6 | lib/**/models/** 7 | Rakefile 8 | .rspec 9 | git_push.sh -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/Gemfile.mustache: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | 5 | group :development, :test do 6 | gem 'rake', '~> 12.3.3' 7 | end 8 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/api.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | require 'uri' 6 | 7 | module {{moduleName}} 8 | {{#operations}} 9 | class {{classname}} 10 | attr_accessor :api_client 11 | 12 | def initialize(api_client = ApiClient.default) 13 | @api_client = api_client 14 | end 15 | {{#operation}} 16 | 17 | {{#summary}} 18 | # {{summary}} 19 | {{/summary}} 20 | {{#notes}} 21 | # {{notes}} 22 | {{/notes}} 23 | {{#allParams}}{{#required}} # @param {{paramName}} {{description}} 24 | {{/required}}{{/allParams}} # @param [Hash] opts the optional parameters 25 | {{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}} 26 | {{/required}}{{/allParams}} # @return [Array<({{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Fixnum, Hash)>] {{#returnType}}{{{returnType}}} data{{/returnType}}{{^returnType}}nil{{/returnType}}, response status code and response headers 27 | def {{vendorExtensions.x-custom-config.methodNameSnake}}(body = {}) 28 | data = @api_client.call_api(:{{httpMethod}}, '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s){{/pathParams}}, body) 29 | data 30 | end 31 | {{/operation}} 32 | end 33 | {{/operations}} 34 | end 35 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/api_error.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | module {{moduleName}} 6 | class ApiError < StandardError 7 | attr_reader :status, :type, :title, :detail, :instance, :errors,:response_headers, :response_body 8 | 9 | # Usage examples: 10 | # ApiError.new 11 | # ApiError.new("message") 12 | # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") 13 | # ApiError.new(:code => 404, :message => "Not Found") 14 | def initialize(arg = nil) 15 | if arg.is_a? Hash 16 | if arg.key?(:message) || arg.key?('message') 17 | super(arg[:message] || arg['message']) 18 | else 19 | super arg 20 | end 21 | 22 | arg.each do |k, v| 23 | instance_variable_set "@#{k}", v 24 | end 25 | else 26 | super arg 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/api_info.mustache: -------------------------------------------------------------------------------- 1 | {{#appName}} 2 | #{{{appName}}} 3 | 4 | {{/appName}} 5 | {{#appDescription}} 6 | #{{{appDescription}}} 7 | 8 | {{/appDescription}} 9 | {{#version}}OpenAPI spec version: {{version}}{{/version}} 10 | {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} 11 | Generated by: https://github.com/swagger-api/swagger-codegen.git 12 | Swagger Codegen version: {{{generatorVersion}}} 13 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/api_test.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | require 'spec_helper' 6 | require 'json' 7 | 8 | # Unit tests for {{moduleName}}::{{classname}} 9 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 10 | # Please update as you see appropriate 11 | {{#operations}}describe '{{classname}}' do 12 | before do 13 | # run before each test 14 | @instance = {{moduleName}}::{{classname}}.new 15 | end 16 | 17 | after do 18 | # run after each test 19 | end 20 | 21 | describe 'test an instance of {{classname}}' do 22 | it 'should create an instance of {{classname}}' do 23 | expect(@instance).to be_instance_of({{moduleName}}::{{classname}}) 24 | end 25 | end 26 | 27 | {{#operation}} 28 | # unit tests for {{operationId}} 29 | {{#summary}} 30 | # {{summary}} 31 | {{/summary}} 32 | {{#notes}} 33 | # {{notes}} 34 | {{/notes}} 35 | {{#allParams}}{{#required}} # @param {{paramName}} {{description}} 36 | {{/required}}{{/allParams}} # @param [Hash] opts the optional parameters 37 | {{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}} 38 | {{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}] 39 | describe '{{operationId}} test' do 40 | it 'should work' do 41 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 42 | end 43 | end 44 | 45 | {{/operation}} 46 | end 47 | {{/operations}} 48 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/gem.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | # Common files 6 | require '{{gemName}}/api_client' 7 | require '{{gemName}}/api_error' 8 | require '{{gemName}}/version' 9 | 10 | # APIs 11 | {{#apiInfo}} 12 | {{#apis}} 13 | require '{{importPath}}' 14 | {{/apis}} 15 | {{/apiInfo}} 16 | 17 | module {{moduleName}} 18 | class Client 19 | def initialize(api_key = '') 20 | set_api_key(api_key) 21 | end 22 | 23 | def set_api_key(api_key = '') 24 | @api_key = api_key 25 | @api_client = ApiClient.new(@api_key) 26 | 27 | {{#apiInfo}} 28 | {{#apis}} 29 | @{{baseName}} = {{classname}}.new(@api_client) 30 | {{/apis}} 31 | {{/apiInfo}} 32 | end 33 | 34 | def set_default_output_format(output_format) 35 | @api_client.set_default_output_format(output_format) 36 | end 37 | 38 | def set_timeout(timeout=nil, read: nil, write: nil, connect: nil) 39 | @api_client.set_timeout(timeout, read: read, write: write, connect: connect) 40 | end 41 | 42 | {{#apiInfo}} 43 | {{#apis}} 44 | def {{classVarName}} 45 | @{{baseName}} 46 | end 47 | {{/apis}} 48 | {{/apiInfo}} 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/model.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | require 'date' 6 | 7 | module {{moduleName}} 8 | {{#models}} 9 | {{#model}} 10 | {{#isEnum}} 11 | {{>partial_model_enum_class}} 12 | {{/isEnum}} 13 | {{^isEnum}} 14 | {{>partial_model_generic}} 15 | {{/isEnum}} 16 | {{/model}} 17 | {{/models}} 18 | end 19 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/model_doc.mustache: -------------------------------------------------------------------------------- 1 | {{#models}}{{#model}}# {{moduleName}}::{{classname}} 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} 7 | {{/vars}} 8 | 9 | {{/model}}{{/models}} 10 | -------------------------------------------------------------------------------- /swagger-config/transactional/ruby/templates/version.mustache: -------------------------------------------------------------------------------- 1 | =begin 2 | {{> api_info}} 3 | =end 4 | 5 | module {{moduleName}} 6 | VERSION = '{{gemVersion}}' 7 | end 8 | -------------------------------------------------------------------------------- /tests/_tools/phpunit-9.2.6.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/43670e7b1a54883db7894267e6895f3abf0b09f9/tests/_tools/phpunit-9.2.6.phar -------------------------------------------------------------------------------- /utils/actions/setVersionVar.js: -------------------------------------------------------------------------------- 1 | const core = require('@actions/core'); 2 | const { existsSync } = require('fs'); 3 | const SwaggerParser = require('@apidevtools/swagger-parser'); 4 | 5 | const fail = (reason) => { 6 | core.setFailed(reason); 7 | return 1; 8 | }; 9 | 10 | async function run() { 11 | try { 12 | const { api } = require('yargs').argv; 13 | 14 | if (!api) { 15 | throw new Error('must include --api arg'); 16 | } 17 | 18 | const specPath = `spec/${api}.json`; 19 | if (!existsSync(specPath)) { 20 | throw new Error(`spec could not be found at ${specPath}`); 21 | } 22 | 23 | const parsed = await SwaggerParser.validate(specPath); 24 | const { version } = parsed.info; 25 | 26 | if (!version) { 27 | throw new Error('could not detect spec version'); 28 | } 29 | 30 | core.setOutput('version', version); 31 | console.log(`Setting SPEC_VERSION to ${version}`); 32 | return 0; 33 | } catch (err) { 34 | return fail(err.message); 35 | } 36 | } 37 | 38 | run(); 39 | -------------------------------------------------------------------------------- /utils/actions/updateLangConfig.js: -------------------------------------------------------------------------------- 1 | const core = require('@actions/core'); 2 | const { existsSync } = require('fs'); 3 | const editJsonFile = require('edit-json-file'); 4 | 5 | const fail = (reason) => { 6 | core.setFailed(reason); 7 | return 1; 8 | }; 9 | 10 | const langMap = new Map([ 11 | ['csharp', 'packageVersion'], 12 | ['java', 'artifactVersion'], 13 | ['javascript', 'projectVersion'], 14 | ['php', 'artifactVersion'], 15 | ['python', 'packageVersion'], 16 | ['ruby', 'gemVersion'], 17 | ]); 18 | 19 | async function run() { 20 | try { 21 | const { api, lang, specVersion } = require('yargs').argv; 22 | 23 | if (!api || !lang || !specVersion) { 24 | console.log({ api, lang, specVersion }); 25 | throw new Error('must include --api, --lang, and --specVersion args'); 26 | } 27 | 28 | const configPath = `swagger-config/${api}/${lang}/config.json`; 29 | if (!existsSync(configPath)) { 30 | throw new Error(`config could not be found at ${configPath}`); 31 | } 32 | 33 | if (langMap.get(lang)) { 34 | const configKey = langMap.get(lang); 35 | 36 | const configFile = editJsonFile(configPath); 37 | configFile.set(configKey, specVersion); 38 | configFile.save(); 39 | 40 | console.log(`Set config.${configKey} to ${specVersion}`); 41 | } else { 42 | console.log(`Unrecognized lang ${lang}, not altering config`); 43 | } 44 | 45 | return 0; 46 | } catch (err) { 47 | return fail(err.message); 48 | } 49 | } 50 | 51 | run(); 52 | -------------------------------------------------------------------------------- /utils/sdk/javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sdk-utils", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "@postlight/mailchimp_sdk_playground": "file:../../../swagger-out/marketing-node", 14 | "@postlight/transactional_sdk_playground": "file:../../../swagger-out/transactional-javascript" 15 | }, 16 | "devDependencies": { 17 | "dotenv": "^8.2.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /utils/sdk/javascript/useMarketing.js: -------------------------------------------------------------------------------- 1 | if (!process.env.GITHUB_ACTION) { 2 | require('dotenv').config(); 3 | } 4 | 5 | const MailchimpMarketing = require('@postlight/mailchimp_sdk_playground'); 6 | const api = new MailchimpMarketing.DefaultApi(); 7 | 8 | const defaultClient = MailchimpMarketing.ApiClient.instance; 9 | 10 | // configure basic auth 11 | const auth = defaultClient.authentications['basicAuth']; 12 | auth.username = process.env.MARKETING_USER; 13 | auth.password = process.env.MARKETING_PASS; 14 | 15 | // eventually we'll want to use a template that returns Promises rather than uses callbacks, 16 | // but for now, let's make a convenience wrapper 17 | const pingAsync = () => { 18 | return new Promise((resolve, reject) => { 19 | api.getPing((err, data, response) => { 20 | if (err) { 21 | reject(err); 22 | } else { 23 | if (response.ok) { 24 | resolve(data ? data : response.text); 25 | } else { 26 | reject(new Error(`Status code ${response.status}`)); 27 | } 28 | } 29 | }); 30 | }); 31 | }; 32 | 33 | const run = async () => { 34 | try { 35 | const res = await pingAsync(); 36 | console.log(`Got ping response:\n\n${JSON.stringify(res)}`); 37 | } catch (err) { 38 | console.log(`Error getting ping: ${err.message}`); 39 | } 40 | }; 41 | 42 | run(); 43 | -------------------------------------------------------------------------------- /utils/sdk/javascript/useTransactional.js: -------------------------------------------------------------------------------- 1 | if (!process.env.GITHUB_ACTION) { 2 | require('dotenv').config(); 3 | } 4 | 5 | const MailchimpTransactional = require('@postlight/transactional_sdk_playground'); 6 | const api = new MailchimpTransactional.DefaultApi(); 7 | 8 | // eventually we'll want to use a template that returns Promises rather than uses callbacks, 9 | // but for now, let's make a convenience wrapper 10 | const pingAsync = () => { 11 | return new Promise((resolve, reject) => { 12 | api.postUsersPing( 13 | { key: process.env.TRANSACTIONAL_KEY }, 14 | (err, data, response) => { 15 | if (err) { 16 | reject(err); 17 | } else { 18 | if (response.ok) { 19 | resolve(data ? data : response.text); 20 | } else { 21 | reject(new Error(`Status code ${response.status}`)); 22 | } 23 | } 24 | } 25 | ); 26 | }); 27 | }; 28 | 29 | const run = async () => { 30 | try { 31 | const res = await pingAsync(); 32 | console.log(`Got ping response: ${res}`); 33 | } catch (err) { 34 | console.log(`Error getting ping: ${err.message}`); 35 | } 36 | }; 37 | 38 | run(); 39 | -------------------------------------------------------------------------------- /utils/sdk/php/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postlight/mailchimp", 3 | "description": "", 4 | "repositories": [ 5 | { 6 | "type": "path", 7 | "url": "../../../swagger-out/marketing-php/MailchimpMarketing" 8 | }, 9 | { 10 | "type": "path", 11 | "url": "../../../swagger-out/transactional-php/MailchimpTransactional" 12 | } 13 | ], 14 | "require": { 15 | "postlight/mailchimp-marketing": "*@dev", 16 | "postlight/mailchimp-transactional": "*@dev", 17 | "vlucas/phpdotenv": "^4.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /utils/sdk/php/useMarketing.php: -------------------------------------------------------------------------------- 1 | load(); 7 | } 8 | 9 | // Configure HTTP basic authorization: basicAuth 10 | $config = MailchimpMarketing\Configuration::getDefaultConfiguration() 11 | ->setUsername(getenv('MARKETING_USER')) 12 | ->setPassword(getenv('MARKETING_PASS')); 13 | 14 | $apiInstance = new MailchimpMarketing\Api\DefaultApi( 15 | null, 16 | $config 17 | ); 18 | 19 | try { 20 | $result = $apiInstance->getPing(); 21 | print_r($result); 22 | } catch (Exception $e) { 23 | echo 'Exception when calling DefaultApi->getPing: ', $e->getMessage(), PHP_EOL; 24 | } -------------------------------------------------------------------------------- /utils/sdk/php/useTransactional.php: -------------------------------------------------------------------------------- 1 | load(); 7 | } 8 | 9 | $apiInstance = new MailchimpTransactional\Api\DefaultApi(); 10 | $body = new \MailchimpTransactional\Model\Body(array('key' => getenv('TRANSACTIONAL_KEY'))); 11 | 12 | try { 13 | $result = $apiInstance->postUsersPing($body); 14 | print_r($result); 15 | } catch (Exception $e) { 16 | echo 'Exception when calling DefaultApi->postUsersPing: ', $e->getMessage(), PHP_EOL; 17 | } -------------------------------------------------------------------------------- /utils/sdk/python/useMarketing.py: -------------------------------------------------------------------------------- 1 | import mailchimp_marketing as MailchimpMarketing 2 | from mailchimp_marketing.api_client import ApiClientError 3 | 4 | import os 5 | from dotenv import load_dotenv 6 | load_dotenv() 7 | 8 | try: 9 | client = MailchimpMarketing.Client() 10 | client.setConfig(os.getenv('API_KEY'), os.getenv('API_SERVER')) 11 | response = client.ping.get() 12 | print('client.ping.get() response: {}'.format(response)) 13 | except ApiClientError as error: 14 | print('An exception occurred: {}'.format(error.text)) 15 | 16 | try: 17 | client = MailchimpMarketing.Client() 18 | client.setConfig(os.getenv('MARKETING_KEY'), os.getenv('MARKETING_SERVER')) 19 | response = client.lists.getList('254844adc9') 20 | print('client.lists.getList() response: {}'.format(response)) 21 | except ApiClientError as error: 22 | print('An exception occurred: {}'.format(error.text)) -------------------------------------------------------------------------------- /utils/sdk/python/useTransactional.py: -------------------------------------------------------------------------------- 1 | import mailchimp_transactional as MailchimpTransactional 2 | from mailchimp_transactional.api_client import ApiClientError 3 | 4 | import os 5 | from dotenv import load_dotenv 6 | load_dotenv() 7 | 8 | try: 9 | client = MailchimpTransactional.Client(os.getenv('TRANSACTIONAL_KEY')) 10 | response = client.users.ping() 11 | print('client.users.ping() response: {}'.format(response)) 12 | except ApiClientError as error: 13 | print('An exception occurred: {}'.format(error.text)) 14 | 15 | try: 16 | client = MailchimpTransactional.Client() 17 | client.set_api_key(os.getenv('TRANSACTIONAL_KEY')) 18 | response = client.users.ping() 19 | print('client.users.ping() response: {}'.format(response)) 20 | except ApiClientError as error: 21 | print('An exception occurred: {}'.format(error.text)) -------------------------------------------------------------------------------- /utils/sdk/ruby/env.example.rb: -------------------------------------------------------------------------------- 1 | TRANSACTIONAL_KEY='' 2 | MARKETING_USER='' 3 | MARKETING_PASS='' 4 | -------------------------------------------------------------------------------- /utils/sdk/ruby/useMarketing.rb: -------------------------------------------------------------------------------- 1 | require 'MailchimpMarketing' 2 | require 'dotenv/load' 3 | 4 | begin 5 | client = MailchimpMarketing::Client.new() 6 | client.set_config(ENV['MARKETING_KEY'], ENV['MARKETING_SERVER']) 7 | result = client.ping.get() 8 | p result 9 | rescue MailchimpMarketing::ApiError => e 10 | puts "Error: #{e}" 11 | end 12 | 13 | begin 14 | client = MailchimpMarketing::Client.new() 15 | client.set_config(ENV['MARKETING_KEY'], ENV['MARKETING_SERVER']) 16 | result = client.lists.getList('254844adc9') 17 | p result 18 | rescue MailchimpMarketing::ApiError => e 19 | puts "Error: #{e}" 20 | end -------------------------------------------------------------------------------- /utils/sdk/ruby/useTransactional.rb: -------------------------------------------------------------------------------- 1 | require 'MailchimpTransactional' 2 | require 'dotenv/load' 3 | 4 | begin 5 | client = MailchimpTransactional::Client.new(ENV['TRANSACTIONAL_KEY']) 6 | result = client.users.ping() # => 'PONG!' 7 | p result 8 | rescue MailchimpTransactional::ApiError => e 9 | puts "Error: #{e}" 10 | end --------------------------------------------------------------------------------