diff --git a/README.md b/README.md index 0471abf..163f592 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,50 @@ -# Dyspatch Javascript API Client +# dyspatch-client -## Introduction +DyspatchClient - JavaScript client for dyspatch-client +# 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. +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. -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. -This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: +- [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) + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 2020.04 -- Package version: 5.0.0 -- Build package: io.swagger.codegen.languages.JavascriptClientCodegen - For more information, please visit [https://docs.dyspatch.io](https://docs.dyspatch.io) +- Package version: 5.0.1 +- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen +For more information, please visit [https://docs.dyspatch.io](https://docs.dyspatch.io) ## Installation ### For [Node.js](https://nodejs.org/) -#### Installing via NPM +#### npm + +To publish the library as a [npm](https://www.npmjs.com/), please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages). + +Then install it via: ```shell npm install dyspatch-client --save ``` +Finally, you need to build the module: + +```shell +npm run build +``` + ##### Local development To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run: @@ -37,18 +59,21 @@ Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the follow npm link ``` -Finally, switch to the directory you want to use your dyspatch-client from, and run: +To use the link you just defined in your project, switch to the directory you want to use your dyspatch-client from, and run: ```shell npm link /path/to/ ``` -You should now be able to `require('dyspatch-client')` in javascript files from the directory you ran the last command above from. +Finally, you need to build the module: + +```shell +npm run build +``` #### git -If the library is hosted at a git repository, e.g. -https://github.com/GIT_USER_ID/GIT_REPO_ID +If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via: ```shell @@ -59,8 +84,7 @@ then install it via: The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following the above steps with Node.js and installing browserify with `npm install -g browserify`, -perform the following (assuming *main.js* is your entry file, that's to say your javascript file where you actually -use this library): +perform the following (assuming *main.js* is your entry file): ```shell browserify main.js > bundle.js @@ -94,7 +118,6 @@ Please follow the [installation](#installation) instruction and execute the foll var DyspatchClient = require('dyspatch-client'); var defaultClient = DyspatchClient.ApiClient.instance; - // Configure API key authorization: Bearer var Bearer = defaultClient.authentications['Bearer']; Bearer.apiKey = "YOUR API KEY" @@ -102,20 +125,15 @@ Bearer.apiKey = "YOUR API KEY" //Bearer.apiKeyPrefix['Authorization'] = "Token" var api = new DyspatchClient.DraftsApi() - var draftId = "draftId_example"; // {String} A draft ID +var languageId = "languageId_example"; // {String} A language ID (eg: en-US) +var 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\" +api.deleteLocalization(draftId, languageId, accept).then(function() { + console.log('API called successfully.'); +}, function(error) { + console.error(error); +}); -var targetLanguage = "targetLanguage_example"; // {String} The type of templating language to compile as. Should only be used for visual templates. - - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -api.draftsDraftIdGet(draftId, targetLanguage, callback); ``` @@ -165,3 +183,4 @@ Class | Method | HTTP request | Description - **Type**: API key - **API key parameter name**: Authorization - **Location**: HTTP header + diff --git a/docs/DraftMetaRead.md b/docs/DraftMetaRead.md index e54367d..428fec1 100644 --- a/docs/DraftMetaRead.md +++ b/docs/DraftMetaRead.md @@ -7,7 +7,6 @@ Name | Type | Description | Notes **id** | **String** | An opaque, unique identifier for a draft | [optional] **templateId** | **String** | An opaque, unique identifier for a template | [optional] **name** | **String** | The name of a draft | [optional] -**description** | **String** | A description of the draft | [optional] **url** | **String** | The API url for a specific draft | [optional] **createdAt** | **Date** | The time of initial creation | [optional] **updatedAt** | **Date** | The time of last update | [optional] diff --git a/docs/DraftsApi.md b/docs/DraftsApi.md index 8326b71..5f4342d 100644 --- a/docs/DraftsApi.md +++ b/docs/DraftsApi.md @@ -38,13 +38,12 @@ let apiInstance = new DyspatchClient.DraftsApi(); let draftId = "draftId_example"; // String | A draft ID let languageId = "languageId_example"; // String | A language ID (eg: en-US) let 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\" -apiInstance.deleteLocalization(draftId, languageId, accept, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully.'); - } +apiInstance.deleteLocalization(draftId, languageId, accept).then(() => { + console.log('API called successfully.'); +}, (error) => { + console.error(error); }); + ``` ### Parameters @@ -93,13 +92,12 @@ let apiInstance = new DyspatchClient.DraftsApi(); let draftId = "draftId_example"; // String | A draft ID let targetLanguage = "targetLanguage_example"; // String | The type of templating language to compile as. Should only be used for visual templates. let 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\" -apiInstance.getDraftById(draftId, targetLanguage, accept, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } +apiInstance.getDraftById(draftId, targetLanguage, accept).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}, (error) => { + console.error(error); }); + ``` ### Parameters @@ -147,13 +145,12 @@ Bearer.apiKey = 'YOUR API KEY'; let apiInstance = new DyspatchClient.DraftsApi(); let draftId = "draftId_example"; // String | A draft ID let 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\" -apiInstance.getDraftLocalizationKeys(draftId, accept, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } +apiInstance.getDraftLocalizationKeys(draftId, accept).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}, (error) => { + console.error(error); }); + ``` ### Parameters @@ -203,13 +200,12 @@ let opts = { 'cursor': "cursor_example", // String | A cursor value used to retrieve a specific page from a paginated result set. 'status': "status_example" // String | Filter the list of drafts by a particular status }; -apiInstance.getDrafts(accept, opts, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } +apiInstance.getDrafts(accept, opts).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}, (error) => { + console.error(error); }); + ``` ### Parameters @@ -257,13 +253,12 @@ Bearer.apiKey = 'YOUR API KEY'; let apiInstance = new DyspatchClient.DraftsApi(); let draftId = "draftId_example"; // String | A draft ID let 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\" -apiInstance.getLocalizationForDraft(draftId, accept, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } +apiInstance.getLocalizationForDraft(draftId, accept).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}, (error) => { + console.error(error); }); + ``` ### Parameters @@ -312,13 +307,12 @@ let draftId = "draftId_example"; // String | A draft ID let languageId = "languageId_example"; // String | A language ID (eg: en-US) let 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\" let inlineObject = new DyspatchClient.InlineObject(); // InlineObject | -apiInstance.saveLocalization(draftId, languageId, accept, inlineObject, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully.'); - } +apiInstance.saveLocalization(draftId, languageId, accept, inlineObject).then(() => { + console.log('API called successfully.'); +}, (error) => { + console.error(error); }); + ``` ### Parameters @@ -369,13 +363,12 @@ let draftId = "draftId_example"; // String | A draft ID let languageId = "languageId_example"; // String | A language ID (eg: en-US) let 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\" let requestBody = {key: "null"}; // {String: String} | -apiInstance.setTranslation(draftId, languageId, accept, requestBody, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully.'); - } +apiInstance.setTranslation(draftId, languageId, accept, requestBody).then(() => { + console.log('API called successfully.'); +}, (error) => { + console.error(error); }); + ``` ### Parameters @@ -424,13 +417,12 @@ Bearer.apiKey = 'YOUR API KEY'; let apiInstance = new DyspatchClient.DraftsApi(); let draftId = "draftId_example"; // String | A draft ID let 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\" -apiInstance.submitDraftForApproval(draftId, accept, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully.'); - } +apiInstance.submitDraftForApproval(draftId, accept).then(() => { + console.log('API called successfully.'); +}, (error) => { + console.error(error); }); + ``` ### Parameters diff --git a/docs/LocalizationsApi.md b/docs/LocalizationsApi.md index 526db7e..d8cc7dd 100644 --- a/docs/LocalizationsApi.md +++ b/docs/LocalizationsApi.md @@ -31,13 +31,12 @@ let apiInstance = new DyspatchClient.LocalizationsApi(); let localizationId = "localizationId_example"; // String | A localization ID let targetLanguage = "targetLanguage_example"; // String | The type of templating language to compile as. Should only be used for visual templates. let 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\" -apiInstance.getLocalizationById(localizationId, targetLanguage, accept, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } +apiInstance.getLocalizationById(localizationId, targetLanguage, accept).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}, (error) => { + console.error(error); }); + ``` ### Parameters diff --git a/docs/TemplatesApi.md b/docs/TemplatesApi.md index 30c37d4..a1d3767 100644 --- a/docs/TemplatesApi.md +++ b/docs/TemplatesApi.md @@ -32,13 +32,12 @@ let apiInstance = new DyspatchClient.TemplatesApi(); let templateId = "templateId_example"; // String | A template ID let targetLanguage = "targetLanguage_example"; // String | The type of templating language to compile as. Should only be used for visual templates. let 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\" -apiInstance.getTemplateById(templateId, targetLanguage, accept, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } +apiInstance.getTemplateById(templateId, targetLanguage, accept).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}, (error) => { + console.error(error); }); + ``` ### Parameters @@ -88,13 +87,12 @@ let accept = "accept_example"; // String | A version of the API that should be u let opts = { 'cursor': "cursor_example" // String | A cursor value used to retrieve a specific page from a paginated result set. }; -apiInstance.getTemplates(accept, opts, (error, data, response) => { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } +apiInstance.getTemplates(accept, opts).then((data) => { + console.log('API called successfully. Returned data: ' + data); +}, (error) => { + console.error(error); }); + ``` ### Parameters diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..ced3be2 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/package.json b/package.json index 8b39f45..a69a110 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "dyspatch-client", - "version": "5.0.0", - "description": "_IntroductionThe_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", + "version": "5.0.1", + "description": "_IntroductionThe_Dyspatch_API_is_based_on_the_REST_paradigm_and_features_resource_based_URLs_with_standard_HTTP_responsecodes_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_onhow_to_implement_Dyspatch__API_Client_LibrariesDyspatch_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", "license": "Apache-2.0", "main": "dist/index.js", "scripts": { diff --git a/src/ApiClient.js b/src/ApiClient.js index 6294229..06415a2 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -17,7 +17,7 @@ import querystring from "querystring"; /** * @module ApiClient -* @version 5.0.0 +* @version 5.0.1 */ /** @@ -337,13 +337,6 @@ class ApiClient { return ApiClient.convertToType(data, returnType); } - /** - * Callback function to receive the result of the operation. - * @callback module:ApiClient~callApiCallback - * @param {String} error Error message, if any. - * @param data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ /** * Invokes the REST service using the supplied settings and parameters. @@ -360,12 +353,11 @@ class ApiClient { * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the * constructor for a complex type. * @param {String} apiBasePath base path defined in the operation/path level to override the default one - * @param {module:ApiClient~callApiCallback} callback The callback function. - * @returns {Object} The SuperAgent request object. + * @returns {Promise} A {@link https://www.promisejs.org/|Promise} object. */ callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, - returnType, apiBasePath, callback) { + returnType, apiBasePath) { var url = this.buildUrl(path, pathParams, apiBasePath); var request = superagent(httpMethod, url); @@ -405,8 +397,6 @@ class ApiClient { if(contentType != 'multipart/form-data') { request.type(contentType); } - } else if (!request.header['Content-Type']) { - request.type('application/json'); } if (contentType === 'application/x-www-form-urlencoded') { @@ -424,6 +414,9 @@ class ApiClient { } } } else if (bodyParam !== null && bodyParam !== undefined) { + if (!request.header['Content-Type']) { + request.type('application/json'); + } request.send(bodyParam); } @@ -448,25 +441,34 @@ class ApiClient { } } - request.end((error, response) => { - if (callback) { - var data = null; - if (!error) { + return new Promise((resolve, reject) => { + request.end((error, response) => { + if (error) { + var err = {}; + if (response) { + err.status = response.status; + err.statusText = response.statusText; + err.body = response.body; + err.response = response; + } + err.error = error; + + reject(err); + } else { try { - data = this.deserialize(response, returnType); + var data = this.deserialize(response, returnType); if (this.enableCookies && typeof window === 'undefined'){ this.agent._saveCookies(response); } + + resolve({data, response}); } catch (err) { - error = err; + reject(err); } } - - callback(error, data, response); - } + }); }); - return request; } /** diff --git a/src/dyspatch-client/APIError.js b/src/dyspatch-client/APIError.js index 74bb262..566e767 100644 --- a/src/dyspatch-client/APIError.js +++ b/src/dyspatch-client/APIError.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The APIError model module. * @module dyspatch-client/APIError - * @version 5.0.0 + * @version 5.0.1 */ class APIError { /** diff --git a/src/dyspatch-client/CompiledRead.js b/src/dyspatch-client/CompiledRead.js index d2a2820..8f0def7 100644 --- a/src/dyspatch-client/CompiledRead.js +++ b/src/dyspatch-client/CompiledRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The CompiledRead model module. * @module dyspatch-client/CompiledRead - * @version 5.0.0 + * @version 5.0.1 */ class CompiledRead { /** diff --git a/src/dyspatch-client/Cursor.js b/src/dyspatch-client/Cursor.js index ade23e7..825e383 100644 --- a/src/dyspatch-client/Cursor.js +++ b/src/dyspatch-client/Cursor.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The Cursor model module. * @module dyspatch-client/Cursor - * @version 5.0.0 + * @version 5.0.1 */ class Cursor { /** diff --git a/src/dyspatch-client/DraftMetaRead.js b/src/dyspatch-client/DraftMetaRead.js index b882a11..168e77c 100644 --- a/src/dyspatch-client/DraftMetaRead.js +++ b/src/dyspatch-client/DraftMetaRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The DraftMetaRead model module. * @module dyspatch-client/DraftMetaRead - * @version 5.0.0 + * @version 5.0.1 */ class DraftMetaRead { /** @@ -57,9 +57,6 @@ class DraftMetaRead { if (data.hasOwnProperty('name')) { obj['name'] = ApiClient.convertToType(data['name'], 'String'); } - if (data.hasOwnProperty('description')) { - obj['description'] = ApiClient.convertToType(data['description'], 'String'); - } if (data.hasOwnProperty('url')) { obj['url'] = ApiClient.convertToType(data['url'], 'String'); } @@ -94,12 +91,6 @@ DraftMetaRead.prototype['templateId'] = undefined; */ DraftMetaRead.prototype['name'] = undefined; -/** - * A description of the draft - * @member {String} description - */ -DraftMetaRead.prototype['description'] = undefined; - /** * The API url for a specific draft * @member {String} url diff --git a/src/dyspatch-client/DraftRead.js b/src/dyspatch-client/DraftRead.js index b2f0817..3bfd30a 100644 --- a/src/dyspatch-client/DraftRead.js +++ b/src/dyspatch-client/DraftRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -18,7 +18,7 @@ import LocalizationMetaRead from './LocalizationMetaRead'; /** * The DraftRead model module. * @module dyspatch-client/DraftRead - * @version 5.0.0 + * @version 5.0.1 */ class DraftRead { /** diff --git a/src/dyspatch-client/DraftsApi.js b/src/dyspatch-client/DraftsApi.js index bc437cc..96b0f51 100644 --- a/src/dyspatch-client/DraftsApi.js +++ b/src/dyspatch-client/DraftsApi.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -23,7 +23,7 @@ import LocalizationMetaRead from '../dyspatch-client/LocalizationMetaRead'; /** * Drafts service. * @module dyspatch-client/DraftsApi -* @version 5.0.0 +* @version 5.0.1 */ export default class DraftsApi { @@ -37,25 +37,18 @@ export default class DraftsApi { constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; } +dfkajsldfjasldkjfaslkdjflaskjdflksajdlfkjs - /** - * Callback function to receive the result of the deleteLocalization operation. - * @callback module:dyspatch-client/DraftsApi~deleteLocalizationCallback - * @param {String} error Error message, if any. - * @param data This operation does not return a value. - * @param {String} response The complete HTTP response. - */ - /** * Remove a localization * Deletes the localization with the given language ID if it exists * @param {String} draftId A draft ID * @param {String} languageId A language ID (eg: en-US) * @param {String} accept 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\" - * @param {module:dyspatch-client/DraftsApi~deleteLocalizationCallback} callback The callback function, accepting three arguments: error, data, response + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - deleteLocalization(draftId, languageId, accept, callback) { + deleteLocalizationWithHttpInfo(draftId, languageId, accept) { let postBody = null; // verify the required parameter 'draftId' is set if (draftId === undefined || draftId === null) { @@ -84,22 +77,30 @@ export default class DraftsApi { let authNames = ['Bearer']; let contentTypes = []; - let accepts = []; + let accepts = ['application/vnd.dyspatch.2020.04+json', '*/*']; let returnType = null; return this.apiClient.callApi( '/drafts/{draftId}/localizations/{languageId}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } /** - * Callback function to receive the result of the getDraftById operation. - * @callback module:dyspatch-client/DraftsApi~getDraftByIdCallback - * @param {String} error Error message, if any. - * @param {module:dyspatch-client/DraftRead} data The data returned by the service call. - * @param {String} response The complete HTTP response. + * Remove a localization + * Deletes the localization with the given language ID if it exists + * @param {String} draftId A draft ID + * @param {String} languageId A language ID (eg: en-US) + * @param {String} accept 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\" + * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ + deleteLocalization(draftId, languageId, accept) { + return this.deleteLocalizationWithHttpInfo(draftId, languageId, accept) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + /** * Get Draft by ID @@ -107,10 +108,9 @@ export default class DraftsApi { * @param {String} draftId A draft ID * @param {module:dyspatch-client/String} targetLanguage The type of templating language to compile as. Should only be used for visual templates. * @param {String} accept 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\" - * @param {module:dyspatch-client/DraftsApi~getDraftByIdCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {@link module:dyspatch-client/DraftRead} + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:dyspatch-client/DraftRead} and HTTP response */ - getDraftById(draftId, targetLanguage, accept, callback) { + getDraftByIdWithHttpInfo(draftId, targetLanguage, accept) { let postBody = null; // verify the required parameter 'draftId' is set if (draftId === undefined || draftId === null) { @@ -144,27 +144,34 @@ export default class DraftsApi { return this.apiClient.callApi( '/drafts/{draftId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } /** - * Callback function to receive the result of the getDraftLocalizationKeys operation. - * @callback module:dyspatch-client/DraftsApi~getDraftLocalizationKeysCallback - * @param {String} error Error message, if any. - * @param {Array.} data The data returned by the service call. - * @param {String} response The complete HTTP response. + * Get Draft by ID + * Gets a draft object with the matching ID. The \"compiled\" field will contain the template in the default, unlocalized form. + * @param {String} draftId A draft ID + * @param {module:dyspatch-client/String} targetLanguage The type of templating language to compile as. Should only be used for visual templates. + * @param {String} accept 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\" + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:dyspatch-client/DraftRead} */ + getDraftById(draftId, targetLanguage, accept) { + return this.getDraftByIdWithHttpInfo(draftId, targetLanguage, accept) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + /** * Get localization keys * 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. * @param {String} draftId A draft ID * @param {String} accept 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\" - * @param {module:dyspatch-client/DraftsApi~getDraftLocalizationKeysCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {@link Array.} + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.} and HTTP response */ - getDraftLocalizationKeys(draftId, accept, callback) { + getDraftLocalizationKeysWithHttpInfo(draftId, accept) { let postBody = null; // verify the required parameter 'draftId' is set if (draftId === undefined || draftId === null) { @@ -188,22 +195,29 @@ export default class DraftsApi { let authNames = ['Bearer']; let contentTypes = []; - let accepts = ['application/vnd.dyspatch.2020.04+json', 'text/vnd.dyspatch.2020.04+x-gettext-translation']; + let accepts = ['application/vnd.dyspatch.2020.04+json', '*/*']; let returnType = [LocalizationKeyRead]; return this.apiClient.callApi( '/drafts/{draftId}/localizationKeys', 'GET', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } /** - * Callback function to receive the result of the getDrafts operation. - * @callback module:dyspatch-client/DraftsApi~getDraftsCallback - * @param {String} error Error message, if any. - * @param {module:dyspatch-client/DraftsRead} data The data returned by the service call. - * @param {String} response The complete HTTP response. + * Get localization keys + * 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. + * @param {String} draftId A draft ID + * @param {String} accept 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\" + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.} */ + getDraftLocalizationKeys(draftId, accept) { + return this.getDraftLocalizationKeysWithHttpInfo(draftId, accept) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + /** * List Drafts @@ -212,10 +226,9 @@ export default class DraftsApi { * @param {Object} opts Optional parameters * @param {String} opts.cursor A cursor value used to retrieve a specific page from a paginated result set. * @param {module:dyspatch-client/String} opts.status Filter the list of drafts by a particular status - * @param {module:dyspatch-client/DraftsApi~getDraftsCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {@link module:dyspatch-client/DraftsRead} + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:dyspatch-client/DraftsRead} and HTTP response */ - getDrafts(accept, opts, callback) { + getDraftsWithHttpInfo(accept, opts) { opts = opts || {}; let postBody = null; // verify the required parameter 'accept' is set @@ -242,27 +255,35 @@ export default class DraftsApi { return this.apiClient.callApi( '/drafts', 'GET', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } /** - * Callback function to receive the result of the getLocalizationForDraft operation. - * @callback module:dyspatch-client/DraftsApi~getLocalizationForDraftCallback - * @param {String} error Error message, if any. - * @param {Array.} data The data returned by the service call. - * @param {String} response The complete HTTP response. + * List Drafts + * Returns all drafts for your organization. + * @param {String} accept 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\" + * @param {Object} opts Optional parameters + * @param {String} opts.cursor A cursor value used to retrieve a specific page from a paginated result set. + * @param {module:dyspatch-client/String} opts.status Filter the list of drafts by a particular status + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:dyspatch-client/DraftsRead} */ + getDrafts(accept, opts) { + return this.getDraftsWithHttpInfo(accept, opts) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + /** * Get localizations on a draft * Returns localization metadata for the draft * @param {String} draftId A draft ID * @param {String} accept 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\" - * @param {module:dyspatch-client/DraftsApi~getLocalizationForDraftCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {@link Array.} + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.} and HTTP response */ - getLocalizationForDraft(draftId, accept, callback) { + getLocalizationForDraftWithHttpInfo(draftId, accept) { let postBody = null; // verify the required parameter 'draftId' is set if (draftId === undefined || draftId === null) { @@ -286,22 +307,29 @@ export default class DraftsApi { let authNames = ['Bearer']; let contentTypes = []; - let accepts = ['application/vnd.dyspatch.2020.04+json']; + let accepts = ['application/vnd.dyspatch.2020.04+json', '*/*']; let returnType = [LocalizationMetaRead]; return this.apiClient.callApi( '/drafts/{draftId}/localizations', 'GET', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } /** - * Callback function to receive the result of the saveLocalization operation. - * @callback module:dyspatch-client/DraftsApi~saveLocalizationCallback - * @param {String} error Error message, if any. - * @param data This operation does not return a value. - * @param {String} response The complete HTTP response. + * Get localizations on a draft + * Returns localization metadata for the draft + * @param {String} draftId A draft ID + * @param {String} accept 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\" + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.} */ + getLocalizationForDraft(draftId, accept) { + return this.getLocalizationForDraftWithHttpInfo(draftId, accept) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + /** * Create or update a localization @@ -310,9 +338,9 @@ export default class DraftsApi { * @param {String} languageId A language ID (eg: en-US) * @param {String} accept 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\" * @param {module:dyspatch-client/InlineObject} inlineObject - * @param {module:dyspatch-client/DraftsApi~saveLocalizationCallback} callback The callback function, accepting three arguments: error, data, response + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - saveLocalization(draftId, languageId, accept, inlineObject, callback) { + saveLocalizationWithHttpInfo(draftId, languageId, accept, inlineObject) { let postBody = inlineObject; // verify the required parameter 'draftId' is set if (draftId === undefined || draftId === null) { @@ -345,22 +373,31 @@ export default class DraftsApi { let authNames = ['Bearer']; let contentTypes = ['application/json']; - let accepts = []; + let accepts = ['application/vnd.dyspatch.2020.04+json', '*/*']; let returnType = null; return this.apiClient.callApi( '/drafts/{draftId}/localizations/{languageId}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } /** - * Callback function to receive the result of the setTranslation operation. - * @callback module:dyspatch-client/DraftsApi~setTranslationCallback - * @param {String} error Error message, if any. - * @param data This operation does not return a value. - * @param {String} response The complete HTTP response. + * Create or update a localization + * Inserts a localization or sets the name on an existing localization that already uses the languageId + * @param {String} draftId A draft ID + * @param {String} languageId A language ID (eg: en-US) + * @param {String} accept 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\" + * @param {module:dyspatch-client/InlineObject} inlineObject + * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ + saveLocalization(draftId, languageId, accept, inlineObject) { + return this.saveLocalizationWithHttpInfo(draftId, languageId, accept, inlineObject) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + /** * Set translations for language @@ -369,9 +406,9 @@ export default class DraftsApi { * @param {String} languageId A language ID (eg: en-US) * @param {String} accept 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\" * @param {Object.} requestBody - * @param {module:dyspatch-client/DraftsApi~setTranslationCallback} callback The callback function, accepting three arguments: error, data, response + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - setTranslation(draftId, languageId, accept, requestBody, callback) { + setTranslationWithHttpInfo(draftId, languageId, accept, requestBody) { let postBody = requestBody; // verify the required parameter 'draftId' is set if (draftId === undefined || draftId === null) { @@ -404,31 +441,40 @@ export default class DraftsApi { let authNames = ['Bearer']; let contentTypes = ['application/json']; - let accepts = ['*/*']; + let accepts = ['application/vnd.dyspatch.2020.04+json', '*/*']; let returnType = null; return this.apiClient.callApi( '/drafts/{draftId}/localizations/{languageId}/translations', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } /** - * Callback function to receive the result of the submitDraftForApproval operation. - * @callback module:dyspatch-client/DraftsApi~submitDraftForApprovalCallback - * @param {String} error Error message, if any. - * @param data This operation does not return a value. - * @param {String} response The complete HTTP response. + * Set translations for language + * 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`. + * @param {String} draftId A draft ID + * @param {String} languageId A language ID (eg: en-US) + * @param {String} accept 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\" + * @param {Object.} requestBody + * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ + setTranslation(draftId, languageId, accept, requestBody) { + return this.setTranslationWithHttpInfo(draftId, languageId, accept, requestBody) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + /** * Submit the draft for approval * Moves the draft into submitted state. * @param {String} draftId A draft ID * @param {String} accept 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\" - * @param {module:dyspatch-client/DraftsApi~submitDraftForApprovalCallback} callback The callback function, accepting three arguments: error, data, response + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - submitDraftForApproval(draftId, accept, callback) { + submitDraftForApprovalWithHttpInfo(draftId, accept) { let postBody = null; // verify the required parameter 'draftId' is set if (draftId === undefined || draftId === null) { @@ -452,14 +498,28 @@ export default class DraftsApi { let authNames = ['Bearer']; let contentTypes = []; - let accepts = ['*/*']; + let accepts = ['application/vnd.dyspatch.2020.04+json', '*/*']; let returnType = null; return this.apiClient.callApi( '/drafts/{draftId}/publishRequest', 'POST', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } + /** + * Submit the draft for approval + * Moves the draft into submitted state. + * @param {String} draftId A draft ID + * @param {String} accept 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\" + * @return {Promise} a {@link https://www.promisejs.org/|Promise} + */ + submitDraftForApproval(draftId, accept) { + return this.submitDraftForApprovalWithHttpInfo(draftId, accept) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + } diff --git a/src/dyspatch-client/DraftsRead.js b/src/dyspatch-client/DraftsRead.js index 6d38bf1..b379d83 100644 --- a/src/dyspatch-client/DraftsRead.js +++ b/src/dyspatch-client/DraftsRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -18,7 +18,7 @@ import DraftMetaRead from './DraftMetaRead'; /** * The DraftsRead model module. * @module dyspatch-client/DraftsRead - * @version 5.0.0 + * @version 5.0.1 */ class DraftsRead { /** diff --git a/src/dyspatch-client/InlineObject.js b/src/dyspatch-client/InlineObject.js index 0f94859..07fd639 100644 --- a/src/dyspatch-client/InlineObject.js +++ b/src/dyspatch-client/InlineObject.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The InlineObject model module. * @module dyspatch-client/InlineObject - * @version 5.0.0 + * @version 5.0.1 */ class InlineObject { /** diff --git a/src/dyspatch-client/LocalizationKeyRead.js b/src/dyspatch-client/LocalizationKeyRead.js index 109d3db..f38dc92 100644 --- a/src/dyspatch-client/LocalizationKeyRead.js +++ b/src/dyspatch-client/LocalizationKeyRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The LocalizationKeyRead model module. * @module dyspatch-client/LocalizationKeyRead - * @version 5.0.0 + * @version 5.0.1 */ class LocalizationKeyRead { /** diff --git a/src/dyspatch-client/LocalizationMetaRead.js b/src/dyspatch-client/LocalizationMetaRead.js index 13fed16..cdedfa0 100644 --- a/src/dyspatch-client/LocalizationMetaRead.js +++ b/src/dyspatch-client/LocalizationMetaRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -16,7 +16,7 @@ import ApiClient from '../ApiClient'; /** * The LocalizationMetaRead model module. * @module dyspatch-client/LocalizationMetaRead - * @version 5.0.0 + * @version 5.0.1 */ class LocalizationMetaRead { /** diff --git a/src/dyspatch-client/LocalizationRead.js b/src/dyspatch-client/LocalizationRead.js index 5148e54..59acdb1 100644 --- a/src/dyspatch-client/LocalizationRead.js +++ b/src/dyspatch-client/LocalizationRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -17,7 +17,7 @@ import CompiledRead from './CompiledRead'; /** * The LocalizationRead model module. * @module dyspatch-client/LocalizationRead - * @version 5.0.0 + * @version 5.0.1 */ class LocalizationRead { /** diff --git a/src/dyspatch-client/LocalizationsApi.js b/src/dyspatch-client/LocalizationsApi.js index c70ab5f..f77eb14 100644 --- a/src/dyspatch-client/LocalizationsApi.js +++ b/src/dyspatch-client/LocalizationsApi.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -19,7 +19,7 @@ import LocalizationRead from '../dyspatch-client/LocalizationRead'; /** * Localizations service. * @module dyspatch-client/LocalizationsApi -* @version 5.0.0 +* @version 5.0.1 */ export default class LocalizationsApi { @@ -33,26 +33,18 @@ export default class LocalizationsApi { constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; } +dfkajsldfjasldkjfaslkdjflaskjdflksajdlfkjs - /** - * Callback function to receive the result of the getLocalizationById operation. - * @callback module:dyspatch-client/LocalizationsApi~getLocalizationByIdCallback - * @param {String} error Error message, if any. - * @param {module:dyspatch-client/LocalizationRead} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - /** * Get Localization Object by ID * Returns a specific localization object with a matching ID * @param {String} localizationId A localization ID * @param {module:dyspatch-client/String} targetLanguage The type of templating language to compile as. Should only be used for visual templates. * @param {String} accept 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\" - * @param {module:dyspatch-client/LocalizationsApi~getLocalizationByIdCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {@link module:dyspatch-client/LocalizationRead} + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:dyspatch-client/LocalizationRead} and HTTP response */ - getLocalizationById(localizationId, targetLanguage, accept, callback) { + getLocalizationByIdWithHttpInfo(localizationId, targetLanguage, accept) { let postBody = null; // verify the required parameter 'localizationId' is set if (localizationId === undefined || localizationId === null) { @@ -86,9 +78,24 @@ export default class LocalizationsApi { return this.apiClient.callApi( '/localizations/{localizationId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } + /** + * Get Localization Object by ID + * Returns a specific localization object with a matching ID + * @param {String} localizationId A localization ID + * @param {module:dyspatch-client/String} targetLanguage The type of templating language to compile as. Should only be used for visual templates. + * @param {String} accept 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\" + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:dyspatch-client/LocalizationRead} + */ + getLocalizationById(localizationId, targetLanguage, accept) { + return this.getLocalizationByIdWithHttpInfo(localizationId, targetLanguage, accept) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + } diff --git a/src/dyspatch-client/TemplateMetaRead.js b/src/dyspatch-client/TemplateMetaRead.js index d715ab3..6550207 100644 --- a/src/dyspatch-client/TemplateMetaRead.js +++ b/src/dyspatch-client/TemplateMetaRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -17,7 +17,7 @@ import LocalizationMetaRead from './LocalizationMetaRead'; /** * The TemplateMetaRead model module. * @module dyspatch-client/TemplateMetaRead - * @version 5.0.0 + * @version 5.0.1 */ class TemplateMetaRead { /** diff --git a/src/dyspatch-client/TemplateRead.js b/src/dyspatch-client/TemplateRead.js index 906dce9..4a8a8de 100644 --- a/src/dyspatch-client/TemplateRead.js +++ b/src/dyspatch-client/TemplateRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -18,7 +18,7 @@ import LocalizationMetaRead from './LocalizationMetaRead'; /** * The TemplateRead model module. * @module dyspatch-client/TemplateRead - * @version 5.0.0 + * @version 5.0.1 */ class TemplateRead { /** diff --git a/src/dyspatch-client/TemplatesApi.js b/src/dyspatch-client/TemplatesApi.js index db0ed24..7eaeff6 100644 --- a/src/dyspatch-client/TemplatesApi.js +++ b/src/dyspatch-client/TemplatesApi.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -20,7 +20,7 @@ import TemplatesRead from '../dyspatch-client/TemplatesRead'; /** * Templates service. * @module dyspatch-client/TemplatesApi -* @version 5.0.0 +* @version 5.0.1 */ export default class TemplatesApi { @@ -34,26 +34,18 @@ export default class TemplatesApi { constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; } +dfkajsldfjasldkjfaslkdjflaskjdflksajdlfkjs - /** - * Callback function to receive the result of the getTemplateById operation. - * @callback module:dyspatch-client/TemplatesApi~getTemplateByIdCallback - * @param {String} error Error message, if any. - * @param {module:dyspatch-client/TemplateRead} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - /** * Get Template by ID * Gets a template object with the matching ID. If the template has published content the \"compiled\" field will contain the template . * @param {String} templateId A template ID * @param {module:dyspatch-client/String} targetLanguage The type of templating language to compile as. Should only be used for visual templates. * @param {String} accept 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\" - * @param {module:dyspatch-client/TemplatesApi~getTemplateByIdCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {@link module:dyspatch-client/TemplateRead} + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:dyspatch-client/TemplateRead} and HTTP response */ - getTemplateById(templateId, targetLanguage, accept, callback) { + getTemplateByIdWithHttpInfo(templateId, targetLanguage, accept) { let postBody = null; // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { @@ -87,17 +79,25 @@ export default class TemplatesApi { return this.apiClient.callApi( '/templates/{templateId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } /** - * Callback function to receive the result of the getTemplates operation. - * @callback module:dyspatch-client/TemplatesApi~getTemplatesCallback - * @param {String} error Error message, if any. - * @param {module:dyspatch-client/TemplatesRead} data The data returned by the service call. - * @param {String} response The complete HTTP response. + * Get Template by ID + * Gets a template object with the matching ID. If the template has published content the \"compiled\" field will contain the template . + * @param {String} templateId A template ID + * @param {module:dyspatch-client/String} targetLanguage The type of templating language to compile as. Should only be used for visual templates. + * @param {String} accept 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\" + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:dyspatch-client/TemplateRead} */ + getTemplateById(templateId, targetLanguage, accept) { + return this.getTemplateByIdWithHttpInfo(templateId, targetLanguage, accept) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + /** * List Templates @@ -105,10 +105,9 @@ export default class TemplatesApi { * @param {String} accept 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\" * @param {Object} opts Optional parameters * @param {String} opts.cursor A cursor value used to retrieve a specific page from a paginated result set. - * @param {module:dyspatch-client/TemplatesApi~getTemplatesCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {@link module:dyspatch-client/TemplatesRead} + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:dyspatch-client/TemplatesRead} and HTTP response */ - getTemplates(accept, opts, callback) { + getTemplatesWithHttpInfo(accept, opts) { opts = opts || {}; let postBody = null; // verify the required parameter 'accept' is set @@ -134,9 +133,24 @@ export default class TemplatesApi { return this.apiClient.callApi( '/templates', 'GET', pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, null, callback + authNames, contentTypes, accepts, returnType, null ); } + /** + * List Templates + * Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated. + * @param {String} accept 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\" + * @param {Object} opts Optional parameters + * @param {String} opts.cursor A cursor value used to retrieve a specific page from a paginated result set. + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:dyspatch-client/TemplatesRead} + */ + getTemplates(accept, opts) { + return this.getTemplatesWithHttpInfo(accept, opts) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + } diff --git a/src/dyspatch-client/TemplatesRead.js b/src/dyspatch-client/TemplatesRead.js index f7db90c..380fc40 100644 --- a/src/dyspatch-client/TemplatesRead.js +++ b/src/dyspatch-client/TemplatesRead.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -18,7 +18,7 @@ import TemplateMetaRead from './TemplateMetaRead'; /** * The TemplatesRead model module. * @module dyspatch-client/TemplatesRead - * @version 5.0.0 + * @version 5.0.1 */ class TemplatesRead { /** diff --git a/src/index.js b/src/index.js index 58fb73c..0a13491 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io @@ -32,7 +32,7 @@ import TemplatesApi from './dyspatch-client/TemplatesApi'; /** -* _IntroductionThe_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.
+* _IntroductionThe_Dyspatch_API_is_based_on_the_REST_paradigm_and_features_resource_based_URLs_with_standard_HTTP_responsecodes_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_onhow_to_implement_Dyspatch__API_Client_LibrariesDyspatch_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.
* The index module provides access to constructors for all the classes which comprise the public API. *

* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: @@ -60,7 +60,7 @@ import TemplatesApi from './dyspatch-client/TemplatesApi'; * *

* @module index -* @version 5.0.0 +* @version 5.0.1 */ export { /** diff --git a/test/api/DraftsApi.spec.js b/test/api/DraftsApi.spec.js index 14f9e90..6d98318 100644 --- a/test/api/DraftsApi.spec.js +++ b/test/api/DraftsApi.spec.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io diff --git a/test/api/LocalizationsApi.spec.js b/test/api/LocalizationsApi.spec.js index 736a8ec..2b55c7b 100644 --- a/test/api/LocalizationsApi.spec.js +++ b/test/api/LocalizationsApi.spec.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io diff --git a/test/api/TemplatesApi.spec.js b/test/api/TemplatesApi.spec.js index 3e1d7ea..9e53e8c 100644 --- a/test/api/TemplatesApi.spec.js +++ b/test/api/TemplatesApi.spec.js @@ -1,6 +1,6 @@ /** * Dyspatch API - * # 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) + * # 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) * * The version of the OpenAPI document: 2020.04 * Contact: support@dyspatch.io diff --git a/test/integration/integration.spec.js b/test/integration/integration.spec.js index 16f187b..6a4a88c 100644 --- a/test/integration/integration.spec.js +++ b/test/integration/integration.spec.js @@ -24,7 +24,7 @@ describe("Integration", () => { }); it("lists templates", done => { - templates.getTemplates(version, {}, (error, data) => { + templates.getTemplates(version, {}).then((data, error) => { if (error) { done(error); return; @@ -36,7 +36,7 @@ describe("Integration", () => { it("gets a single template", done => { const id = "tem_01de5teh6k59kya8q92mb01qzq" - templates.getTemplateById(id, "handlebars", version, (error, data) => { + templates.getTemplateById(id, "handlebars", version).then((data, error) => { if (error) { done(error); return; @@ -47,7 +47,7 @@ describe("Integration", () => { }); it("lists drafts", done => { - drafts.getDrafts(version, {}, (error, data) => { + drafts.getDrafts(version, {}).then((data, error) => { if (error) { done(error); return; @@ -59,7 +59,7 @@ describe("Integration", () => { it("gets a single draft", done => { const id = "tdft_01dxkwr0nevs5h2baa3n3dgktp" - drafts.getDraftById(id, "handlebars", version, (error, data) => { + drafts.getDraftById(id, "handlebars", version).then((data, error) => { if (error) { done(error); return;