Skip to content

Latest commit

 

History

History
448 lines (300 loc) · 15.7 KB

DraftsApi.md

File metadata and controls

448 lines (300 loc) · 15.7 KB

DyspatchClient.DraftsApi

All URIs are relative to https://api.dyspatch.io

Method HTTP request Description
deleteLocalization DELETE /drafts/{draftId}/localizations/{languageId} Remove a localization
getDraftById GET /drafts/{draftId} Get Draft by ID
getDraftLocalizationKeys GET /drafts/{draftId}/localizationKeys Get localization keys
getDrafts GET /drafts List Drafts
getLocalizationForDraft GET /drafts/{draftId}/localizations Get localizations on a draft
saveLocalization PUT /drafts/{draftId}/localizations/{languageId} Create or update a localization
setTranslation PUT /drafts/{draftId}/localizations/{languageId}/translations Set translations for language
submitDraftForApproval POST /drafts/{draftId}/publishRequest Submit the draft for approval

deleteLocalization

deleteLocalization(draftId, languageId, accept)

Remove a localization

Deletes the localization with the given language ID if it exists

Example

import DyspatchClient from 'dyspatch-client';
let defaultClient = DyspatchClient.ApiClient.instance;
// Configure API key authorization: Bearer
let Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix = 'Token';

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.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
apiInstance.deleteLocalization(draftId, languageId, accept).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
draftId String A draft ID
languageId String A language ID (eg: en-US)
accept String A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json"

Return type

null (empty response body)

Authorization

Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

getDraftById

DraftRead getDraftById(draftId, targetLanguage, accept)

Get Draft by ID

Gets a draft object with the matching ID. The "compiled" field will contain the template in the default, unlocalized form.

Example

import DyspatchClient from 'dyspatch-client';
let defaultClient = DyspatchClient.ApiClient.instance;
// Configure API key authorization: Bearer
let Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix = 'Token';

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.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
apiInstance.getDraftById(draftId, targetLanguage, accept).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
draftId String A draft ID
targetLanguage String The type of templating language to compile as. Should only be used for visual templates.
accept String A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json"

Return type

DraftRead

Authorization

Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.dyspatch.2020.11+json, /

getDraftLocalizationKeys

[LocalizationKeyRead] getDraftLocalizationKeys(draftId, accept)

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.11+json` to get a JSON object, or `text/vnd.dyspatch.2020.11+x-gettext-translation` to get the POT file.

Example

import DyspatchClient from 'dyspatch-client';
let defaultClient = DyspatchClient.ApiClient.instance;
// Configure API key authorization: Bearer
let Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix = 'Token';

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.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
apiInstance.getDraftLocalizationKeys(draftId, accept).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
draftId String A draft ID
accept String A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json"

Return type

[LocalizationKeyRead]

Authorization

Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.dyspatch.2020.11+json, text/vnd.dyspatch.2020.11+x-gettext-translation

getDrafts

DraftsRead getDrafts(accept, opts)

List Drafts

Returns all drafts for your organization.

Example

import DyspatchClient from 'dyspatch-client';
let defaultClient = DyspatchClient.ApiClient.instance;
// Configure API key authorization: Bearer
let Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix = 'Token';

let apiInstance = new DyspatchClient.DraftsApi();
let accept = "accept_example"; // String | A version of the API that should be used for the request. For example, to use version \"2020.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
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).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
accept String A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json"
cursor String A cursor value used to retrieve a specific page from a paginated result set. [optional]
status String Filter the list of drafts by a particular status [optional]

Return type

DraftsRead

Authorization

Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.dyspatch.2020.11+json, /

getLocalizationForDraft

[LocalizationMetaRead] getLocalizationForDraft(draftId, accept)

Get localizations on a draft

Returns localization metadata for the draft

Example

import DyspatchClient from 'dyspatch-client';
let defaultClient = DyspatchClient.ApiClient.instance;
// Configure API key authorization: Bearer
let Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix = 'Token';

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.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
apiInstance.getLocalizationForDraft(draftId, accept).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
draftId String A draft ID
accept String A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json"

Return type

[LocalizationMetaRead]

Authorization

Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.dyspatch.2020.11+json

saveLocalization

saveLocalization(draftId, languageId, accept, inlineObject)

Create or update a localization

Inserts a localization or sets the name on an existing localization that already uses the languageId

Example

import DyspatchClient from 'dyspatch-client';
let defaultClient = DyspatchClient.ApiClient.instance;
// Configure API key authorization: Bearer
let Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix = 'Token';

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.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
let inlineObject = new DyspatchClient.InlineObject(); // InlineObject | 
apiInstance.saveLocalization(draftId, languageId, accept, inlineObject).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
draftId String A draft ID
languageId String A language ID (eg: en-US)
accept String A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json"
inlineObject InlineObject

Return type

null (empty response body)

Authorization

Bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

setTranslation

setTranslation(draftId, languageId, accept, requestBody)

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`.

Example

import DyspatchClient from 'dyspatch-client';
let defaultClient = DyspatchClient.ApiClient.instance;
// Configure API key authorization: Bearer
let Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix = 'Token';

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.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
let requestBody = {key: "null"}; // {String: String} | 
apiInstance.setTranslation(draftId, languageId, accept, requestBody).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
draftId String A draft ID
languageId String A language ID (eg: en-US)
accept String A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json"
requestBody {String: String}

Return type

null (empty response body)

Authorization

Bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: /

submitDraftForApproval

submitDraftForApproval(draftId, accept)

Submit the draft for approval

Moves the draft into submitted state.

Example

import DyspatchClient from 'dyspatch-client';
let defaultClient = DyspatchClient.ApiClient.instance;
// Configure API key authorization: Bearer
let Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix = 'Token';

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.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
apiInstance.submitDraftForApproval(draftId, accept).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
draftId String A draft ID
accept String A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json"

Return type

null (empty response body)

Authorization

Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: /