forked from loafle/openapi-generator-original
Merge pull request #2447 from wing328/js_update_sample
[Javascript] update Petstore sample
This commit is contained in:
commit
f80d6c9939
@ -1,69 +1,76 @@
|
|||||||
# swagger-petstore
|
# swagger-petstore
|
||||||
|
|
||||||
SwaggerPetstore - JavaScript client for swagger-petstore
|
SwaggerPetstore - JavaScript client for swagger-petstore
|
||||||
|
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||||
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||||
|
|
||||||
Version: 1.0.0
|
- API verion: 1.0.0
|
||||||
|
- Package version: 1.0.0
|
||||||
Automatically generated by the JavaScript Swagger Codegen project:
|
- Build date: 2016-03-24T19:50:42.301+08:00
|
||||||
|
|
||||||
- Build date: 2016-03-18T15:44:17.513Z
|
|
||||||
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
|
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Use in [Node.js](https://nodejs.org/)
|
### For [Node.js](https://nodejs.org/)
|
||||||
|
|
||||||
The generated client is valid [npm](https://www.npmjs.com/) package, you can publish it as described
|
#### npm
|
||||||
in [Publishing npm packages](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
|
||||||
|
|
||||||
After that, you can install it into your project via:
|
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
|
```shell
|
||||||
npm install swagger-petstore --save
|
npm install swagger-petstore --save
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also host the generated client as a git repository on github, e.g.
|
#### git
|
||||||
https://github.com/YOUR_USERNAME/swagger-petstore
|
#
|
||||||
|
If the library is hosted at a git repository, e.g.
|
||||||
Then you can install it via:
|
https://github.com/YOUR_USERNAME/YOUR_GIT_REPO_ID
|
||||||
|
then install it via:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
npm install YOUR_USERNAME/swagger-petstore --save
|
npm install YOUR_USERNAME/YOUR_GIT_REPO_ID --save
|
||||||
```
|
```
|
||||||
|
|
||||||
### Use in browser with [browserify](http://browserify.org/)
|
### For browser
|
||||||
|
|
||||||
The client also works in browser environment via npm and browserify. After following
|
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`,
|
the above steps with Node.js and installing browserify with `npm install -g browserify`,
|
||||||
you can do this in your project (assuming *main.js* is your entry file):
|
perform the following (assuming *main.js* is your entry file):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
browserify main.js > bundle.js
|
browserify main.js > bundle.js
|
||||||
```
|
```
|
||||||
|
|
||||||
The generated *bundle.js* can now be included in your HTML pages.
|
Then include *bundle.js* in the HTML pages.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
Please follow the [installation](#installation) instruction and execute the following JS code:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger-petstore');
|
var SwaggerPetstore = require('swagger-petstore');
|
||||||
|
|
||||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||||
defaultClient.timeout = 10 * 1000;
|
|
||||||
defaultClient.defaultHeaders['Test-Header'] = 'test_value';
|
|
||||||
|
|
||||||
// Assuming there's a `PetApi` containing a `getPetById` method
|
// Configure OAuth2 access token for authorization: petstore_auth
|
||||||
// which returns a model object:
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
var api = new SwaggerPetstore.PetApi();
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
api.getPetById(2, function(err, pet, resp) {
|
|
||||||
console.log('HTTP status code: ' + resp.status);
|
var api = new SwaggerPetstore.PetApi()
|
||||||
console.log('Response Content-Type: ' + resp.get('Content-Type'));
|
|
||||||
if (err) {
|
var opts = {
|
||||||
console.error(err);
|
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
|
||||||
} else {
|
};
|
||||||
console.log(pet);
|
api.addPet(opts).then(function() {
|
||||||
}
|
console.log('API called successfully.');
|
||||||
|
}, function(error) {
|
||||||
|
console.error(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# SwaggerPetstore.InlineResponse200
|
# SwaggerPetstore.InlineResponse200
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -4,5 +4,6 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**name** | **Integer** | | [optional]
|
**name** | **Integer** | | [optional]
|
||||||
|
**snakeCase** | **Integer** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# SwaggerPetstore.PetApi
|
# SwaggerPetstore.PetApi
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||||
@ -35,12 +34,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
|
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
|
||||||
};
|
};
|
||||||
api.addPet(opts).then(function() {
|
apiInstance.addPet(opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -84,12 +83,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'body': "B" // {String} Pet object in the form of byte array
|
'body': "B" // {String} Pet object in the form of byte array
|
||||||
};
|
};
|
||||||
api.addPetUsingByteArray(opts).then(function() {
|
apiInstance.addPetUsingByteArray(opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -133,14 +132,14 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var petId = 789; // {Integer} Pet id to delete
|
var petId = 789; // {Integer} Pet id to delete
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'apiKey': "apiKey_example" // {String}
|
'apiKey': "apiKey_example" // {String}
|
||||||
};
|
};
|
||||||
api.deletePet(petId, opts).then(function() {
|
apiInstance.deletePet(petId, opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -185,12 +184,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'status': ["available"] // {[String]} Status values that need to be considered for query
|
'status': ["available"] // {[String]} Status values that need to be considered for query
|
||||||
};
|
};
|
||||||
api.findPetsByStatus(opts).then(function(data) {
|
apiInstance.findPetsByStatus(opts).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -234,12 +233,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'tags': ["tags_example"] // {[String]} Tags to filter by
|
'tags': ["tags_example"] // {[String]} Tags to filter by
|
||||||
};
|
};
|
||||||
api.findPetsByTags(opts).then(function(data) {
|
apiInstance.findPetsByTags(opts).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -289,11 +288,11 @@ api_key.apiKey = "YOUR API KEY"
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||||
|
|
||||||
api.getPetById(petId).then(function(data) {
|
apiInstance.getPetById(petId).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -343,11 +342,11 @@ api_key.apiKey = "YOUR API KEY"
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||||
|
|
||||||
api.getPetByIdInObject(petId).then(function(data) {
|
apiInstance.getPetByIdInObject(petId).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -397,11 +396,11 @@ api_key.apiKey = "YOUR API KEY"
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||||
|
|
||||||
api.petPetIdtestingByteArraytrueGet(petId).then(function(data) {
|
apiInstance.petPetIdtestingByteArraytrueGet(petId).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -445,12 +444,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
|
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
|
||||||
};
|
};
|
||||||
api.updatePet(opts).then(function() {
|
apiInstance.updatePet(opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -494,7 +493,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var petId = "petId_example"; // {String} ID of pet that needs to be updated
|
var petId = "petId_example"; // {String} ID of pet that needs to be updated
|
||||||
|
|
||||||
@ -502,7 +501,7 @@ var opts = {
|
|||||||
'name': "name_example", // {String} Updated name of the pet
|
'name': "name_example", // {String} Updated name of the pet
|
||||||
'status': "status_example" // {String} Updated status of the pet
|
'status': "status_example" // {String} Updated status of the pet
|
||||||
};
|
};
|
||||||
api.updatePetWithForm(petId, opts).then(function() {
|
apiInstance.updatePetWithForm(petId, opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -548,7 +547,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
|||||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.PetApi()
|
var apiInstance = new SwaggerPetstore.PetApi()
|
||||||
|
|
||||||
var petId = 789; // {Integer} ID of pet to update
|
var petId = 789; // {Integer} ID of pet to update
|
||||||
|
|
||||||
@ -556,7 +555,7 @@ var opts = {
|
|||||||
'additionalMetadata': "additionalMetadata_example", // {String} Additional data to pass to server
|
'additionalMetadata': "additionalMetadata_example", // {String} Additional data to pass to server
|
||||||
'file': "/path/to/file.txt" // {File} file to upload
|
'file': "/path/to/file.txt" // {File} file to upload
|
||||||
};
|
};
|
||||||
api.uploadFile(petId, opts).then(function() {
|
apiInstance.uploadFile(petId, opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# SwaggerPetstore.StoreApi
|
# SwaggerPetstore.StoreApi
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||||
@ -25,11 +24,11 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or
|
|||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger-petstore');
|
var SwaggerPetstore = require('swagger-petstore');
|
||||||
|
|
||||||
var api = new SwaggerPetstore.StoreApi()
|
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||||
|
|
||||||
var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted
|
var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted
|
||||||
|
|
||||||
api.deleteOrder(orderId).then(function() {
|
apiInstance.deleteOrder(orderId).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -81,12 +80,12 @@ test_api_client_secret.apiKey = "YOUR API KEY"
|
|||||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
|
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.StoreApi()
|
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'status': "placed" // {String} Status value that needs to be considered for query
|
'status': "placed" // {String} Status value that needs to be considered for query
|
||||||
};
|
};
|
||||||
api.findOrdersByStatus(opts).then(function(data) {
|
apiInstance.findOrdersByStatus(opts).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -132,8 +131,8 @@ api_key.apiKey = "YOUR API KEY"
|
|||||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.StoreApi()
|
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||||
api.getInventory().then(function(data) {
|
apiInstance.getInventory().then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -176,8 +175,8 @@ api_key.apiKey = "YOUR API KEY"
|
|||||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.StoreApi()
|
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||||
api.getInventoryInObject().then(function(data) {
|
apiInstance.getInventoryInObject().then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -226,11 +225,11 @@ test_api_key_query.apiKey = "YOUR API KEY"
|
|||||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
|
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.StoreApi()
|
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||||
|
|
||||||
var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched
|
var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched
|
||||||
|
|
||||||
api.getOrderById(orderId).then(function(data) {
|
apiInstance.getOrderById(orderId).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -282,12 +281,12 @@ test_api_client_secret.apiKey = "YOUR API KEY"
|
|||||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
|
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
|
||||||
|
|
||||||
var api = new SwaggerPetstore.StoreApi()
|
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet
|
'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet
|
||||||
};
|
};
|
||||||
api.placeOrder(opts).then(function(data) {
|
apiInstance.placeOrder(opts).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -26,12 +26,12 @@ This can only be done by the logged in user.
|
|||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger-petstore');
|
var SwaggerPetstore = require('swagger-petstore');
|
||||||
|
|
||||||
var api = new SwaggerPetstore.UserApi()
|
var apiInstance = new SwaggerPetstore.UserApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'body': new SwaggerPetstore.User() // {User} Created user object
|
'body': new SwaggerPetstore.User() // {User} Created user object
|
||||||
};
|
};
|
||||||
api.createUser(opts).then(function() {
|
apiInstance.createUser(opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -70,12 +70,12 @@ Creates list of users with given input array
|
|||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger-petstore');
|
var SwaggerPetstore = require('swagger-petstore');
|
||||||
|
|
||||||
var api = new SwaggerPetstore.UserApi()
|
var apiInstance = new SwaggerPetstore.UserApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'body': [new SwaggerPetstore.User()] // {[User]} List of user object
|
'body': [new SwaggerPetstore.User()] // {[User]} List of user object
|
||||||
};
|
};
|
||||||
api.createUsersWithArrayInput(opts).then(function() {
|
apiInstance.createUsersWithArrayInput(opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -114,12 +114,12 @@ Creates list of users with given input array
|
|||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger-petstore');
|
var SwaggerPetstore = require('swagger-petstore');
|
||||||
|
|
||||||
var api = new SwaggerPetstore.UserApi()
|
var apiInstance = new SwaggerPetstore.UserApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'body': [new SwaggerPetstore.User()] // {[User]} List of user object
|
'body': [new SwaggerPetstore.User()] // {[User]} List of user object
|
||||||
};
|
};
|
||||||
api.createUsersWithListInput(opts).then(function() {
|
apiInstance.createUsersWithListInput(opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -164,11 +164,11 @@ var test_http_basic = defaultClient.authentications['test_http_basic'];
|
|||||||
test_http_basic.username = 'YOUR USERNAME'
|
test_http_basic.username = 'YOUR USERNAME'
|
||||||
test_http_basic.password = 'YOUR PASSWORD'
|
test_http_basic.password = 'YOUR PASSWORD'
|
||||||
|
|
||||||
var api = new SwaggerPetstore.UserApi()
|
var apiInstance = new SwaggerPetstore.UserApi()
|
||||||
|
|
||||||
var username = "username_example"; // {String} The name that needs to be deleted
|
var username = "username_example"; // {String} The name that needs to be deleted
|
||||||
|
|
||||||
api.deleteUser(username).then(function() {
|
apiInstance.deleteUser(username).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -207,11 +207,11 @@ Get user by user name
|
|||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger-petstore');
|
var SwaggerPetstore = require('swagger-petstore');
|
||||||
|
|
||||||
var api = new SwaggerPetstore.UserApi()
|
var apiInstance = new SwaggerPetstore.UserApi()
|
||||||
|
|
||||||
var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing.
|
var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
api.getUserByName(username).then(function(data) {
|
apiInstance.getUserByName(username).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -250,13 +250,13 @@ Logs user into the system
|
|||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger-petstore');
|
var SwaggerPetstore = require('swagger-petstore');
|
||||||
|
|
||||||
var api = new SwaggerPetstore.UserApi()
|
var apiInstance = new SwaggerPetstore.UserApi()
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'username': "username_example", // {String} The user name for login
|
'username': "username_example", // {String} The user name for login
|
||||||
'password': "password_example" // {String} The password for login in clear text
|
'password': "password_example" // {String} The password for login in clear text
|
||||||
};
|
};
|
||||||
api.loginUser(opts).then(function(data) {
|
apiInstance.loginUser(opts).then(function(data) {
|
||||||
console.log('API called successfully. Returned data: ' + data);
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -296,8 +296,8 @@ Logs out current logged in user session
|
|||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger-petstore');
|
var SwaggerPetstore = require('swagger-petstore');
|
||||||
|
|
||||||
var api = new SwaggerPetstore.UserApi()
|
var apiInstance = new SwaggerPetstore.UserApi()
|
||||||
api.logoutUser().then(function() {
|
apiInstance.logoutUser().then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -333,14 +333,14 @@ This can only be done by the logged in user.
|
|||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger-petstore');
|
var SwaggerPetstore = require('swagger-petstore');
|
||||||
|
|
||||||
var api = new SwaggerPetstore.UserApi()
|
var apiInstance = new SwaggerPetstore.UserApi()
|
||||||
|
|
||||||
var username = "username_example"; // {String} name that need to be deleted
|
var username = "username_example"; // {String} name that need to be deleted
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
'body': new SwaggerPetstore.User() // {User} Updated user object
|
'body': new SwaggerPetstore.User() // {User} Updated user object
|
||||||
};
|
};
|
||||||
api.updateUser(username, opts).then(function() {
|
apiInstance.updateUser(username, opts).then(function() {
|
||||||
console.log('API called successfully.');
|
console.log('API called successfully.');
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* Constructs a new PetApi.
|
* Constructs a new PetApi.
|
||||||
* @alias module:api/PetApi
|
* @alias module:api/PetApi
|
||||||
* @class
|
* @class
|
||||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
||||||
* if unspecified.
|
* if unspecified.
|
||||||
*/
|
*/
|
||||||
var exports = function(apiClient) {
|
var exports = function(apiClient) {
|
||||||
@ -144,7 +144,7 @@
|
|||||||
* Finds Pets by status
|
* Finds Pets by status
|
||||||
* Multiple status values can be provided with comma separated strings
|
* Multiple status values can be provided with comma separated strings
|
||||||
* @param {Object} opts Optional parameters
|
* @param {Object} opts Optional parameters
|
||||||
* @param {Array.<String>} opts.status Status values that need to be considered for query
|
* @param {Array.<String>} opts.status Status values that need to be considered for query (default to available)
|
||||||
* data is of type: {Array.<module:model/Pet>}
|
* data is of type: {Array.<module:model/Pet>}
|
||||||
*/
|
*/
|
||||||
this.findPetsByStatus = function(opts) {
|
this.findPetsByStatus = function(opts) {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* Constructs a new StoreApi.
|
* Constructs a new StoreApi.
|
||||||
* @alias module:api/StoreApi
|
* @alias module:api/StoreApi
|
||||||
* @class
|
* @class
|
||||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
||||||
* if unspecified.
|
* if unspecified.
|
||||||
*/
|
*/
|
||||||
var exports = function(apiClient) {
|
var exports = function(apiClient) {
|
||||||
@ -40,11 +40,6 @@
|
|||||||
*/
|
*/
|
||||||
this.deleteOrder = function(orderId) {
|
this.deleteOrder = function(orderId) {
|
||||||
var postBody = null;
|
var postBody = null;
|
||||||
// verify the required parameter 'orderId' is set
|
|
||||||
if (orderId == null) {
|
|
||||||
throw "Missing the required parameter 'orderId' when calling deleteOrder";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// verify the required parameter 'orderId' is set
|
// verify the required parameter 'orderId' is set
|
||||||
if (orderId == undefined || orderId == null) {
|
if (orderId == undefined || orderId == null) {
|
||||||
@ -79,7 +74,7 @@
|
|||||||
* Finds orders by status
|
* Finds orders by status
|
||||||
* A single status value can be provided as a string
|
* A single status value can be provided as a string
|
||||||
* @param {Object} opts Optional parameters
|
* @param {Object} opts Optional parameters
|
||||||
* @param {module:model/String} opts.status Status value that needs to be considered for query
|
* @param {module:model/String} opts.status Status value that needs to be considered for query (default to placed)
|
||||||
* data is of type: {Array.<module:model/Order>}
|
* data is of type: {Array.<module:model/Order>}
|
||||||
*/
|
*/
|
||||||
this.findOrdersByStatus = function(opts) {
|
this.findOrdersByStatus = function(opts) {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* Constructs a new UserApi.
|
* Constructs a new UserApi.
|
||||||
* @alias module:api/UserApi
|
* @alias module:api/UserApi
|
||||||
* @class
|
* @class
|
||||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
||||||
* if unspecified.
|
* if unspecified.
|
||||||
*/
|
*/
|
||||||
var exports = function(apiClient) {
|
var exports = function(apiClient) {
|
||||||
@ -139,11 +139,6 @@
|
|||||||
*/
|
*/
|
||||||
this.deleteUser = function(username) {
|
this.deleteUser = function(username) {
|
||||||
var postBody = null;
|
var postBody = null;
|
||||||
// verify the required parameter 'username' is set
|
|
||||||
if (username == null) {
|
|
||||||
throw "Missing the required parameter 'username' when calling deleteUser";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// verify the required parameter 'username' is set
|
// verify the required parameter 'username' is set
|
||||||
if (username == undefined || username == null) {
|
if (username == undefined || username == null) {
|
||||||
@ -182,11 +177,6 @@
|
|||||||
*/
|
*/
|
||||||
this.getUserByName = function(username) {
|
this.getUserByName = function(username) {
|
||||||
var postBody = null;
|
var postBody = null;
|
||||||
// verify the required parameter 'username' is set
|
|
||||||
if (username == null) {
|
|
||||||
throw "Missing the required parameter 'username' when calling getUserByName";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// verify the required parameter 'username' is set
|
// verify the required parameter 'username' is set
|
||||||
if (username == undefined || username == null) {
|
if (username == undefined || username == null) {
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
var exports = function() {
|
var exports = function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,6 +46,9 @@
|
|||||||
if (data.hasOwnProperty('name')) {
|
if (data.hasOwnProperty('name')) {
|
||||||
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||||
}
|
}
|
||||||
|
if (data.hasOwnProperty('snake_case')) {
|
||||||
|
obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Integer');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -55,6 +59,11 @@
|
|||||||
*/
|
*/
|
||||||
exports.prototype['name'] = undefined;
|
exports.prototype['name'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {Integer} snake_case
|
||||||
|
*/
|
||||||
|
exports.prototype['snake_case'] = undefined;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
|
|||||||
|
|
||||||
- API verion: 1.0.0
|
- API verion: 1.0.0
|
||||||
- Package version: 1.0.0
|
- Package version: 1.0.0
|
||||||
- Build date: 2016-03-18T18:26:17.121+08:00
|
- Build date: 2016-03-24T19:50:27.240+08:00
|
||||||
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
|
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
@ -4,5 +4,6 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**name** | **Integer** | | [optional]
|
**name** | **Integer** | | [optional]
|
||||||
|
**snakeCase** | **Integer** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,11 +25,7 @@
|
|||||||
* Constructs a new PetApi.
|
* Constructs a new PetApi.
|
||||||
* @alias module:api/PetApi
|
* @alias module:api/PetApi
|
||||||
* @class
|
* @class
|
||||||
<<<<<<< HEAD
|
|
||||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
|
||||||
=======
|
|
||||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
||||||
>>>>>>> update js doc
|
|
||||||
* if unspecified.
|
* if unspecified.
|
||||||
*/
|
*/
|
||||||
var exports = function(apiClient) {
|
var exports = function(apiClient) {
|
||||||
@ -179,11 +175,7 @@
|
|||||||
* Finds Pets by status
|
* Finds Pets by status
|
||||||
* Multiple status values can be provided with comma separated strings
|
* Multiple status values can be provided with comma separated strings
|
||||||
* @param {Object} opts Optional parameters
|
* @param {Object} opts Optional parameters
|
||||||
<<<<<<< HEAD
|
|
||||||
* @param {Array.<String>} opts.status Status values that need to be considered for query
|
|
||||||
=======
|
|
||||||
* @param {Array.<String>} opts.status Status values that need to be considered for query (default to available)
|
* @param {Array.<String>} opts.status Status values that need to be considered for query (default to available)
|
||||||
>>>>>>> update js doc
|
|
||||||
* @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response
|
* @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response
|
||||||
* data is of type: {Array.<module:model/Pet>}
|
* data is of type: {Array.<module:model/Pet>}
|
||||||
*/
|
*/
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
var exports = function() {
|
var exports = function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,6 +46,9 @@
|
|||||||
if (data.hasOwnProperty('name')) {
|
if (data.hasOwnProperty('name')) {
|
||||||
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||||
}
|
}
|
||||||
|
if (data.hasOwnProperty('snake_case')) {
|
||||||
|
obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Integer');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -55,6 +59,11 @@
|
|||||||
*/
|
*/
|
||||||
exports.prototype['name'] = undefined;
|
exports.prototype['name'] = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @member {Integer} snake_case
|
||||||
|
*/
|
||||||
|
exports.prototype['snake_case'] = undefined;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user