diff --git a/README.md b/README.md index 081b33a..c59fda8 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,27 @@ -# Dyspatch Java API client +# dyspatch-java Dyspatch API - API version: 2020.04 - - Build date: 2020-01-02T21:36:38.986Z[GMT] # Introduction -The Dyspatch API is based on the REST paradigm and features resource based URLs -with standard HTTP response codes to indicate errors. We use standard HTTP -authentication and request verbs and all responses are JSON formatted. See our -[Implementation -Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more -details on how to implement Dyspatch. +The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response +codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. +See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on +how to implement Dyspatch. -For more information, please visit [https://docs.dyspatch.io](https://docs.dyspatch.io) +## API Client Libraries +Dyspatch provides API Clients for popular languages and web frameworks. + +- [Java](https://github.com/getdyspatch/dyspatch-java) +- [Javascript](https://github.com/getdyspatch/dyspatch-javascript) +- [Python](https://github.com/getdyspatch/dyspatch-python) +- [C#](https://github.com/getdyspatch/dyspatch-dotnet) +- [Go](https://github.com/getdyspatch/dyspatch-golang) +- [Ruby](https://github.com/getdyspatch/dyspatch-ruby) + + + For more information, please visit [https://docs.dyspatch.io](https://docs.dyspatch.io) *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* @@ -21,7 +29,7 @@ For more information, please visit [https://docs.dyspatch.io](https://docs.dyspa ## Requirements Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation @@ -48,7 +56,7 @@ Add this dependency to your project's POM: io.dyspatch dyspatch-java - 5.0.1 + 5.0.2 compile ``` @@ -58,7 +66,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "io.dyspatch:dyspatch-java:5.0.1" +compile "io.dyspatch:dyspatch-java:5.0.2" ``` ### Others @@ -71,7 +79,7 @@ mvn clean package Then manually install the following JARs: -* `target/dyspatch-java-5.0.1.jar` +* `target/dyspatch-java-5.0.2.jar` * `target/lib/*.jar` ## Getting Started @@ -92,16 +100,17 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("https://api.dyspatch.io"); - + // Configure API key authorization: Bearer - defaultClient.setApiKey(System.getenv("DYSPATCH_API_KEY")); - defaultClient.setApiKeyPrefix("Bearer"); + ApiKeyAuth Bearer = (ApiKeyAuth) defaultClient.getAuthentication("Bearer"); + Bearer.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //Bearer.setApiKeyPrefix("Token"); - // Initialize your API objects: DraftsApi apiInstance = new DraftsApi(defaultClient); String draftId = "draftId_example"; // String | A draft ID String languageId = "languageId_example"; // String | A language ID (eg: en-US) - String accept = "application/vnd.dyspatch.2020.04+json"; + String accept = "accept_example"; // String | A version of the API that should be used for the request. For example, to use version \"2020.04\", set the value to \"application/vnd.dyspatch.2020.04+json\" try { apiInstance.deleteLocalization(draftId, languageId, accept); } catch (ApiException e) { diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 0000000..a97329f --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,1863 @@ +openapi: 3.0.0 +info: + contact: + email: support@dyspatch.io + name: Dyspatch Support + url: https://docs.dyspatch.io + description: | + # Introduction + + The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response + codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. + See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on + how to implement Dyspatch. + + ## API Client Libraries + Dyspatch provides API Clients for popular languages and web frameworks. + + - [Java](https://github.com/getdyspatch/dyspatch-java) + - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) + - [Python](https://github.com/getdyspatch/dyspatch-python) + - [C#](https://github.com/getdyspatch/dyspatch-dotnet) + - [Go](https://github.com/getdyspatch/dyspatch-golang) + - [Ruby](https://github.com/getdyspatch/dyspatch-ruby) + termsOfService: https://www.dyspatch.io/legal/terms-of-service/ + title: Dyspatch API + version: "2020.04" + x-logo: + url: /api/dyspatch_logo.png +servers: +- url: https://api.dyspatch.io +tags: +- description: | + Templates are the email templates found in your Dyspatch account. Only the + published Template Draft is returned. + + A typical integration will start with using the Templates list endpoint to iterate through and sync Templates. + name: Templates +- description: | + Drafts represent unpublished versions of templates that are still mutable. There could be many in progress drafts for a template. + name: Drafts +- description: | + Localization objects are the same as Template objects except they contain + localized content. + + If your account is using localizations then use this instead of the compiled Template object. + name: Localizations +paths: + /templates: + get: + description: Gets a list of Template Metadata objects for all templates. Up + to 25 results returned before results are paginated. + operationId: getTemplates + parameters: + - description: A cursor value used to retrieve a specific page from a paginated + result set. + explode: true + in: query + name: cursor + required: false + schema: + type: string + style: form + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/vnd.dyspatch.2020.04+json: + schema: + $ref: '#/components/schemas/TemplatesRead' + description: A list of templates + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "400": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Invalid request + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "401": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthenticated + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "403": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthorized + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "429": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Rate limit exceeded + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "500": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + default: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + security: + - Bearer: [] + summary: List Templates + tags: + - Templates + x-accepts: '*/*,application/vnd.dyspatch.2020.04+json' + /templates/{templateId}: + get: + description: Gets a template object with the matching ID. If the template has + published content the "compiled" field will contain the template . + operationId: getTemplateById + parameters: + - description: A template ID + explode: false + in: path + name: templateId + required: true + schema: + type: string + style: simple + - description: The type of templating language to compile as. Should only be + used for visual templates. + explode: true + in: query + name: targetLanguage + required: true + schema: + enum: + - html + - handlebars + - ampscript + - freemarker + - cheetah + - jinja + type: string + style: form + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/vnd.dyspatch.2020.04+json: + schema: + $ref: '#/components/schemas/TemplateRead' + description: A template object with the requested ID. If the template has + no published content the "compiled" field will be *null*. + headers: + X-RateLimit-Remaining: + description: The number of requests left for the current time window + explode: false + schema: + type: integer + style: simple + "400": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Invalid request + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "401": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthenticated + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "403": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthorized + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "404": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Resource not found + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "429": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Rate limit exceeded + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "500": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + default: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + security: + - Bearer: [] + summary: Get Template by ID + tags: + - Templates + x-accepts: '*/*,application/vnd.dyspatch.2020.04+json' + /drafts: + get: + description: Returns all drafts for your organization. + operationId: getDrafts + parameters: + - description: A cursor value used to retrieve a specific page from a paginated + result set. + explode: true + in: query + name: cursor + required: false + schema: + type: string + style: form + - description: Filter the list of drafts by a particular status + explode: true + in: query + name: status + required: false + schema: + enum: + - awaitingTranslation + type: string + style: form + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/vnd.dyspatch.2020.04+json: + schema: + $ref: '#/components/schemas/DraftsRead' + description: Drafts + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "400": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Invalid request + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "401": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthenticated + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "403": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthorized + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "404": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Resource not found + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "429": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Rate limit exceeded + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "500": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + default: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + security: + - Bearer: [] + summary: List Drafts + tags: + - Drafts + x-accepts: '*/*,application/vnd.dyspatch.2020.04+json' + /drafts/{draftId}/publishRequest: + post: + description: Moves the draft into submitted state. + operationId: submitDraftForApproval + parameters: + - description: A draft ID + explode: false + in: path + name: draftId + required: true + schema: + type: string + style: simple + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + responses: + "200": + description: Successfully submitted + "400": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Invalid request + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "401": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthenticated + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "403": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthorized + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "404": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Resource not found + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "429": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Rate limit exceeded + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "500": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + default: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + security: + - Bearer: [] + summary: Submit the draft for approval + tags: + - Drafts + x-accepts: '*/*' + /drafts/{draftId}: + get: + description: Gets a draft object with the matching ID. The "compiled" field + will contain the template in the default, unlocalized form. + operationId: getDraftById + parameters: + - description: A draft ID + explode: false + in: path + name: draftId + required: true + schema: + type: string + style: simple + - description: The type of templating language to compile as. Should only be + used for visual templates. + explode: true + in: query + name: targetLanguage + required: true + schema: + enum: + - html + - handlebars + - ampscript + - freemarker + - cheetah + - jinja + type: string + style: form + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/vnd.dyspatch.2020.04+json: + schema: + $ref: '#/components/schemas/DraftRead' + description: A draft object with the requested ID. + headers: + X-RateLimit-Remaining: + description: The number of requests left for the current time window + explode: false + schema: + type: integer + style: simple + "400": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Invalid request + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "401": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthenticated + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "403": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthorized + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "404": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Resource not found + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "429": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Rate limit exceeded + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "500": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + default: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + security: + - Bearer: [] + summary: Get Draft by ID + tags: + - Drafts + x-accepts: '*/*,application/vnd.dyspatch.2020.04+json' + /drafts/{draftId}/localizations: + get: + description: Returns localization metadata for the draft + operationId: getLocalizationForDraft + parameters: + - description: A draft ID + explode: false + in: path + name: draftId + required: true + schema: + type: string + style: simple + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/vnd.dyspatch.2020.04+json: + schema: + items: + $ref: '#/components/schemas/LocalizationMetaRead' + type: array + description: A list of localizations + headers: + X-RateLimit-Remaining: + description: The number of requests left for the current time window + explode: false + schema: + type: integer + style: simple + security: + - Bearer: [] + summary: Get localizations on a draft + tags: + - Drafts + x-accepts: application/vnd.dyspatch.2020.04+json + /drafts/{draftId}/localizations/{languageId}: + delete: + description: Deletes the localization with the given language ID if it exists + operationId: deleteLocalization + parameters: + - description: A draft ID + explode: false + in: path + name: draftId + required: true + schema: + type: string + style: simple + - description: 'A language ID (eg: en-US)' + explode: false + in: path + name: languageId + required: true + schema: + type: string + style: simple + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + responses: + "200": + description: Successful delete + security: + - Bearer: [] + summary: Remove a localization + tags: + - Drafts + x-accepts: application/json + put: + description: Inserts a localization or sets the name on an existing localization + that already uses the languageId + operationId: saveLocalization + parameters: + - description: A draft ID + explode: false + in: path + name: draftId + required: true + schema: + type: string + style: simple + - description: 'A language ID (eg: en-US)' + explode: false + in: path + name: languageId + required: true + schema: + type: string + style: simple + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object' + content: + application/json: + schema: + properties: + name: + example: English (US) + type: string + type: object + required: true + responses: + "200": + description: Successful upsert + security: + - Bearer: [] + summary: Create or update a localization + tags: + - Drafts + x-contentType: application/json + x-accepts: application/json + /drafts/{draftId}/localizations/{languageId}/translations: + put: + description: Completely replaces any existing translations for the given language + with those provided in request body. Variables embedded in keys or values + are expected to be in the format `%(my_variable)s` and will automatically + convert to the correct Dyspatch format depending on the type of template. + Accepts key/value pairs in JSON format or in gettext PO file format. For JSON + set `Content-Type` header to `application/json`. For gettext PO format set + `Content-Type` header to `text/x-gettext-translation`. + operationId: setTranslation + parameters: + - description: A draft ID + explode: false + in: path + name: draftId + required: true + schema: + type: string + style: simple + - description: 'A language ID (eg: en-US)' + explode: false + in: path + name: languageId + required: true + schema: + type: string + style: simple + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + example: + Hello %(name)s: Bonjour %(name)s + Welcome: Bienvenue + type: object + required: true + responses: + "200": + description: Successful + "403": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthorized + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + security: + - Bearer: [] + summary: Set translations for language + tags: + - Drafts + x-contentType: application/json + x-accepts: '*/*' + /drafts/{draftId}/localizationKeys: + get: + description: Returns the list of values that need to be translated for the draft. + Set the `Accept` header to `application/vnd.dyspatch.2020.04+json` to get + a JSON object, or `text/vnd.dyspatch.2020.04+x-gettext-translation` to get + the POT file. + operationId: getDraftLocalizationKeys + parameters: + - description: A draft ID + explode: false + in: path + name: draftId + required: true + schema: + type: string + style: simple + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/vnd.dyspatch.2020.04+json: + schema: + items: + $ref: '#/components/schemas/LocalizationKeyRead' + type: array + text/vnd.dyspatch.2020.04+x-gettext-translation: + schema: + format: binary + type: string + description: Localization keys + security: + - Bearer: [] + summary: Get localization keys + tags: + - Drafts + x-accepts: application/vnd.dyspatch.2020.04+json,text/vnd.dyspatch.2020.04+x-gettext-translation + /localizations/{localizationId}: + get: + description: Returns a specific localization object with a matching ID + operationId: getLocalizationById + parameters: + - description: A localization ID + explode: false + in: path + name: localizationId + required: true + schema: + type: string + style: simple + - description: The type of templating language to compile as. Should only be + used for visual templates. + explode: true + in: query + name: targetLanguage + required: true + schema: + enum: + - html + - handlebars + - ampscript + - freemarker + - cheetah + - jinja + type: string + style: form + - description: A version of the API that should be used for the request. For + example, to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/vnd.dyspatch.2020.04+json: + schema: + $ref: '#/components/schemas/LocalizationRead' + description: A localization object with the requested ID + headers: + X-RateLimit-Remaining: + description: The number of requests left for the current time window + explode: false + schema: + type: integer + style: simple + "400": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Invalid request + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "401": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthenticated + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "403": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthorized + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "404": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Resource not found + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "429": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Rate limit exceeded + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + "500": + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + default: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + security: + - Bearer: [] + summary: Get Localization Object by ID + tags: + - Localizations + x-accepts: '*/*,application/vnd.dyspatch.2020.04+json' +components: + parameters: + version: + description: A version of the API that should be used for the request. For example, + to use version "2020.04", set the value to "application/vnd.dyspatch.2020.04+json" + explode: false + in: header + name: Accept + required: true + schema: + type: string + style: simple + cursor: + description: A cursor value used to retrieve a specific page from a paginated + result set. + explode: true + in: query + name: cursor + required: false + schema: + type: string + style: form + templateId: + description: A template ID + explode: false + in: path + name: templateId + required: true + schema: + type: string + style: simple + draftId: + description: A draft ID + explode: false + in: path + name: draftId + required: true + schema: + type: string + style: simple + languageId: + description: 'A language ID (eg: en-US)' + explode: false + in: path + name: languageId + required: true + schema: + type: string + style: simple + targetLanguage: + description: The type of templating language to compile as. Should only be used + for visual templates. + explode: true + in: query + name: targetLanguage + required: true + schema: + enum: + - html + - handlebars + - ampscript + - freemarker + - cheetah + - jinja + type: string + style: form + localizationId: + description: A localization ID + explode: false + in: path + name: localizationId + required: true + schema: + type: string + style: simple + status: + description: Filter the list of drafts by a particular status + explode: true + in: query + name: status + required: false + schema: + enum: + - awaitingTranslation + type: string + style: form + requestBodies: + inline_object: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object' + required: true + responses: + InternalError: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Server error + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + InvalidRequest: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Invalid request + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + RateLimited: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Rate limit exceeded + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + Unauthenticated: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthenticated + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + Unauthorized: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Unauthorized + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + NotFound: + content: + '*/*': + schema: + $ref: '#/components/schemas/APIError' + description: Resource not found + headers: + X-RateLimit-Remaining: + description: The number of requests left for the time window. + explode: false + schema: + type: integer + style: simple + schemas: + cursor: + description: Information about paginated results + example: + next: next + hasMore: true + properties: + next: + description: A cursor to fetch the next page of results + type: string + hasMore: + description: Whether there is a next page of results + type: boolean + type: object + templateId: + description: An opaque, unique identifier for a template + example: tem_g3L7Cw6Hp5wU + type: string + draftId: + description: An opaque, unique identifier for a draft + example: tdft_g3L7Cw6Hp5wU + type: string + localeGroupId: + description: the locale group this localization belongs to, if this field is + empty the localization does not belong to any locale group + example: lgr_alka38ajla301 + type: string + templateName: + description: The name of a template + type: string + templateDescription: + description: A description of the template + type: string + templateUrl: + description: The API url for a specific template + example: /templates/tem_g3L7Cw6Hp5wUaf395LehwK + type: string + draftName: + description: The name of a draft + type: string + draftUrl: + description: The API url for a specific draft + example: /drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU + type: string + localizationId: + description: An opaque, unique identifier for a localization + example: loc_g3L7Cw6Hp5wUaf395LehwK + type: string + localizationUrl: + description: The API url for a specific localization + example: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + type: string + localizationName: + description: The user-specified name of a localization + example: English (US) + type: string + languages: + description: | + a list of locale codes that are available in the localization. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/) for an exhaustive list of locale codes. + items: + type: string + type: array + createdAt: + description: The time of initial creation + format: date-time + type: string + updatedAt: + description: The time of last update + format: date-time + type: string + TemplateMetaRead: + description: the template metadata + example: + createdAt: 2000-01-23T04:56:07.000+00:00 + localizations: + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + name: name + description: description + id: tem_g3L7Cw6Hp5wU + url: /templates/tem_g3L7Cw6Hp5wUaf395LehwK + updatedAt: 2000-01-23T04:56:07.000+00:00 + properties: + id: + description: An opaque, unique identifier for a template + example: tem_g3L7Cw6Hp5wU + type: string + name: + description: The name of a template + type: string + description: + description: A description of the template + type: string + url: + description: The API url for a specific template + example: /templates/tem_g3L7Cw6Hp5wUaf395LehwK + type: string + localizations: + description: A list of the template's available localization objects + items: + $ref: '#/components/schemas/LocalizationMetaRead' + type: array + createdAt: + description: The time of initial creation + format: date-time + type: string + updatedAt: + description: The time of last update + format: date-time + type: string + type: object + TemplatesRead: + description: list of template metadata + example: + cursor: + next: next + hasMore: true + data: + - createdAt: 2000-01-23T04:56:07.000+00:00 + localizations: + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + name: name + description: description + id: tem_g3L7Cw6Hp5wU + url: /templates/tem_g3L7Cw6Hp5wUaf395LehwK + updatedAt: 2000-01-23T04:56:07.000+00:00 + - createdAt: 2000-01-23T04:56:07.000+00:00 + localizations: + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + name: name + description: description + id: tem_g3L7Cw6Hp5wU + url: /templates/tem_g3L7Cw6Hp5wUaf395LehwK + updatedAt: 2000-01-23T04:56:07.000+00:00 + properties: + cursor: + $ref: '#/components/schemas/cursor' + data: + description: A list of template metadata objects + items: + $ref: '#/components/schemas/TemplateMetaRead' + type: array + type: object + TemplateRead: + description: list of template metadata + example: + createdAt: 2000-01-23T04:56:07.000+00:00 + compiled: + sender: Example + subject: subject + replyTo: Example + html: html + text: text + localizations: + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + name: name + description: description + id: tem_g3L7Cw6Hp5wU + url: /templates/tem_g3L7Cw6Hp5wUaf395LehwK + updatedAt: 2000-01-23T04:56:07.000+00:00 + properties: + id: + description: An opaque, unique identifier for a template + example: tem_g3L7Cw6Hp5wU + type: string + name: + description: The name of a template + type: string + description: + description: A description of the template + type: string + url: + description: The API url for a specific template + example: /templates/tem_g3L7Cw6Hp5wUaf395LehwK + type: string + compiled: + $ref: '#/components/schemas/CompiledRead' + createdAt: + description: The time of initial creation + format: date-time + type: string + updatedAt: + description: The time of last update + format: date-time + type: string + localizations: + description: A list of the Template's available localizations + items: + $ref: '#/components/schemas/LocalizationMetaRead' + type: array + type: object + DraftRead: + description: template draft metadata included latest draft revision + example: + template: tem_g3L7Cw6Hp5wU + createdAt: 2000-01-23T04:56:07.000+00:00 + compiled: + sender: Example + subject: subject + replyTo: Example + html: html + text: text + localizations: + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + - localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + name: name + id: tdft_g3L7Cw6Hp5wU + url: /drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU + updatedAt: 2000-01-23T04:56:07.000+00:00 + properties: + id: + description: An opaque, unique identifier for a draft + example: tdft_g3L7Cw6Hp5wU + type: string + template: + description: An opaque, unique identifier for a template + example: tem_g3L7Cw6Hp5wU + type: string + name: + description: The name of a draft + type: string + url: + description: The API url for a specific draft + example: /drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU + type: string + compiled: + $ref: '#/components/schemas/CompiledRead' + createdAt: + description: The time of initial creation + format: date-time + type: string + updatedAt: + description: The time of last update + format: date-time + type: string + localizations: + description: A list of the Template's available localizations + items: + $ref: '#/components/schemas/LocalizationMetaRead' + type: array + type: object + LocalizationMetaRead: + description: localization metadata + example: + localeGroup: lgr_alka38ajla301 + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + properties: + id: + description: An opaque, unique identifier for a localization + example: loc_g3L7Cw6Hp5wUaf395LehwK + type: string + name: + description: The user-specified name of a localization + example: English (US) + type: string + url: + description: The API url for a specific localization + example: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + type: string + localeGroup: + description: the locale group this localization belongs to, if this field + is empty the localization does not belong to any locale group + example: lgr_alka38ajla301 + type: string + languages: + description: | + a list of locale codes that are available in the localization. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/) for an exhaustive list of locale codes. + items: + type: string + type: array + type: object + LocalizationRead: + description: localization metadata and latest revision for associated template + example: + template: tem_g3L7Cw6Hp5wU + createdAt: 2000-01-23T04:56:07.000+00:00 + localeGroup: lgr_alka38ajla301 + compiled: + sender: Example + subject: subject + replyTo: Example + html: html + text: text + languages: + - languages + - languages + name: English (US) + id: loc_g3L7Cw6Hp5wUaf395LehwK + url: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + updatedAt: 2000-01-23T04:56:07.000+00:00 + properties: + id: + description: An opaque, unique identifier for a localization + example: loc_g3L7Cw6Hp5wUaf395LehwK + type: string + languages: + description: | + a list of locale codes that are available in the localization. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/) for an exhaustive list of locale codes. + items: + type: string + type: array + url: + description: The API url for a specific localization + example: /localizations/loc_g3L7Cw6Hp5wUaf395LehwK + type: string + template: + description: An opaque, unique identifier for a template + example: tem_g3L7Cw6Hp5wU + type: string + compiled: + $ref: '#/components/schemas/CompiledRead' + createdAt: + description: The time of initial creation + format: date-time + type: string + updatedAt: + description: The time of last update + format: date-time + type: string + name: + description: The user-specified name of a localization + example: English (US) + type: string + localeGroup: + description: the locale group this localization belongs to, if this field + is empty the localization does not belong to any locale group + example: lgr_alka38ajla301 + type: string + type: object + LocalizationKeyRead: + description: localization key + properties: + key: + type: string + comment: + type: string + type: object + DraftsRead: + description: list of draft metadata + example: + cursor: + next: next + hasMore: true + data: + - createdAt: 2000-01-23T04:56:07.000+00:00 + name: name + id: tdft_g3L7Cw6Hp5wU + templateId: tem_g3L7Cw6Hp5wU + url: /drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU + updatedAt: 2000-01-23T04:56:07.000+00:00 + - createdAt: 2000-01-23T04:56:07.000+00:00 + name: name + id: tdft_g3L7Cw6Hp5wU + templateId: tem_g3L7Cw6Hp5wU + url: /drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU + updatedAt: 2000-01-23T04:56:07.000+00:00 + properties: + cursor: + $ref: '#/components/schemas/cursor' + data: + description: A list of draft metadata objects + items: + $ref: '#/components/schemas/DraftMetaRead' + type: array + type: object + DraftMetaRead: + description: draft metadata + example: + createdAt: 2000-01-23T04:56:07.000+00:00 + name: name + id: tdft_g3L7Cw6Hp5wU + templateId: tem_g3L7Cw6Hp5wU + url: /drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU + updatedAt: 2000-01-23T04:56:07.000+00:00 + properties: + id: + description: An opaque, unique identifier for a draft + example: tdft_g3L7Cw6Hp5wU + type: string + templateId: + description: An opaque, unique identifier for a template + example: tem_g3L7Cw6Hp5wU + type: string + name: + description: The name of a draft + type: string + url: + description: The API url for a specific draft + example: /drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU + type: string + createdAt: + description: The time of initial creation + format: date-time + type: string + updatedAt: + description: The time of last update + format: date-time + type: string + type: object + APIError: + description: possible errors from the api + properties: + code: + description: | + Error code: + * server_error - Internal server error. + * invalid_parameter - Validation error, parameter will contain invalid field and message will contain the reason. + * invalid_body - Body could not be parsed, message will contain the reason. + * invalid_request - Validation error, the protocol used to make the request was not https. + * unauthorized - Credentials were found but permissions were not sufficient. + * unauthenticated - Credentials were not found or were not valid. + * not_found - The requested resource was not found. + * rate_limited - The request was refused because a rate limit was exceeded. There is an account wide rate limit of 3600 requests per-minute, although that is subject to change. The current remaining rate limit can be viewed by checking the X-Ratelimit-Remaining header. + * prohibited_action - The request was refused because an action was not valid for the requested resource. Typically this will happen if you try to make changes to a locked resource. + enum: + - server_error + - invalid_parameter + - invalid_body + - invalid_request + - unauthorized + - unauthenticated + - not_found + - rate_limited + - prohibited_action + type: string + message: + description: Human readable error message + type: string + parameter: + description: The invalid parameter, if 'code' is invalid_parameter + type: string + type: object + CompiledRead: + description: revision data + example: + sender: Example + subject: subject + replyTo: Example + html: html + text: text + properties: + sender: + description: Sender address + example: Example + type: string + replyTo: + description: Reply-To address + example: Example + type: string + subject: + description: Base64 encoded template subject line + format: byte + type: string + html: + description: Base64 encoded template HTML body + format: byte + type: string + text: + description: Base64 encoded template text body + format: byte + type: string + type: object + inline_object: + properties: + name: + example: English (US) + type: string + type: object + securitySchemes: + Bearer: + description: | + Set Bearer followed by your API key as the Authorization header in your + API requests. + + ```shell + Authorization: Bearer EXAMPLEAPIKEYXXXXXXXX12345678 + ``` + + Below is an example curl request with an API key in the Authorization header. + + ```shell + curl --request GET \ + --url https://api.dyspatch.io/templates \ + --header 'Authorization: Bearer EXAMPLEAPIKEYXXXXXXXX12345678' \ + --header 'Accept: application/vnd.dyspatch.2020.04+json' + ``` + in: header + name: Authorization + type: apiKey + diff --git a/build.gradle b/build.gradle index 2377e48..58f5018 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,14 @@ apply plugin: 'idea' apply plugin: 'eclipse' apply plugin: 'java' +apply plugin: 'maven-publish' group = 'io.dyspatch' -version = '5.0.1' +version = '5.0.2' buildscript { repositories { - mavenCentral() + maven { url "https://repo1.maven.org/maven2" } jcenter() } dependencies { @@ -16,6 +17,14 @@ buildscript { } } +publishing { + publications { + maven(MavenPublication) { + from components.java + } + } +} + repositories { jcenter() } @@ -36,8 +45,8 @@ if(hasProperty('target') && target == 'android') { targetSdkVersion 25 } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } // Rename the aar correctly @@ -52,7 +61,7 @@ if(hasProperty('target') && target == 'android') { } dependencies { - provided 'javax.annotation:jsr250-api:1.0' + provided 'javax.annotation:javax.annotation-api:1.3.2' } } @@ -82,8 +91,8 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 install { repositories.mavenInstaller { @@ -98,17 +107,17 @@ if(hasProperty('target') && target == 'android') { } dependencies { - compile 'io.swagger:swagger-annotations:1.5.22' + compile 'io.swagger:swagger-annotations:1.5.24' compile "com.google.code.findbugs:jsr305:3.0.2" - compile 'com.squareup.okhttp3:okhttp:3.14.2' - compile 'com.squareup.okhttp3:logging-interceptor:3.14.2' - compile 'com.google.code.gson:gson:2.8.5' - compile 'io.gsonfire:gson-fire:1.8.3' - compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9' - compile 'org.threeten:threetenbp:1.4.0' - testCompile 'junit:junit:4.12' + compile 'com.squareup.okhttp3:okhttp:4.7.2' + compile 'com.squareup.okhttp3:logging-interceptor:4.7.2' + compile 'com.google.code.gson:gson:2.8.6' + compile 'io.gsonfire:gson-fire:1.8.4' + compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.10' + compile 'javax.annotation:javax.annotation-api:1.3.2' + testCompile 'junit:junit:4.13' } javadoc { options.tags = [ "http.response.details:a:Http Response Details" ] -} +} \ No newline at end of file diff --git a/build.sbt b/build.sbt index 9381dff..bf4889e 100644 --- a/build.sbt +++ b/build.sbt @@ -2,22 +2,22 @@ lazy val root = (project in file(".")). settings( organization := "io.dyspatch", name := "dyspatch-java", - version := "5.0.1", + version := "5.0.2", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.22", - "com.squareup.okhttp3" % "okhttp" % "3.14.2", - "com.squareup.okhttp3" % "logging-interceptor" % "3.14.2", - "com.google.code.gson" % "gson" % "2.8.5", - "org.apache.commons" % "commons-lang3" % "3.9", - "org.threeten" % "threetenbp" % "1.4.0" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.24", + "com.squareup.okhttp3" % "okhttp" % "3.14.7", + "com.squareup.okhttp3" % "logging-interceptor" % "3.14.7", + "com.google.code.gson" % "gson" % "2.8.6", + "org.apache.commons" % "commons-lang3" % "3.10", "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", - "javax.annotation" % "jsr250-api" % "1.0" % "compile", - "junit" % "junit" % "4.12" % "test", + "javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", + "junit" % "junit" % "4.13" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) ) diff --git a/pom.xml b/pom.xml index fb3b22b..0c0b47a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ dyspatch-java jar dyspatch-java - 5.0.1 + 5.0.2 https://github.com/openapitools/openapi-generator OpenAPI Java @@ -33,6 +33,20 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + org.apache.maven.plugins maven-enforcer-plugin @@ -56,7 +70,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12 + 3.0.0-M4 @@ -66,7 +80,7 @@ -Xms512m -Xmx1500m methods - pertest + 10 @@ -135,7 +149,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.10.4 + 3.1.1 attach-javadocs @@ -145,6 +159,7 @@ + none http.response.details @@ -231,15 +246,11 @@ commons-lang3 ${commons-lang3-version} - - org.threeten - threetenbp - ${threetenbp-version} - javax.annotation - jsr250-api + javax.annotation-api ${javax-annotation-version} + provided @@ -250,18 +261,16 @@ - 1.7 + 1.8 ${java.version} ${java.version} - 1.8.3 - 1.5.22 - 3.14.2 - 2.8.5 - 3.9 - 1.4.0 - 1.0.0 - 1.0 - 4.12 + 1.8.4 + 1.5.24 + 4.7.2 + 2.8.6 + 3.10 + 1.3.2 + 4.13 UTF-8 - + \ No newline at end of file diff --git a/src/main/java/io/dyspatch/client/ApiClient.java b/src/main/java/io/dyspatch/client/ApiClient.java index 4a4ae33..13b9035 100644 --- a/src/main/java/io/dyspatch/client/ApiClient.java +++ b/src/main/java/io/dyspatch/client/ApiClient.java @@ -20,9 +20,6 @@ import okhttp3.logging.HttpLoggingInterceptor.Level; import okio.BufferedSink; import okio.Okio; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; import javax.net.ssl.*; import java.io.File; @@ -30,6 +27,7 @@ import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; +import java.net.URI; import java.net.URLConnection; import java.net.URLEncoder; import java.security.GeneralSecurityException; @@ -40,6 +38,9 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; @@ -80,6 +81,7 @@ public class ApiClient { */ public ApiClient() { init(); + initHttpClient(); // Setup authentications (key: authentication name, value: authentication). authentications.put("Bearer", new ApiKeyAuth("header", "Authorization")); @@ -87,18 +89,27 @@ public ApiClient() { authentications = Collections.unmodifiableMap(authentications); } - private void init() { + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.addNetworkInterceptor(getProgressInterceptor()); - httpClient = builder.build(); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + httpClient = builder.build(); + } + private void init() { verifyingSsl = true; json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/5.0.1/java"); + setUserAgent("OpenAPI-Generator/5.0.2/java"); authentications = new HashMap(); } diff --git a/src/main/java/io/dyspatch/client/JSON.java b/src/main/java/io/dyspatch/client/JSON.java index fad72ef..7eb5c80 100644 --- a/src/main/java/io/dyspatch/client/JSON.java +++ b/src/main/java/io/dyspatch/client/JSON.java @@ -23,9 +23,6 @@ import com.google.gson.JsonElement; import io.gsonfire.GsonFireBuilder; import io.gsonfire.TypeSelector; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; import io.dyspatch.client.model.*; import okio.ByteString; @@ -36,6 +33,9 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; @@ -65,8 +65,15 @@ private static String getDiscriminatorValue(JsonElement readElement, String disc return element.getAsString(); } + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { - Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase(Locale.ROOT)); + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); if (null == clazz) { throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); } diff --git a/src/main/java/io/dyspatch/client/ServerConfiguration.java b/src/main/java/io/dyspatch/client/ServerConfiguration.java new file mode 100644 index 0000000..e05b6e1 --- /dev/null +++ b/src/main/java/io/dyspatch/client/ServerConfiguration.java @@ -0,0 +1,58 @@ +package io.dyspatch.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A describtion of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replaceAll("\\{" + name + "\\}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/src/main/java/io/dyspatch/client/ServerVariable.java b/src/main/java/io/dyspatch/client/ServerVariable.java new file mode 100644 index 0000000..a22d83d --- /dev/null +++ b/src/main/java/io/dyspatch/client/ServerVariable.java @@ -0,0 +1,23 @@ +package io.dyspatch.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/src/main/java/io/dyspatch/client/api/DraftsApi.java b/src/main/java/io/dyspatch/client/api/DraftsApi.java index ac06692..fe243e6 100644 --- a/src/main/java/io/dyspatch/client/api/DraftsApi.java +++ b/src/main/java/io/dyspatch/client/api/DraftsApi.java @@ -91,7 +91,7 @@ public okhttp3.Call deleteLocalizationCall(String draftId, String languageId, St Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.dyspatch.2020.04+json" + "application/vnd.dyspatch.2020.04+json", "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -384,7 +384,7 @@ public okhttp3.Call getDraftLocalizationKeysCall(String draftId, String accept, Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.dyspatch.2020.04+json", "text/vnd.dyspatch.2020.04+x-gettext-translation" + "application/vnd.dyspatch.2020.04+json", "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -666,7 +666,7 @@ public okhttp3.Call getLocalizationForDraftCall(String draftId, String accept, f Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.dyspatch.2020.04+json" + "application/vnd.dyspatch.2020.04+json", "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -793,7 +793,7 @@ public okhttp3.Call saveLocalizationCall(String draftId, String languageId, Stri Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.dyspatch.2020.04+json" + "application/vnd.dyspatch.2020.04+json", "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { diff --git a/src/main/java/io/dyspatch/client/model/DraftMetaRead.java b/src/main/java/io/dyspatch/client/model/DraftMetaRead.java index 0dd6045..a4d6bb7 100644 --- a/src/main/java/io/dyspatch/client/model/DraftMetaRead.java +++ b/src/main/java/io/dyspatch/client/model/DraftMetaRead.java @@ -23,7 +23,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; -import org.threeten.bp.OffsetDateTime; +import java.time.OffsetDateTime; /** * draft metadata diff --git a/src/main/java/io/dyspatch/client/model/DraftRead.java b/src/main/java/io/dyspatch/client/model/DraftRead.java index 82e4a09..15efc16 100644 --- a/src/main/java/io/dyspatch/client/model/DraftRead.java +++ b/src/main/java/io/dyspatch/client/model/DraftRead.java @@ -25,9 +25,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; /** * template draft metadata included latest draft revision @@ -237,7 +237,7 @@ public DraftRead localizations(List localizations) { public DraftRead addLocalizationsItem(LocalizationMetaRead localizationsItem) { if (this.localizations == null) { - this.localizations = new ArrayList(); + this.localizations = new ArrayList<>(); } this.localizations.add(localizationsItem); return this; diff --git a/src/main/java/io/dyspatch/client/model/DraftsRead.java b/src/main/java/io/dyspatch/client/model/DraftsRead.java index 92f59bf..d6c6de2 100644 --- a/src/main/java/io/dyspatch/client/model/DraftsRead.java +++ b/src/main/java/io/dyspatch/client/model/DraftsRead.java @@ -74,7 +74,7 @@ public DraftsRead data(List data) { public DraftsRead addDataItem(DraftMetaRead dataItem) { if (this.data == null) { - this.data = new ArrayList(); + this.data = new ArrayList<>(); } this.data.add(dataItem); return this; diff --git a/src/main/java/io/dyspatch/client/model/LocalizationMetaRead.java b/src/main/java/io/dyspatch/client/model/LocalizationMetaRead.java index a4c987a..e853835 100644 --- a/src/main/java/io/dyspatch/client/model/LocalizationMetaRead.java +++ b/src/main/java/io/dyspatch/client/model/LocalizationMetaRead.java @@ -153,7 +153,7 @@ public LocalizationMetaRead languages(List languages) { public LocalizationMetaRead addLanguagesItem(String languagesItem) { if (this.languages == null) { - this.languages = new ArrayList(); + this.languages = new ArrayList<>(); } this.languages.add(languagesItem); return this; diff --git a/src/main/java/io/dyspatch/client/model/LocalizationRead.java b/src/main/java/io/dyspatch/client/model/LocalizationRead.java index 22bd2cd..6064c0c 100644 --- a/src/main/java/io/dyspatch/client/model/LocalizationRead.java +++ b/src/main/java/io/dyspatch/client/model/LocalizationRead.java @@ -24,9 +24,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; /** * localization metadata and latest revision for associated template @@ -102,7 +102,7 @@ public LocalizationRead languages(List languages) { public LocalizationRead addLanguagesItem(String languagesItem) { if (this.languages == null) { - this.languages = new ArrayList(); + this.languages = new ArrayList<>(); } this.languages.add(languagesItem); return this; diff --git a/src/main/java/io/dyspatch/client/model/TemplateMetaRead.java b/src/main/java/io/dyspatch/client/model/TemplateMetaRead.java index 09d6852..8189a50 100644 --- a/src/main/java/io/dyspatch/client/model/TemplateMetaRead.java +++ b/src/main/java/io/dyspatch/client/model/TemplateMetaRead.java @@ -24,9 +24,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; /** * the template metadata @@ -163,7 +163,7 @@ public TemplateMetaRead localizations(List localizations) public TemplateMetaRead addLocalizationsItem(LocalizationMetaRead localizationsItem) { if (this.localizations == null) { - this.localizations = new ArrayList(); + this.localizations = new ArrayList<>(); } this.localizations.add(localizationsItem); return this; diff --git a/src/main/java/io/dyspatch/client/model/TemplateRead.java b/src/main/java/io/dyspatch/client/model/TemplateRead.java index 1e8a4ff..e12b66a 100644 --- a/src/main/java/io/dyspatch/client/model/TemplateRead.java +++ b/src/main/java/io/dyspatch/client/model/TemplateRead.java @@ -25,9 +25,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; /** * list of template metadata @@ -237,7 +237,7 @@ public TemplateRead localizations(List localizations) { public TemplateRead addLocalizationsItem(LocalizationMetaRead localizationsItem) { if (this.localizations == null) { - this.localizations = new ArrayList(); + this.localizations = new ArrayList<>(); } this.localizations.add(localizationsItem); return this; diff --git a/src/main/java/io/dyspatch/client/model/TemplatesRead.java b/src/main/java/io/dyspatch/client/model/TemplatesRead.java index 9343f17..38be9e7 100644 --- a/src/main/java/io/dyspatch/client/model/TemplatesRead.java +++ b/src/main/java/io/dyspatch/client/model/TemplatesRead.java @@ -74,7 +74,7 @@ public TemplatesRead data(List data) { public TemplatesRead addDataItem(TemplateMetaRead dataItem) { if (this.data == null) { - this.data = new ArrayList(); + this.data = new ArrayList<>(); } this.data.add(dataItem); return this; diff --git a/src/test/java/io/dyspatch/client/model/DraftMetaReadTest.java b/src/test/java/io/dyspatch/client/model/DraftMetaReadTest.java index 68692b8..4dea9dd 100644 --- a/src/test/java/io/dyspatch/client/model/DraftMetaReadTest.java +++ b/src/test/java/io/dyspatch/client/model/DraftMetaReadTest.java @@ -21,7 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; -import org.threeten.bp.OffsetDateTime; +import java.time.OffsetDateTime; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; diff --git a/src/test/java/io/dyspatch/client/model/DraftReadTest.java b/src/test/java/io/dyspatch/client/model/DraftReadTest.java index 3573f1b..f8a7593 100644 --- a/src/test/java/io/dyspatch/client/model/DraftReadTest.java +++ b/src/test/java/io/dyspatch/client/model/DraftReadTest.java @@ -23,9 +23,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; diff --git a/src/test/java/io/dyspatch/client/model/LocalizationReadTest.java b/src/test/java/io/dyspatch/client/model/LocalizationReadTest.java index 4be9600..eb188f0 100644 --- a/src/test/java/io/dyspatch/client/model/LocalizationReadTest.java +++ b/src/test/java/io/dyspatch/client/model/LocalizationReadTest.java @@ -22,9 +22,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; diff --git a/src/test/java/io/dyspatch/client/model/TemplateMetaReadTest.java b/src/test/java/io/dyspatch/client/model/TemplateMetaReadTest.java index 5d8577e..813480a 100644 --- a/src/test/java/io/dyspatch/client/model/TemplateMetaReadTest.java +++ b/src/test/java/io/dyspatch/client/model/TemplateMetaReadTest.java @@ -22,9 +22,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; diff --git a/src/test/java/io/dyspatch/client/model/TemplateReadTest.java b/src/test/java/io/dyspatch/client/model/TemplateReadTest.java index 905c7aa..7efa159 100644 --- a/src/test/java/io/dyspatch/client/model/TemplateReadTest.java +++ b/src/test/java/io/dyspatch/client/model/TemplateReadTest.java @@ -23,9 +23,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test;