forked from loafle/openapi-generator-original
Merge pull request #2411 from demonfiddler/master
[JavaScript] Recommission integration tests for Issue#2258.
This commit is contained in:
commit
b65d444498
@ -6,7 +6,7 @@ Version: 1.0.0
|
||||
|
||||
Automatically generated by the JavaScript Swagger Codegen project:
|
||||
|
||||
- Build date: 2016-03-17T16:01:50.137+08:00
|
||||
- Build date: 2016-03-18T15:44:17.513Z
|
||||
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
|
||||
|
||||
## Installation
|
||||
@ -116,25 +116,10 @@ Class | Method | HTTP request | Description
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
### test_api_client_id
|
||||
### test_api_key_header
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
### test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
|
||||
### api_key
|
||||
@ -147,15 +132,30 @@ Class | Method | HTTP request | Description
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
### test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **Location**: HTTP header
|
||||
|
||||
### test_api_client_id
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
### test_api_key_query
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_query
|
||||
- **Location**: URL query string
|
||||
|
||||
### test_api_key_header
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
|
@ -1,13 +1,14 @@
|
||||
|
||||
# SwaggerPetstore.InlineResponse200
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**photoUrls** | **[String]** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**tags** | [**[Tag]**](Tag.md) | | [optional]
|
||||
**id** | **Integer** | |
|
||||
**category** | **Object** | | [optional]
|
||||
**tags** | [**[Tag]**](Tag.md) | | [optional]
|
||||
**status** | **String** | pet status in the store | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**photoUrls** | **[String]** | | [optional]
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
# SwaggerPetstore.PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
@ -278,16 +279,16 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
var api_key = defaultClient.authentications['api_key'];
|
||||
api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
@ -312,7 +313,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@ -332,16 +333,16 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
var api_key = defaultClient.authentications['api_key'];
|
||||
api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
@ -366,7 +367,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@ -386,16 +387,16 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
var api_key = defaultClient.authentications['api_key'];
|
||||
api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
@ -420,7 +421,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
# SwaggerPetstore.StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
@ -213,18 +214,18 @@ For valid response try integer IDs with value <= 5 or > 10. Other values w
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure API key authorization: test_api_key_query
|
||||
var test_api_key_query = defaultClient.authentications['test_api_key_query'];
|
||||
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)
|
||||
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
|
||||
|
||||
// Configure API key authorization: test_api_key_header
|
||||
var test_api_key_header = defaultClient.authentications['test_api_key_header'];
|
||||
test_api_key_header.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//test_api_key_header.apiKeyPrefix['test_api_key_header'] = "Token"
|
||||
|
||||
// Configure API key authorization: test_api_key_query
|
||||
var test_api_key_query = defaultClient.authentications['test_api_key_query'];
|
||||
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)
|
||||
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
|
||||
|
||||
var api = new SwaggerPetstore.StoreApi()
|
||||
|
||||
var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched
|
||||
@ -249,7 +250,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header)
|
||||
[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
|
@ -15,50 +15,78 @@
|
||||
}(this, function(superagent) {
|
||||
'use strict';
|
||||
|
||||
var ApiClient = function ApiClient() {
|
||||
/**
|
||||
* The base path to put in front of every API call's (relative) path.
|
||||
* @module ApiClient
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
|
||||
* application to use this class directly - the *Api and model classes provide the public API for the service. The
|
||||
* contents of this file should be regarded as internal but are documented for completeness.
|
||||
* @alias module:ApiClient
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
/**
|
||||
* The base URL against which to resolve every API call's (relative) path.
|
||||
* @type {String}
|
||||
* @default http://petstore.swagger.io/v2
|
||||
*/
|
||||
this.basePath = 'http://petstore.swagger.io/v2'.replace(/\/+$/, '');
|
||||
|
||||
/**
|
||||
* The authentication methods to be included for all API calls.
|
||||
* @type {Array.<String>}
|
||||
*/
|
||||
this.authentications = {
|
||||
'petstore_auth': {type: 'oauth2'},
|
||||
'test_api_client_id': {type: 'apiKey', in: 'header', name: 'x-test_api_client_id'},
|
||||
'test_api_client_secret': {type: 'apiKey', in: 'header', name: 'x-test_api_client_secret'},
|
||||
'api_key': {type: 'apiKey', in: 'header', name: 'api_key'},
|
||||
'test_api_key_header': {type: 'apiKey', 'in': 'header', name: 'test_api_key_header'},
|
||||
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||
'test_http_basic': {type: 'basic'},
|
||||
'test_api_key_query': {type: 'apiKey', in: 'query', name: 'test_api_key_query'},
|
||||
'test_api_key_header': {type: 'apiKey', in: 'header', name: 'test_api_key_header'}
|
||||
'test_api_client_secret': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_secret'},
|
||||
'test_api_client_id': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_id'},
|
||||
'test_api_key_query': {type: 'apiKey', 'in': 'query', name: 'test_api_key_query'},
|
||||
'petstore_auth': {type: 'oauth2'}
|
||||
};
|
||||
|
||||
/**
|
||||
* The default HTTP headers to be included for all API calls.
|
||||
* @type {Array.<String>}
|
||||
* @default {}
|
||||
*/
|
||||
this.defaultHeaders = {};
|
||||
|
||||
/**
|
||||
* The default HTTP timeout for all API calls.
|
||||
* @type {Number}
|
||||
* @default 60000
|
||||
*/
|
||||
this.timeout = 60000;
|
||||
};
|
||||
|
||||
ApiClient.prototype.paramToString = function paramToString(param) {
|
||||
if (param == null) {
|
||||
// return empty string for null and undefined
|
||||
/**
|
||||
* Returns a string representation for an actual parameter.
|
||||
* @param param The actual parameter.
|
||||
* @returns {String} The string representation of <code>param</code>.
|
||||
*/
|
||||
exports.prototype.paramToString = function(param) {
|
||||
if (param == undefined || param == null) {
|
||||
return '';
|
||||
} else if (param instanceof Date) {
|
||||
return param.toJSON();
|
||||
} else {
|
||||
return param.toString();
|
||||
}
|
||||
if (param instanceof Date) {
|
||||
return param.toJSON();
|
||||
}
|
||||
return param.toString();
|
||||
};
|
||||
|
||||
/**
|
||||
* Build full URL by appending the given path to base path and replacing
|
||||
* path parameter placeholders with parameter values.
|
||||
* Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values.
|
||||
* NOTE: query parameters are not handled here.
|
||||
* @param {String} path The path to append to the base URL.
|
||||
* @param {Object} pathParams The parameter values to append.
|
||||
* @returns {String} The encoded path with parameter values substituted.
|
||||
*/
|
||||
ApiClient.prototype.buildUrl = function buildUrl(path, pathParams) {
|
||||
exports.prototype.buildUrl = function(path, pathParams) {
|
||||
if (!path.match(/^\//)) {
|
||||
path = '/' + path;
|
||||
}
|
||||
@ -77,34 +105,40 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* Checks whether the given content type represents JSON.<br>
|
||||
* JSON content type examples:<br>
|
||||
* <ul>
|
||||
* <li>application/json</li>
|
||||
* <li>application/json; charset=UTF8</li>
|
||||
* <li>APPLICATION/JSON</li>
|
||||
* </ul>
|
||||
* @param {String} contentType The MIME content type to check.
|
||||
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
|
||||
*/
|
||||
ApiClient.prototype.isJsonMime = function isJsonMime(mime) {
|
||||
return Boolean(mime != null && mime.match(/^application\/json(;.*)?$/i));
|
||||
exports.prototype.isJsonMime = function(contentType) {
|
||||
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
|
||||
};
|
||||
|
||||
/**
|
||||
* Choose a MIME from the given MIMEs with JSON preferred,
|
||||
* i.e. return JSON if included, otherwise return the first one.
|
||||
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
|
||||
* @param {Array.<String>} contentTypes
|
||||
* @returns {String} The chosen content type, preferring JSON.
|
||||
*/
|
||||
ApiClient.prototype.jsonPreferredMime = function jsonPreferredMime(mimes) {
|
||||
var len = mimes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (this.isJsonMime(mimes[i])) {
|
||||
return mimes[i];
|
||||
exports.prototype.jsonPreferredMime = function(contentTypes) {
|
||||
for (var i = 0; i < contentTypes.length; i++) {
|
||||
if (this.isJsonMime(contentTypes[i])) {
|
||||
return contentTypes[i];
|
||||
}
|
||||
}
|
||||
return mimes[0];
|
||||
return contentTypes[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the given parameter value is like file content.
|
||||
* Checks whether the given parameter value represents file-like content.
|
||||
* @param param The parameter to check.
|
||||
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
||||
*/
|
||||
ApiClient.prototype.isFileParam = function isFileParam(param) {
|
||||
exports.prototype.isFileParam = function(param) {
|
||||
// fs.ReadStream in Node.js (but not in runtime like browserify)
|
||||
if (typeof window === 'undefined' &&
|
||||
typeof require === 'function' &&
|
||||
@ -128,15 +162,19 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalize parameters values:
|
||||
* remove nils,
|
||||
* keep files and arrays,
|
||||
* format to string with `paramToString` for other cases.
|
||||
* Normalizes parameter values:
|
||||
* <ul>
|
||||
* <li>remove nils</li>
|
||||
* <li>keep files and arrays</li>
|
||||
* <li>format to string with `paramToString` for other cases</li>
|
||||
* </ul>
|
||||
* @param {Object.<String, Object>} params The parameters as object properties.
|
||||
* @returns {Object.<String, Object>} normalized parameters.
|
||||
*/
|
||||
ApiClient.prototype.normalizeParams = function normalizeParams(params) {
|
||||
exports.prototype.normalizeParams = function(params) {
|
||||
var newParams = {};
|
||||
for (var key in params) {
|
||||
if (params.hasOwnProperty(key) && params[key] != null) {
|
||||
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
|
||||
var value = params[key];
|
||||
if (this.isFileParam(value) || Array.isArray(value)) {
|
||||
newParams[key] = value;
|
||||
@ -149,10 +187,46 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* Build parameter value according to the given collection format.
|
||||
* @param {String} collectionFormat one of 'csv', 'ssv', 'tsv', 'pipes' and 'multi'
|
||||
* Enumeration of collection format separator strategies.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
ApiClient.prototype.buildCollectionParam = function buildCollectionParam(param, collectionFormat) {
|
||||
exports.CollectionFormatEnum = {
|
||||
/**
|
||||
* Comma-separated values. Value: <code>csv</code>
|
||||
* @const
|
||||
*/
|
||||
CSV: ',',
|
||||
/**
|
||||
* Space-separated values. Value: <code>ssv</code>
|
||||
* @const
|
||||
*/
|
||||
SSV: ' ',
|
||||
/**
|
||||
* Tab-separated values. Value: <code>tsv</code>
|
||||
* @const
|
||||
*/
|
||||
TSV: '\t',
|
||||
/**
|
||||
* Pipe(|)-separated values. Value: <code>pipes</code>
|
||||
* @const
|
||||
*/
|
||||
PIPES: '|',
|
||||
/**
|
||||
* Native array. Value: <code>multi</code>
|
||||
* @const
|
||||
*/
|
||||
MULTI: 'multi'
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds a string representation of an array-type actual parameter, according to the given collection format.
|
||||
* @param {Array} param An array parameter.
|
||||
* @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
|
||||
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
|
||||
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
|
||||
*/
|
||||
exports.prototype.buildCollectionParam = function buildCollectionParam(param, collectionFormat) {
|
||||
if (param == null) {
|
||||
return null;
|
||||
}
|
||||
@ -166,14 +240,19 @@
|
||||
case 'pipes':
|
||||
return param.map(this.paramToString).join('|');
|
||||
case 'multi':
|
||||
// return the array directly as Superagent will handle it as expected
|
||||
// return the array directly as SuperAgent will handle it as expected
|
||||
return param.map(this.paramToString);
|
||||
default:
|
||||
throw new Error('Unknown collection format: ' + collectionFormat);
|
||||
}
|
||||
};
|
||||
|
||||
ApiClient.prototype.applyAuthToRequest = function applyAuthToRequest(request, authNames) {
|
||||
/**
|
||||
* Applies authentication headers to the request.
|
||||
* @param {Object} request The request object created by a <code>superagent()</code> call.
|
||||
* @param {Array.<String>} authNames An array of authentication method names.
|
||||
*/
|
||||
exports.prototype.applyAuthToRequest = function(request, authNames) {
|
||||
var _this = this;
|
||||
authNames.forEach(function(authName) {
|
||||
var auth = _this.authentications[authName];
|
||||
@ -191,7 +270,7 @@
|
||||
} else {
|
||||
data[auth.name] = auth.apiKey;
|
||||
}
|
||||
if (auth.in === 'header') {
|
||||
if (auth['in'] === 'header') {
|
||||
request.set(data);
|
||||
} else {
|
||||
request.query(data);
|
||||
@ -209,24 +288,48 @@
|
||||
});
|
||||
};
|
||||
|
||||
ApiClient.prototype.deserialize = function deserialize(response, returnType) {
|
||||
/**
|
||||
* Deserializes an HTTP response body into a value of the specified type.
|
||||
* @param {Object} response A SuperAgent response object.
|
||||
* @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types
|
||||
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
||||
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
||||
* all properties on <code>data<code> will be converted to this type.
|
||||
* @returns A value of the specified type.
|
||||
*/
|
||||
exports.prototype.deserialize = function deserialize(response, returnType) {
|
||||
if (response == null || returnType == null) {
|
||||
return null;
|
||||
}
|
||||
// Rely on Superagent for parsing response body.
|
||||
// Rely on SuperAgent for parsing response body.
|
||||
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
||||
var data = response.body;
|
||||
if (data == null) {
|
||||
// Superagent does not always produce a body; use the unparsed response
|
||||
// as a fallback
|
||||
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
||||
data = response.text;
|
||||
}
|
||||
return ApiClient.convertToType(data, returnType);
|
||||
return exports.convertToType(data, returnType);
|
||||
};
|
||||
|
||||
ApiClient.prototype.callApi = function callApi(path, httpMethod, pathParams,
|
||||
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes,
|
||||
accepts, returnType) {
|
||||
/**
|
||||
* Invokes the REST service using the supplied settings and parameters.
|
||||
* @param {String} path The base URL to invoke.
|
||||
* @param {String} httpMethod The HTTP method to use.
|
||||
* @param {Object.<String, String>} pathParams A map of path parameters and their values.
|
||||
* @param {Object.<String, Object>} queryParams A map of query parameters and their values.
|
||||
* @param {Object.<String, Object>} headerParams A map of header parameters and their values.
|
||||
* @param {Object.<String, Object>} formParams A map of form parameters and their values.
|
||||
* @param {Object} bodyParam The value to pass as the request body.
|
||||
* @param {Array.<String>} authNames An array of authentication type names.
|
||||
* @param {Array.<String>} contentTypes An array of request MIME types.
|
||||
* @param {Array.<String>} accepts An array of acceptable response MIME types.
|
||||
* @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the
|
||||
* constructor for a complex type. * @returns {Promise} A Promise object.
|
||||
*/
|
||||
exports.prototype.callApi = function callApi(path, httpMethod, pathParams,
|
||||
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
|
||||
returnType) {
|
||||
|
||||
var _this = this;
|
||||
var url = this.buildUrl(path, pathParams);
|
||||
var request = superagent(httpMethod, url);
|
||||
@ -273,28 +376,37 @@
|
||||
request.accept(accept);
|
||||
}
|
||||
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
request.end(function(error, response) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
var data = _this.deserialize(response, returnType);
|
||||
resolve(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
ApiClient.parseDate = function parseDate(str) {
|
||||
str = str.replace(/T/i, ' ');
|
||||
return new Date(str);
|
||||
/**
|
||||
* Parses an ISO-8601 string representation of a date value.
|
||||
* @param {String} str The date value as a string.
|
||||
* @returns {Date} The parsed date object.
|
||||
*/
|
||||
exports.parseDate = function(str) {
|
||||
return new Date(str.replace(/T/i, ' '));
|
||||
};
|
||||
|
||||
ApiClient.convertToType = function convertToType(data, type) {
|
||||
/**
|
||||
* Converts a value to the specified type.
|
||||
* @param {(String|Object)} data The data to convert, as a string or object.
|
||||
* @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
|
||||
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
||||
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
||||
* all properties on <code>data<code> will be converted to this type.
|
||||
* @returns An instance of the specified type.
|
||||
*/
|
||||
exports.convertToType = function(data, type) {
|
||||
switch (type) {
|
||||
case 'Boolean':
|
||||
return Boolean(data);
|
||||
@ -312,13 +424,12 @@
|
||||
return data;
|
||||
} else if (typeof type === 'function') {
|
||||
// for model type like: User
|
||||
var model = type.constructFromObject(data);
|
||||
return model;
|
||||
return type.constructFromObject(data);
|
||||
} else if (Array.isArray(type)) {
|
||||
// for array type like: ['String']
|
||||
var itemType = type[0];
|
||||
return data.map(function(item) {
|
||||
return ApiClient.convertToType(item, itemType);
|
||||
return exports.convertToType(item, itemType);
|
||||
});
|
||||
} else if (typeof type === 'object') {
|
||||
// for plain object type like: {'String': 'Integer'}
|
||||
@ -333,8 +444,8 @@
|
||||
var result = {};
|
||||
for (var k in data) {
|
||||
if (data.hasOwnProperty(k)) {
|
||||
var key = ApiClient.convertToType(k, keyType);
|
||||
var value = ApiClient.convertToType(data[k], valueType);
|
||||
var key = exports.convertToType(k, keyType);
|
||||
var value = exports.convertToType(data[k], valueType);
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
@ -346,7 +457,11 @@
|
||||
}
|
||||
};
|
||||
|
||||
ApiClient.default = new ApiClient();
|
||||
/**
|
||||
* The default API client implementation.
|
||||
* @type {module:ApiClient}
|
||||
*/
|
||||
exports.instance = new exports();
|
||||
|
||||
return ApiClient;
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,18 +15,31 @@
|
||||
}(this, function(ApiClient, Pet, InlineResponse200) {
|
||||
'use strict';
|
||||
|
||||
var PetApi = function PetApi(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.default;
|
||||
/**
|
||||
* Pet service.
|
||||
* @module api/PetApi
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new PetApi.
|
||||
* @alias module:api/PetApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
|
||||
var self = this;
|
||||
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
* @param {Pet} opts['body'] Pet object that needs to be added to the store
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/Pet} opts.body Pet object that needs to be added to the store
|
||||
*/
|
||||
self.addPet = function(opts) {
|
||||
this.addPet = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -50,15 +63,16 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*
|
||||
* @param {String} opts['body'] Pet object in the form of byte array
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.body Pet object in the form of byte array
|
||||
*/
|
||||
self.addPetUsingByteArray = function(opts) {
|
||||
this.addPetUsingByteArray = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -82,21 +96,22 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
* @param {Integer} petId Pet id to delete
|
||||
* @param {String} opts['apiKey']
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.apiKey
|
||||
*/
|
||||
self.deletePet = function(petId, opts) {
|
||||
this.deletePet = function(petId, opts) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling deletePet";
|
||||
}
|
||||
|
||||
@ -122,16 +137,17 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param {[String]} opts['status'] Status values that need to be considered for query (default to available)
|
||||
* data is of type: [Pet]
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Array.<String>} opts.status Status values that need to be considered for query
|
||||
* data is of type: {Array.<module:model/Pet>}
|
||||
*/
|
||||
self.findPetsByStatus = function(opts) {
|
||||
this.findPetsByStatus = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
@ -156,16 +172,17 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param {[String]} opts['tags'] Tags to filter by
|
||||
* data is of type: [Pet]
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Array.<String>} opts.tags Tags to filter by
|
||||
* data is of type: {Array.<module:model/Pet>}
|
||||
*/
|
||||
self.findPetsByTags = function(opts) {
|
||||
this.findPetsByTags = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
@ -190,20 +207,20 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param {Integer} petId ID of pet that needs to be fetched
|
||||
* data is of type: Pet
|
||||
* data is of type: {module:model/Pet}
|
||||
*/
|
||||
self.getPetById = function(petId) {
|
||||
this.getPetById = function(petId) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling getPetById";
|
||||
}
|
||||
|
||||
@ -218,7 +235,7 @@
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth', 'api_key'];
|
||||
var authNames = ['api_key', 'petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/json', 'application/xml'];
|
||||
var returnType = Pet;
|
||||
@ -228,20 +245,20 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param {Integer} petId ID of pet that needs to be fetched
|
||||
* data is of type: InlineResponse200
|
||||
* data is of type: {module:model/InlineResponse200}
|
||||
*/
|
||||
self.getPetByIdInObject = function(petId) {
|
||||
this.getPetByIdInObject = function(petId) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling getPetByIdInObject";
|
||||
}
|
||||
|
||||
@ -256,7 +273,7 @@
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth', 'api_key'];
|
||||
var authNames = ['api_key', 'petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/json', 'application/xml'];
|
||||
var returnType = InlineResponse200;
|
||||
@ -266,20 +283,20 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param {Integer} petId ID of pet that needs to be fetched
|
||||
* data is of type: 'String'
|
||||
* data is of type: {'String'}
|
||||
*/
|
||||
self.petPetIdtestingByteArraytrueGet = function(petId) {
|
||||
this.petPetIdtestingByteArraytrueGet = function(petId) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet";
|
||||
}
|
||||
|
||||
@ -294,7 +311,7 @@
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth', 'api_key'];
|
||||
var authNames = ['api_key', 'petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/json', 'application/xml'];
|
||||
var returnType = 'String';
|
||||
@ -304,15 +321,16 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param {Pet} opts['body'] Pet object that needs to be added to the store
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/Pet} opts.body Pet object that needs to be added to the store
|
||||
*/
|
||||
self.updatePet = function(opts) {
|
||||
this.updatePet = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -336,22 +354,23 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
* @param {String} petId ID of pet that needs to be updated
|
||||
* @param {String} opts['name'] Updated name of the pet
|
||||
* @param {String} opts['status'] Updated status of the pet
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.name Updated name of the pet
|
||||
* @param {String} opts.status Updated status of the pet
|
||||
*/
|
||||
self.updatePetWithForm = function(petId, opts) {
|
||||
this.updatePetWithForm = function(petId, opts) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling updatePetWithForm";
|
||||
}
|
||||
|
||||
@ -378,22 +397,23 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param {Integer} petId ID of pet to update
|
||||
* @param {String} opts['additionalMetadata'] Additional data to pass to server
|
||||
* @param {File} opts['file'] file to upload
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.additionalMetadata Additional data to pass to server
|
||||
* @param {File} opts.file file to upload
|
||||
*/
|
||||
self.uploadFile = function(petId, opts) {
|
||||
this.uploadFile = function(petId, opts) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling uploadFile";
|
||||
}
|
||||
|
||||
@ -420,11 +440,8 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return PetApi;
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,10 +15,22 @@
|
||||
}(this, function(ApiClient, Order) {
|
||||
'use strict';
|
||||
|
||||
var StoreApi = function StoreApi(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.default;
|
||||
/**
|
||||
* Store service.
|
||||
* @module api/StoreApi
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new StoreApi.
|
||||
* @alias module:api/StoreApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
|
||||
var self = this;
|
||||
|
||||
|
||||
/**
|
||||
@ -26,15 +38,20 @@
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* @param {String} orderId ID of the order that needs to be deleted
|
||||
*/
|
||||
self.deleteOrder = function(orderId) {
|
||||
this.deleteOrder = function(orderId) {
|
||||
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
|
||||
if (orderId == undefined || orderId == null) {
|
||||
throw "Missing the required parameter 'orderId' when calling deleteOrder";
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'orderId': orderId
|
||||
};
|
||||
@ -55,16 +72,17 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds orders by status
|
||||
* A single status value can be provided as a string
|
||||
* @param {String} opts['status'] Status value that needs to be considered for query (default to placed)
|
||||
* data is of type: [Order]
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/String} opts.status Status value that needs to be considered for query
|
||||
* data is of type: {Array.<module:model/Order>}
|
||||
*/
|
||||
self.findOrdersByStatus = function(opts) {
|
||||
this.findOrdersByStatus = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
@ -89,15 +107,15 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
* data is of type: {'String': 'Integer'}
|
||||
* data is of type: {Object.<String, {'String': 'Integer'}>}
|
||||
*/
|
||||
self.getInventory = function() {
|
||||
this.getInventory = function() {
|
||||
var postBody = null;
|
||||
|
||||
|
||||
@ -120,15 +138,15 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
* Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
* data is of type: Object
|
||||
* data is of type: {Object}
|
||||
*/
|
||||
self.getInventoryInObject = function() {
|
||||
this.getInventoryInObject = function() {
|
||||
var postBody = null;
|
||||
|
||||
|
||||
@ -151,20 +169,20 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @param {String} orderId ID of pet that needs to be fetched
|
||||
* data is of type: Order
|
||||
* data is of type: {module:model/Order}
|
||||
*/
|
||||
self.getOrderById = function(orderId) {
|
||||
this.getOrderById = function(orderId) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'orderId' is set
|
||||
if (orderId == null) {
|
||||
if (orderId == undefined || orderId == null) {
|
||||
throw "Missing the required parameter 'orderId' when calling getOrderById";
|
||||
}
|
||||
|
||||
@ -179,7 +197,7 @@
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['test_api_key_query', 'test_api_key_header'];
|
||||
var authNames = ['test_api_key_header', 'test_api_key_query'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/json', 'application/xml'];
|
||||
var returnType = Order;
|
||||
@ -189,16 +207,17 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param {Order} opts['body'] order placed for purchasing the pet
|
||||
* data is of type: Order
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/Order} opts.body order placed for purchasing the pet
|
||||
* data is of type: {module:model/Order}
|
||||
*/
|
||||
self.placeOrder = function(opts) {
|
||||
this.placeOrder = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -222,11 +241,8 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return StoreApi;
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,18 +15,31 @@
|
||||
}(this, function(ApiClient, User) {
|
||||
'use strict';
|
||||
|
||||
var UserApi = function UserApi(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.default;
|
||||
/**
|
||||
* User service.
|
||||
* @module api/UserApi
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new UserApi.
|
||||
* @alias module:api/UserApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
|
||||
var self = this;
|
||||
|
||||
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
* @param {User} opts['body'] Created user object
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/User} opts.body Created user object
|
||||
*/
|
||||
self.createUser = function(opts) {
|
||||
this.createUser = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -50,15 +63,16 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param {[User]} opts['body'] List of user object
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Array.<module:model/User>} opts.body List of user object
|
||||
*/
|
||||
self.createUsersWithArrayInput = function(opts) {
|
||||
this.createUsersWithArrayInput = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -82,15 +96,16 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param {[User]} opts['body'] List of user object
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Array.<module:model/User>} opts.body List of user object
|
||||
*/
|
||||
self.createUsersWithListInput = function(opts) {
|
||||
this.createUsersWithListInput = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -114,23 +129,28 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
* @param {String} username The name that needs to be deleted
|
||||
*/
|
||||
self.deleteUser = function(username) {
|
||||
this.deleteUser = function(username) {
|
||||
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
|
||||
if (username == undefined || username == null) {
|
||||
throw "Missing the required parameter 'username' when calling deleteUser";
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'username': username
|
||||
};
|
||||
@ -151,24 +171,29 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
* @param {String} username The name that needs to be fetched. Use user1 for testing.
|
||||
* data is of type: User
|
||||
* data is of type: {module:model/User}
|
||||
*/
|
||||
self.getUserByName = function(username) {
|
||||
this.getUserByName = function(username) {
|
||||
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
|
||||
if (username == undefined || username == null) {
|
||||
throw "Missing the required parameter 'username' when calling getUserByName";
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'username': username
|
||||
};
|
||||
@ -189,17 +214,18 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
* @param {String} opts['username'] The user name for login
|
||||
* @param {String} opts['password'] The password for login in clear text
|
||||
* data is of type: 'String'
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.username The user name for login
|
||||
* @param {String} opts.password The password for login in clear text
|
||||
* data is of type: {'String'}
|
||||
*/
|
||||
self.loginUser = function(opts) {
|
||||
this.loginUser = function(opts) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
@ -225,14 +251,14 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
*/
|
||||
self.logoutUser = function() {
|
||||
this.logoutUser = function() {
|
||||
var postBody = null;
|
||||
|
||||
|
||||
@ -255,21 +281,22 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
* @param {String} username name that need to be deleted
|
||||
* @param {User} opts['body'] Updated user object
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/User} opts.body Updated user object
|
||||
*/
|
||||
self.updateUser = function(username, opts) {
|
||||
this.updateUser = function(username, opts) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username == null) {
|
||||
if (username == undefined || username == null) {
|
||||
throw "Missing the required parameter 'username' when calling updateUser";
|
||||
}
|
||||
|
||||
@ -294,11 +321,8 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return UserApi;
|
||||
return exports;
|
||||
}));
|
||||
|
@ -9,20 +9,109 @@
|
||||
}(function(ApiClient, Category, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
/**
|
||||
* 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.<br>
|
||||
* The <code>index</code> module provides access to constructors for all the classes which comprise the public API.
|
||||
* <p>
|
||||
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
|
||||
* <pre>
|
||||
* var SwaggerPetstore = require('./index'); // See note below*.
|
||||
* var xxxSvc = new SwaggerPetstore.XxxApi(); // Allocate the API class we're going to use.
|
||||
* var yyyModel = new SwaggerPetstore.Yyy(); // Construct a model instance.
|
||||
* yyyModel.someProperty = 'someValue';
|
||||
* ...
|
||||
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
|
||||
* ...
|
||||
* </pre>
|
||||
* <em>*NOTE: For a top-level AMD script, use require(['./index'], function(){...}) and put the application logic within the
|
||||
* callback function.</em>
|
||||
* </p>
|
||||
* <p>
|
||||
* A non-AMD browser application (discouraged) might do something like this:
|
||||
* <pre>
|
||||
* var xxxSvc = new SwaggerPetstore.XxxApi(); // Allocate the API class we're going to use.
|
||||
* var yyy = new SwaggerPetstore.Yyy(); // Construct a model instance.
|
||||
* yyyModel.someProperty = 'someValue';
|
||||
* ...
|
||||
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
|
||||
* ...
|
||||
* </pre>
|
||||
* </p>
|
||||
* @module index
|
||||
* @version 1.0.0
|
||||
*/
|
||||
var exports = {
|
||||
/**
|
||||
* The ApiClient constructor.
|
||||
* @property {module:ApiClient}
|
||||
*/
|
||||
ApiClient: ApiClient,
|
||||
/**
|
||||
* The Category model constructor.
|
||||
* @property {module:model/Category}
|
||||
*/
|
||||
Category: Category,
|
||||
/**
|
||||
* The InlineResponse200 model constructor.
|
||||
* @property {module:model/InlineResponse200}
|
||||
*/
|
||||
InlineResponse200: InlineResponse200,
|
||||
/**
|
||||
* The Model200Response model constructor.
|
||||
* @property {module:model/Model200Response}
|
||||
*/
|
||||
Model200Response: Model200Response,
|
||||
/**
|
||||
* The ModelReturn model constructor.
|
||||
* @property {module:model/ModelReturn}
|
||||
*/
|
||||
ModelReturn: ModelReturn,
|
||||
/**
|
||||
* The Name model constructor.
|
||||
* @property {module:model/Name}
|
||||
*/
|
||||
Name: Name,
|
||||
/**
|
||||
* The Order model constructor.
|
||||
* @property {module:model/Order}
|
||||
*/
|
||||
Order: Order,
|
||||
/**
|
||||
* The Pet model constructor.
|
||||
* @property {module:model/Pet}
|
||||
*/
|
||||
Pet: Pet,
|
||||
/**
|
||||
* The SpecialModelName model constructor.
|
||||
* @property {module:model/SpecialModelName}
|
||||
*/
|
||||
SpecialModelName: SpecialModelName,
|
||||
/**
|
||||
* The Tag model constructor.
|
||||
* @property {module:model/Tag}
|
||||
*/
|
||||
Tag: Tag,
|
||||
/**
|
||||
* The User model constructor.
|
||||
* @property {module:model/User}
|
||||
*/
|
||||
User: User,
|
||||
/**
|
||||
* The PetApi service constructor.
|
||||
* @property {module:api/PetApi}
|
||||
*/
|
||||
PetApi: PetApi,
|
||||
/**
|
||||
* The StoreApi service constructor.
|
||||
* @property {module:api/StoreApi}
|
||||
*/
|
||||
StoreApi: StoreApi,
|
||||
/**
|
||||
* The UserApi service constructor.
|
||||
* @property {module:api/UserApi}
|
||||
*/
|
||||
UserApi: UserApi
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,63 +15,57 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Category model module.
|
||||
* @module model/Category
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Category</code>.
|
||||
* @alias module:model/Category
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
|
||||
var Category = function Category() {
|
||||
|
||||
};
|
||||
|
||||
Category.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Category();
|
||||
/**
|
||||
* Constructs a <code>Category</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Category} obj Optional instance to populate.
|
||||
* @return {module:model/Category} The populated <code>Category</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Category.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
Category.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
Category.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
**/
|
||||
Category.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* @member {String} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Category;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,161 +15,118 @@
|
||||
}(this, function(ApiClient, Tag) {
|
||||
'use strict';
|
||||
|
||||
|
||||
var InlineResponse200 = function InlineResponse200(id) {
|
||||
/**
|
||||
* The InlineResponse200 model module.
|
||||
* @module model/InlineResponse200
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* datatype: Integer
|
||||
* required
|
||||
**/
|
||||
* Constructs a new <code>InlineResponse200</code>.
|
||||
* @alias module:model/InlineResponse200
|
||||
* @class
|
||||
* @param id
|
||||
*/
|
||||
var exports = function(id) {
|
||||
|
||||
|
||||
this['id'] = id;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
InlineResponse200.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new InlineResponse200();
|
||||
/**
|
||||
* Constructs a <code>InlineResponse200</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/InlineResponse200} obj Optional instance to populate.
|
||||
* @return {module:model/InlineResponse200} The populated <code>InlineResponse200</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['photoUrls']) {
|
||||
_this['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
|
||||
if (data.hasOwnProperty('tags')) {
|
||||
obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
|
||||
}
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('category')) {
|
||||
obj['category'] = ApiClient.convertToType(data['category'], Object);
|
||||
}
|
||||
|
||||
if (data['category']) {
|
||||
_this['category'] = ApiClient.convertToType(data['category'], Object);
|
||||
if (data.hasOwnProperty('status')) {
|
||||
obj['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
}
|
||||
|
||||
if (data['tags']) {
|
||||
_this['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
}
|
||||
|
||||
if (data['status']) {
|
||||
_this['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
if (data.hasOwnProperty('photoUrls')) {
|
||||
obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {[String]}
|
||||
**/
|
||||
InlineResponse200.prototype.getPhotoUrls = function() {
|
||||
return this['photoUrls'];
|
||||
}
|
||||
* @member {Array.<module:model/Tag>} tags
|
||||
*/
|
||||
exports.prototype['tags'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {[String]} photoUrls
|
||||
**/
|
||||
InlineResponse200.prototype.setPhotoUrls = function(photoUrls) {
|
||||
this['photoUrls'] = photoUrls;
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
InlineResponse200.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
* @member {Object} category
|
||||
*/
|
||||
exports.prototype['category'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
**/
|
||||
InlineResponse200.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* pet status in the store
|
||||
* @member {module:model/InlineResponse200.StatusEnum} status
|
||||
*/
|
||||
exports.prototype['status'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
InlineResponse200.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {String} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
InlineResponse200.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
* @member {Array.<String>} photoUrls
|
||||
*/
|
||||
exports.prototype['photoUrls'] = undefined;
|
||||
|
||||
|
||||
/**
|
||||
* @return {Object}
|
||||
**/
|
||||
InlineResponse200.prototype.getCategory = function() {
|
||||
return this['category'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} category
|
||||
**/
|
||||
InlineResponse200.prototype.setCategory = function(category) {
|
||||
this['category'] = category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {[Tag]}
|
||||
**/
|
||||
InlineResponse200.prototype.getTags = function() {
|
||||
return this['tags'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {[Tag]} tags
|
||||
**/
|
||||
InlineResponse200.prototype.setTags = function(tags) {
|
||||
this['tags'] = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* get pet status in the store
|
||||
* @return {StatusEnum}
|
||||
**/
|
||||
InlineResponse200.prototype.getStatus = function() {
|
||||
return this['status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* set pet status in the store
|
||||
* @param {StatusEnum} status
|
||||
**/
|
||||
InlineResponse200.prototype.setStatus = function(status) {
|
||||
this['status'] = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var StatusEnum = {
|
||||
|
||||
* Allowed values for the <code>status</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
exports.StatusEnum = {
|
||||
/**
|
||||
* value: available
|
||||
* @const
|
||||
*/
|
||||
AVAILABLE: "available",
|
||||
|
||||
/**
|
||||
* value: pending
|
||||
* @const
|
||||
*/
|
||||
PENDING: "pending",
|
||||
|
||||
/**
|
||||
* value: sold
|
||||
* @const
|
||||
*/
|
||||
SOLD: "sold"
|
||||
};
|
||||
|
||||
InlineResponse200.StatusEnum = StatusEnum;
|
||||
|
||||
|
||||
return InlineResponse200;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,45 +15,48 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Model200Response model module.
|
||||
* @module model/Model200Response
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Model200Response</code>.
|
||||
* @alias module:model/Model200Response
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
var Model200Response = function Model200Response() {
|
||||
|
||||
};
|
||||
|
||||
Model200Response.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Model200Response();
|
||||
/**
|
||||
* Constructs a <code>Model200Response</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Model200Response} obj Optional instance to populate.
|
||||
* @return {module:model/Model200Response} The populated <code>Model200Response</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Model200Response.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} name
|
||||
**/
|
||||
Model200Response.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* @member {Integer} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Model200Response;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,45 +15,48 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The ModelReturn model module.
|
||||
* @module model/ModelReturn
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>ModelReturn</code>.
|
||||
* @alias module:model/ModelReturn
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
var ModelReturn = function ModelReturn() {
|
||||
|
||||
};
|
||||
|
||||
ModelReturn.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new ModelReturn();
|
||||
/**
|
||||
* Constructs a <code>ModelReturn</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/ModelReturn} obj Optional instance to populate.
|
||||
* @return {module:model/ModelReturn} The populated <code>ModelReturn</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['return']) {
|
||||
_this['return'] = ApiClient.convertToType(data['return'], 'Integer');
|
||||
if (data.hasOwnProperty('return')) {
|
||||
obj['return'] = ApiClient.convertToType(data['return'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
ModelReturn.prototype.getReturn = function() {
|
||||
return this['return'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} _return
|
||||
**/
|
||||
ModelReturn.prototype.setReturn = function(_return) {
|
||||
this['return'] = _return;
|
||||
}
|
||||
* @member {Integer} return
|
||||
*/
|
||||
exports.prototype['return'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return ModelReturn;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,45 +15,48 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Name model module.
|
||||
* @module model/Name
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Name</code>.
|
||||
* @alias module:model/Name
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
var Name = function Name() {
|
||||
|
||||
};
|
||||
|
||||
Name.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Name();
|
||||
/**
|
||||
* Constructs a <code>Name</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Name} obj Optional instance to populate.
|
||||
* @return {module:model/Name} The populated <code>Name</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Name.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} name
|
||||
**/
|
||||
Name.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* @member {Integer} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Name;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -1,59 +0,0 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.ObjectReturn = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
var ObjectReturn = function ObjectReturn() {
|
||||
|
||||
};
|
||||
|
||||
ObjectReturn.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new ObjectReturn();
|
||||
|
||||
if (data['return']) {
|
||||
_this['return'] = ApiClient.convertToType(data['return'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
ObjectReturn.prototype.getReturn = function() {
|
||||
return this['return'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} _return
|
||||
**/
|
||||
ObjectReturn.prototype.setReturn = function(_return) {
|
||||
this['return'] = _return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return ObjectReturn;
|
||||
|
||||
|
||||
}));
|
@ -15,156 +15,117 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Order model module.
|
||||
* @module model/Order
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Order</code>.
|
||||
* @alias module:model/Order
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var Order = function Order() {
|
||||
|
||||
};
|
||||
|
||||
Order.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Order();
|
||||
/**
|
||||
* Constructs a <code>Order</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Order} obj Optional instance to populate.
|
||||
* @return {module:model/Order} The populated <code>Order</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['petId']) {
|
||||
_this['petId'] = ApiClient.convertToType(data['petId'], 'Integer');
|
||||
if (data.hasOwnProperty('petId')) {
|
||||
obj['petId'] = ApiClient.convertToType(data['petId'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['quantity']) {
|
||||
_this['quantity'] = ApiClient.convertToType(data['quantity'], 'Integer');
|
||||
if (data.hasOwnProperty('quantity')) {
|
||||
obj['quantity'] = ApiClient.convertToType(data['quantity'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['shipDate']) {
|
||||
_this['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date');
|
||||
if (data.hasOwnProperty('shipDate')) {
|
||||
obj['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date');
|
||||
}
|
||||
|
||||
if (data['status']) {
|
||||
_this['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
if (data.hasOwnProperty('status')) {
|
||||
obj['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
}
|
||||
|
||||
if (data['complete']) {
|
||||
_this['complete'] = ApiClient.convertToType(data['complete'], 'Boolean');
|
||||
if (data.hasOwnProperty('complete')) {
|
||||
obj['complete'] = ApiClient.convertToType(data['complete'], 'Boolean');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Order.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
Order.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
* @member {Integer} petId
|
||||
*/
|
||||
exports.prototype['petId'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Order.prototype.getPetId = function() {
|
||||
return this['petId'];
|
||||
}
|
||||
* @member {Integer} quantity
|
||||
*/
|
||||
exports.prototype['quantity'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} petId
|
||||
**/
|
||||
Order.prototype.setPetId = function(petId) {
|
||||
this['petId'] = petId;
|
||||
}
|
||||
* @member {Date} shipDate
|
||||
*/
|
||||
exports.prototype['shipDate'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Order.prototype.getQuantity = function() {
|
||||
return this['quantity'];
|
||||
}
|
||||
* Order Status
|
||||
* @member {module:model/Order.StatusEnum} status
|
||||
*/
|
||||
exports.prototype['status'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} quantity
|
||||
**/
|
||||
Order.prototype.setQuantity = function(quantity) {
|
||||
this['quantity'] = quantity;
|
||||
}
|
||||
* @member {Boolean} complete
|
||||
*/
|
||||
exports.prototype['complete'] = undefined;
|
||||
|
||||
|
||||
/**
|
||||
* @return {Date}
|
||||
**/
|
||||
Order.prototype.getShipDate = function() {
|
||||
return this['shipDate'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Date} shipDate
|
||||
**/
|
||||
Order.prototype.setShipDate = function(shipDate) {
|
||||
this['shipDate'] = shipDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Order Status
|
||||
* @return {StatusEnum}
|
||||
**/
|
||||
Order.prototype.getStatus = function() {
|
||||
return this['status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* set Order Status
|
||||
* @param {StatusEnum} status
|
||||
**/
|
||||
Order.prototype.setStatus = function(status) {
|
||||
this['status'] = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {Boolean}
|
||||
**/
|
||||
Order.prototype.getComplete = function() {
|
||||
return this['complete'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Boolean} complete
|
||||
**/
|
||||
Order.prototype.setComplete = function(complete) {
|
||||
this['complete'] = complete;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var StatusEnum = {
|
||||
|
||||
* Allowed values for the <code>status</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
exports.StatusEnum = {
|
||||
/**
|
||||
* value: placed
|
||||
* @const
|
||||
*/
|
||||
PLACED: "placed",
|
||||
|
||||
/**
|
||||
* value: approved
|
||||
* @const
|
||||
*/
|
||||
APPROVED: "approved",
|
||||
|
||||
/**
|
||||
* value: delivered
|
||||
* @const
|
||||
*/
|
||||
DELIVERED: "delivered"
|
||||
};
|
||||
|
||||
Order.StatusEnum = StatusEnum;
|
||||
|
||||
|
||||
return Order;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,166 +15,119 @@
|
||||
}(this, function(ApiClient, Category, Tag) {
|
||||
'use strict';
|
||||
|
||||
|
||||
var Pet = function Pet(name, photoUrls) {
|
||||
/**
|
||||
* The Pet model module.
|
||||
* @module model/Pet
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* datatype: String
|
||||
* required
|
||||
**/
|
||||
* Constructs a new <code>Pet</code>.
|
||||
* @alias module:model/Pet
|
||||
* @class
|
||||
* @param name
|
||||
* @param photoUrls
|
||||
*/
|
||||
var exports = function(name, photoUrls) {
|
||||
|
||||
|
||||
|
||||
this['name'] = name;
|
||||
/**
|
||||
* datatype: [String]
|
||||
* required
|
||||
**/
|
||||
this['photoUrls'] = photoUrls;
|
||||
|
||||
|
||||
};
|
||||
|
||||
Pet.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Pet();
|
||||
/**
|
||||
* Constructs a <code>Pet</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Pet} obj Optional instance to populate.
|
||||
* @return {module:model/Pet} The populated <code>Pet</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['category']) {
|
||||
_this['category'] = Category.constructFromObject(data['category']);
|
||||
if (data.hasOwnProperty('category')) {
|
||||
obj['category'] = Category.constructFromObject(data['category']);
|
||||
}
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
}
|
||||
|
||||
if (data['photoUrls']) {
|
||||
_this['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
|
||||
if (data.hasOwnProperty('photoUrls')) {
|
||||
obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
|
||||
}
|
||||
|
||||
if (data['tags']) {
|
||||
_this['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
|
||||
if (data.hasOwnProperty('tags')) {
|
||||
obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
|
||||
}
|
||||
|
||||
if (data['status']) {
|
||||
_this['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
if (data.hasOwnProperty('status')) {
|
||||
obj['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Pet.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
Pet.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
* @member {module:model/Category} category
|
||||
*/
|
||||
exports.prototype['category'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {Category}
|
||||
**/
|
||||
Pet.prototype.getCategory = function() {
|
||||
return this['category'];
|
||||
}
|
||||
* @member {String} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Category} category
|
||||
**/
|
||||
Pet.prototype.setCategory = function(category) {
|
||||
this['category'] = category;
|
||||
}
|
||||
* @member {Array.<String>} photoUrls
|
||||
*/
|
||||
exports.prototype['photoUrls'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
Pet.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
* @member {Array.<module:model/Tag>} tags
|
||||
*/
|
||||
exports.prototype['tags'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
**/
|
||||
Pet.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* pet status in the store
|
||||
* @member {module:model/Pet.StatusEnum} status
|
||||
*/
|
||||
exports.prototype['status'] = undefined;
|
||||
|
||||
|
||||
/**
|
||||
* @return {[String]}
|
||||
**/
|
||||
Pet.prototype.getPhotoUrls = function() {
|
||||
return this['photoUrls'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {[String]} photoUrls
|
||||
**/
|
||||
Pet.prototype.setPhotoUrls = function(photoUrls) {
|
||||
this['photoUrls'] = photoUrls;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {[Tag]}
|
||||
**/
|
||||
Pet.prototype.getTags = function() {
|
||||
return this['tags'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {[Tag]} tags
|
||||
**/
|
||||
Pet.prototype.setTags = function(tags) {
|
||||
this['tags'] = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* get pet status in the store
|
||||
* @return {StatusEnum}
|
||||
**/
|
||||
Pet.prototype.getStatus = function() {
|
||||
return this['status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* set pet status in the store
|
||||
* @param {StatusEnum} status
|
||||
**/
|
||||
Pet.prototype.setStatus = function(status) {
|
||||
this['status'] = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var StatusEnum = {
|
||||
|
||||
* Allowed values for the <code>status</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
exports.StatusEnum = {
|
||||
/**
|
||||
* value: available
|
||||
* @const
|
||||
*/
|
||||
AVAILABLE: "available",
|
||||
|
||||
/**
|
||||
* value: pending
|
||||
* @const
|
||||
*/
|
||||
PENDING: "pending",
|
||||
|
||||
/**
|
||||
* value: sold
|
||||
* @const
|
||||
*/
|
||||
SOLD: "sold"
|
||||
};
|
||||
|
||||
Pet.StatusEnum = StatusEnum;
|
||||
|
||||
|
||||
return Pet;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,45 +15,48 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The SpecialModelName model module.
|
||||
* @module model/SpecialModelName
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>SpecialModelName</code>.
|
||||
* @alias module:model/SpecialModelName
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
var SpecialModelName = function SpecialModelName() {
|
||||
|
||||
};
|
||||
|
||||
SpecialModelName.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new SpecialModelName();
|
||||
/**
|
||||
* Constructs a <code>SpecialModelName</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/SpecialModelName} obj Optional instance to populate.
|
||||
* @return {module:model/SpecialModelName} The populated <code>SpecialModelName</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['$special[property.name]']) {
|
||||
_this['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Integer');
|
||||
if (data.hasOwnProperty('$special[property.name]')) {
|
||||
obj['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
SpecialModelName.prototype.getSpecialPropertyName = function() {
|
||||
return this['$special[property.name]'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} specialPropertyName
|
||||
**/
|
||||
SpecialModelName.prototype.setSpecialPropertyName = function(specialPropertyName) {
|
||||
this['$special[property.name]'] = specialPropertyName;
|
||||
}
|
||||
* @member {Integer} $special[property.name]
|
||||
*/
|
||||
exports.prototype['$special[property.name]'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return SpecialModelName;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,63 +15,57 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Tag model module.
|
||||
* @module model/Tag
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Tag</code>.
|
||||
* @alias module:model/Tag
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
|
||||
var Tag = function Tag() {
|
||||
|
||||
};
|
||||
|
||||
Tag.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Tag();
|
||||
/**
|
||||
* Constructs a <code>Tag</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Tag} obj Optional instance to populate.
|
||||
* @return {module:model/Tag} The populated <code>Tag</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Tag.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
Tag.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
Tag.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
**/
|
||||
Tag.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* @member {String} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Tag;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,173 +15,112 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The User model module.
|
||||
* @module model/User
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>User</code>.
|
||||
* @alias module:model/User
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var User = function User() {
|
||||
|
||||
};
|
||||
|
||||
User.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new User();
|
||||
/**
|
||||
* Constructs a <code>User</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/User} obj Optional instance to populate.
|
||||
* @return {module:model/User} The populated <code>User</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['username']) {
|
||||
_this['username'] = ApiClient.convertToType(data['username'], 'String');
|
||||
if (data.hasOwnProperty('username')) {
|
||||
obj['username'] = ApiClient.convertToType(data['username'], 'String');
|
||||
}
|
||||
|
||||
if (data['firstName']) {
|
||||
_this['firstName'] = ApiClient.convertToType(data['firstName'], 'String');
|
||||
if (data.hasOwnProperty('firstName')) {
|
||||
obj['firstName'] = ApiClient.convertToType(data['firstName'], 'String');
|
||||
}
|
||||
|
||||
if (data['lastName']) {
|
||||
_this['lastName'] = ApiClient.convertToType(data['lastName'], 'String');
|
||||
if (data.hasOwnProperty('lastName')) {
|
||||
obj['lastName'] = ApiClient.convertToType(data['lastName'], 'String');
|
||||
}
|
||||
|
||||
if (data['email']) {
|
||||
_this['email'] = ApiClient.convertToType(data['email'], 'String');
|
||||
if (data.hasOwnProperty('email')) {
|
||||
obj['email'] = ApiClient.convertToType(data['email'], 'String');
|
||||
}
|
||||
|
||||
if (data['password']) {
|
||||
_this['password'] = ApiClient.convertToType(data['password'], 'String');
|
||||
if (data.hasOwnProperty('password')) {
|
||||
obj['password'] = ApiClient.convertToType(data['password'], 'String');
|
||||
}
|
||||
|
||||
if (data['phone']) {
|
||||
_this['phone'] = ApiClient.convertToType(data['phone'], 'String');
|
||||
if (data.hasOwnProperty('phone')) {
|
||||
obj['phone'] = ApiClient.convertToType(data['phone'], 'String');
|
||||
}
|
||||
|
||||
if (data['userStatus']) {
|
||||
_this['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Integer');
|
||||
if (data.hasOwnProperty('userStatus')) {
|
||||
obj['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
User.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
User.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
* @member {String} username
|
||||
*/
|
||||
exports.prototype['username'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getUsername = function() {
|
||||
return this['username'];
|
||||
}
|
||||
* @member {String} firstName
|
||||
*/
|
||||
exports.prototype['firstName'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} username
|
||||
**/
|
||||
User.prototype.setUsername = function(username) {
|
||||
this['username'] = username;
|
||||
}
|
||||
* @member {String} lastName
|
||||
*/
|
||||
exports.prototype['lastName'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getFirstName = function() {
|
||||
return this['firstName'];
|
||||
}
|
||||
* @member {String} email
|
||||
*/
|
||||
exports.prototype['email'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} firstName
|
||||
**/
|
||||
User.prototype.setFirstName = function(firstName) {
|
||||
this['firstName'] = firstName;
|
||||
}
|
||||
* @member {String} password
|
||||
*/
|
||||
exports.prototype['password'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getLastName = function() {
|
||||
return this['lastName'];
|
||||
}
|
||||
* @member {String} phone
|
||||
*/
|
||||
exports.prototype['phone'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} lastName
|
||||
**/
|
||||
User.prototype.setLastName = function(lastName) {
|
||||
this['lastName'] = lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getEmail = function() {
|
||||
return this['email'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} email
|
||||
**/
|
||||
User.prototype.setEmail = function(email) {
|
||||
this['email'] = email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getPassword = function() {
|
||||
return this['password'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} password
|
||||
**/
|
||||
User.prototype.setPassword = function(password) {
|
||||
this['password'] = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getPhone = function() {
|
||||
return this['phone'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} phone
|
||||
**/
|
||||
User.prototype.setPhone = function(phone) {
|
||||
this['phone'] = phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* get User Status
|
||||
* @return {Integer}
|
||||
**/
|
||||
User.prototype.getUserStatus = function() {
|
||||
return this['userStatus'];
|
||||
}
|
||||
|
||||
/**
|
||||
* set User Status
|
||||
* @param {Integer} userStatus
|
||||
**/
|
||||
User.prototype.setUserStatus = function(userStatus) {
|
||||
this['userStatus'] = userStatus;
|
||||
}
|
||||
* User Status
|
||||
* @member {Integer} userStatus
|
||||
*/
|
||||
exports.prototype['userStatus'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return User;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -4,34 +4,35 @@ if (typeof module === 'object' && module.exports) {
|
||||
var sinon = require('sinon');
|
||||
}
|
||||
|
||||
var apiClient = SwaggerPetstore.ApiClient.default;
|
||||
var apiClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
describe('ApiClient', function() {
|
||||
describe('defaults', function() {
|
||||
it('should have correct default values with the default API client', function() {
|
||||
expect(apiClient).to.be.ok();
|
||||
expect(apiClient.basePath).to.be('http://petstore.swagger.io/v2');
|
||||
expect(apiClient.authentications).to.eql({
|
||||
petstore_auth: {type: 'oauth2'},
|
||||
api_key: {type: 'apiKey', in: 'header', name: 'api_key'},
|
||||
api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||
test_http_basic: {type: 'basic'},
|
||||
test_api_client_id: {
|
||||
type: 'apiKey',
|
||||
in: 'header',
|
||||
'in': 'header',
|
||||
name: 'x-test_api_client_id'
|
||||
},
|
||||
test_api_client_secret: {
|
||||
type: 'apiKey',
|
||||
in: 'header',
|
||||
'in': 'header',
|
||||
name: 'x-test_api_client_secret'
|
||||
},
|
||||
test_api_key_query: {
|
||||
type: 'apiKey',
|
||||
in: 'query',
|
||||
'in': 'query',
|
||||
name: 'test_api_key_query'
|
||||
},
|
||||
test_api_key_header: {
|
||||
type: 'apiKey',
|
||||
in: 'header',
|
||||
'in': 'header',
|
||||
name: 'test_api_key_header'
|
||||
}
|
||||
});
|
||||
@ -274,7 +275,7 @@ describe('ApiClient', function() {
|
||||
var apiKeyAuth, oauth2;
|
||||
|
||||
beforeEach(function() {
|
||||
newClient.authentications[apiKeyAuthName] = {type: 'apiKey', name: 'api_key', in: 'query'};
|
||||
newClient.authentications[apiKeyAuthName] = {type: 'apiKey', name: 'api_key', 'in': 'query'};
|
||||
newClient.authentications[oauth2Name] = {type: 'oauth2'};
|
||||
apiKeyAuth = newClient.authentications[apiKeyAuthName];
|
||||
oauth2 = newClient.authentications[oauth2Name];
|
||||
@ -377,10 +378,10 @@ function makeDumbRequest(apiClient, opts) {
|
||||
var headerParams = opts.headerParams || {};
|
||||
var formParams = opts.formParams || {};
|
||||
var bodyParam = opts.bodyParam;
|
||||
var authNames = [];
|
||||
var contentTypes = opts.contentTypes || [];
|
||||
var accepts = opts.accepts || [];
|
||||
var callback = opts.callback;
|
||||
return apiClient.callApi(path, httpMethod, pathParams, queryParams,
|
||||
headerParams, formParams, bodyParam, contentTypes, accepts, callback
|
||||
);
|
||||
headerParams, formParams, bodyParam, authNames, contentTypes, accepts);
|
||||
}
|
||||
|
@ -3,25 +3,45 @@ if (typeof module === 'object' && module.exports) {
|
||||
var SwaggerPetstore = require('../../src/index');
|
||||
}
|
||||
|
||||
// When testing in the Node.js environment, ApiClient will need access to a Promise constructor.
|
||||
if (typeof Promise == 'undefined')
|
||||
Promise = require('promise');
|
||||
|
||||
var api;
|
||||
|
||||
beforeEach(function() {
|
||||
api = new SwaggerPetstore.PetApi();
|
||||
});
|
||||
|
||||
var getProperty = function(object, getter, property) {
|
||||
// Use getter method if present; otherwise, get the property directly.
|
||||
if (typeof object[getter] === 'function')
|
||||
return object[getter]();
|
||||
else
|
||||
return object[property];
|
||||
}
|
||||
|
||||
var setProperty = function(object, setter, property, value) {
|
||||
// Use setter method if present; otherwise, set the property directly.
|
||||
if (typeof object[setter] === 'function')
|
||||
object[setter](value);
|
||||
else
|
||||
object[property] = value;
|
||||
}
|
||||
|
||||
var createRandomPet = function() {
|
||||
var id = new Date().getTime();
|
||||
var pet = new SwaggerPetstore.Pet();
|
||||
pet.setId(id);
|
||||
pet.setName("gorilla" + id);
|
||||
setProperty(pet, "setId", "id", id);
|
||||
setProperty(pet, "setName", "name", "gorilla" + id);
|
||||
|
||||
var category = new SwaggerPetstore.Category();
|
||||
category.setName("really-happy");
|
||||
pet.setCategory(category);
|
||||
setProperty(category, "setName", "name", "really-happy");
|
||||
setProperty(pet, "setCategory", "category", category);
|
||||
|
||||
pet.setStatus('available');
|
||||
setProperty(pet, "setStatus", "status", "available");
|
||||
var photos = ["http://foo.bar.com/1", "http://foo.bar.com/2"];
|
||||
pet.setPhotoUrls(photos);
|
||||
setProperty(pet, "setPhotoUrls", "photoUrls", photos);
|
||||
|
||||
return pet;
|
||||
};
|
||||
@ -34,14 +54,13 @@ describe('PetApi', function() {
|
||||
return api.getPetById(pet.id)
|
||||
})
|
||||
.then(function(fetched) {
|
||||
//expect(response.status).to.be(200);
|
||||
//expect(response.ok).to.be(true);
|
||||
//expect(response.get('Content-Type')).to.be('application/json');
|
||||
expect(fetched).to.be.ok();
|
||||
expect(fetched.id).to.be(pet.id);
|
||||
expect(fetched.getPhotoUrls()).to.eql(pet.getPhotoUrls());
|
||||
expect(fetched.getCategory()).to.be.ok();
|
||||
expect(fetched.getCategory().getName()).to.be(pet.getCategory().getName());
|
||||
expect(getProperty(fetched, "getPhotoUrls", "photoUrls"))
|
||||
.to.eql(getProperty(pet, "getPhotoUrls", "photoUrls"));
|
||||
expect(getProperty(fetched, "getCategory", "category")).to.be.ok();
|
||||
expect(getProperty(getProperty(fetched, "getCategory", "category"), "getName", "name"))
|
||||
.to.be(getProperty(getProperty(pet, "getCategory", "category"), "getName", "name"));
|
||||
|
||||
api.deletePet(pet.id);
|
||||
done();
|
||||
|
@ -6,7 +6,7 @@ Version: 1.0.0
|
||||
|
||||
Automatically generated by the JavaScript Swagger Codegen project:
|
||||
|
||||
- Build date: 2016-03-17T16:01:44.795+08:00
|
||||
- Build date: 2016-03-18T12:55:58.976Z
|
||||
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
|
||||
|
||||
## Installation
|
||||
@ -116,25 +116,10 @@ Class | Method | HTTP request | Description
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
### test_api_client_id
|
||||
### test_api_key_header
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
### test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
|
||||
### api_key
|
||||
@ -147,15 +132,30 @@ Class | Method | HTTP request | Description
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
### test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **Location**: HTTP header
|
||||
|
||||
### test_api_client_id
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
### test_api_key_query
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_query
|
||||
- **Location**: URL query string
|
||||
|
||||
### test_api_key_header
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**photoUrls** | **[String]** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**tags** | [**[Tag]**](Tag.md) | | [optional]
|
||||
**id** | **Integer** | |
|
||||
**category** | **Object** | | [optional]
|
||||
**tags** | [**[Tag]**](Tag.md) | | [optional]
|
||||
**status** | **String** | pet status in the store | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**photoUrls** | **[String]** | | [optional]
|
||||
|
||||
|
||||
|
@ -293,16 +293,16 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
var api_key = defaultClient.authentications['api_key'];
|
||||
api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
@ -330,7 +330,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@ -350,16 +350,16 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
var api_key = defaultClient.authentications['api_key'];
|
||||
api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
@ -387,7 +387,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@ -407,16 +407,16 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
var api_key = defaultClient.authentications['api_key'];
|
||||
api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
@ -444,7 +444,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
|
@ -225,18 +225,18 @@ For valid response try integer IDs with value <= 5 or > 10. Other values w
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure API key authorization: test_api_key_query
|
||||
var test_api_key_query = defaultClient.authentications['test_api_key_query'];
|
||||
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)
|
||||
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
|
||||
|
||||
// Configure API key authorization: test_api_key_header
|
||||
var test_api_key_header = defaultClient.authentications['test_api_key_header'];
|
||||
test_api_key_header.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//test_api_key_header.apiKeyPrefix['test_api_key_header'] = "Token"
|
||||
|
||||
// Configure API key authorization: test_api_key_query
|
||||
var test_api_key_query = defaultClient.authentications['test_api_key_query'];
|
||||
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)
|
||||
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
|
||||
|
||||
var api = new SwaggerPetstore.StoreApi()
|
||||
|
||||
var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched
|
||||
@ -264,7 +264,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header)
|
||||
[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
|
@ -15,50 +15,78 @@
|
||||
}(this, function(superagent) {
|
||||
'use strict';
|
||||
|
||||
var ApiClient = function ApiClient() {
|
||||
/**
|
||||
* The base path to put in front of every API call's (relative) path.
|
||||
* @module ApiClient
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
|
||||
* application to use this class directly - the *Api and model classes provide the public API for the service. The
|
||||
* contents of this file should be regarded as internal but are documented for completeness.
|
||||
* @alias module:ApiClient
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
/**
|
||||
* The base URL against which to resolve every API call's (relative) path.
|
||||
* @type {String}
|
||||
* @default http://petstore.swagger.io/v2
|
||||
*/
|
||||
this.basePath = 'http://petstore.swagger.io/v2'.replace(/\/+$/, '');
|
||||
|
||||
/**
|
||||
* The authentication methods to be included for all API calls.
|
||||
* @type {Array.<String>}
|
||||
*/
|
||||
this.authentications = {
|
||||
'petstore_auth': {type: 'oauth2'},
|
||||
'test_api_client_id': {type: 'apiKey', in: 'header', name: 'x-test_api_client_id'},
|
||||
'test_api_client_secret': {type: 'apiKey', in: 'header', name: 'x-test_api_client_secret'},
|
||||
'api_key': {type: 'apiKey', in: 'header', name: 'api_key'},
|
||||
'test_api_key_header': {type: 'apiKey', 'in': 'header', name: 'test_api_key_header'},
|
||||
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||
'test_http_basic': {type: 'basic'},
|
||||
'test_api_key_query': {type: 'apiKey', in: 'query', name: 'test_api_key_query'},
|
||||
'test_api_key_header': {type: 'apiKey', in: 'header', name: 'test_api_key_header'}
|
||||
'test_api_client_secret': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_secret'},
|
||||
'test_api_client_id': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_id'},
|
||||
'test_api_key_query': {type: 'apiKey', 'in': 'query', name: 'test_api_key_query'},
|
||||
'petstore_auth': {type: 'oauth2'}
|
||||
};
|
||||
|
||||
/**
|
||||
* The default HTTP headers to be included for all API calls.
|
||||
* @type {Array.<String>}
|
||||
* @default {}
|
||||
*/
|
||||
this.defaultHeaders = {};
|
||||
|
||||
/**
|
||||
* The default HTTP timeout for all API calls.
|
||||
* @type {Number}
|
||||
* @default 60000
|
||||
*/
|
||||
this.timeout = 60000;
|
||||
};
|
||||
|
||||
ApiClient.prototype.paramToString = function paramToString(param) {
|
||||
if (param == null) {
|
||||
// return empty string for null and undefined
|
||||
/**
|
||||
* Returns a string representation for an actual parameter.
|
||||
* @param param The actual parameter.
|
||||
* @returns {String} The string representation of <code>param</code>.
|
||||
*/
|
||||
exports.prototype.paramToString = function(param) {
|
||||
if (param == undefined || param == null) {
|
||||
return '';
|
||||
} else if (param instanceof Date) {
|
||||
return param.toJSON();
|
||||
} else {
|
||||
return param.toString();
|
||||
}
|
||||
if (param instanceof Date) {
|
||||
return param.toJSON();
|
||||
}
|
||||
return param.toString();
|
||||
};
|
||||
|
||||
/**
|
||||
* Build full URL by appending the given path to base path and replacing
|
||||
* path parameter placeholders with parameter values.
|
||||
* Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values.
|
||||
* NOTE: query parameters are not handled here.
|
||||
* @param {String} path The path to append to the base URL.
|
||||
* @param {Object} pathParams The parameter values to append.
|
||||
* @returns {String} The encoded path with parameter values substituted.
|
||||
*/
|
||||
ApiClient.prototype.buildUrl = function buildUrl(path, pathParams) {
|
||||
exports.prototype.buildUrl = function(path, pathParams) {
|
||||
if (!path.match(/^\//)) {
|
||||
path = '/' + path;
|
||||
}
|
||||
@ -77,34 +105,40 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* Checks whether the given content type represents JSON.<br>
|
||||
* JSON content type examples:<br>
|
||||
* <ul>
|
||||
* <li>application/json</li>
|
||||
* <li>application/json; charset=UTF8</li>
|
||||
* <li>APPLICATION/JSON</li>
|
||||
* </ul>
|
||||
* @param {String} contentType The MIME content type to check.
|
||||
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
|
||||
*/
|
||||
ApiClient.prototype.isJsonMime = function isJsonMime(mime) {
|
||||
return Boolean(mime != null && mime.match(/^application\/json(;.*)?$/i));
|
||||
exports.prototype.isJsonMime = function(contentType) {
|
||||
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
|
||||
};
|
||||
|
||||
/**
|
||||
* Choose a MIME from the given MIMEs with JSON preferred,
|
||||
* i.e. return JSON if included, otherwise return the first one.
|
||||
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
|
||||
* @param {Array.<String>} contentTypes
|
||||
* @returns {String} The chosen content type, preferring JSON.
|
||||
*/
|
||||
ApiClient.prototype.jsonPreferredMime = function jsonPreferredMime(mimes) {
|
||||
var len = mimes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (this.isJsonMime(mimes[i])) {
|
||||
return mimes[i];
|
||||
exports.prototype.jsonPreferredMime = function(contentTypes) {
|
||||
for (var i = 0; i < contentTypes.length; i++) {
|
||||
if (this.isJsonMime(contentTypes[i])) {
|
||||
return contentTypes[i];
|
||||
}
|
||||
}
|
||||
return mimes[0];
|
||||
return contentTypes[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the given parameter value is like file content.
|
||||
* Checks whether the given parameter value represents file-like content.
|
||||
* @param param The parameter to check.
|
||||
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
||||
*/
|
||||
ApiClient.prototype.isFileParam = function isFileParam(param) {
|
||||
exports.prototype.isFileParam = function(param) {
|
||||
// fs.ReadStream in Node.js (but not in runtime like browserify)
|
||||
if (typeof window === 'undefined' &&
|
||||
typeof require === 'function' &&
|
||||
@ -128,15 +162,19 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalize parameters values:
|
||||
* remove nils,
|
||||
* keep files and arrays,
|
||||
* format to string with `paramToString` for other cases.
|
||||
* Normalizes parameter values:
|
||||
* <ul>
|
||||
* <li>remove nils</li>
|
||||
* <li>keep files and arrays</li>
|
||||
* <li>format to string with `paramToString` for other cases</li>
|
||||
* </ul>
|
||||
* @param {Object.<String, Object>} params The parameters as object properties.
|
||||
* @returns {Object.<String, Object>} normalized parameters.
|
||||
*/
|
||||
ApiClient.prototype.normalizeParams = function normalizeParams(params) {
|
||||
exports.prototype.normalizeParams = function(params) {
|
||||
var newParams = {};
|
||||
for (var key in params) {
|
||||
if (params.hasOwnProperty(key) && params[key] != null) {
|
||||
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
|
||||
var value = params[key];
|
||||
if (this.isFileParam(value) || Array.isArray(value)) {
|
||||
newParams[key] = value;
|
||||
@ -149,10 +187,46 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* Build parameter value according to the given collection format.
|
||||
* @param {String} collectionFormat one of 'csv', 'ssv', 'tsv', 'pipes' and 'multi'
|
||||
* Enumeration of collection format separator strategies.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
ApiClient.prototype.buildCollectionParam = function buildCollectionParam(param, collectionFormat) {
|
||||
exports.CollectionFormatEnum = {
|
||||
/**
|
||||
* Comma-separated values. Value: <code>csv</code>
|
||||
* @const
|
||||
*/
|
||||
CSV: ',',
|
||||
/**
|
||||
* Space-separated values. Value: <code>ssv</code>
|
||||
* @const
|
||||
*/
|
||||
SSV: ' ',
|
||||
/**
|
||||
* Tab-separated values. Value: <code>tsv</code>
|
||||
* @const
|
||||
*/
|
||||
TSV: '\t',
|
||||
/**
|
||||
* Pipe(|)-separated values. Value: <code>pipes</code>
|
||||
* @const
|
||||
*/
|
||||
PIPES: '|',
|
||||
/**
|
||||
* Native array. Value: <code>multi</code>
|
||||
* @const
|
||||
*/
|
||||
MULTI: 'multi'
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds a string representation of an array-type actual parameter, according to the given collection format.
|
||||
* @param {Array} param An array parameter.
|
||||
* @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
|
||||
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
|
||||
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
|
||||
*/
|
||||
exports.prototype.buildCollectionParam = function buildCollectionParam(param, collectionFormat) {
|
||||
if (param == null) {
|
||||
return null;
|
||||
}
|
||||
@ -166,14 +240,19 @@
|
||||
case 'pipes':
|
||||
return param.map(this.paramToString).join('|');
|
||||
case 'multi':
|
||||
// return the array directly as Superagent will handle it as expected
|
||||
// return the array directly as SuperAgent will handle it as expected
|
||||
return param.map(this.paramToString);
|
||||
default:
|
||||
throw new Error('Unknown collection format: ' + collectionFormat);
|
||||
}
|
||||
};
|
||||
|
||||
ApiClient.prototype.applyAuthToRequest = function applyAuthToRequest(request, authNames) {
|
||||
/**
|
||||
* Applies authentication headers to the request.
|
||||
* @param {Object} request The request object created by a <code>superagent()</code> call.
|
||||
* @param {Array.<String>} authNames An array of authentication method names.
|
||||
*/
|
||||
exports.prototype.applyAuthToRequest = function(request, authNames) {
|
||||
var _this = this;
|
||||
authNames.forEach(function(authName) {
|
||||
var auth = _this.authentications[authName];
|
||||
@ -191,7 +270,7 @@
|
||||
} else {
|
||||
data[auth.name] = auth.apiKey;
|
||||
}
|
||||
if (auth.in === 'header') {
|
||||
if (auth['in'] === 'header') {
|
||||
request.set(data);
|
||||
} else {
|
||||
request.query(data);
|
||||
@ -209,24 +288,58 @@
|
||||
});
|
||||
};
|
||||
|
||||
ApiClient.prototype.deserialize = function deserialize(response, returnType) {
|
||||
/**
|
||||
* Deserializes an HTTP response body into a value of the specified type.
|
||||
* @param {Object} response A SuperAgent response object.
|
||||
* @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types
|
||||
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
||||
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
||||
* all properties on <code>data<code> will be converted to this type.
|
||||
* @returns A value of the specified type.
|
||||
*/
|
||||
exports.prototype.deserialize = function deserialize(response, returnType) {
|
||||
if (response == null || returnType == null) {
|
||||
return null;
|
||||
}
|
||||
// Rely on Superagent for parsing response body.
|
||||
// Rely on SuperAgent for parsing response body.
|
||||
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
||||
var data = response.body;
|
||||
if (data == null) {
|
||||
// Superagent does not always produce a body; use the unparsed response
|
||||
// as a fallback
|
||||
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
||||
data = response.text;
|
||||
}
|
||||
return ApiClient.convertToType(data, returnType);
|
||||
return exports.convertToType(data, returnType);
|
||||
};
|
||||
|
||||
ApiClient.prototype.callApi = function callApi(path, httpMethod, pathParams,
|
||||
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes,
|
||||
accepts, returnType, callback) {
|
||||
/**
|
||||
* 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.
|
||||
* @param {String} path The base URL to invoke.
|
||||
* @param {String} httpMethod The HTTP method to use.
|
||||
* @param {Object.<String, String>} pathParams A map of path parameters and their values.
|
||||
* @param {Object.<String, Object>} queryParams A map of query parameters and their values.
|
||||
* @param {Object.<String, Object>} headerParams A map of header parameters and their values.
|
||||
* @param {Object.<String, Object>} formParams A map of form parameters and their values.
|
||||
* @param {Object} bodyParam The value to pass as the request body.
|
||||
* @param {Array.<String>} authNames An array of authentication type names.
|
||||
* @param {Array.<String>} contentTypes An array of request MIME types.
|
||||
* @param {Array.<String>} accepts An array of acceptable response MIME types.
|
||||
* @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 {module:ApiClient~callApiCallback} callback The callback function.
|
||||
* @returns {Object} The SuperAgent request object.
|
||||
*/
|
||||
exports.prototype.callApi = function callApi(path, httpMethod, pathParams,
|
||||
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
|
||||
returnType, callback) {
|
||||
|
||||
var _this = this;
|
||||
var url = this.buildUrl(path, pathParams);
|
||||
var request = superagent(httpMethod, url);
|
||||
@ -274,7 +387,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
request.end(function(error, response) {
|
||||
if (callback) {
|
||||
var data = null;
|
||||
@ -286,15 +398,27 @@
|
||||
});
|
||||
|
||||
return request;
|
||||
|
||||
};
|
||||
|
||||
ApiClient.parseDate = function parseDate(str) {
|
||||
str = str.replace(/T/i, ' ');
|
||||
return new Date(str);
|
||||
/**
|
||||
* Parses an ISO-8601 string representation of a date value.
|
||||
* @param {String} str The date value as a string.
|
||||
* @returns {Date} The parsed date object.
|
||||
*/
|
||||
exports.parseDate = function(str) {
|
||||
return new Date(str.replace(/T/i, ' '));
|
||||
};
|
||||
|
||||
ApiClient.convertToType = function convertToType(data, type) {
|
||||
/**
|
||||
* Converts a value to the specified type.
|
||||
* @param {(String|Object)} data The data to convert, as a string or object.
|
||||
* @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
|
||||
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
||||
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
||||
* all properties on <code>data<code> will be converted to this type.
|
||||
* @returns An instance of the specified type.
|
||||
*/
|
||||
exports.convertToType = function(data, type) {
|
||||
switch (type) {
|
||||
case 'Boolean':
|
||||
return Boolean(data);
|
||||
@ -312,13 +436,12 @@
|
||||
return data;
|
||||
} else if (typeof type === 'function') {
|
||||
// for model type like: User
|
||||
var model = type.constructFromObject(data);
|
||||
return model;
|
||||
return type.constructFromObject(data);
|
||||
} else if (Array.isArray(type)) {
|
||||
// for array type like: ['String']
|
||||
var itemType = type[0];
|
||||
return data.map(function(item) {
|
||||
return ApiClient.convertToType(item, itemType);
|
||||
return exports.convertToType(item, itemType);
|
||||
});
|
||||
} else if (typeof type === 'object') {
|
||||
// for plain object type like: {'String': 'Integer'}
|
||||
@ -333,8 +456,8 @@
|
||||
var result = {};
|
||||
for (var k in data) {
|
||||
if (data.hasOwnProperty(k)) {
|
||||
var key = ApiClient.convertToType(k, keyType);
|
||||
var value = ApiClient.convertToType(data[k], valueType);
|
||||
var key = exports.convertToType(k, keyType);
|
||||
var value = exports.convertToType(data[k], valueType);
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
@ -346,7 +469,11 @@
|
||||
}
|
||||
};
|
||||
|
||||
ApiClient.default = new ApiClient();
|
||||
/**
|
||||
* The default API client implementation.
|
||||
* @type {module:ApiClient}
|
||||
*/
|
||||
exports.instance = new exports();
|
||||
|
||||
return ApiClient;
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,19 +15,39 @@
|
||||
}(this, function(ApiClient, Pet, InlineResponse200) {
|
||||
'use strict';
|
||||
|
||||
var PetApi = function PetApi(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.default;
|
||||
/**
|
||||
* Pet service.
|
||||
* @module api/PetApi
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
var self = this;
|
||||
/**
|
||||
* Constructs a new PetApi.
|
||||
* @alias module:api/PetApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the addPet operation.
|
||||
* @callback module:api/PetApi~addPetCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
* @param {Pet} opts['body'] Pet object that needs to be added to the store
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/Pet} opts.body Pet object that needs to be added to the store
|
||||
* @param {module:api/PetApi~addPetCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.addPet = function(opts, callback) {
|
||||
this.addPet = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -51,16 +71,24 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the addPetUsingByteArray operation.
|
||||
* @callback module:api/PetApi~addPetUsingByteArrayCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*
|
||||
* @param {String} opts['body'] Pet object in the form of byte array
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.body Pet object in the form of byte array
|
||||
* @param {module:api/PetApi~addPetUsingByteArrayCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.addPetUsingByteArray = function(opts, callback) {
|
||||
this.addPetUsingByteArray = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -84,22 +112,30 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the deletePet operation.
|
||||
* @callback module:api/PetApi~deletePetCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
* @param {Integer} petId Pet id to delete
|
||||
* @param {String} opts['apiKey']
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.apiKey
|
||||
* @param {module:api/PetApi~deletePetCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.deletePet = function(petId, opts, callback) {
|
||||
this.deletePet = function(petId, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling deletePet";
|
||||
}
|
||||
|
||||
@ -125,17 +161,25 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the findPetsByStatus operation.
|
||||
* @callback module:api/PetApi~findPetsByStatusCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {Array.<module:model/Pet>} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param {[String]} opts['status'] Status values that need to be considered for query (default to available)
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: [Pet]
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Array.<String>} opts.status Status values that need to be considered for query
|
||||
* @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {Array.<module:model/Pet>}
|
||||
*/
|
||||
self.findPetsByStatus = function(opts, callback) {
|
||||
this.findPetsByStatus = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
@ -160,17 +204,25 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the findPetsByTags operation.
|
||||
* @callback module:api/PetApi~findPetsByTagsCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {Array.<module:model/Pet>} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param {[String]} opts['tags'] Tags to filter by
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: [Pet]
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Array.<String>} opts.tags Tags to filter by
|
||||
* @param {module:api/PetApi~findPetsByTagsCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {Array.<module:model/Pet>}
|
||||
*/
|
||||
self.findPetsByTags = function(opts, callback) {
|
||||
this.findPetsByTags = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
@ -195,21 +247,28 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the getPetById operation.
|
||||
* @callback module:api/PetApi~getPetByIdCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/Pet} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param {Integer} petId ID of pet that needs to be fetched
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: Pet
|
||||
* @param {module:api/PetApi~getPetByIdCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {module:model/Pet}
|
||||
*/
|
||||
self.getPetById = function(petId, callback) {
|
||||
this.getPetById = function(petId, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling getPetById";
|
||||
}
|
||||
|
||||
@ -224,7 +283,7 @@
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth', 'api_key'];
|
||||
var authNames = ['api_key', 'petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/json', 'application/xml'];
|
||||
var returnType = Pet;
|
||||
@ -234,21 +293,28 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the getPetByIdInObject operation.
|
||||
* @callback module:api/PetApi~getPetByIdInObjectCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/InlineResponse200} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param {Integer} petId ID of pet that needs to be fetched
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: InlineResponse200
|
||||
* @param {module:api/PetApi~getPetByIdInObjectCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {module:model/InlineResponse200}
|
||||
*/
|
||||
self.getPetByIdInObject = function(petId, callback) {
|
||||
this.getPetByIdInObject = function(petId, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling getPetByIdInObject";
|
||||
}
|
||||
|
||||
@ -263,7 +329,7 @@
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth', 'api_key'];
|
||||
var authNames = ['api_key', 'petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/json', 'application/xml'];
|
||||
var returnType = InlineResponse200;
|
||||
@ -273,21 +339,28 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the petPetIdtestingByteArraytrueGet operation.
|
||||
* @callback module:api/PetApi~petPetIdtestingByteArraytrueGetCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {'String'} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param {Integer} petId ID of pet that needs to be fetched
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: 'String'
|
||||
* @param {module:api/PetApi~petPetIdtestingByteArraytrueGetCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {'String'}
|
||||
*/
|
||||
self.petPetIdtestingByteArraytrueGet = function(petId, callback) {
|
||||
this.petPetIdtestingByteArraytrueGet = function(petId, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet";
|
||||
}
|
||||
|
||||
@ -302,7 +375,7 @@
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth', 'api_key'];
|
||||
var authNames = ['api_key', 'petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/json', 'application/xml'];
|
||||
var returnType = 'String';
|
||||
@ -312,16 +385,24 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the updatePet operation.
|
||||
* @callback module:api/PetApi~updatePetCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param {Pet} opts['body'] Pet object that needs to be added to the store
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/Pet} opts.body Pet object that needs to be added to the store
|
||||
* @param {module:api/PetApi~updatePetCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.updatePet = function(opts, callback) {
|
||||
this.updatePet = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -345,23 +426,31 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the updatePetWithForm operation.
|
||||
* @callback module:api/PetApi~updatePetWithFormCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
* @param {String} petId ID of pet that needs to be updated
|
||||
* @param {String} opts['name'] Updated name of the pet
|
||||
* @param {String} opts['status'] Updated status of the pet
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.name Updated name of the pet
|
||||
* @param {String} opts.status Updated status of the pet
|
||||
* @param {module:api/PetApi~updatePetWithFormCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.updatePetWithForm = function(petId, opts, callback) {
|
||||
this.updatePetWithForm = function(petId, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling updatePetWithForm";
|
||||
}
|
||||
|
||||
@ -388,23 +477,31 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the uploadFile operation.
|
||||
* @callback module:api/PetApi~uploadFileCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param {Integer} petId ID of pet to update
|
||||
* @param {String} opts['additionalMetadata'] Additional data to pass to server
|
||||
* @param {File} opts['file'] file to upload
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.additionalMetadata Additional data to pass to server
|
||||
* @param {File} opts.file file to upload
|
||||
* @param {module:api/PetApi~uploadFileCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.uploadFile = function(petId, opts, callback) {
|
||||
this.uploadFile = function(petId, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
if (petId == undefined || petId == null) {
|
||||
throw "Missing the required parameter 'petId' when calling uploadFile";
|
||||
}
|
||||
|
||||
@ -431,11 +528,8 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return PetApi;
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,23 +15,42 @@
|
||||
}(this, function(ApiClient, Order) {
|
||||
'use strict';
|
||||
|
||||
var StoreApi = function StoreApi(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.default;
|
||||
/**
|
||||
* Store service.
|
||||
* @module api/StoreApi
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
var self = this;
|
||||
/**
|
||||
* Constructs a new StoreApi.
|
||||
* @alias module:api/StoreApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the deleteOrder operation.
|
||||
* @callback module:api/StoreApi~deleteOrderCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* @param {String} orderId ID of the order that needs to be deleted
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {module:api/StoreApi~deleteOrderCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.deleteOrder = function(orderId, callback) {
|
||||
this.deleteOrder = function(orderId, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'orderId' is set
|
||||
if (orderId == null) {
|
||||
if (orderId == undefined || orderId == null) {
|
||||
throw "Missing the required parameter 'orderId' when calling deleteOrder";
|
||||
}
|
||||
|
||||
@ -56,17 +75,25 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the findOrdersByStatus operation.
|
||||
* @callback module:api/StoreApi~findOrdersByStatusCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {Array.<module:model/Order>} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Finds orders by status
|
||||
* A single status value can be provided as a string
|
||||
* @param {String} opts['status'] Status value that needs to be considered for query (default to placed)
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: [Order]
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/String} opts.status Status value that needs to be considered for query
|
||||
* @param {module:api/StoreApi~findOrdersByStatusCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {Array.<module:model/Order>}
|
||||
*/
|
||||
self.findOrdersByStatus = function(opts, callback) {
|
||||
this.findOrdersByStatus = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
@ -91,16 +118,23 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the getInventory operation.
|
||||
* @callback module:api/StoreApi~getInventoryCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {Object.<String, {'String': 'Integer'}>} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {'String': 'Integer'}
|
||||
* @param {module:api/StoreApi~getInventoryCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {Object.<String, {'String': 'Integer'}>}
|
||||
*/
|
||||
self.getInventory = function(callback) {
|
||||
this.getInventory = function(callback) {
|
||||
var postBody = null;
|
||||
|
||||
|
||||
@ -123,16 +157,23 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the getInventoryInObject operation.
|
||||
* @callback module:api/StoreApi~getInventoryInObjectCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {Object} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
* Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: Object
|
||||
* @param {module:api/StoreApi~getInventoryInObjectCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {Object}
|
||||
*/
|
||||
self.getInventoryInObject = function(callback) {
|
||||
this.getInventoryInObject = function(callback) {
|
||||
var postBody = null;
|
||||
|
||||
|
||||
@ -155,21 +196,28 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the getOrderById operation.
|
||||
* @callback module:api/StoreApi~getOrderByIdCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/Order} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @param {String} orderId ID of pet that needs to be fetched
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: Order
|
||||
* @param {module:api/StoreApi~getOrderByIdCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {module:model/Order}
|
||||
*/
|
||||
self.getOrderById = function(orderId, callback) {
|
||||
this.getOrderById = function(orderId, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'orderId' is set
|
||||
if (orderId == null) {
|
||||
if (orderId == undefined || orderId == null) {
|
||||
throw "Missing the required parameter 'orderId' when calling getOrderById";
|
||||
}
|
||||
|
||||
@ -184,7 +232,7 @@
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['test_api_key_query', 'test_api_key_header'];
|
||||
var authNames = ['test_api_key_header', 'test_api_key_query'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/json', 'application/xml'];
|
||||
var returnType = Order;
|
||||
@ -194,17 +242,25 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the placeOrder operation.
|
||||
* @callback module:api/StoreApi~placeOrderCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/Order} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param {Order} opts['body'] order placed for purchasing the pet
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: Order
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/Order} opts.body order placed for purchasing the pet
|
||||
* @param {module:api/StoreApi~placeOrderCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {module:model/Order}
|
||||
*/
|
||||
self.placeOrder = function(opts, callback) {
|
||||
this.placeOrder = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -228,11 +284,8 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return StoreApi;
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,19 +15,39 @@
|
||||
}(this, function(ApiClient, User) {
|
||||
'use strict';
|
||||
|
||||
var UserApi = function UserApi(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.default;
|
||||
/**
|
||||
* User service.
|
||||
* @module api/UserApi
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
var self = this;
|
||||
/**
|
||||
* Constructs a new UserApi.
|
||||
* @alias module:api/UserApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the createUser operation.
|
||||
* @callback module:api/UserApi~createUserCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
* @param {User} opts['body'] Created user object
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/User} opts.body Created user object
|
||||
* @param {module:api/UserApi~createUserCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.createUser = function(opts, callback) {
|
||||
this.createUser = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -51,16 +71,24 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the createUsersWithArrayInput operation.
|
||||
* @callback module:api/UserApi~createUsersWithArrayInputCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param {[User]} opts['body'] List of user object
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Array.<module:model/User>} opts.body List of user object
|
||||
* @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.createUsersWithArrayInput = function(opts, callback) {
|
||||
this.createUsersWithArrayInput = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -84,16 +112,24 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the createUsersWithListInput operation.
|
||||
* @callback module:api/UserApi~createUsersWithListInputCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param {[User]} opts['body'] List of user object
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Array.<module:model/User>} opts.body List of user object
|
||||
* @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.createUsersWithListInput = function(opts, callback) {
|
||||
this.createUsersWithListInput = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
@ -117,20 +153,27 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the deleteUser operation.
|
||||
* @callback module:api/UserApi~deleteUserCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
* @param {String} username The name that needs to be deleted
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {module:api/UserApi~deleteUserCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.deleteUser = function(username, callback) {
|
||||
this.deleteUser = function(username, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username == null) {
|
||||
if (username == undefined || username == null) {
|
||||
throw "Missing the required parameter 'username' when calling deleteUser";
|
||||
}
|
||||
|
||||
@ -155,21 +198,28 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the getUserByName operation.
|
||||
* @callback module:api/UserApi~getUserByNameCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/User} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
* @param {String} username The name that needs to be fetched. Use user1 for testing.
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: User
|
||||
* @param {module:api/UserApi~getUserByNameCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {module:model/User}
|
||||
*/
|
||||
self.getUserByName = function(username, callback) {
|
||||
this.getUserByName = function(username, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username == null) {
|
||||
if (username == undefined || username == null) {
|
||||
throw "Missing the required parameter 'username' when calling getUserByName";
|
||||
}
|
||||
|
||||
@ -194,18 +244,26 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the loginUser operation.
|
||||
* @callback module:api/UserApi~loginUserCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {'String'} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
* @param {String} opts['username'] The user name for login
|
||||
* @param {String} opts['password'] The password for login in clear text
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* data is of type: 'String'
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.username The user name for login
|
||||
* @param {String} opts.password The password for login in clear text
|
||||
* @param {module:api/UserApi~loginUserCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {'String'}
|
||||
*/
|
||||
self.loginUser = function(opts, callback) {
|
||||
this.loginUser = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
@ -231,15 +289,22 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the logoutUser operation.
|
||||
* @callback module:api/UserApi~logoutUserCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {module:api/UserApi~logoutUserCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.logoutUser = function(callback) {
|
||||
this.logoutUser = function(callback) {
|
||||
var postBody = null;
|
||||
|
||||
|
||||
@ -262,22 +327,30 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the updateUser operation.
|
||||
* @callback module:api/UserApi~updateUserCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
* @param {String} username name that need to be deleted
|
||||
* @param {User} opts['body'] Updated user object
|
||||
* @param {function} callback the callback function, accepting three arguments: error, data, response
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/User} opts.body Updated user object
|
||||
* @param {module:api/UserApi~updateUserCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
self.updateUser = function(username, opts, callback) {
|
||||
this.updateUser = function(username, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username == null) {
|
||||
if (username == undefined || username == null) {
|
||||
throw "Missing the required parameter 'username' when calling updateUser";
|
||||
}
|
||||
|
||||
@ -302,11 +375,8 @@
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return UserApi;
|
||||
return exports;
|
||||
}));
|
||||
|
@ -9,20 +9,109 @@
|
||||
}(function(ApiClient, Category, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
/**
|
||||
* 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.<br>
|
||||
* The <code>index</code> module provides access to constructors for all the classes which comprise the public API.
|
||||
* <p>
|
||||
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
|
||||
* <pre>
|
||||
* var SwaggerPetstore = require('./index'); // See note below*.
|
||||
* var xxxSvc = new SwaggerPetstore.XxxApi(); // Allocate the API class we're going to use.
|
||||
* var yyyModel = new SwaggerPetstore.Yyy(); // Construct a model instance.
|
||||
* yyyModel.someProperty = 'someValue';
|
||||
* ...
|
||||
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
|
||||
* ...
|
||||
* </pre>
|
||||
* <em>*NOTE: For a top-level AMD script, use require(['./index'], function(){...}) and put the application logic within the
|
||||
* callback function.</em>
|
||||
* </p>
|
||||
* <p>
|
||||
* A non-AMD browser application (discouraged) might do something like this:
|
||||
* <pre>
|
||||
* var xxxSvc = new SwaggerPetstore.XxxApi(); // Allocate the API class we're going to use.
|
||||
* var yyy = new SwaggerPetstore.Yyy(); // Construct a model instance.
|
||||
* yyyModel.someProperty = 'someValue';
|
||||
* ...
|
||||
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
|
||||
* ...
|
||||
* </pre>
|
||||
* </p>
|
||||
* @module index
|
||||
* @version 1.0.0
|
||||
*/
|
||||
var exports = {
|
||||
/**
|
||||
* The ApiClient constructor.
|
||||
* @property {module:ApiClient}
|
||||
*/
|
||||
ApiClient: ApiClient,
|
||||
/**
|
||||
* The Category model constructor.
|
||||
* @property {module:model/Category}
|
||||
*/
|
||||
Category: Category,
|
||||
/**
|
||||
* The InlineResponse200 model constructor.
|
||||
* @property {module:model/InlineResponse200}
|
||||
*/
|
||||
InlineResponse200: InlineResponse200,
|
||||
/**
|
||||
* The Model200Response model constructor.
|
||||
* @property {module:model/Model200Response}
|
||||
*/
|
||||
Model200Response: Model200Response,
|
||||
/**
|
||||
* The ModelReturn model constructor.
|
||||
* @property {module:model/ModelReturn}
|
||||
*/
|
||||
ModelReturn: ModelReturn,
|
||||
/**
|
||||
* The Name model constructor.
|
||||
* @property {module:model/Name}
|
||||
*/
|
||||
Name: Name,
|
||||
/**
|
||||
* The Order model constructor.
|
||||
* @property {module:model/Order}
|
||||
*/
|
||||
Order: Order,
|
||||
/**
|
||||
* The Pet model constructor.
|
||||
* @property {module:model/Pet}
|
||||
*/
|
||||
Pet: Pet,
|
||||
/**
|
||||
* The SpecialModelName model constructor.
|
||||
* @property {module:model/SpecialModelName}
|
||||
*/
|
||||
SpecialModelName: SpecialModelName,
|
||||
/**
|
||||
* The Tag model constructor.
|
||||
* @property {module:model/Tag}
|
||||
*/
|
||||
Tag: Tag,
|
||||
/**
|
||||
* The User model constructor.
|
||||
* @property {module:model/User}
|
||||
*/
|
||||
User: User,
|
||||
/**
|
||||
* The PetApi service constructor.
|
||||
* @property {module:api/PetApi}
|
||||
*/
|
||||
PetApi: PetApi,
|
||||
/**
|
||||
* The StoreApi service constructor.
|
||||
* @property {module:api/StoreApi}
|
||||
*/
|
||||
StoreApi: StoreApi,
|
||||
/**
|
||||
* The UserApi service constructor.
|
||||
* @property {module:api/UserApi}
|
||||
*/
|
||||
UserApi: UserApi
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,63 +15,57 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Category model module.
|
||||
* @module model/Category
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Category</code>.
|
||||
* @alias module:model/Category
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
|
||||
var Category = function Category() {
|
||||
|
||||
};
|
||||
|
||||
Category.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Category();
|
||||
/**
|
||||
* Constructs a <code>Category</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Category} obj Optional instance to populate.
|
||||
* @return {module:model/Category} The populated <code>Category</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Category.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
Category.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
Category.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
**/
|
||||
Category.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* @member {String} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Category;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,161 +15,118 @@
|
||||
}(this, function(ApiClient, Tag) {
|
||||
'use strict';
|
||||
|
||||
|
||||
var InlineResponse200 = function InlineResponse200(id) {
|
||||
/**
|
||||
* The InlineResponse200 model module.
|
||||
* @module model/InlineResponse200
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* datatype: Integer
|
||||
* required
|
||||
**/
|
||||
* Constructs a new <code>InlineResponse200</code>.
|
||||
* @alias module:model/InlineResponse200
|
||||
* @class
|
||||
* @param id
|
||||
*/
|
||||
var exports = function(id) {
|
||||
|
||||
|
||||
this['id'] = id;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
InlineResponse200.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new InlineResponse200();
|
||||
/**
|
||||
* Constructs a <code>InlineResponse200</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/InlineResponse200} obj Optional instance to populate.
|
||||
* @return {module:model/InlineResponse200} The populated <code>InlineResponse200</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['photoUrls']) {
|
||||
_this['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
|
||||
if (data.hasOwnProperty('tags')) {
|
||||
obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
|
||||
}
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('category')) {
|
||||
obj['category'] = ApiClient.convertToType(data['category'], Object);
|
||||
}
|
||||
|
||||
if (data['category']) {
|
||||
_this['category'] = ApiClient.convertToType(data['category'], Object);
|
||||
if (data.hasOwnProperty('status')) {
|
||||
obj['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
}
|
||||
|
||||
if (data['tags']) {
|
||||
_this['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
}
|
||||
|
||||
if (data['status']) {
|
||||
_this['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
if (data.hasOwnProperty('photoUrls')) {
|
||||
obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {[String]}
|
||||
**/
|
||||
InlineResponse200.prototype.getPhotoUrls = function() {
|
||||
return this['photoUrls'];
|
||||
}
|
||||
* @member {Array.<module:model/Tag>} tags
|
||||
*/
|
||||
exports.prototype['tags'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {[String]} photoUrls
|
||||
**/
|
||||
InlineResponse200.prototype.setPhotoUrls = function(photoUrls) {
|
||||
this['photoUrls'] = photoUrls;
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
InlineResponse200.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
* @member {Object} category
|
||||
*/
|
||||
exports.prototype['category'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
**/
|
||||
InlineResponse200.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* pet status in the store
|
||||
* @member {module:model/InlineResponse200.StatusEnum} status
|
||||
*/
|
||||
exports.prototype['status'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
InlineResponse200.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {String} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
InlineResponse200.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
* @member {Array.<String>} photoUrls
|
||||
*/
|
||||
exports.prototype['photoUrls'] = undefined;
|
||||
|
||||
|
||||
/**
|
||||
* @return {Object}
|
||||
**/
|
||||
InlineResponse200.prototype.getCategory = function() {
|
||||
return this['category'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} category
|
||||
**/
|
||||
InlineResponse200.prototype.setCategory = function(category) {
|
||||
this['category'] = category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {[Tag]}
|
||||
**/
|
||||
InlineResponse200.prototype.getTags = function() {
|
||||
return this['tags'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {[Tag]} tags
|
||||
**/
|
||||
InlineResponse200.prototype.setTags = function(tags) {
|
||||
this['tags'] = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* get pet status in the store
|
||||
* @return {StatusEnum}
|
||||
**/
|
||||
InlineResponse200.prototype.getStatus = function() {
|
||||
return this['status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* set pet status in the store
|
||||
* @param {StatusEnum} status
|
||||
**/
|
||||
InlineResponse200.prototype.setStatus = function(status) {
|
||||
this['status'] = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var StatusEnum = {
|
||||
|
||||
* Allowed values for the <code>status</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
exports.StatusEnum = {
|
||||
/**
|
||||
* value: available
|
||||
* @const
|
||||
*/
|
||||
AVAILABLE: "available",
|
||||
|
||||
/**
|
||||
* value: pending
|
||||
* @const
|
||||
*/
|
||||
PENDING: "pending",
|
||||
|
||||
/**
|
||||
* value: sold
|
||||
* @const
|
||||
*/
|
||||
SOLD: "sold"
|
||||
};
|
||||
|
||||
InlineResponse200.StatusEnum = StatusEnum;
|
||||
|
||||
|
||||
return InlineResponse200;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,45 +15,48 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Model200Response model module.
|
||||
* @module model/Model200Response
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Model200Response</code>.
|
||||
* @alias module:model/Model200Response
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
var Model200Response = function Model200Response() {
|
||||
|
||||
};
|
||||
|
||||
Model200Response.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Model200Response();
|
||||
/**
|
||||
* Constructs a <code>Model200Response</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Model200Response} obj Optional instance to populate.
|
||||
* @return {module:model/Model200Response} The populated <code>Model200Response</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Model200Response.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} name
|
||||
**/
|
||||
Model200Response.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* @member {Integer} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Model200Response;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,45 +15,48 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The ModelReturn model module.
|
||||
* @module model/ModelReturn
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>ModelReturn</code>.
|
||||
* @alias module:model/ModelReturn
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
var ModelReturn = function ModelReturn() {
|
||||
|
||||
};
|
||||
|
||||
ModelReturn.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new ModelReturn();
|
||||
/**
|
||||
* Constructs a <code>ModelReturn</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/ModelReturn} obj Optional instance to populate.
|
||||
* @return {module:model/ModelReturn} The populated <code>ModelReturn</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['return']) {
|
||||
_this['return'] = ApiClient.convertToType(data['return'], 'Integer');
|
||||
if (data.hasOwnProperty('return')) {
|
||||
obj['return'] = ApiClient.convertToType(data['return'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
ModelReturn.prototype.getReturn = function() {
|
||||
return this['return'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} _return
|
||||
**/
|
||||
ModelReturn.prototype.setReturn = function(_return) {
|
||||
this['return'] = _return;
|
||||
}
|
||||
* @member {Integer} return
|
||||
*/
|
||||
exports.prototype['return'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return ModelReturn;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,45 +15,48 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Name model module.
|
||||
* @module model/Name
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Name</code>.
|
||||
* @alias module:model/Name
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
var Name = function Name() {
|
||||
|
||||
};
|
||||
|
||||
Name.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Name();
|
||||
/**
|
||||
* Constructs a <code>Name</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Name} obj Optional instance to populate.
|
||||
* @return {module:model/Name} The populated <code>Name</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Name.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} name
|
||||
**/
|
||||
Name.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* @member {Integer} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Name;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -1,59 +0,0 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.ObjectReturn = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
var ObjectReturn = function ObjectReturn() {
|
||||
|
||||
};
|
||||
|
||||
ObjectReturn.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new ObjectReturn();
|
||||
|
||||
if (data['return']) {
|
||||
_this['return'] = ApiClient.convertToType(data['return'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
ObjectReturn.prototype.getReturn = function() {
|
||||
return this['return'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} _return
|
||||
**/
|
||||
ObjectReturn.prototype.setReturn = function(_return) {
|
||||
this['return'] = _return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return ObjectReturn;
|
||||
|
||||
|
||||
}));
|
@ -15,156 +15,117 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Order model module.
|
||||
* @module model/Order
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Order</code>.
|
||||
* @alias module:model/Order
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var Order = function Order() {
|
||||
|
||||
};
|
||||
|
||||
Order.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Order();
|
||||
/**
|
||||
* Constructs a <code>Order</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Order} obj Optional instance to populate.
|
||||
* @return {module:model/Order} The populated <code>Order</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['petId']) {
|
||||
_this['petId'] = ApiClient.convertToType(data['petId'], 'Integer');
|
||||
if (data.hasOwnProperty('petId')) {
|
||||
obj['petId'] = ApiClient.convertToType(data['petId'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['quantity']) {
|
||||
_this['quantity'] = ApiClient.convertToType(data['quantity'], 'Integer');
|
||||
if (data.hasOwnProperty('quantity')) {
|
||||
obj['quantity'] = ApiClient.convertToType(data['quantity'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['shipDate']) {
|
||||
_this['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date');
|
||||
if (data.hasOwnProperty('shipDate')) {
|
||||
obj['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date');
|
||||
}
|
||||
|
||||
if (data['status']) {
|
||||
_this['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
if (data.hasOwnProperty('status')) {
|
||||
obj['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
}
|
||||
|
||||
if (data['complete']) {
|
||||
_this['complete'] = ApiClient.convertToType(data['complete'], 'Boolean');
|
||||
if (data.hasOwnProperty('complete')) {
|
||||
obj['complete'] = ApiClient.convertToType(data['complete'], 'Boolean');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Order.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
Order.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
* @member {Integer} petId
|
||||
*/
|
||||
exports.prototype['petId'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Order.prototype.getPetId = function() {
|
||||
return this['petId'];
|
||||
}
|
||||
* @member {Integer} quantity
|
||||
*/
|
||||
exports.prototype['quantity'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} petId
|
||||
**/
|
||||
Order.prototype.setPetId = function(petId) {
|
||||
this['petId'] = petId;
|
||||
}
|
||||
* @member {Date} shipDate
|
||||
*/
|
||||
exports.prototype['shipDate'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Order.prototype.getQuantity = function() {
|
||||
return this['quantity'];
|
||||
}
|
||||
* Order Status
|
||||
* @member {module:model/Order.StatusEnum} status
|
||||
*/
|
||||
exports.prototype['status'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} quantity
|
||||
**/
|
||||
Order.prototype.setQuantity = function(quantity) {
|
||||
this['quantity'] = quantity;
|
||||
}
|
||||
* @member {Boolean} complete
|
||||
*/
|
||||
exports.prototype['complete'] = undefined;
|
||||
|
||||
|
||||
/**
|
||||
* @return {Date}
|
||||
**/
|
||||
Order.prototype.getShipDate = function() {
|
||||
return this['shipDate'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Date} shipDate
|
||||
**/
|
||||
Order.prototype.setShipDate = function(shipDate) {
|
||||
this['shipDate'] = shipDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Order Status
|
||||
* @return {StatusEnum}
|
||||
**/
|
||||
Order.prototype.getStatus = function() {
|
||||
return this['status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* set Order Status
|
||||
* @param {StatusEnum} status
|
||||
**/
|
||||
Order.prototype.setStatus = function(status) {
|
||||
this['status'] = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {Boolean}
|
||||
**/
|
||||
Order.prototype.getComplete = function() {
|
||||
return this['complete'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Boolean} complete
|
||||
**/
|
||||
Order.prototype.setComplete = function(complete) {
|
||||
this['complete'] = complete;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var StatusEnum = {
|
||||
|
||||
* Allowed values for the <code>status</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
exports.StatusEnum = {
|
||||
/**
|
||||
* value: placed
|
||||
* @const
|
||||
*/
|
||||
PLACED: "placed",
|
||||
|
||||
/**
|
||||
* value: approved
|
||||
* @const
|
||||
*/
|
||||
APPROVED: "approved",
|
||||
|
||||
/**
|
||||
* value: delivered
|
||||
* @const
|
||||
*/
|
||||
DELIVERED: "delivered"
|
||||
};
|
||||
|
||||
Order.StatusEnum = StatusEnum;
|
||||
|
||||
|
||||
return Order;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,166 +15,119 @@
|
||||
}(this, function(ApiClient, Category, Tag) {
|
||||
'use strict';
|
||||
|
||||
|
||||
var Pet = function Pet(name, photoUrls) {
|
||||
/**
|
||||
* The Pet model module.
|
||||
* @module model/Pet
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* datatype: String
|
||||
* required
|
||||
**/
|
||||
* Constructs a new <code>Pet</code>.
|
||||
* @alias module:model/Pet
|
||||
* @class
|
||||
* @param name
|
||||
* @param photoUrls
|
||||
*/
|
||||
var exports = function(name, photoUrls) {
|
||||
|
||||
|
||||
|
||||
this['name'] = name;
|
||||
/**
|
||||
* datatype: [String]
|
||||
* required
|
||||
**/
|
||||
this['photoUrls'] = photoUrls;
|
||||
|
||||
|
||||
};
|
||||
|
||||
Pet.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Pet();
|
||||
/**
|
||||
* Constructs a <code>Pet</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Pet} obj Optional instance to populate.
|
||||
* @return {module:model/Pet} The populated <code>Pet</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['category']) {
|
||||
_this['category'] = Category.constructFromObject(data['category']);
|
||||
if (data.hasOwnProperty('category')) {
|
||||
obj['category'] = Category.constructFromObject(data['category']);
|
||||
}
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
}
|
||||
|
||||
if (data['photoUrls']) {
|
||||
_this['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
|
||||
if (data.hasOwnProperty('photoUrls')) {
|
||||
obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
|
||||
}
|
||||
|
||||
if (data['tags']) {
|
||||
_this['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
|
||||
if (data.hasOwnProperty('tags')) {
|
||||
obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
|
||||
}
|
||||
|
||||
if (data['status']) {
|
||||
_this['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
if (data.hasOwnProperty('status')) {
|
||||
obj['status'] = ApiClient.convertToType(data['status'], 'String');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Pet.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
Pet.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
* @member {module:model/Category} category
|
||||
*/
|
||||
exports.prototype['category'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {Category}
|
||||
**/
|
||||
Pet.prototype.getCategory = function() {
|
||||
return this['category'];
|
||||
}
|
||||
* @member {String} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Category} category
|
||||
**/
|
||||
Pet.prototype.setCategory = function(category) {
|
||||
this['category'] = category;
|
||||
}
|
||||
* @member {Array.<String>} photoUrls
|
||||
*/
|
||||
exports.prototype['photoUrls'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
Pet.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
* @member {Array.<module:model/Tag>} tags
|
||||
*/
|
||||
exports.prototype['tags'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
**/
|
||||
Pet.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* pet status in the store
|
||||
* @member {module:model/Pet.StatusEnum} status
|
||||
*/
|
||||
exports.prototype['status'] = undefined;
|
||||
|
||||
|
||||
/**
|
||||
* @return {[String]}
|
||||
**/
|
||||
Pet.prototype.getPhotoUrls = function() {
|
||||
return this['photoUrls'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {[String]} photoUrls
|
||||
**/
|
||||
Pet.prototype.setPhotoUrls = function(photoUrls) {
|
||||
this['photoUrls'] = photoUrls;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {[Tag]}
|
||||
**/
|
||||
Pet.prototype.getTags = function() {
|
||||
return this['tags'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {[Tag]} tags
|
||||
**/
|
||||
Pet.prototype.setTags = function(tags) {
|
||||
this['tags'] = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* get pet status in the store
|
||||
* @return {StatusEnum}
|
||||
**/
|
||||
Pet.prototype.getStatus = function() {
|
||||
return this['status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* set pet status in the store
|
||||
* @param {StatusEnum} status
|
||||
**/
|
||||
Pet.prototype.setStatus = function(status) {
|
||||
this['status'] = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var StatusEnum = {
|
||||
|
||||
* Allowed values for the <code>status</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
exports.StatusEnum = {
|
||||
/**
|
||||
* value: available
|
||||
* @const
|
||||
*/
|
||||
AVAILABLE: "available",
|
||||
|
||||
/**
|
||||
* value: pending
|
||||
* @const
|
||||
*/
|
||||
PENDING: "pending",
|
||||
|
||||
/**
|
||||
* value: sold
|
||||
* @const
|
||||
*/
|
||||
SOLD: "sold"
|
||||
};
|
||||
|
||||
Pet.StatusEnum = StatusEnum;
|
||||
|
||||
|
||||
return Pet;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,45 +15,48 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The SpecialModelName model module.
|
||||
* @module model/SpecialModelName
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>SpecialModelName</code>.
|
||||
* @alias module:model/SpecialModelName
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
var SpecialModelName = function SpecialModelName() {
|
||||
|
||||
};
|
||||
|
||||
SpecialModelName.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new SpecialModelName();
|
||||
/**
|
||||
* Constructs a <code>SpecialModelName</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/SpecialModelName} obj Optional instance to populate.
|
||||
* @return {module:model/SpecialModelName} The populated <code>SpecialModelName</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['$special[property.name]']) {
|
||||
_this['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Integer');
|
||||
if (data.hasOwnProperty('$special[property.name]')) {
|
||||
obj['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
SpecialModelName.prototype.getSpecialPropertyName = function() {
|
||||
return this['$special[property.name]'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Integer} specialPropertyName
|
||||
**/
|
||||
SpecialModelName.prototype.setSpecialPropertyName = function(specialPropertyName) {
|
||||
this['$special[property.name]'] = specialPropertyName;
|
||||
}
|
||||
* @member {Integer} $special[property.name]
|
||||
*/
|
||||
exports.prototype['$special[property.name]'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return SpecialModelName;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,63 +15,57 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The Tag model module.
|
||||
* @module model/Tag
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Tag</code>.
|
||||
* @alias module:model/Tag
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
|
||||
var Tag = function Tag() {
|
||||
|
||||
};
|
||||
|
||||
Tag.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new Tag();
|
||||
/**
|
||||
* Constructs a <code>Tag</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/Tag} obj Optional instance to populate.
|
||||
* @return {module:model/Tag} The populated <code>Tag</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['name']) {
|
||||
_this['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
Tag.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
Tag.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
Tag.prototype.getName = function() {
|
||||
return this['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
**/
|
||||
Tag.prototype.setName = function(name) {
|
||||
this['name'] = name;
|
||||
}
|
||||
* @member {String} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Tag;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -15,173 +15,112 @@
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The User model module.
|
||||
* @module model/User
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>User</code>.
|
||||
* @alias module:model/User
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var User = function User() {
|
||||
|
||||
};
|
||||
|
||||
User.constructFromObject = function(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
var _this = new User();
|
||||
/**
|
||||
* Constructs a <code>User</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {module:model/User} obj Optional instance to populate.
|
||||
* @return {module:model/User} The populated <code>User</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data['id']) {
|
||||
_this['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
if (data.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Integer');
|
||||
}
|
||||
|
||||
if (data['username']) {
|
||||
_this['username'] = ApiClient.convertToType(data['username'], 'String');
|
||||
if (data.hasOwnProperty('username')) {
|
||||
obj['username'] = ApiClient.convertToType(data['username'], 'String');
|
||||
}
|
||||
|
||||
if (data['firstName']) {
|
||||
_this['firstName'] = ApiClient.convertToType(data['firstName'], 'String');
|
||||
if (data.hasOwnProperty('firstName')) {
|
||||
obj['firstName'] = ApiClient.convertToType(data['firstName'], 'String');
|
||||
}
|
||||
|
||||
if (data['lastName']) {
|
||||
_this['lastName'] = ApiClient.convertToType(data['lastName'], 'String');
|
||||
if (data.hasOwnProperty('lastName')) {
|
||||
obj['lastName'] = ApiClient.convertToType(data['lastName'], 'String');
|
||||
}
|
||||
|
||||
if (data['email']) {
|
||||
_this['email'] = ApiClient.convertToType(data['email'], 'String');
|
||||
if (data.hasOwnProperty('email')) {
|
||||
obj['email'] = ApiClient.convertToType(data['email'], 'String');
|
||||
}
|
||||
|
||||
if (data['password']) {
|
||||
_this['password'] = ApiClient.convertToType(data['password'], 'String');
|
||||
if (data.hasOwnProperty('password')) {
|
||||
obj['password'] = ApiClient.convertToType(data['password'], 'String');
|
||||
}
|
||||
|
||||
if (data['phone']) {
|
||||
_this['phone'] = ApiClient.convertToType(data['phone'], 'String');
|
||||
if (data.hasOwnProperty('phone')) {
|
||||
obj['phone'] = ApiClient.convertToType(data['phone'], 'String');
|
||||
}
|
||||
|
||||
if (data['userStatus']) {
|
||||
_this['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Integer');
|
||||
if (data.hasOwnProperty('userStatus')) {
|
||||
obj['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Integer');
|
||||
}
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {Integer}
|
||||
**/
|
||||
User.prototype.getId = function() {
|
||||
return this['id'];
|
||||
}
|
||||
* @member {Integer} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {Integer} id
|
||||
**/
|
||||
User.prototype.setId = function(id) {
|
||||
this['id'] = id;
|
||||
}
|
||||
* @member {String} username
|
||||
*/
|
||||
exports.prototype['username'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getUsername = function() {
|
||||
return this['username'];
|
||||
}
|
||||
* @member {String} firstName
|
||||
*/
|
||||
exports.prototype['firstName'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} username
|
||||
**/
|
||||
User.prototype.setUsername = function(username) {
|
||||
this['username'] = username;
|
||||
}
|
||||
* @member {String} lastName
|
||||
*/
|
||||
exports.prototype['lastName'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getFirstName = function() {
|
||||
return this['firstName'];
|
||||
}
|
||||
* @member {String} email
|
||||
*/
|
||||
exports.prototype['email'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} firstName
|
||||
**/
|
||||
User.prototype.setFirstName = function(firstName) {
|
||||
this['firstName'] = firstName;
|
||||
}
|
||||
* @member {String} password
|
||||
*/
|
||||
exports.prototype['password'] = undefined;
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getLastName = function() {
|
||||
return this['lastName'];
|
||||
}
|
||||
* @member {String} phone
|
||||
*/
|
||||
exports.prototype['phone'] = undefined;
|
||||
|
||||
/**
|
||||
* @param {String} lastName
|
||||
**/
|
||||
User.prototype.setLastName = function(lastName) {
|
||||
this['lastName'] = lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getEmail = function() {
|
||||
return this['email'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} email
|
||||
**/
|
||||
User.prototype.setEmail = function(email) {
|
||||
this['email'] = email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getPassword = function() {
|
||||
return this['password'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} password
|
||||
**/
|
||||
User.prototype.setPassword = function(password) {
|
||||
this['password'] = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
**/
|
||||
User.prototype.getPhone = function() {
|
||||
return this['phone'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} phone
|
||||
**/
|
||||
User.prototype.setPhone = function(phone) {
|
||||
this['phone'] = phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* get User Status
|
||||
* @return {Integer}
|
||||
**/
|
||||
User.prototype.getUserStatus = function() {
|
||||
return this['userStatus'];
|
||||
}
|
||||
|
||||
/**
|
||||
* set User Status
|
||||
* @param {Integer} userStatus
|
||||
**/
|
||||
User.prototype.setUserStatus = function(userStatus) {
|
||||
this['userStatus'] = userStatus;
|
||||
}
|
||||
* User Status
|
||||
* @member {Integer} userStatus
|
||||
*/
|
||||
exports.prototype['userStatus'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return User;
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
@ -4,7 +4,7 @@ if (typeof module === 'object' && module.exports) {
|
||||
var sinon = require('sinon');
|
||||
}
|
||||
|
||||
var apiClient = SwaggerPetstore.ApiClient.default;
|
||||
var apiClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
describe('ApiClient', function() {
|
||||
describe('defaults', function() {
|
||||
@ -13,26 +13,26 @@ describe('ApiClient', function() {
|
||||
expect(apiClient.basePath).to.be('http://petstore.swagger.io/v2');
|
||||
expect(apiClient.authentications).to.eql({
|
||||
petstore_auth: {type: 'oauth2'},
|
||||
api_key: {type: 'apiKey', in: 'header', name: 'api_key'},
|
||||
api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||
test_http_basic: {type: 'basic'},
|
||||
test_api_client_id: {
|
||||
type: 'apiKey',
|
||||
in: 'header',
|
||||
'in': 'header',
|
||||
name: 'x-test_api_client_id'
|
||||
},
|
||||
test_api_client_secret: {
|
||||
type: 'apiKey',
|
||||
in: 'header',
|
||||
'in': 'header',
|
||||
name: 'x-test_api_client_secret'
|
||||
},
|
||||
test_api_key_query: {
|
||||
type: 'apiKey',
|
||||
in: 'query',
|
||||
'in': 'query',
|
||||
name: 'test_api_key_query'
|
||||
},
|
||||
test_api_key_header: {
|
||||
type: 'apiKey',
|
||||
in: 'header',
|
||||
'in': 'header',
|
||||
name: 'test_api_key_header'
|
||||
}
|
||||
});
|
||||
@ -275,7 +275,7 @@ describe('ApiClient', function() {
|
||||
var apiKeyAuth, oauth2;
|
||||
|
||||
beforeEach(function() {
|
||||
newClient.authentications[apiKeyAuthName] = {type: 'apiKey', name: 'api_key', in: 'query'};
|
||||
newClient.authentications[apiKeyAuthName] = {type: 'apiKey', name: 'api_key', 'in': 'query'};
|
||||
newClient.authentications[oauth2Name] = {type: 'oauth2'};
|
||||
apiKeyAuth = newClient.authentications[apiKeyAuthName];
|
||||
oauth2 = newClient.authentications[oauth2Name];
|
||||
|
@ -18,20 +18,36 @@
|
||||
api = new SwaggerPetstore.PetApi();
|
||||
});
|
||||
|
||||
var getProperty = function(object, getter, property) {
|
||||
// Use getter method if present; otherwise, get the property directly.
|
||||
if (typeof object[getter] === 'function')
|
||||
return object[getter]();
|
||||
else
|
||||
return object[property];
|
||||
}
|
||||
|
||||
var setProperty = function(object, setter, property, value) {
|
||||
// Use setter method if present; otherwise, set the property directly.
|
||||
if (typeof object[setter] === 'function')
|
||||
object[setter](value);
|
||||
else
|
||||
object[property] = value;
|
||||
}
|
||||
|
||||
var createRandomPet = function() {
|
||||
var id = new Date().getTime();
|
||||
var pet = new SwaggerPetstore.Pet();
|
||||
pet.setId(id);
|
||||
pet.setName("pet" + id);
|
||||
setProperty(pet, "setId", "id", id);
|
||||
setProperty(pet, "setName", "name", "pet" + id);
|
||||
|
||||
var category = new SwaggerPetstore.Category();
|
||||
category.setId(id);
|
||||
category.setName("category" + id);
|
||||
pet.setCategory(category);
|
||||
setProperty(category, "setId", "id", id);
|
||||
setProperty(category, "setName", "name", "category" + id);
|
||||
setProperty(pet, "setCategory", "category", category);
|
||||
|
||||
pet.setStatus('available');
|
||||
setProperty(pet, "setStatus", "status", "available");
|
||||
var photos = ["http://foo.bar.com/1", "http://foo.bar.com/2"];
|
||||
pet.setPhotoUrls(photos);
|
||||
setProperty(pet, "setPhotoUrls", "photoUrls", photos);
|
||||
|
||||
return pet;
|
||||
};
|
||||
@ -50,9 +66,12 @@
|
||||
|
||||
expect(fetched).to.be.a(SwaggerPetstore.Pet);
|
||||
expect(fetched.id).to.be(pet.id);
|
||||
expect(fetched.getPhotoUrls()).to.eql(pet.getPhotoUrls());
|
||||
expect(fetched.getCategory()).to.be.a(SwaggerPetstore.Category);
|
||||
expect(fetched.getCategory().getName()).to.be(pet.getCategory().getName());
|
||||
expect(getProperty(fetched, "getPhotoUrls", "photoUrls"))
|
||||
.to.eql(getProperty(pet, "getPhotoUrls", "photoUrls"));
|
||||
expect(getProperty(fetched, "getCategory", "category"))
|
||||
.to.be.a(SwaggerPetstore.Category);
|
||||
expect(getProperty(getProperty(fetched, "getCategory", "category"), "getName", "name"))
|
||||
.to.be(getProperty(getProperty(pet, "getCategory", "category"), "getName", "name"));
|
||||
|
||||
api.deletePet(pet.id);
|
||||
done();
|
||||
@ -75,8 +94,10 @@
|
||||
var categoryObj = fetched.category;
|
||||
expect(categoryObj).to.be.a(Object);
|
||||
expect(categoryObj).not.to.be.a(SwaggerPetstore.Category);
|
||||
expect(categoryObj.id).to.be(pet.getCategory().getId());
|
||||
expect(categoryObj.name).to.be(pet.getCategory().getName());
|
||||
expect(categoryObj.id)
|
||||
.to.be(getProperty(getProperty(pet, "getCategory", "category"), "getId", "id"));
|
||||
expect(categoryObj.name)
|
||||
.to.be(getProperty(getProperty(pet, "getCategory", "category"), "getName", "name"));
|
||||
|
||||
api.deletePet(pet.id);
|
||||
done();
|
||||
|
Loading…
x
Reference in New Issue
Block a user