Skip to content

Commit

Permalink
new generator
Browse files Browse the repository at this point in the history
  • Loading branch information
dlsteuer committed Jul 7, 2020
1 parent d11c17f commit c9620fb
Show file tree
Hide file tree
Showing 25 changed files with 127 additions and 57 deletions.
65 changes: 43 additions & 22 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)
- 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,24 @@ 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 targetLanguage = "targetLanguage_example"; // {String} The type of templating language to compile as. Should only be used for visual templates.


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\"
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
console.log('API called successfully.');
}
};
api.draftsDraftIdGet(draftId, targetLanguage, callback);
api.deleteLocalization(draftId, languageId, accept, callback);

```

Expand Down Expand Up @@ -165,3 +185,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
58 changes: 58 additions & 0 deletions git_push.sh
Original file line number Diff line number Diff line change
@@ -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'

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
"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": {
Expand Down
7 changes: 4 additions & 3 deletions src/ApiClient.js
Original file line number Diff line number Diff line change
@@ -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: [email protected]
Expand Down Expand Up @@ -405,8 +405,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') {
Expand All @@ -424,6 +422,9 @@ class ApiClient {
}
}
} else if (bodyParam !== null && bodyParam !== undefined) {
if (!request.header['Content-Type']) {
request.type('application/json');
}
request.send(bodyParam);
}

Expand Down
2 changes: 1 addition & 1 deletion src/dyspatch-client/APIError.js
Original file line number Diff line number Diff line change
@@ -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: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion src/dyspatch-client/CompiledRead.js
Original file line number Diff line number Diff line change
@@ -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: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion src/dyspatch-client/Cursor.js
Original file line number Diff line number Diff line change
@@ -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: [email protected]
Expand Down
11 changes: 1 addition & 10 deletions src/dyspatch-client/DraftMetaRead.js
Original file line number Diff line number Diff line change
@@ -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: [email protected]
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit c9620fb

Please sign in to comment.