Skip to content

Commit

Permalink
Merge pull request #7 from getdyspatch/new-generator
Browse files Browse the repository at this point in the history
New generator
  • Loading branch information
dlsteuer authored Jul 8, 2020
2 parents d11c17f + 3feac1b commit 79de2fd
Show file tree
Hide file tree
Showing 29 changed files with 421 additions and 282 deletions.
75 changes: 47 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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/<JAVASCRIPT_CLIENT_DIR>
```

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
Expand All @@ -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
Expand Down Expand Up @@ -94,28 +118,22 @@ 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"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//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);

```

Expand Down Expand Up @@ -165,3 +183,4 @@ Class | Method | HTTP request | Description
- **Type**: API key
- **API key parameter name**: Authorization
- **Location**: HTTP header

1 change: 0 additions & 1 deletion docs/DraftMetaRead.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
88 changes: 40 additions & 48 deletions docs/DraftsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions docs/LocalizationsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 10 additions & 12 deletions docs/TemplatesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 79de2fd

Please sign in to comment.