mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
commit
41527ead54
34
bin/javascript-es6-petstore.sh
Executable file
34
bin/javascript-es6-petstore.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript \
|
||||
-i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l javascript \
|
||||
-o samples/client/petstore/javascript-es6 \
|
||||
--additional-properties useEs6=true"
|
||||
|
||||
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags
|
@ -2,3 +2,5 @@
|
||||
|
||||
./bin/javascript-petstore.sh
|
||||
./bin/javascript-promise-petstore.sh
|
||||
./bin/javascript-es6-petstore.sh
|
||||
./bin/javascript-promise-es6-petstore.sh
|
||||
|
35
bin/javascript-promise-es6-petstore.sh
Executable file
35
bin/javascript-promise-es6-petstore.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript \
|
||||
-i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l javascript \
|
||||
-o samples/client/petstore/javascript-promise-es6 \
|
||||
--additional-properties useEs6=true \
|
||||
--additional-properties usePromises=true"
|
||||
|
||||
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags
|
10
bin/windows/javascript-es6-petstore.bat
Normal file
10
bin/windows/javascript-es6-petstore.bat
Normal file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l javascript -o samples\client\petstore\javascript-es6 --additional-properties useEs6=true
|
||||
|
||||
java -DappName=PetstoreClient %JAVA_OPTS% -jar %executable% %ags%
|
@ -1,2 +1,3 @@
|
||||
call .\bin\windows\javascript-petstore.bat
|
||||
call .\bin\windows\javascript-promise-petstore.bat
|
||||
call .\bin\windows\javascript-es6-petstore.bat
|
||||
|
10
bin/windows/javascript-promise-es6-petstore.bat
Normal file
10
bin/windows/javascript-promise-es6-petstore.bat
Normal file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l javascript -o samples\client\petstore\javascript-promise-es6 --additional-properties useEs6=true --additional-properties usePromises=true
|
||||
|
||||
java -DappName=PetstoreClient %JAVA_OPTS% -jar %executable% %ags%
|
@ -26,6 +26,7 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
@ -180,6 +181,9 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "configOptions")
|
||||
private Map<?, ?> configOptions;
|
||||
|
||||
@Parameter(name = "importMappings")
|
||||
private List<String> importMappings;
|
||||
|
||||
/**
|
||||
* Generate the apis
|
||||
*/
|
||||
@ -387,7 +391,7 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
applyInstantiationTypesKvp(configOptions.get("instantiation-types").toString(), configurator);
|
||||
}
|
||||
|
||||
if(configOptions.containsKey("import-mappings")) {
|
||||
if(importMappings == null && configOptions.containsKey("import-mappings")) {
|
||||
applyImportMappingsKvp(configOptions.get("import-mappings").toString(), configurator);
|
||||
}
|
||||
|
||||
@ -402,12 +406,17 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
if(configOptions.containsKey("additional-properties")) {
|
||||
applyAdditionalPropertiesKvp(configOptions.get("additional-properties").toString(), configurator);
|
||||
}
|
||||
|
||||
|
||||
if(configOptions.containsKey("reserved-words-mappings")) {
|
||||
applyReservedWordsMappingsKvp(configOptions.get("reserved-words-mappings").toString(), configurator);
|
||||
}
|
||||
}
|
||||
|
||||
if (importMappings != null && !configOptions.containsKey("import-mappings")) {
|
||||
String importMappingsAsString = importMappings.toString();
|
||||
applyImportMappingsKvp(importMappingsAsString.substring(0, importMappingsAsString.length() - 1), configurator);
|
||||
}
|
||||
|
||||
if (environmentVariables != null) {
|
||||
|
||||
for(String key : environmentVariables.keySet()) {
|
||||
|
@ -13,7 +13,6 @@ import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.models.ArrayModel;
|
||||
import io.swagger.models.ComposedModel;
|
||||
import io.swagger.models.Info;
|
||||
import io.swagger.models.License;
|
||||
import io.swagger.models.Model;
|
||||
@ -22,7 +21,6 @@ import io.swagger.models.Operation;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.BooleanProperty;
|
||||
import io.swagger.models.properties.ByteArrayProperty;
|
||||
import io.swagger.models.properties.DateProperty;
|
||||
import io.swagger.models.properties.DateTimeProperty;
|
||||
import io.swagger.models.properties.DoubleProperty;
|
||||
@ -41,7 +39,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -60,6 +57,28 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
public static final String USE_INHERITANCE = "useInheritance";
|
||||
public static final String EMIT_MODEL_METHODS = "emitModelMethods";
|
||||
public static final String EMIT_JS_DOC = "emitJSDoc";
|
||||
public static final String USE_ES6 = "useES6";
|
||||
|
||||
final String[][] JAVASCRIPT_SUPPORTING_FILES = new String[][] {
|
||||
new String[] {"package.mustache", "package.json"},
|
||||
new String[] {"index.mustache", "src/index.js"},
|
||||
new String[] {"ApiClient.mustache", "src/ApiClient.js"},
|
||||
new String[] {"git_push.sh.mustache", "git_push.sh"},
|
||||
new String[] {"README.mustache", "README.md"},
|
||||
new String[] {"mocha.opts", "mocha.opts"},
|
||||
new String[] {"travis.yml", ".travis.yml"}
|
||||
};
|
||||
|
||||
final String[][] JAVASCRIPT_ES6_SUPPORTING_FILES = new String[][] {
|
||||
new String[] {"package.mustache", "package.json"},
|
||||
new String[] {"index.mustache", "src/index.js"},
|
||||
new String[] {"ApiClient.mustache", "src/ApiClient.js"},
|
||||
new String[] {"git_push.sh.mustache", "git_push.sh"},
|
||||
new String[] {"README.mustache", "README.md"},
|
||||
new String[] {"mocha.opts", "mocha.opts"},
|
||||
new String[] {"travis.yml", ".travis.yml"},
|
||||
new String[] {".babelrc.mustache", ".babelrc"}
|
||||
};
|
||||
|
||||
protected String projectName;
|
||||
protected String moduleName;
|
||||
@ -77,6 +96,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
protected String modelDocPath = "docs/";
|
||||
protected String apiTestPath = "api/";
|
||||
protected String modelTestPath = "model/";
|
||||
protected boolean useES6;
|
||||
|
||||
public JavascriptClientCodegen() {
|
||||
super();
|
||||
@ -174,6 +194,9 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
.defaultValue(Boolean.TRUE.toString()));
|
||||
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "hides the timestamp when files were generated")
|
||||
.defaultValue(Boolean.TRUE.toString()));
|
||||
cliOptions.add(new CliOption(USE_ES6,
|
||||
"use JavaScript ES6 (ECMAScript 6)")
|
||||
.defaultValue(Boolean.TRUE.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -242,6 +265,9 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
if (additionalProperties.containsKey(EMIT_JS_DOC)) {
|
||||
setEmitJSDoc(convertPropertyToBooleanAndWriteBack(EMIT_JS_DOC));
|
||||
}
|
||||
if (additionalProperties.containsKey(USE_ES6)) {
|
||||
setUseES6(convertPropertyToBooleanAndWriteBack(USE_ES6));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -298,18 +324,20 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
additionalProperties.put(USE_INHERITANCE, supportsInheritance);
|
||||
additionalProperties.put(EMIT_MODEL_METHODS, emitModelMethods);
|
||||
additionalProperties.put(EMIT_JS_DOC, emitJSDoc);
|
||||
additionalProperties.put(USE_ES6, useES6);
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
supportingFiles.add(new SupportingFile("package.mustache", "", "package.json"));
|
||||
supportingFiles.add(new SupportingFile("index.mustache", createPath(sourceFolder, invokerPackage), "index.js"));
|
||||
supportingFiles.add(new SupportingFile("ApiClient.mustache", createPath(sourceFolder, invokerPackage), "ApiClient.js"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("mocha.opts", "", "mocha.opts"));
|
||||
supportingFiles.add(new SupportingFile("travis.yml", "", ".travis.yml"));
|
||||
String[][] supportingTemplateFiles = JAVASCRIPT_SUPPORTING_FILES;
|
||||
if (useES6) {
|
||||
supportingTemplateFiles = JAVASCRIPT_ES6_SUPPORTING_FILES;
|
||||
}
|
||||
|
||||
for (String[] supportingTemplateFile :supportingTemplateFiles) {
|
||||
supportingFiles.add(new SupportingFile(supportingTemplateFile[0], "", supportingTemplateFile[1]));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -399,6 +427,15 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
this.usePromises = usePromises;
|
||||
}
|
||||
|
||||
public void setUseES6(boolean useES6) {
|
||||
this.useES6 = useES6;
|
||||
if (useES6) {
|
||||
embeddedTemplateDir = templateDir = "Javascript-es6";
|
||||
} else {
|
||||
embeddedTemplateDir = templateDir = "Javascript";
|
||||
}
|
||||
}
|
||||
|
||||
public void setUseInheritance(boolean useInheritance) {
|
||||
this.supportsInheritance = useInheritance;
|
||||
this.supportsMixins = useInheritance;
|
||||
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": ["es2015", "stage-0"]
|
||||
}
|
@ -0,0 +1,585 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
import superagent from "superagent";
|
||||
import querystring from "querystring";
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient
|
||||
* @version {{projectVersion}}
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient
|
||||
* @class
|
||||
*/{{/emitJSDoc}}
|
||||
export default class ApiClient {
|
||||
constructor() {
|
||||
{{#emitJSDoc}}/**
|
||||
* The base URL against which to resolve every API call's (relative) path.
|
||||
* @type {String}
|
||||
* @default {{{basePath}}}
|
||||
*/{{/emitJSDoc}}
|
||||
this.basePath = '{{{basePath}}}'.replace(/\/+$/, '');
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* The authentication methods to be included for all API calls.
|
||||
* @type {Array.<String>}
|
||||
*/{{/emitJSDoc}}{{=< >=}}
|
||||
this.authentications = {
|
||||
<#authMethods>
|
||||
<#isBasic>
|
||||
'<name>': {type: 'basic'}<^-last>,</-last>
|
||||
</isBasic>
|
||||
<#isApiKey>
|
||||
'<name>': {type: 'apiKey', 'in': <#isKeyInHeader>'header'</isKeyInHeader><^isKeyInHeader>'query'</isKeyInHeader>, name: '<keyParamName>'}<^-last>,</-last>
|
||||
</isApiKey>
|
||||
<#isOAuth>
|
||||
'<name>': {type: 'oauth2'}<^-last>,</-last>
|
||||
</isOAuth>
|
||||
</authMethods>
|
||||
}
|
||||
|
||||
<={{ }}=>{{#emitJSDoc}}/**
|
||||
* The default HTTP headers to be included for all API calls.
|
||||
* @type {Array.<String>}
|
||||
* @default {}
|
||||
*/{{/emitJSDoc}}
|
||||
this.defaultHeaders = {};
|
||||
|
||||
/**
|
||||
* The default HTTP timeout for all API calls.
|
||||
* @type {Number}
|
||||
* @default 60000
|
||||
*/
|
||||
this.timeout = 60000;
|
||||
|
||||
/**
|
||||
* If set to false an additional timestamp parameter is added to all API GET calls to
|
||||
* prevent browser caching
|
||||
* @type {Boolean}
|
||||
* @default true
|
||||
*/
|
||||
this.cache = true;
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* If set to true, the client will save the cookies from each server
|
||||
* response, and return them in the next request.
|
||||
* @default false
|
||||
*/{{/emitJSDoc}}
|
||||
this.enableCookies = false;
|
||||
|
||||
/*
|
||||
* Used to save and return cookies in a node.js (non-browser) setting,
|
||||
* if this.enableCookies is set to true.
|
||||
*/
|
||||
if (typeof window === 'undefined') {
|
||||
this.agent = new superagent.agent();
|
||||
}
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Returns a string representation for an actual parameter.
|
||||
* @param param The actual parameter.
|
||||
* @returns {String} The string representation of <code>param</code>.
|
||||
*/{{/emitJSDoc}}
|
||||
paramToString(param) {
|
||||
if (param == undefined || param == null) {
|
||||
return '';
|
||||
}
|
||||
if (param instanceof Date) {
|
||||
return param.toJSON();
|
||||
}
|
||||
|
||||
return param.toString();
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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.
|
||||
*/{{/emitJSDoc}}
|
||||
buildUrl(path, pathParams) {
|
||||
if (!path.match(/^\//)) {
|
||||
path = '/' + path;
|
||||
}
|
||||
|
||||
var url = this.basePath + path;
|
||||
url = url.replace(/\{([\w-]+)\}/g, (fullMatch, key) => {
|
||||
var value;
|
||||
if (pathParams.hasOwnProperty(key)) {
|
||||
value = this.paramToString(pathParams[key]);
|
||||
} else {
|
||||
value = fullMatch;
|
||||
}
|
||||
|
||||
return encodeURIComponent(value);
|
||||
});
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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>.
|
||||
*/{{/emitJSDoc}}
|
||||
isJsonMime(contentType) {
|
||||
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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.
|
||||
*/{{/emitJSDoc}}
|
||||
jsonPreferredMime(contentTypes) {
|
||||
for (var i = 0; i < contentTypes.length; i++) {
|
||||
if (this.isJsonMime(contentTypes[i])) {
|
||||
return contentTypes[i];
|
||||
}
|
||||
}
|
||||
|
||||
return contentTypes[0];
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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.
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
isFileParam(param) {
|
||||
// fs.ReadStream in Node.js (but not in runtime like browserify)
|
||||
if (typeof window === 'undefined' && typeof require === 'function' && require('fs') && param instanceof require('fs').ReadStream) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Buffer in Node.js
|
||||
if (typeof Buffer === 'function' && param instanceof Buffer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Blob in browser
|
||||
if (typeof Blob === 'function' && param instanceof Blob) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
|
||||
if (typeof File === 'function' && param instanceof File) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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.
|
||||
*/{{/emitJSDoc}}
|
||||
normalizeParams(params) {
|
||||
var newParams = {};
|
||||
for (var key in params) {
|
||||
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
|
||||
var value = params[key];
|
||||
if (this.isFileParam(value) || Array.isArray(value)) {
|
||||
newParams[key] = value;
|
||||
} else {
|
||||
newParams[key] = this.paramToString(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newParams;
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Enumeration of collection format separator strategies.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/{{/emitJSDoc}}
|
||||
static CollectionFormatEnum = {
|
||||
{{#emitJSDoc}}/**
|
||||
* Comma-separated values. Value: <code>csv</code>
|
||||
* @const
|
||||
*/{{/emitJSDoc}}
|
||||
CSV: ',',
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Space-separated values. Value: <code>ssv</code>
|
||||
* @const
|
||||
*/{{/emitJSDoc}}
|
||||
SSV: ' ',
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Tab-separated values. Value: <code>tsv</code>
|
||||
* @const
|
||||
*/{{/emitJSDoc}}
|
||||
TSV: '\t',
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Pipe(|)-separated values. Value: <code>pipes</code>
|
||||
* @const
|
||||
*/{{/emitJSDoc}}
|
||||
PIPES: '|',
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Native array. Value: <code>multi</code>
|
||||
* @const
|
||||
*/{{/emitJSDoc}}
|
||||
MULTI: 'multi'
|
||||
};
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Builds a string representation of an array-type actual parameter, according to the given collection format.
|
||||
* @param {Array} param An array parameter.
|
||||
* @param {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}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>.
|
||||
*/{{/emitJSDoc}}
|
||||
buildCollectionParam(param, collectionFormat) {
|
||||
if (param == null) {
|
||||
return null;
|
||||
}
|
||||
switch (collectionFormat) {
|
||||
case 'csv':
|
||||
return param.map(this.paramToString).join(',');
|
||||
case 'ssv':
|
||||
return param.map(this.paramToString).join(' ');
|
||||
case 'tsv':
|
||||
return param.map(this.paramToString).join('\t');
|
||||
case 'pipes':
|
||||
return param.map(this.paramToString).join('|');
|
||||
case 'multi':
|
||||
//return the array directly as SuperAgent will handle it as expected
|
||||
return param.map(this.paramToString);
|
||||
default:
|
||||
throw new Error('Unknown collection format: ' + collectionFormat);
|
||||
}
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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.
|
||||
*/{{/emitJSDoc}}
|
||||
applyAuthToRequest(request, authNames) {
|
||||
authNames.forEach((authName) => {
|
||||
var auth = this.authentications[authName];
|
||||
switch (auth.type) {
|
||||
case 'basic':
|
||||
if (auth.username || auth.password) {
|
||||
request.auth(auth.username || '', auth.password || '');
|
||||
}
|
||||
|
||||
break;
|
||||
case 'apiKey':
|
||||
if (auth.apiKey) {
|
||||
var data = {};
|
||||
if (auth.apiKeyPrefix) {
|
||||
data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
|
||||
} else {
|
||||
data[auth.name] = auth.apiKey;
|
||||
}
|
||||
|
||||
if (auth['in'] === 'header') {
|
||||
request.set(data);
|
||||
} else {
|
||||
request.query(data);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'oauth2':
|
||||
if (auth.accessToken) {
|
||||
request.set({'Authorization': 'Bearer ' + auth.accessToken});
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unknown authentication type: ' + auth.type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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.
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
deserialize(response, returnType) {
|
||||
if (response == null || returnType == null || response.status == 204) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Rely on SuperAgent for parsing response body.
|
||||
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
||||
var data = response.body;
|
||||
if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) {
|
||||
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
||||
data = response.text;
|
||||
}
|
||||
|
||||
return exports.convertToType(data, returnType);
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}{{^usePromises}}/**
|
||||
* Callback function to receive the result of the operation.
|
||||
* @callback module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}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.
|
||||
*/{{/usePromises}}{{/emitJSDoc}}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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.{{^usePromises}}
|
||||
* @param {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient~callApiCallback} callback The callback function.{{/usePromises}}
|
||||
* @returns {{#usePromises}}{Promise} A {@link https://www.promisejs.org/|Promise} object{{/usePromises}}{{^usePromises}}{Object} The SuperAgent request object{{/usePromises}}.
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
callApi(path, httpMethod, pathParams,
|
||||
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
|
||||
returnType{{^usePromises}}, callback{{/usePromises}}) {
|
||||
|
||||
var url = this.buildUrl(path, pathParams);
|
||||
var request = superagent(httpMethod, url);
|
||||
|
||||
// apply authentications
|
||||
this.applyAuthToRequest(request, authNames);
|
||||
|
||||
// set query parameters
|
||||
if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
|
||||
queryParams['_'] = new Date().getTime();
|
||||
}
|
||||
|
||||
request.query(this.normalizeParams(queryParams));
|
||||
|
||||
// set header parameters
|
||||
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
|
||||
|
||||
// set request timeout
|
||||
request.timeout(this.timeout);
|
||||
|
||||
var contentType = this.jsonPreferredMime(contentTypes);
|
||||
if (contentType) {
|
||||
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
|
||||
if(contentType != 'multipart/form-data') {
|
||||
request.type(contentType);
|
||||
}
|
||||
} else if (!request.header['Content-Type']) {
|
||||
request.type('application/json');
|
||||
}
|
||||
|
||||
if (contentType === 'application/x-www-form-urlencoded') {
|
||||
request.send(querystring.stringify(this.normalizeParams(formParams)));
|
||||
} else if (contentType == 'multipart/form-data') {
|
||||
var _formParams = this.normalizeParams(formParams);
|
||||
for (var key in _formParams) {
|
||||
if (_formParams.hasOwnProperty(key)) {
|
||||
if (this.isFileParam(_formParams[key])) {
|
||||
// file field
|
||||
request.attach(key, _formParams[key]);
|
||||
} else {
|
||||
request.field(key, _formParams[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (bodyParam) {
|
||||
request.send(bodyParam);
|
||||
}
|
||||
|
||||
var accept = this.jsonPreferredMime(accepts);
|
||||
if (accept) {
|
||||
request.accept(accept);
|
||||
}
|
||||
|
||||
if (returnType === 'Blob') {
|
||||
request.responseType('blob');
|
||||
}
|
||||
|
||||
// Attach previously saved cookies, if enabled
|
||||
if (this.enableCookies){
|
||||
if (typeof window === 'undefined') {
|
||||
this.agent.attachCookies(request);
|
||||
}
|
||||
else {
|
||||
request.withCredentials();
|
||||
}
|
||||
}
|
||||
|
||||
{{#usePromises}}return new Promise((resolve, reject) => {
|
||||
request.end(function(error, response) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
try {
|
||||
var data = this.deserialize(response, returnType);
|
||||
if (this.enableCookies && typeof window === 'undefined'){
|
||||
this.agent.saveCookies(response);
|
||||
}
|
||||
|
||||
resolve({data, response});
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
});{{/usePromises}}
|
||||
|
||||
{{^usePromises}}request.end((error, response) => {
|
||||
if (callback) {
|
||||
var data = null;
|
||||
if (!error) {
|
||||
try {
|
||||
data = this.deserialize(response, returnType);
|
||||
if (this.enableCookies && typeof window === 'undefined'){
|
||||
this.agent.saveCookies(response);
|
||||
}
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
}
|
||||
|
||||
callback(error, data, response);
|
||||
}
|
||||
});
|
||||
|
||||
return request;{{/usePromises}}
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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.
|
||||
*/{{/emitJSDoc}}
|
||||
static parseDate(str) {
|
||||
return new Date(str.replace(/T/i, ' '));
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* 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 or null or undefined if data is null or undefined.
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
static convertToType(data, type) {
|
||||
if (data === null || data === undefined)
|
||||
return data
|
||||
|
||||
switch (type) {
|
||||
case 'Boolean':
|
||||
return Boolean(data);
|
||||
case 'Integer':
|
||||
return parseInt(data, 10);
|
||||
case 'Number':
|
||||
return parseFloat(data);
|
||||
case 'String':
|
||||
return String(data);
|
||||
case 'Date':
|
||||
return this.parseDate(String(data));
|
||||
case 'Blob':
|
||||
return data;
|
||||
default:
|
||||
if (type === Object) {
|
||||
// generic object, return directly
|
||||
return data;
|
||||
} else if (typeof type === 'function') {
|
||||
// for model type like: User
|
||||
return type.constructFromObject(data);
|
||||
} else if (Array.isArray(type)) {
|
||||
// for array type like: ['String']
|
||||
var itemType = type[0];
|
||||
|
||||
return data.map((item) => {
|
||||
return exports.convertToType(item, itemType);
|
||||
});
|
||||
} else if (typeof type === 'object') {
|
||||
// for plain object type like: {'String': 'Integer'}
|
||||
var keyType, valueType;
|
||||
for (var k in type) {
|
||||
if (type.hasOwnProperty(k)) {
|
||||
keyType = k;
|
||||
valueType = type[k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var result = {};
|
||||
for (var k in data) {
|
||||
if (data.hasOwnProperty(k)) {
|
||||
var key = exports.convertToType(k, keyType);
|
||||
var value = exports.convertToType(data[k], valueType);
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} else {
|
||||
// for unknown type, return the data directly
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Constructs a new map or array model from REST data.
|
||||
* @param data {Object|Array} The REST data.
|
||||
* @param obj {Object|Array} The target object or array.
|
||||
*/{{/emitJSDoc}}
|
||||
static constructFromObject(data, obj, itemType) {
|
||||
if (Array.isArray(data)) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data.hasOwnProperty(i))
|
||||
obj[i] = exports.convertToType(data[i], itemType);
|
||||
}
|
||||
} else {
|
||||
for (var k in data) {
|
||||
if (data.hasOwnProperty(k))
|
||||
obj[k] = exports.convertToType(data[k], itemType);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* The default API client implementation.
|
||||
* @type {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient}
|
||||
*/{{/emitJSDoc}}
|
||||
static instance = new ApiClient();
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
# {{projectName}}
|
||||
|
||||
{{moduleName}} - JavaScript client for {{projectName}}
|
||||
{{#appDescription}}
|
||||
{{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: {{appVersion}}
|
||||
- Package version: {{projectVersion}}
|
||||
{{^hideGenerationTimestamp}}
|
||||
- Build date: {{generatedDate}}
|
||||
{{/hideGenerationTimestamp}}
|
||||
- Build package: {{generatorClass}}
|
||||
{{#infoUrl}}
|
||||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
{{/infoUrl}}
|
||||
|
||||
## Installation
|
||||
|
||||
### For [Node.js](https://nodejs.org/)
|
||||
|
||||
#### npm
|
||||
|
||||
To publish the library as a [npm](https://www.npmjs.com/),
|
||||
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
||||
|
||||
Then install it via:
|
||||
|
||||
```shell
|
||||
npm install {{{projectName}}} --save
|
||||
```
|
||||
|
||||
#### git
|
||||
#
|
||||
If the library is hosted at a git repository, e.g.
|
||||
https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}}
|
||||
then install it via:
|
||||
|
||||
```shell
|
||||
npm install {{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} --save
|
||||
```
|
||||
|
||||
### For browser
|
||||
|
||||
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
|
||||
the above steps with Node.js and installing browserify with `npm install -g browserify`,
|
||||
perform the following (assuming *main.js* is your entry file):
|
||||
|
||||
```shell
|
||||
browserify main.js > bundle.js
|
||||
```
|
||||
|
||||
Then include *bundle.js* in the HTML pages.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following JS code:
|
||||
|
||||
```javascript
|
||||
var {{{moduleName}}} = require('{{{projectName}}}');
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}
|
||||
var defaultClient = {{{moduleName}}}.ApiClient.instance;
|
||||
{{#authMethods}}{{#isBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.username = 'YOUR USERNAME'
|
||||
{{{name}}}.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//{{{name}}}.apiKeyPrefix['{{{keyParamName}}}'] = "Token"{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.accessToken = "YOUR ACCESS TOKEN"{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
var api = new {{{moduleName}}}.{{{classname}}}(){{#hasParams}}
|
||||
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
||||
var {{{paramName}}} = {{{example}}}; // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}
|
||||
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
||||
var opts = { {{#allParams}}{{^required}}
|
||||
'{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}{{/required}}{{/allParams}}
|
||||
};{{/hasOptionalParams}}{{/hasParams}}
|
||||
{{#usePromises}}
|
||||
api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}).then(function({{#returnType}}data{{/returnType}}) {
|
||||
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
{{/usePromises}}{{^usePromises}}
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
|
||||
}
|
||||
};
|
||||
api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}{{#hasParams}}, {{/hasParams}}callback);
|
||||
{{/usePromises}}{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}.{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
{{#models}}{{#model}} - [{{moduleName}}.{{classname}}]({{modelDocPath}}{{classname}}.md)
|
||||
{{/model}}{{/models}}
|
||||
|
||||
## Documentation for Authorization
|
||||
|
||||
{{^authMethods}} All endpoints do not require authorization.
|
||||
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
||||
{{#authMethods}}### {{name}}
|
||||
|
||||
{{#isApiKey}}- **Type**: API key
|
||||
- **API key parameter name**: {{keyParamName}}
|
||||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}- **Type**: OAuth
|
||||
- **Flow**: {{flow}}
|
||||
- **Authorization URL**: {{authorizationUrl}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}} - {{scope}}: {{description}}
|
||||
{{/scopes}}
|
||||
{{/isOAuth}}
|
||||
|
||||
{{/authMethods}}
|
@ -0,0 +1,103 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
{{=< >=}}
|
||||
import ApiClient from "../ApiClient";
|
||||
<#imports>import <import> from '../<#modelPackage><&modelPackage>/</modelPackage><import>';
|
||||
</imports>
|
||||
|
||||
<#emitJSDoc>/**
|
||||
* <baseName> service.
|
||||
* @module <#invokerPackage><&invokerPackage>/</invokerPackage><#apiPackage><&apiPackage>/</apiPackage><classname>
|
||||
* @version <projectVersion>
|
||||
*/</emitJSDoc>
|
||||
export default class <classname> {
|
||||
|
||||
<#emitJSDoc>/**
|
||||
* Constructs a new <&classname>. <#description>
|
||||
* <description></description>
|
||||
* @alias module:<#invokerPackage><&invokerPackage>/</invokerPackage><#apiPackage><apiPackage>/</apiPackage><classname>
|
||||
* @class
|
||||
* @param {module:<#invokerPackage><&invokerPackage>/</invokerPackage>ApiClient} apiClient Optional API client implementation to use,
|
||||
* default to {@link module:<#invokerPackage><&invokerPackage>/</invokerPackage>ApiClient#instance} if unspecified.
|
||||
*/</emitJSDoc>
|
||||
constructor(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
}
|
||||
|
||||
<#operations><#operation><#emitJSDoc><^usePromises>
|
||||
/**
|
||||
* Callback function to receive the result of the <operationId> operation.
|
||||
* @callback module:<#invokerPackage><invokerPackage>/</invokerPackage><#apiPackage><apiPackage>/</apiPackage><classname>~<operationId>Callback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param <#vendorExtensions.x-jsdoc-type>{<&vendorExtensions.x-jsdoc-type>} data The data returned by the service call.</vendorExtensions.x-jsdoc-type><^vendorExtensions.x-jsdoc-type>data This operation does not return a value.</vendorExtensions.x-jsdoc-type>
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/</usePromises>
|
||||
|
||||
/**<#summary>
|
||||
* <summary></summary><#notes>
|
||||
* <notes></notes><#allParams><#required>
|
||||
* @param {<&vendorExtensions.x-jsdoc-type>} <paramName> <description></required></allParams><#hasOptionalParams>
|
||||
* @param {Object} opts Optional parameters<#allParams><^required>
|
||||
* @param {<&vendorExtensions.x-jsdoc-type>} opts.<paramName> <description><#defaultValue> (default to <.>)</defaultValue></required></allParams></hasOptionalParams><^usePromises>
|
||||
* @param {module:<#invokerPackage><&invokerPackage>/</invokerPackage><#apiPackage><&apiPackage>/</apiPackage><&classname>~<operationId>Callback} callback The callback function, accepting three arguments: error, data, response<#returnType>
|
||||
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}</returnType></usePromises><#usePromises>
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}<#returnType>, with an object containing data of type {@link <&vendorExtensions.x-jsdoc-type>} and HTTP response</returnType><^returnType>, with an object containing HTTP response</returnType></usePromises>
|
||||
*/
|
||||
</emitJSDoc> <operationId><#usePromises>WithHttpInfo</usePromises>(<vendorExtensions.x-codegen-argList>) {<#hasOptionalParams>
|
||||
opts = opts || {};</hasOptionalParams>
|
||||
let postBody = <#bodyParam><#required><paramName></required><^required>opts['<paramName>']</required></bodyParam><^bodyParam>null</bodyParam>;
|
||||
<#allParams><#required>
|
||||
// verify the required parameter '<paramName>' is set
|
||||
if (<paramName> === undefined || <paramName> === null) {
|
||||
throw new Error("Missing the required parameter '<paramName>' when calling <operationId>");
|
||||
}
|
||||
</required></allParams>
|
||||
|
||||
let pathParams = {<#pathParams>
|
||||
'<baseName>': <#required><paramName></required><^required>opts['<paramName>']</required><#hasMore>,</hasMore></pathParams>
|
||||
};
|
||||
let queryParams = {<#queryParams>
|
||||
'<baseName>': <#collectionFormat>this.apiClient.buildCollectionParam(<#required><paramName></required><^required>opts['<paramName>']</required>, '<collectionFormat>')</collectionFormat><^collectionFormat><#required><paramName></required><^required>opts['<paramName>']</required></collectionFormat><#hasMore>,</hasMore></queryParams>
|
||||
};
|
||||
let headerParams = {<#headerParams>
|
||||
'<baseName>': <#required><paramName></required><^required>opts['<paramName>']</required><#hasMore>,</hasMore></headerParams>
|
||||
};
|
||||
let formParams = {<#formParams>
|
||||
'<baseName>': <#collectionFormat>this.apiClient.buildCollectionParam(<#required><paramName></required><^required>opts['<paramName>']</required>, '<collectionFormat>')</collectionFormat><^collectionFormat><#required><paramName></required><^required>opts['<paramName>']</required></collectionFormat><#hasMore>,</hasMore></formParams>
|
||||
};
|
||||
|
||||
let authNames = [<#authMethods>'<name>'<#hasMore>, </hasMore></authMethods>];
|
||||
let contentTypes = [<#consumes>'<& mediaType>'<#hasMore>, </hasMore></consumes>];
|
||||
let accepts = [<#produces>'<& mediaType>'<#hasMore>, </hasMore></produces>];
|
||||
let returnType = <#returnType><&returnType></returnType><^returnType>null</returnType>;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'<&path>', '<httpMethod>',
|
||||
pathParams, queryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType<^usePromises>, callback</usePromises>
|
||||
);
|
||||
}
|
||||
<#usePromises>
|
||||
<#emitJSDoc>
|
||||
|
||||
/**<#summary>
|
||||
* <summary></summary><#notes>
|
||||
* <notes></notes><#allParams><#required>
|
||||
* @param {<&vendorExtensions.x-jsdoc-type>} <paramName> <description></required></allParams><#hasOptionalParams>
|
||||
* @param {Object} opts Optional parameters<#allParams><^required>
|
||||
* @param {<&vendorExtensions.x-jsdoc-type>} opts.<paramName> <description><#defaultValue> (default to <.>)</defaultValue></required></allParams></hasOptionalParams><^usePromises>
|
||||
* @param {module:<#invokerPackage><&invokerPackage>/</invokerPackage><#apiPackage><&apiPackage>/</apiPackage><&classname>~<operationId>Callback} callback The callback function, accepting three arguments: error, data, response<#returnType>
|
||||
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}</returnType></usePromises><#usePromises>
|
||||
* @return {Promise} a {@link https://www.promisejs.org/|Promise}<#returnType>, with data of type {@link <&vendorExtensions.x-jsdoc-type>}</returnType></usePromises>
|
||||
*/
|
||||
</emitJSDoc> <operationId>(<vendorExtensions.x-codegen-argList>) {
|
||||
return this.<operationId>WithHttpInfo(<vendorExtensions.x-codegen-argList>)
|
||||
.then(function(response_and_data) {
|
||||
return response_and_data.data;
|
||||
});
|
||||
}
|
||||
</usePromises>
|
||||
</operation></operations>
|
||||
|
||||
}
|
||||
<={{ }}=>
|
@ -0,0 +1,88 @@
|
||||
# {{moduleName}}.{{classname}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
<a name="{{operationId}}"></a>
|
||||
# **{{operationId}}**
|
||||
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}})
|
||||
|
||||
{{summary}}{{#notes}}
|
||||
|
||||
{{notes}}{{/notes}}
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import {{{moduleName}}} from '{{{projectName}}}';
|
||||
{{#hasAuthMethods}}
|
||||
let defaultClient = {{{moduleName}}}.ApiClient.default;
|
||||
{{#authMethods}}{{#isBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
let {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.username = 'YOUR USERNAME';
|
||||
{{{name}}}.password = 'YOUR PASSWORD';{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
let {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.apiKey = 'YOUR API KEY';
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//{{{name}}}.apiKeyPrefix = 'Token';{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
let {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.accessToken = 'YOUR ACCESS TOKEN';{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
let apiInstance = new {{{moduleName}}}.{{{classname}}}();{{#hasParams}}
|
||||
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
||||
let {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
||||
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
||||
let opts = { {{#allParams}}{{^required}}
|
||||
'{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} // {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}}
|
||||
};{{/hasOptionalParams}}{{/hasParams}}
|
||||
{{#usePromises}}
|
||||
apiInstance.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}).then(({{#returnType}}data{{/returnType}}) => {
|
||||
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
|
||||
}, (error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
{{/usePromises}}{{^usePromises}}
|
||||
apiInstance.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}{{#hasParams}}, {{/hasParams}}(error, data, response) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
|
||||
}
|
||||
});
|
||||
{{/usePromises}}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
||||
{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
### Return type
|
||||
|
||||
{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}}
|
||||
|
||||
### Authorization
|
||||
|
||||
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||
- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
@ -0,0 +1,55 @@
|
||||
{{>licenseInfo}}
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD.
|
||||
define(['expect.js', '../../src/index'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
factory(require('expect.js'), require('../../src/index'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
factory(root.expect, root.{{moduleName}});
|
||||
}
|
||||
}(this, function(expect, {{moduleName}}) {
|
||||
'use strict';
|
||||
|
||||
var instance;
|
||||
|
||||
beforeEach(function() {
|
||||
instance = new {{moduleName}}.{{classname}}();
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
describe('{{classname}}', function() {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
describe('{{operationId}}', function() {
|
||||
it('should call {{operationId}} successfully', function(done) {
|
||||
//uncomment below and update the code to test {{operationId}}
|
||||
//instance.{{operationId}}(function(error) {
|
||||
// if (error) throw error;
|
||||
//expect().to.be();
|
||||
//});
|
||||
done();
|
||||
});
|
||||
});
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
});
|
||||
|
||||
}));
|
@ -0,0 +1,15 @@
|
||||
{{#emitJSDoc}}/**
|
||||
* Allowed values for the <code>{{baseName}}</code> property.
|
||||
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
||||
* @readonly
|
||||
*/{{/emitJSDoc}}
|
||||
export default {{datatypeWithEnum}} = {
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{#emitJSDoc}}/**
|
||||
* value: {{{value}}}
|
||||
* @const
|
||||
*/{{/emitJSDoc}}
|
||||
"{{name}}": {{{value}}}{{^-last}},
|
||||
{{/-last}}
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
};
|
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="{{{gitUserId}}}"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="{{{gitRepoId}}}"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="{{{releaseNote}}}"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the Git credential in your environment."
|
||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
@ -0,0 +1,33 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
node_modules
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
@ -0,0 +1,58 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
import ApiClient from './ApiClient';
|
||||
{{#models}}import {{#model}}{{classFilename}}{{/model}} from './{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{importPath}}';
|
||||
{{/models}}{{#apiInfo}}{{#apis}}import {{importPath}} from './{{#apiPackage}}{{apiPackage}}/{{/apiPackage}}{{importPath}}';
|
||||
{{/apis}}{{/apiInfo}}
|
||||
|
||||
{{#emitJSDoc}}/**{{#projectDescription}}
|
||||
* {{projectDescription}}.<br>{{/projectDescription}}
|
||||
* 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 {{moduleName}} = require('{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}index'); // See note below*.
|
||||
* var xxxSvc = new {{moduleName}}.XxxApi(); // Allocate the API class we're going to use.
|
||||
* var yyyModel = new {{moduleName}}.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(['{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}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 {{moduleName}}.XxxApi(); // Allocate the API class we're going to use.
|
||||
* var yyy = new {{moduleName}}.Yyy(); // Construct a model instance.
|
||||
* yyyModel.someProperty = 'someValue';
|
||||
* ...
|
||||
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
|
||||
* ...
|
||||
* </pre>
|
||||
* </p>
|
||||
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}index
|
||||
* @version {{projectVersion}}
|
||||
*/{{/emitJSDoc}}
|
||||
export {
|
||||
{{=< >=}}
|
||||
<#emitJSDoc>/**
|
||||
* The ApiClient constructor.
|
||||
* @property {module:<#invokerPackage><invokerPackage>/</invokerPackage>ApiClient}
|
||||
*/</emitJSDoc>
|
||||
ApiClient<#models>,
|
||||
|
||||
<#emitJSDoc>/**
|
||||
* The <importPath> model constructor.
|
||||
* @property {module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><importPath>}
|
||||
*/</emitJSDoc>
|
||||
<importPath></models><#apiInfo><#apis>,
|
||||
|
||||
<#emitJSDoc>/**
|
||||
* The <importPath> service constructor.
|
||||
* @property {module:<#invokerPackage><invokerPackage>/</invokerPackage><#apiPackage><apiPackage>/</apiPackage><importPath>}
|
||||
*/</emitJSDoc>
|
||||
<importPath></apis></apiInfo>
|
||||
};<={{ }}=>
|
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* {{{appName}}}
|
||||
* {{{appDescription}}}
|
||||
*
|
||||
* {{#version}}OpenAPI spec version: {{{version}}}{{/version}}
|
||||
* {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
@ -0,0 +1 @@
|
||||
--timeout 10000
|
@ -0,0 +1,9 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
import ApiClient from '../ApiClient';
|
||||
{{#imports}}import {{import}} from './{{import}}';
|
||||
{{/imports}}
|
||||
|
||||
{{#models}}{{#model}}
|
||||
{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}}
|
||||
{{/model}}{{/models}}
|
@ -0,0 +1,25 @@
|
||||
{{#models}}{{#model}}{{#isEnum}}# {{moduleName}}.{{classname}}
|
||||
|
||||
## Enum
|
||||
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
* `{{name}}` (value: `{{{value}}}`)
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
{{/isEnum}}{{^isEnum}}# {{moduleName}}.{{classname}}
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
|
||||
{{/vars}}
|
||||
{{#vars}}{{#isEnum}}
|
||||
|
||||
<a name="{{{datatypeWithEnum}}}"></a>
|
||||
## Enum: {{datatypeWithEnum}}
|
||||
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
* `{{name}}` (value: `{{{value}}}`)
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
{{/isEnum}}{{/vars}}
|
||||
{{/isEnum}}{{/model}}{{/models}}
|
@ -0,0 +1,65 @@
|
||||
{{>licenseInfo}}
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD.
|
||||
define(['expect.js', '../../src/index'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
factory(require('expect.js'), require('../../src/index'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
factory(root.expect, root.{{moduleName}});
|
||||
}
|
||||
}(this, function(expect, {{moduleName}}) {
|
||||
'use strict';
|
||||
|
||||
var instance;
|
||||
|
||||
beforeEach(function() {
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{^isEnum}}
|
||||
instance = new {{moduleName}}.{{classname}}();
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
describe('{{classname}}', function() {
|
||||
it('should create an instance of {{classname}}', function() {
|
||||
// uncomment below and update the code to test {{classname}}
|
||||
//var instane = new {{moduleName}}.{{classname}}();
|
||||
//expect(instance).to.be.a({{moduleName}}.{{classname}});
|
||||
});
|
||||
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#vars}}
|
||||
it('should have the property {{name}} (base name: "{{baseName}}")', function() {
|
||||
// uncomment below and update the code to test the property {{name}}
|
||||
//var instane = new {{moduleName}}.{{classname}}();
|
||||
//expect(instance).to.be();
|
||||
});
|
||||
|
||||
{{/vars}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
});
|
||||
|
||||
}));
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "{{{projectName}}}",
|
||||
"version": "{{{projectVersion}}}",
|
||||
"description": "{{{projectDescription}}}",
|
||||
"license": "Unlicense",
|
||||
"main": "{{sourceFolder}}{{#invokerPackage}}/{{invokerPackage}}{{/invokerPackage}}/index.js",
|
||||
"scripts": {
|
||||
"test": "mocha --compilers js:babel-core/register --recursive"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel": "^6.23.0",
|
||||
"babel-cli": "^6.24.1",
|
||||
"superagent": "3.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "6.18.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-stage-0": "^6.24.1",
|
||||
"expect.js": "~0.3.1",
|
||||
"mocha": "~2.3.4",
|
||||
"sinon": "1.17.3"
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
{{#emitJSDoc}}/**
|
||||
* Enum class {{classname}}.
|
||||
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
||||
* @readonly
|
||||
*/{{/emitJSDoc}}
|
||||
export default class {{classname}} {
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{#emitJSDoc}}/**
|
||||
* value: {{{value}}}
|
||||
* @const
|
||||
*/{{/emitJSDoc}}
|
||||
{{name}} = {{{value}}};
|
||||
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Returns a <code>{{classname}}</code> enum value from a Javascript object name.
|
||||
* @param {Object} data The plain JavaScript object containing the name of the enum value.
|
||||
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The enum <code>{{classname}}</code> value.
|
||||
*/{{/emitJSDoc}}
|
||||
static constructFromObject(object) {
|
||||
return object;
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
|
||||
{{#models}}{{#model}}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* The {{classname}} model module.
|
||||
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @version {{projectVersion}}
|
||||
*/{{/emitJSDoc}}
|
||||
export default class {{classname}} {
|
||||
{{#emitJSDoc}}/**
|
||||
* Constructs a new <code>{{classname}}</code>.{{#description}}
|
||||
* {{description}}{{/description}}
|
||||
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @class{{#useInheritance}}{{#parent}}
|
||||
* @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}}
|
||||
* @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}}
|
||||
* @param {{name}} {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{#description}}{{{description}}}{{/description}}{{/vendorExtensions.x-all-required}}
|
||||
*/{{/emitJSDoc}}
|
||||
|
||||
constructor({{#vendorExtensions.x-all-required}}{{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) {
|
||||
{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}}
|
||||
this = new Array();
|
||||
Object.setPrototypeOf(this, exports);{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}
|
||||
|
||||
{{#useInheritance}}
|
||||
{{#parentModel}}{{classname}}.call(this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
|
||||
{{#interfaceModels}}{{classname}}.call(this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});{{/interfaceModels}}
|
||||
{{/useInheritance}}
|
||||
|
||||
{{#vars}}{{#required}}this['{{baseName}}'] = {{name}};{{/required}}{{/vars}}
|
||||
|
||||
{{#parent}}{{^parentModel}}return this;{{/parentModel}}{{/parent}}
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**
|
||||
* Constructs a <code>{{classname}}</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:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
|
||||
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
|
||||
*/{{/emitJSDoc}}
|
||||
static constructFromObject(data, obj) {
|
||||
if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
|
||||
obj = obj || new exports();
|
||||
|
||||
{{#parent}}{{^parentModel}}ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}');{{/parentModel}}
|
||||
{{/parent}}
|
||||
|
||||
{{#useInheritance}}{{#parentModel}}{{classname}}.constructFromObject(data, obj);{{/parentModel}}
|
||||
{{#interfaces}}{{.}}.constructFromObject(data, obj);{{/interfaces}}
|
||||
{{/useInheritance}}
|
||||
|
||||
{{#vars}}
|
||||
if (data.hasOwnProperty('{{baseName}}')) {
|
||||
obj['{{baseName}}']{{{defaultValueWithParam}}}
|
||||
}
|
||||
{{/vars}}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
{{#vars}}
|
||||
{{#emitJSDoc}}/**{{#description}}
|
||||
* {{{description}}}{{/description}}
|
||||
* @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
|
||||
* @default {{{defaultValue}}}{{/defaultValue}}
|
||||
*/{{/emitJSDoc}}
|
||||
{{baseName}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
||||
{{/vars}}
|
||||
|
||||
{{#useInheritance}}{{#interfaceModels}}
|
||||
// Implement {{classname}} interface:
|
||||
{{#allVars}}{{#emitJSDoc}}/**{{#description}}
|
||||
* {{{description}}}{{/description}}
|
||||
* @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
|
||||
* @default {{{defaultValue}}}{{/defaultValue}}
|
||||
*/{{/emitJSDoc}}
|
||||
{{baseName}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
||||
{{/allVars}}
|
||||
{{/interfaceModels}}{{/useInheritance}}
|
||||
|
||||
|
||||
{{#emitModelMethods}}{{#vars}}
|
||||
{{#emitJSDoc}}/**{{#description}}
|
||||
* Returns {{{description}}}{{/description}}{{#minimum}}
|
||||
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
||||
* maximum: {{maximum}}{{/maximum}}
|
||||
* @return {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=>
|
||||
*/{{/emitJSDoc}}
|
||||
{{getter}}() {
|
||||
return this.{{baseName}};
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}/**{{#description}}
|
||||
* Sets {{{description}}}{{/description}}
|
||||
* @param {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{name}}{{#description}} {{{description}}}{{/description}}
|
||||
*/{{/emitJSDoc}}
|
||||
{{setter}}({{name}}) {
|
||||
this['{{baseName}}'] = {{name}};
|
||||
}
|
||||
{{/vars}}{{/emitModelMethods}}
|
||||
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
{{^isContainer}}
|
||||
{{>partial_model_inner_enum}}
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
{{#items.isEnum}}
|
||||
{{#items}}
|
||||
{{^isContainer}}
|
||||
{{>partial_model_inner_enum}}
|
||||
{{/isContainer}}
|
||||
{{/items}}
|
||||
{{/items.isEnum}}
|
||||
{{/vars}}
|
||||
|
||||
{{/model}}{{/models}}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{{#emitJSDoc}}/**
|
||||
* Allowed values for the <code>{{baseName}}</code> property.
|
||||
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
||||
* @readonly
|
||||
*/{{/emitJSDoc}}
|
||||
static {{datatypeWithEnum}} = {
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{#emitJSDoc}}/**
|
||||
* value: {{{value}}}
|
||||
* @const
|
||||
*/{{/emitJSDoc}}
|
||||
"{{name}}": {{{value}}}{{^-last}},
|
||||
{{/-last}}
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
- "6.1"
|
||||
- "5"
|
||||
- "5.11"
|
||||
|
@ -68,6 +68,8 @@ public class JavaScriptClientOptionsTest extends AbstractOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setEmitJSDoc(Boolean.valueOf(JavaScriptOptionsProvider.EMIT_JS_DOC_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setUseES6(Boolean.valueOf(JavaScriptOptionsProvider.USE_ES6_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public class JavaScriptOptionsProvider implements OptionsProvider {
|
||||
public static final String EMIT_MODEL_METHODS_VALUE = "true";
|
||||
public static final String EMIT_JS_DOC_VALUE = "false";
|
||||
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
|
||||
public static final String USE_ES6_VALUE = "true";
|
||||
|
||||
|
||||
private ImmutableMap<String, String> options;
|
||||
@ -62,6 +63,7 @@ public class JavaScriptOptionsProvider implements OptionsProvider {
|
||||
.put(JavascriptClientCodegen.EMIT_JS_DOC, EMIT_JS_DOC_VALUE)
|
||||
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
|
||||
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
|
||||
.put(JavascriptClientCodegen.USE_ES6, USE_ES6_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
@ -0,0 +1 @@
|
||||
2.3.0-SNAPSHOT
|
7
samples/client/petstore/javascript-es6/.travis.yml
Normal file
7
samples/client/petstore/javascript-es6/.travis.yml
Normal file
@ -0,0 +1,7 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
- "6.1"
|
||||
- "5"
|
||||
- "5.11"
|
||||
|
169
samples/client/petstore/javascript-es6/README.md
Normal file
169
samples/client/petstore/javascript-es6/README.md
Normal file
@ -0,0 +1,169 @@
|
||||
# swagger_petstore
|
||||
|
||||
SwaggerPetstore - JavaScript client for swagger_petstore
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
### For [Node.js](https://nodejs.org/)
|
||||
|
||||
#### npm
|
||||
|
||||
To publish the library as a [npm](https://www.npmjs.com/),
|
||||
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
||||
|
||||
Then install it via:
|
||||
|
||||
```shell
|
||||
npm install swagger_petstore --save
|
||||
```
|
||||
|
||||
#### git
|
||||
#
|
||||
If the library is hosted at a git repository, e.g.
|
||||
https://github.com/GIT_USER_ID/GIT_REPO_ID
|
||||
then install it via:
|
||||
|
||||
```shell
|
||||
npm install GIT_USER_ID/GIT_REPO_ID --save
|
||||
```
|
||||
|
||||
### For browser
|
||||
|
||||
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
|
||||
the above steps with Node.js and installing browserify with `npm install -g browserify`,
|
||||
perform the following (assuming *main.js* is your entry file):
|
||||
|
||||
```shell
|
||||
browserify main.js > bundle.js
|
||||
```
|
||||
|
||||
Then include *bundle.js* in the HTML pages.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following JS code:
|
||||
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var api = new SwaggerPetstore.FakeApi()
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.OuterBoolean() // {OuterBoolean} Input boolean as post body
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
api.fakeOuterBooleanSerialize(opts, callback);
|
||||
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*SwaggerPetstore.FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||
*SwaggerPetstore.FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||
*SwaggerPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||
*SwaggerPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||
*SwaggerPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||
*SwaggerPetstore.FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*SwaggerPetstore.FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||
*SwaggerPetstore.Fake_classname_tags123Api* | [**testClassname**](docs/Fake_classname_tags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||
*SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
*SwaggerPetstore.PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*SwaggerPetstore.PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*SwaggerPetstore.PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*SwaggerPetstore.PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
*SwaggerPetstore.PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
*SwaggerPetstore.PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*SwaggerPetstore.PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*SwaggerPetstore.StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*SwaggerPetstore.StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*SwaggerPetstore.StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
*SwaggerPetstore.StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
*SwaggerPetstore.UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
||||
*SwaggerPetstore.UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*SwaggerPetstore.UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*SwaggerPetstore.UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
*SwaggerPetstore.UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
*SwaggerPetstore.UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
*SwaggerPetstore.UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
*SwaggerPetstore.UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
- [SwaggerPetstore.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||
- [SwaggerPetstore.Animal](docs/Animal.md)
|
||||
- [SwaggerPetstore.AnimalFarm](docs/AnimalFarm.md)
|
||||
- [SwaggerPetstore.ApiResponse](docs/ApiResponse.md)
|
||||
- [SwaggerPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||
- [SwaggerPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||
- [SwaggerPetstore.ArrayTest](docs/ArrayTest.md)
|
||||
- [SwaggerPetstore.Capitalization](docs/Capitalization.md)
|
||||
- [SwaggerPetstore.Category](docs/Category.md)
|
||||
- [SwaggerPetstore.ClassModel](docs/ClassModel.md)
|
||||
- [SwaggerPetstore.Client](docs/Client.md)
|
||||
- [SwaggerPetstore.EnumArrays](docs/EnumArrays.md)
|
||||
- [SwaggerPetstore.EnumClass](docs/EnumClass.md)
|
||||
- [SwaggerPetstore.EnumTest](docs/EnumTest.md)
|
||||
- [SwaggerPetstore.FormatTest](docs/FormatTest.md)
|
||||
- [SwaggerPetstore.HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||
- [SwaggerPetstore.List](docs/List.md)
|
||||
- [SwaggerPetstore.MapTest](docs/MapTest.md)
|
||||
- [SwaggerPetstore.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||
- [SwaggerPetstore.Model200Response](docs/Model200Response.md)
|
||||
- [SwaggerPetstore.ModelReturn](docs/ModelReturn.md)
|
||||
- [SwaggerPetstore.Name](docs/Name.md)
|
||||
- [SwaggerPetstore.NumberOnly](docs/NumberOnly.md)
|
||||
- [SwaggerPetstore.Order](docs/Order.md)
|
||||
- [SwaggerPetstore.OuterBoolean](docs/OuterBoolean.md)
|
||||
- [SwaggerPetstore.OuterComposite](docs/OuterComposite.md)
|
||||
- [SwaggerPetstore.OuterEnum](docs/OuterEnum.md)
|
||||
- [SwaggerPetstore.OuterNumber](docs/OuterNumber.md)
|
||||
- [SwaggerPetstore.OuterString](docs/OuterString.md)
|
||||
- [SwaggerPetstore.Pet](docs/Pet.md)
|
||||
- [SwaggerPetstore.ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
- [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md)
|
||||
- [SwaggerPetstore.Tag](docs/Tag.md)
|
||||
- [SwaggerPetstore.User](docs/User.md)
|
||||
- [SwaggerPetstore.Cat](docs/Cat.md)
|
||||
- [SwaggerPetstore.Dog](docs/Dog.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
### http_basic_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
@ -0,0 +1,9 @@
|
||||
# SwaggerPetstore.AdditionalPropertiesClass
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**mapProperty** | **{String: String}** | | [optional]
|
||||
**mapOfMapProperty** | **{String: {String: String}}** | | [optional]
|
||||
|
||||
|
9
samples/client/petstore/javascript-es6/docs/Animal.md
Normal file
9
samples/client/petstore/javascript-es6/docs/Animal.md
Normal file
@ -0,0 +1,9 @@
|
||||
# SwaggerPetstore.Animal
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**className** | **String** | |
|
||||
**color** | **String** | | [optional] [default to 'red']
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
# SwaggerPetstore.AnimalFarm
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
|
10
samples/client/petstore/javascript-es6/docs/ApiResponse.md
Normal file
10
samples/client/petstore/javascript-es6/docs/ApiResponse.md
Normal file
@ -0,0 +1,10 @@
|
||||
# SwaggerPetstore.ApiResponse
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **Number** | | [optional]
|
||||
**type** | **String** | | [optional]
|
||||
**message** | **String** | | [optional]
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.ArrayOfArrayOfNumberOnly
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**arrayArrayNumber** | **[[Number]]** | | [optional]
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.ArrayOfNumberOnly
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**arrayNumber** | **[Number]** | | [optional]
|
||||
|
||||
|
10
samples/client/petstore/javascript-es6/docs/ArrayTest.md
Normal file
10
samples/client/petstore/javascript-es6/docs/ArrayTest.md
Normal file
@ -0,0 +1,10 @@
|
||||
# SwaggerPetstore.ArrayTest
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**arrayOfString** | **[String]** | | [optional]
|
||||
**arrayArrayOfInteger** | **[[Number]]** | | [optional]
|
||||
**arrayArrayOfModel** | **[[ReadOnlyFirst]]** | | [optional]
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
# SwaggerPetstore.Capitalization
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**smallCamel** | **String** | | [optional]
|
||||
**capitalCamel** | **String** | | [optional]
|
||||
**smallSnake** | **String** | | [optional]
|
||||
**capitalSnake** | **String** | | [optional]
|
||||
**sCAETHFlowPoints** | **String** | | [optional]
|
||||
**ATT_NAME** | **String** | Name of the pet | [optional]
|
||||
|
||||
|
8
samples/client/petstore/javascript-es6/docs/Cat.md
Normal file
8
samples/client/petstore/javascript-es6/docs/Cat.md
Normal file
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.Cat
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**declawed** | **Boolean** | | [optional]
|
||||
|
||||
|
9
samples/client/petstore/javascript-es6/docs/Category.md
Normal file
9
samples/client/petstore/javascript-es6/docs/Category.md
Normal file
@ -0,0 +1,9 @@
|
||||
# SwaggerPetstore.Category
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Number** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.ClassModel
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**_class** | **String** | | [optional]
|
||||
|
||||
|
8
samples/client/petstore/javascript-es6/docs/Client.md
Normal file
8
samples/client/petstore/javascript-es6/docs/Client.md
Normal file
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.Client
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**client** | **String** | | [optional]
|
||||
|
||||
|
8
samples/client/petstore/javascript-es6/docs/Dog.md
Normal file
8
samples/client/petstore/javascript-es6/docs/Dog.md
Normal file
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.Dog
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**breed** | **String** | | [optional]
|
||||
|
||||
|
31
samples/client/petstore/javascript-es6/docs/EnumArrays.md
Normal file
31
samples/client/petstore/javascript-es6/docs/EnumArrays.md
Normal file
@ -0,0 +1,31 @@
|
||||
# SwaggerPetstore.EnumArrays
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**justSymbol** | **String** | | [optional]
|
||||
**arrayEnum** | **[String]** | | [optional]
|
||||
|
||||
|
||||
<a name="JustSymbolEnum"></a>
|
||||
## Enum: JustSymbolEnum
|
||||
|
||||
|
||||
* `GREATER_THAN_OR_EQUAL_TO` (value: `">="`)
|
||||
|
||||
* `DOLLAR` (value: `"$"`)
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="[ArrayEnumEnum]"></a>
|
||||
## Enum: [ArrayEnumEnum]
|
||||
|
||||
|
||||
* `fish` (value: `"fish"`)
|
||||
|
||||
* `crab` (value: `"crab"`)
|
||||
|
||||
|
||||
|
||||
|
12
samples/client/petstore/javascript-es6/docs/EnumClass.md
Normal file
12
samples/client/petstore/javascript-es6/docs/EnumClass.md
Normal file
@ -0,0 +1,12 @@
|
||||
# SwaggerPetstore.EnumClass
|
||||
|
||||
## Enum
|
||||
|
||||
|
||||
* `_abc` (value: `"_abc"`)
|
||||
|
||||
* `-efg` (value: `"-efg"`)
|
||||
|
||||
* `(xyz)` (value: `"(xyz)"`)
|
||||
|
||||
|
46
samples/client/petstore/javascript-es6/docs/EnumTest.md
Normal file
46
samples/client/petstore/javascript-es6/docs/EnumTest.md
Normal file
@ -0,0 +1,46 @@
|
||||
# SwaggerPetstore.EnumTest
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**enumString** | **String** | | [optional]
|
||||
**enumInteger** | **Number** | | [optional]
|
||||
**enumNumber** | **Number** | | [optional]
|
||||
**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional]
|
||||
|
||||
|
||||
<a name="EnumStringEnum"></a>
|
||||
## Enum: EnumStringEnum
|
||||
|
||||
|
||||
* `UPPER` (value: `"UPPER"`)
|
||||
|
||||
* `lower` (value: `"lower"`)
|
||||
|
||||
* `empty` (value: `""`)
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="EnumIntegerEnum"></a>
|
||||
## Enum: EnumIntegerEnum
|
||||
|
||||
|
||||
* `1` (value: `1`)
|
||||
|
||||
* `-1` (value: `-1`)
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="EnumNumberEnum"></a>
|
||||
## Enum: EnumNumberEnum
|
||||
|
||||
|
||||
* `1.1` (value: `1.1`)
|
||||
|
||||
* `-1.2` (value: `-1.2`)
|
||||
|
||||
|
||||
|
||||
|
393
samples/client/petstore/javascript-es6/docs/FakeApi.md
Normal file
393
samples/client/petstore/javascript-es6/docs/FakeApi.md
Normal file
@ -0,0 +1,393 @@
|
||||
# SwaggerPetstore.FakeApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||
[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||
[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||
[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||
|
||||
|
||||
<a name="fakeOuterBooleanSerialize"></a>
|
||||
# **fakeOuterBooleanSerialize**
|
||||
> OuterBoolean fakeOuterBooleanSerialize(opts)
|
||||
|
||||
|
||||
|
||||
Test serialization of outer boolean types
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.FakeApi();
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.OuterBoolean() // OuterBoolean | Input boolean as post body
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.fakeOuterBooleanSerialize(opts, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**OuterBoolean**](OuterBoolean.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="fakeOuterCompositeSerialize"></a>
|
||||
# **fakeOuterCompositeSerialize**
|
||||
> OuterComposite fakeOuterCompositeSerialize(opts)
|
||||
|
||||
|
||||
|
||||
Test serialization of object with outer number type
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.FakeApi();
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.OuterComposite() // OuterComposite | Input composite as post body
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.fakeOuterCompositeSerialize(opts, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**OuterComposite**](OuterComposite.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="fakeOuterNumberSerialize"></a>
|
||||
# **fakeOuterNumberSerialize**
|
||||
> OuterNumber fakeOuterNumberSerialize(opts)
|
||||
|
||||
|
||||
|
||||
Test serialization of outer number types
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.FakeApi();
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.OuterNumber() // OuterNumber | Input number as post body
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.fakeOuterNumberSerialize(opts, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**OuterNumber**](OuterNumber.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="fakeOuterStringSerialize"></a>
|
||||
# **fakeOuterStringSerialize**
|
||||
> OuterString fakeOuterStringSerialize(opts)
|
||||
|
||||
|
||||
|
||||
Test serialization of outer string types
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.FakeApi();
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.OuterString() // OuterString | Input string as post body
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.fakeOuterStringSerialize(opts, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterString**](OuterString.md)| Input string as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**OuterString**](OuterString.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="testClientModel"></a>
|
||||
# **testClientModel**
|
||||
> Client testClientModel(body)
|
||||
|
||||
To test \"client\" model
|
||||
|
||||
To test \"client\" model
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.FakeApi();
|
||||
|
||||
var body = new SwaggerPetstore.Client(); // Client | client model
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.testClientModel(body, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="testEndpointParameters"></a>
|
||||
# **testEndpointParameters**
|
||||
> testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts)
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// Configure HTTP basic authorization: http_basic_test
|
||||
var http_basic_test = defaultClient.authentications['http_basic_test'];
|
||||
http_basic_test.username = 'YOUR USERNAME';
|
||||
http_basic_test.password = 'YOUR PASSWORD';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.FakeApi();
|
||||
|
||||
var _number = 3.4; // Number | None
|
||||
|
||||
var _double = 1.2; // Number | None
|
||||
|
||||
var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
|
||||
var _byte = B; // Blob | None
|
||||
|
||||
var opts = {
|
||||
'integer': 56, // Number | None
|
||||
'int32': 56, // Number | None
|
||||
'int64': 789, // Number | None
|
||||
'_float': 3.4, // Number | None
|
||||
'_string': "_string_example", // String | None
|
||||
'binary': B, // Blob | None
|
||||
'_date': new Date("2013-10-20"), // Date | None
|
||||
'dateTime': new Date("2013-10-20T19:20:30+01:00"), // Date | None
|
||||
'password': "password_example", // String | None
|
||||
'callback': "callback_example" // String | None
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**_number** | **Number**| None |
|
||||
**_double** | **Number**| None |
|
||||
**patternWithoutDelimiter** | **String**| None |
|
||||
**_byte** | **Blob**| None |
|
||||
**integer** | **Number**| None | [optional]
|
||||
**int32** | **Number**| None | [optional]
|
||||
**int64** | **Number**| None | [optional]
|
||||
**_float** | **Number**| None | [optional]
|
||||
**_string** | **String**| None | [optional]
|
||||
**binary** | **Blob**| None | [optional]
|
||||
**_date** | **Date**| None | [optional]
|
||||
**dateTime** | **Date**| None | [optional]
|
||||
**password** | **String**| None | [optional]
|
||||
**callback** | **String**| None | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[http_basic_test](../README.md#http_basic_test)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
- **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
|
||||
<a name="testEnumParameters"></a>
|
||||
# **testEnumParameters**
|
||||
> testEnumParameters(opts)
|
||||
|
||||
To test enum parameters
|
||||
|
||||
To test enum parameters
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.FakeApi();
|
||||
|
||||
var opts = {
|
||||
'enumFormStringArray': ["enumFormStringArray_example"], // [String] | Form parameter enum test (string array)
|
||||
'enumFormString': "-efg", // String | Form parameter enum test (string)
|
||||
'enumHeaderStringArray': ["enumHeaderStringArray_example"], // [String] | Header parameter enum test (string array)
|
||||
'enumHeaderString': "-efg", // String | Header parameter enum test (string)
|
||||
'enumQueryStringArray': ["enumQueryStringArray_example"], // [String] | Query parameter enum test (string array)
|
||||
'enumQueryString': "-efg", // String | Query parameter enum test (string)
|
||||
'enumQueryInteger': 56, // Number | Query parameter enum test (double)
|
||||
'enumQueryDouble': 1.2 // Number | Query parameter enum test (double)
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.testEnumParameters(opts, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enumFormStringArray** | [**[String]**](String.md)| Form parameter enum test (string array) | [optional]
|
||||
**enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg]
|
||||
**enumHeaderStringArray** | [**[String]**](String.md)| Header parameter enum test (string array) | [optional]
|
||||
**enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg]
|
||||
**enumQueryStringArray** | [**[String]**](String.md)| Query parameter enum test (string array) | [optional]
|
||||
**enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg]
|
||||
**enumQueryInteger** | **Number**| Query parameter enum test (double) | [optional]
|
||||
**enumQueryDouble** | **Number**| Query parameter enum test (double) | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: */*
|
||||
- **Accept**: */*
|
||||
|
@ -0,0 +1,53 @@
|
||||
# SwaggerPetstore.Fake_classname_tags123Api
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**testClassname**](Fake_classname_tags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||
|
||||
|
||||
<a name="testClassname"></a>
|
||||
# **testClassname**
|
||||
> Client testClassname(body)
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.Fake_classname_tags123Api();
|
||||
|
||||
var body = new SwaggerPetstore.Client(); // Client | client model
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.testClassname(body, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
20
samples/client/petstore/javascript-es6/docs/FormatTest.md
Normal file
20
samples/client/petstore/javascript-es6/docs/FormatTest.md
Normal file
@ -0,0 +1,20 @@
|
||||
# SwaggerPetstore.FormatTest
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**integer** | **Number** | | [optional]
|
||||
**int32** | **Number** | | [optional]
|
||||
**int64** | **Number** | | [optional]
|
||||
**_number** | **Number** | |
|
||||
**_float** | **Number** | | [optional]
|
||||
**_double** | **Number** | | [optional]
|
||||
**_string** | **String** | | [optional]
|
||||
**_byte** | **Blob** | |
|
||||
**binary** | **Blob** | | [optional]
|
||||
**_date** | **Date** | |
|
||||
**dateTime** | **Date** | | [optional]
|
||||
**uuid** | **String** | | [optional]
|
||||
**password** | **String** | |
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# SwaggerPetstore.HasOnlyReadOnly
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**bar** | **String** | | [optional]
|
||||
**foo** | **String** | | [optional]
|
||||
|
||||
|
8
samples/client/petstore/javascript-es6/docs/List.md
Normal file
8
samples/client/petstore/javascript-es6/docs/List.md
Normal file
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.List
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**_123List** | **String** | | [optional]
|
||||
|
||||
|
20
samples/client/petstore/javascript-es6/docs/MapTest.md
Normal file
20
samples/client/petstore/javascript-es6/docs/MapTest.md
Normal file
@ -0,0 +1,20 @@
|
||||
# SwaggerPetstore.MapTest
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**mapMapOfString** | **{String: {String: String}}** | | [optional]
|
||||
**mapOfEnumString** | **{String: String}** | | [optional]
|
||||
|
||||
|
||||
<a name="{String: String}"></a>
|
||||
## Enum: {String: String}
|
||||
|
||||
|
||||
* `UPPER` (value: `"UPPER"`)
|
||||
|
||||
* `lower` (value: `"lower"`)
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
# SwaggerPetstore.MixedPropertiesAndAdditionalPropertiesClass
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**uuid** | **String** | | [optional]
|
||||
**dateTime** | **Date** | | [optional]
|
||||
**map** | [**{String: Animal}**](Animal.md) | | [optional]
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# SwaggerPetstore.Model200Response
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **Number** | | [optional]
|
||||
**_class** | **String** | | [optional]
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.ModelReturn
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**_return** | **Number** | | [optional]
|
||||
|
||||
|
11
samples/client/petstore/javascript-es6/docs/Name.md
Normal file
11
samples/client/petstore/javascript-es6/docs/Name.md
Normal file
@ -0,0 +1,11 @@
|
||||
# SwaggerPetstore.Name
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **Number** | |
|
||||
**snakeCase** | **Number** | | [optional]
|
||||
**property** | **String** | | [optional]
|
||||
**_123Number** | **Number** | | [optional]
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.NumberOnly
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**justNumber** | **Number** | | [optional]
|
||||
|
||||
|
26
samples/client/petstore/javascript-es6/docs/Order.md
Normal file
26
samples/client/petstore/javascript-es6/docs/Order.md
Normal file
@ -0,0 +1,26 @@
|
||||
# SwaggerPetstore.Order
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Number** | | [optional]
|
||||
**petId** | **Number** | | [optional]
|
||||
**quantity** | **Number** | | [optional]
|
||||
**shipDate** | **Date** | | [optional]
|
||||
**status** | **String** | Order Status | [optional]
|
||||
**complete** | **Boolean** | | [optional] [default to false]
|
||||
|
||||
|
||||
<a name="StatusEnum"></a>
|
||||
## Enum: StatusEnum
|
||||
|
||||
|
||||
* `placed` (value: `"placed"`)
|
||||
|
||||
* `approved` (value: `"approved"`)
|
||||
|
||||
* `delivered` (value: `"delivered"`)
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
# SwaggerPetstore.OuterBoolean
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
# SwaggerPetstore.OuterComposite
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**myNumber** | [**OuterNumber**](OuterNumber.md) | | [optional]
|
||||
**myString** | [**OuterString**](OuterString.md) | | [optional]
|
||||
**myBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional]
|
||||
|
||||
|
12
samples/client/petstore/javascript-es6/docs/OuterEnum.md
Normal file
12
samples/client/petstore/javascript-es6/docs/OuterEnum.md
Normal file
@ -0,0 +1,12 @@
|
||||
# SwaggerPetstore.OuterEnum
|
||||
|
||||
## Enum
|
||||
|
||||
|
||||
* `placed` (value: `"placed"`)
|
||||
|
||||
* `approved` (value: `"approved"`)
|
||||
|
||||
* `delivered` (value: `"delivered"`)
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
# SwaggerPetstore.OuterNumber
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
# SwaggerPetstore.OuterString
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
|
26
samples/client/petstore/javascript-es6/docs/Pet.md
Normal file
26
samples/client/petstore/javascript-es6/docs/Pet.md
Normal file
@ -0,0 +1,26 @@
|
||||
# SwaggerPetstore.Pet
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Number** | | [optional]
|
||||
**category** | [**Category**](Category.md) | | [optional]
|
||||
**name** | **String** | |
|
||||
**photoUrls** | **[String]** | |
|
||||
**tags** | [**[Tag]**](Tag.md) | | [optional]
|
||||
**status** | **String** | pet status in the store | [optional]
|
||||
|
||||
|
||||
<a name="StatusEnum"></a>
|
||||
## Enum: StatusEnum
|
||||
|
||||
|
||||
* `available` (value: `"available"`)
|
||||
|
||||
* `pending` (value: `"pending"`)
|
||||
|
||||
* `sold` (value: `"sold"`)
|
||||
|
||||
|
||||
|
||||
|
442
samples/client/petstore/javascript-es6/docs/PetApi.md
Normal file
442
samples/client/petstore/javascript-es6/docs/PetApi.md
Normal file
@ -0,0 +1,442 @@
|
||||
# SwaggerPetstore.PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
# **addPet**
|
||||
> addPet(body)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.addPet(body, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="deletePet"></a>
|
||||
# **deletePet**
|
||||
> deletePet(petId, opts)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
var petId = 789; // Number | Pet id to delete
|
||||
|
||||
var opts = {
|
||||
'apiKey': "apiKey_example" // String |
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.deletePet(petId, opts, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Number**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="findPetsByStatus"></a>
|
||||
# **findPetsByStatus**
|
||||
> [Pet] findPetsByStatus(status)
|
||||
|
||||
Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
var status = ["status_example"]; // [String] | Status values that need to be considered for filter
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.findPetsByStatus(status, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**[String]**](String.md)| Status values that need to be considered for filter |
|
||||
|
||||
### Return type
|
||||
|
||||
[**[Pet]**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="findPetsByTags"></a>
|
||||
# **findPetsByTags**
|
||||
> [Pet] findPetsByTags(tags)
|
||||
|
||||
Finds Pets by tags
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
var tags = ["tags_example"]; // [String] | Tags to filter by
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.findPetsByTags(tags, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**[String]**](String.md)| Tags to filter by |
|
||||
|
||||
### Return type
|
||||
|
||||
[**[Pet]**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="getPetById"></a>
|
||||
# **getPetById**
|
||||
> Pet getPetById(petId)
|
||||
|
||||
Find pet by ID
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// 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 = 'Token';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
var petId = 789; // Number | ID of pet to return
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.getPetById(petId, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Number**| ID of pet to return |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="updatePet"></a>
|
||||
# **updatePet**
|
||||
> updatePet(body)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.updatePet(body, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="updatePetWithForm"></a>
|
||||
# **updatePetWithForm**
|
||||
> updatePetWithForm(petId, opts)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
var petId = 789; // Number | ID of pet that needs to be updated
|
||||
|
||||
var opts = {
|
||||
'name': "name_example", // String | Updated name of the pet
|
||||
'status': "status_example" // String | Updated status of the pet
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.updatePetWithForm(petId, opts, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Number**| ID of pet that needs to be updated |
|
||||
**name** | **String**| Updated name of the pet | [optional]
|
||||
**status** | **String**| Updated status of the pet | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="uploadFile"></a>
|
||||
# **uploadFile**
|
||||
> ApiResponse uploadFile(petId, opts)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = 'YOUR ACCESS TOKEN';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi();
|
||||
|
||||
var petId = 789; // Number | ID of pet to update
|
||||
|
||||
var opts = {
|
||||
'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server
|
||||
'file': "/path/to/file.txt" // File | file to upload
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.uploadFile(petId, opts, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Number**| ID of pet to update |
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional]
|
||||
**file** | **File**| file to upload | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ApiResponse**](ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
@ -0,0 +1,9 @@
|
||||
# SwaggerPetstore.ReadOnlyFirst
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**bar** | **String** | | [optional]
|
||||
**baz** | **String** | | [optional]
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
# SwaggerPetstore.SpecialModelName
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**specialPropertyName** | **Number** | | [optional]
|
||||
|
||||
|
197
samples/client/petstore/javascript-es6/docs/StoreApi.md
Normal file
197
samples/client/petstore/javascript-es6/docs/StoreApi.md
Normal file
@ -0,0 +1,197 @@
|
||||
# SwaggerPetstore.StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
<a name="deleteOrder"></a>
|
||||
# **deleteOrder**
|
||||
> deleteOrder(orderId)
|
||||
|
||||
Delete purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.StoreApi();
|
||||
|
||||
var orderId = "orderId_example"; // String | ID of the order that needs to be deleted
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.deleteOrder(orderId, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="getInventory"></a>
|
||||
# **getInventory**
|
||||
> {'String': 'Number'} getInventory()
|
||||
|
||||
Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||
|
||||
// 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 = 'Token';
|
||||
|
||||
var apiInstance = new SwaggerPetstore.StoreApi();
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.getInventory(callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**{'String': 'Number'}**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="getOrderById"></a>
|
||||
# **getOrderById**
|
||||
> Order getOrderById(orderId)
|
||||
|
||||
Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.StoreApi();
|
||||
|
||||
var orderId = 789; // Number | ID of pet that needs to be fetched
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.getOrderById(orderId, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **Number**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="placeOrder"></a>
|
||||
# **placeOrder**
|
||||
> Order placeOrder(body)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.StoreApi();
|
||||
|
||||
var body = new SwaggerPetstore.Order(); // Order | order placed for purchasing the pet
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.placeOrder(body, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
9
samples/client/petstore/javascript-es6/docs/Tag.md
Normal file
9
samples/client/petstore/javascript-es6/docs/Tag.md
Normal file
@ -0,0 +1,9 @@
|
||||
# SwaggerPetstore.Tag
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Number** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
|
||||
|
15
samples/client/petstore/javascript-es6/docs/User.md
Normal file
15
samples/client/petstore/javascript-es6/docs/User.md
Normal file
@ -0,0 +1,15 @@
|
||||
# SwaggerPetstore.User
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Number** | | [optional]
|
||||
**username** | **String** | | [optional]
|
||||
**firstName** | **String** | | [optional]
|
||||
**lastName** | **String** | | [optional]
|
||||
**email** | **String** | | [optional]
|
||||
**password** | **String** | | [optional]
|
||||
**phone** | **String** | | [optional]
|
||||
**userStatus** | **Number** | User Status | [optional]
|
||||
|
||||
|
384
samples/client/petstore/javascript-es6/docs/UserApi.md
Normal file
384
samples/client/petstore/javascript-es6/docs/UserApi.md
Normal file
@ -0,0 +1,384 @@
|
||||
# SwaggerPetstore.UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
|
||||
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
<a name="createUser"></a>
|
||||
# **createUser**
|
||||
> createUser(body)
|
||||
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.UserApi();
|
||||
|
||||
var body = new SwaggerPetstore.User(); // User | Created user object
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.createUser(body, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="createUsersWithArrayInput"></a>
|
||||
# **createUsersWithArrayInput**
|
||||
> createUsersWithArrayInput(body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.UserApi();
|
||||
|
||||
var body = [new SwaggerPetstore.User()]; // [User] | List of user object
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.createUsersWithArrayInput(body, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="createUsersWithListInput"></a>
|
||||
# **createUsersWithListInput**
|
||||
> createUsersWithListInput(body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.UserApi();
|
||||
|
||||
var body = [new SwaggerPetstore.User()]; // [User] | List of user object
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.createUsersWithListInput(body, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**[User]**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="deleteUser"></a>
|
||||
# **deleteUser**
|
||||
> deleteUser(username)
|
||||
|
||||
Delete user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.UserApi();
|
||||
|
||||
var username = "username_example"; // String | The name that needs to be deleted
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.deleteUser(username, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="getUserByName"></a>
|
||||
# **getUserByName**
|
||||
> User getUserByName(username)
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.UserApi();
|
||||
|
||||
var username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.getUserByName(username, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
|
||||
### Return type
|
||||
|
||||
[**User**](User.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="loginUser"></a>
|
||||
# **loginUser**
|
||||
> 'String' loginUser(username, password)
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.UserApi();
|
||||
|
||||
var username = "username_example"; // String | The user name for login
|
||||
|
||||
var password = "password_example"; // String | The password for login in clear text
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}
|
||||
};
|
||||
apiInstance.loginUser(username, password, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
|
||||
### Return type
|
||||
|
||||
**'String'**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="logoutUser"></a>
|
||||
# **logoutUser**
|
||||
> logoutUser()
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.UserApi();
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.logoutUser(callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="updateUser"></a>
|
||||
# **updateUser**
|
||||
> updateUser(username, body)
|
||||
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger_petstore');
|
||||
|
||||
var apiInstance = new SwaggerPetstore.UserApi();
|
||||
|
||||
var username = "username_example"; // String | name that need to be deleted
|
||||
|
||||
var body = new SwaggerPetstore.User(); // User | Updated user object
|
||||
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
};
|
||||
apiInstance.updateUser(username, body, callback);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
52
samples/client/petstore/javascript-es6/git_push.sh
Normal file
52
samples/client/petstore/javascript-es6/git_push.sh
Normal file
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the Git credential in your environment."
|
||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
1
samples/client/petstore/javascript-es6/mocha.opts
Normal file
1
samples/client/petstore/javascript-es6/mocha.opts
Normal file
@ -0,0 +1 @@
|
||||
--timeout 10000
|
18
samples/client/petstore/javascript-es6/package.json
Normal file
18
samples/client/petstore/javascript-es6/package.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "swagger_petstore",
|
||||
"version": "1.0.0",
|
||||
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters__",
|
||||
"license": "Unlicense",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "./node_modules/mocha/bin/mocha --recursive"
|
||||
},
|
||||
"dependencies": {
|
||||
"superagent": "3.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~2.3.4",
|
||||
"sinon": "1.17.3",
|
||||
"expect.js": "~0.3.1"
|
||||
}
|
||||
}
|
45
samples/client/petstore/javascript-es6/pom.xml
Normal file
45
samples/client/petstore/javascript-es6/pom.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-petstore-javascript-es6</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Swagger Petstore JS ES6 Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>npm-install</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>install</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>mocha</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
585
samples/client/petstore/javascript-es6/src/ApiClient.js
Normal file
585
samples/client/petstore/javascript-es6/src/ApiClient.js
Normal file
@ -0,0 +1,585 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['superagent', 'querystring'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('superagent'), require('querystring'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.ApiClient = factory(root.superagent, root.querystring);
|
||||
}
|
||||
}(this, function(superagent, querystring) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @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:80/v2
|
||||
*/
|
||||
this.basePath = 'http://petstore.swagger.io:80/v2'.replace(/\/+$/, '');
|
||||
|
||||
/**
|
||||
* The authentication methods to be included for all API calls.
|
||||
* @type {Array.<String>}
|
||||
*/
|
||||
this.authentications = {
|
||||
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||
'http_basic_test': {type: 'basic'},
|
||||
'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;
|
||||
|
||||
/**
|
||||
* If set to false an additional timestamp parameter is added to all API GET calls to
|
||||
* prevent browser caching
|
||||
* @type {Boolean}
|
||||
* @default true
|
||||
*/
|
||||
this.cache = true;
|
||||
|
||||
/**
|
||||
* If set to true, the client will save the cookies from each server
|
||||
* response, and return them in the next request.
|
||||
* @default false
|
||||
*/
|
||||
this.enableCookies = false;
|
||||
|
||||
/*
|
||||
* Used to save and return cookies in a node.js (non-browser) setting,
|
||||
* if this.enableCookies is set to true.
|
||||
*/
|
||||
if (typeof window === 'undefined') {
|
||||
this.agent = new superagent.agent();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* 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 '';
|
||||
}
|
||||
if (param instanceof Date) {
|
||||
return param.toJSON();
|
||||
}
|
||||
return param.toString();
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
exports.prototype.buildUrl = function(path, pathParams) {
|
||||
if (!path.match(/^\//)) {
|
||||
path = '/' + path;
|
||||
}
|
||||
var url = this.basePath + path;
|
||||
var _this = this;
|
||||
url = url.replace(/\{([\w-]+)\}/g, function(fullMatch, key) {
|
||||
var value;
|
||||
if (pathParams.hasOwnProperty(key)) {
|
||||
value = _this.paramToString(pathParams[key]);
|
||||
} else {
|
||||
value = fullMatch;
|
||||
}
|
||||
return encodeURIComponent(value);
|
||||
});
|
||||
return url;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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>.
|
||||
*/
|
||||
exports.prototype.isJsonMime = function(contentType) {
|
||||
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
exports.prototype.jsonPreferredMime = function(contentTypes) {
|
||||
for (var i = 0; i < contentTypes.length; i++) {
|
||||
if (this.isJsonMime(contentTypes[i])) {
|
||||
return contentTypes[i];
|
||||
}
|
||||
}
|
||||
return contentTypes[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
exports.prototype.isFileParam = function(param) {
|
||||
// fs.ReadStream in Node.js (but not in runtime like browserify)
|
||||
if (typeof window === 'undefined' &&
|
||||
typeof require === 'function' &&
|
||||
require('fs') &&
|
||||
param instanceof require('fs').ReadStream) {
|
||||
return true;
|
||||
}
|
||||
// Buffer in Node.js
|
||||
if (typeof Buffer === 'function' && param instanceof Buffer) {
|
||||
return true;
|
||||
}
|
||||
// Blob in browser
|
||||
if (typeof Blob === 'function' && param instanceof Blob) {
|
||||
return true;
|
||||
}
|
||||
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
|
||||
if (typeof File === 'function' && param instanceof File) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
exports.prototype.normalizeParams = function(params) {
|
||||
var newParams = {};
|
||||
for (var key in params) {
|
||||
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
|
||||
var value = params[key];
|
||||
if (this.isFileParam(value) || Array.isArray(value)) {
|
||||
newParams[key] = value;
|
||||
} else {
|
||||
newParams[key] = this.paramToString(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return newParams;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration of collection format separator strategies.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
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;
|
||||
}
|
||||
switch (collectionFormat) {
|
||||
case 'csv':
|
||||
return param.map(this.paramToString).join(',');
|
||||
case 'ssv':
|
||||
return param.map(this.paramToString).join(' ');
|
||||
case 'tsv':
|
||||
return param.map(this.paramToString).join('\t');
|
||||
case 'pipes':
|
||||
return param.map(this.paramToString).join('|');
|
||||
case 'multi':
|
||||
// return the array directly as SuperAgent will handle it as expected
|
||||
return param.map(this.paramToString);
|
||||
default:
|
||||
throw new Error('Unknown collection format: ' + collectionFormat);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 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];
|
||||
switch (auth.type) {
|
||||
case 'basic':
|
||||
if (auth.username || auth.password) {
|
||||
request.auth(auth.username || '', auth.password || '');
|
||||
}
|
||||
break;
|
||||
case 'apiKey':
|
||||
if (auth.apiKey) {
|
||||
var data = {};
|
||||
if (auth.apiKeyPrefix) {
|
||||
data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
|
||||
} else {
|
||||
data[auth.name] = auth.apiKey;
|
||||
}
|
||||
if (auth['in'] === 'header') {
|
||||
request.set(data);
|
||||
} else {
|
||||
request.query(data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'oauth2':
|
||||
if (auth.accessToken) {
|
||||
request.set({'Authorization': 'Bearer ' + auth.accessToken});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unknown authentication type: ' + auth.type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 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 || response.status == 204) {
|
||||
return null;
|
||||
}
|
||||
// Rely on SuperAgent for parsing response body.
|
||||
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
||||
var data = response.body;
|
||||
if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) {
|
||||
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
||||
data = response.text;
|
||||
}
|
||||
return exports.convertToType(data, returnType);
|
||||
};
|
||||
|
||||
/**
|
||||
* 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>} collectionQueryParams A map of collection 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, collectionQueryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
|
||||
returnType, callback) {
|
||||
|
||||
var _this = this;
|
||||
var url = this.buildUrl(path, pathParams);
|
||||
var request = superagent(httpMethod, url);
|
||||
|
||||
// apply authentications
|
||||
this.applyAuthToRequest(request, authNames);
|
||||
|
||||
// set collection query parameters
|
||||
for (var key in collectionQueryParams) {
|
||||
if (collectionQueryParams.hasOwnProperty(key)) {
|
||||
var param = collectionQueryParams[key];
|
||||
if (param.collectionFormat === 'csv') {
|
||||
// SuperAgent normally percent-encodes all reserved characters in a query parameter. However,
|
||||
// commas are used as delimiters for the 'csv' collectionFormat so they must not be encoded. We
|
||||
// must therefore construct and encode 'csv' collection query parameters manually.
|
||||
if (param.value != null) {
|
||||
var value = param.value.map(this.paramToString).map(encodeURIComponent).join(',');
|
||||
request.query(encodeURIComponent(key) + "=" + value);
|
||||
}
|
||||
} else {
|
||||
// All other collection query parameters should be treated as ordinary query parameters.
|
||||
queryParams[key] = this.buildCollectionParam(param.value, param.collectionFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set query parameters
|
||||
if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
|
||||
queryParams['_'] = new Date().getTime();
|
||||
}
|
||||
request.query(this.normalizeParams(queryParams));
|
||||
|
||||
// set header parameters
|
||||
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
|
||||
|
||||
// set request timeout
|
||||
request.timeout(this.timeout);
|
||||
|
||||
var contentType = this.jsonPreferredMime(contentTypes);
|
||||
if (contentType) {
|
||||
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
|
||||
if(contentType != 'multipart/form-data') {
|
||||
request.type(contentType);
|
||||
}
|
||||
} else if (!request.header['Content-Type']) {
|
||||
request.type('application/json');
|
||||
}
|
||||
|
||||
if (contentType === 'application/x-www-form-urlencoded') {
|
||||
request.send(querystring.stringify(this.normalizeParams(formParams)));
|
||||
} else if (contentType == 'multipart/form-data') {
|
||||
var _formParams = this.normalizeParams(formParams);
|
||||
for (var key in _formParams) {
|
||||
if (_formParams.hasOwnProperty(key)) {
|
||||
if (this.isFileParam(_formParams[key])) {
|
||||
// file field
|
||||
request.attach(key, _formParams[key]);
|
||||
} else {
|
||||
request.field(key, _formParams[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (bodyParam) {
|
||||
request.send(bodyParam);
|
||||
}
|
||||
|
||||
var accept = this.jsonPreferredMime(accepts);
|
||||
if (accept) {
|
||||
request.accept(accept);
|
||||
}
|
||||
|
||||
if (returnType === 'Blob') {
|
||||
request.responseType('blob');
|
||||
}
|
||||
|
||||
// Attach previously saved cookies, if enabled
|
||||
if (this.enableCookies){
|
||||
if (typeof window === 'undefined') {
|
||||
this.agent.attachCookies(request);
|
||||
}
|
||||
else {
|
||||
request.withCredentials();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
request.end(function(error, response) {
|
||||
if (callback) {
|
||||
var data = null;
|
||||
if (!error) {
|
||||
try {
|
||||
data = _this.deserialize(response, returnType);
|
||||
if (_this.enableCookies && typeof window === 'undefined'){
|
||||
_this.agent.saveCookies(response);
|
||||
}
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
}
|
||||
callback(error, data, response);
|
||||
}
|
||||
});
|
||||
|
||||
return request;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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, ' '));
|
||||
};
|
||||
|
||||
/**
|
||||
* 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 or null or undefined if data is null or undefined.
|
||||
*/
|
||||
exports.convertToType = function(data, type) {
|
||||
if (data === null || data === undefined)
|
||||
return data
|
||||
|
||||
switch (type) {
|
||||
case 'Boolean':
|
||||
return Boolean(data);
|
||||
case 'Integer':
|
||||
return parseInt(data, 10);
|
||||
case 'Number':
|
||||
return parseFloat(data);
|
||||
case 'String':
|
||||
return String(data);
|
||||
case 'Date':
|
||||
return this.parseDate(String(data));
|
||||
case 'Blob':
|
||||
return data;
|
||||
default:
|
||||
if (type === Object) {
|
||||
// generic object, return directly
|
||||
return data;
|
||||
} else if (typeof type === 'function') {
|
||||
// for model type like: User
|
||||
return type.constructFromObject(data);
|
||||
} else if (Array.isArray(type)) {
|
||||
// for array type like: ['String']
|
||||
var itemType = type[0];
|
||||
return data.map(function(item) {
|
||||
return exports.convertToType(item, itemType);
|
||||
});
|
||||
} else if (typeof type === 'object') {
|
||||
// for plain object type like: {'String': 'Integer'}
|
||||
var keyType, valueType;
|
||||
for (var k in type) {
|
||||
if (type.hasOwnProperty(k)) {
|
||||
keyType = k;
|
||||
valueType = type[k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
var result = {};
|
||||
for (var k in data) {
|
||||
if (data.hasOwnProperty(k)) {
|
||||
var key = exports.convertToType(k, keyType);
|
||||
var value = exports.convertToType(data[k], valueType);
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
// for unknown type, return the data directly
|
||||
return data;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a new map or array model from REST data.
|
||||
* @param data {Object|Array} The REST data.
|
||||
* @param obj {Object|Array} The target object or array.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj, itemType) {
|
||||
if (Array.isArray(data)) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data.hasOwnProperty(i))
|
||||
obj[i] = exports.convertToType(data[i], itemType);
|
||||
}
|
||||
} else {
|
||||
for (var k in data) {
|
||||
if (data.hasOwnProperty(k))
|
||||
obj[k] = exports.convertToType(data[k], itemType);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The default API client implementation.
|
||||
* @type {module:ApiClient}
|
||||
*/
|
||||
exports.instance = new exports();
|
||||
|
||||
return exports;
|
||||
}));
|
423
samples/client/petstore/javascript-es6/src/api/FakeApi.js
Normal file
423
samples/client/petstore/javascript-es6/src/api/FakeApi.js
Normal file
@ -0,0 +1,423 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/Client', 'model/OuterBoolean', 'model/OuterComposite', 'model/OuterNumber', 'model/OuterString'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('../model/Client'), require('../model/OuterBoolean'), require('../model/OuterComposite'), require('../model/OuterNumber'), require('../model/OuterString'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Client, root.SwaggerPetstore.OuterBoolean, root.SwaggerPetstore.OuterComposite, root.SwaggerPetstore.OuterNumber, root.SwaggerPetstore.OuterString);
|
||||
}
|
||||
}(this, function(ApiClient, Client, OuterBoolean, OuterComposite, OuterNumber, OuterString) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Fake service.
|
||||
* @module api/FakeApi
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new FakeApi.
|
||||
* @alias module:api/FakeApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use,
|
||||
* default to {@link module:ApiClient#instance} if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the fakeOuterBooleanSerialize operation.
|
||||
* @callback module:api/FakeApi~fakeOuterBooleanSerializeCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/OuterBoolean} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test serialization of outer boolean types
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/OuterBoolean} opts.body Input boolean as post body
|
||||
* @param {module:api/FakeApi~fakeOuterBooleanSerializeCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/OuterBoolean}
|
||||
*/
|
||||
this.fakeOuterBooleanSerialize = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = [];
|
||||
var returnType = OuterBoolean;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/fake/outer/boolean', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the fakeOuterCompositeSerialize operation.
|
||||
* @callback module:api/FakeApi~fakeOuterCompositeSerializeCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/OuterComposite} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test serialization of object with outer number type
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/OuterComposite} opts.body Input composite as post body
|
||||
* @param {module:api/FakeApi~fakeOuterCompositeSerializeCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/OuterComposite}
|
||||
*/
|
||||
this.fakeOuterCompositeSerialize = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = [];
|
||||
var returnType = OuterComposite;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/fake/outer/composite', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the fakeOuterNumberSerialize operation.
|
||||
* @callback module:api/FakeApi~fakeOuterNumberSerializeCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/OuterNumber} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test serialization of outer number types
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/OuterNumber} opts.body Input number as post body
|
||||
* @param {module:api/FakeApi~fakeOuterNumberSerializeCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/OuterNumber}
|
||||
*/
|
||||
this.fakeOuterNumberSerialize = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = [];
|
||||
var returnType = OuterNumber;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/fake/outer/number', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the fakeOuterStringSerialize operation.
|
||||
* @callback module:api/FakeApi~fakeOuterStringSerializeCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/OuterString} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test serialization of outer string types
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/OuterString} opts.body Input string as post body
|
||||
* @param {module:api/FakeApi~fakeOuterStringSerializeCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/OuterString}
|
||||
*/
|
||||
this.fakeOuterStringSerialize = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = opts['body'];
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = [];
|
||||
var returnType = OuterString;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/fake/outer/string', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the testClientModel operation.
|
||||
* @callback module:api/FakeApi~testClientModelCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/Client} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* To test \"client\" model
|
||||
* To test \"client\" model
|
||||
* @param {module:model/Client} body client model
|
||||
* @param {module:api/FakeApi~testClientModelCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/Client}
|
||||
*/
|
||||
this.testClientModel = function(body, callback) {
|
||||
var postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
throw new Error("Missing the required parameter 'body' when calling testClientModel");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = ['application/json'];
|
||||
var accepts = ['application/json'];
|
||||
var returnType = Client;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/fake', 'PATCH',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the testEndpointParameters operation.
|
||||
* @callback module:api/FakeApi~testEndpointParametersCallback
|
||||
* @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 for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* @param {Number} _number None
|
||||
* @param {Number} _double None
|
||||
* @param {String} patternWithoutDelimiter None
|
||||
* @param {Blob} _byte None
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Number} opts.integer None
|
||||
* @param {Number} opts.int32 None
|
||||
* @param {Number} opts.int64 None
|
||||
* @param {Number} opts._float None
|
||||
* @param {String} opts._string None
|
||||
* @param {Blob} opts.binary None
|
||||
* @param {Date} opts._date None
|
||||
* @param {Date} opts.dateTime None
|
||||
* @param {String} opts.password None
|
||||
* @param {String} opts.callback None
|
||||
* @param {module:api/FakeApi~testEndpointParametersCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.testEndpointParameters = function(_number, _double, patternWithoutDelimiter, _byte, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter '_number' is set
|
||||
if (_number === undefined || _number === null) {
|
||||
throw new Error("Missing the required parameter '_number' when calling testEndpointParameters");
|
||||
}
|
||||
|
||||
// verify the required parameter '_double' is set
|
||||
if (_double === undefined || _double === null) {
|
||||
throw new Error("Missing the required parameter '_double' when calling testEndpointParameters");
|
||||
}
|
||||
|
||||
// verify the required parameter 'patternWithoutDelimiter' is set
|
||||
if (patternWithoutDelimiter === undefined || patternWithoutDelimiter === null) {
|
||||
throw new Error("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
|
||||
}
|
||||
|
||||
// verify the required parameter '_byte' is set
|
||||
if (_byte === undefined || _byte === null) {
|
||||
throw new Error("Missing the required parameter '_byte' when calling testEndpointParameters");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
'integer': opts['integer'],
|
||||
'int32': opts['int32'],
|
||||
'int64': opts['int64'],
|
||||
'number': _number,
|
||||
'float': opts['_float'],
|
||||
'double': _double,
|
||||
'string': opts['_string'],
|
||||
'pattern_without_delimiter': patternWithoutDelimiter,
|
||||
'byte': _byte,
|
||||
'binary': opts['binary'],
|
||||
'date': opts['_date'],
|
||||
'dateTime': opts['dateTime'],
|
||||
'password': opts['password'],
|
||||
'callback': opts['callback']
|
||||
};
|
||||
|
||||
var authNames = ['http_basic_test'];
|
||||
var contentTypes = ['application/xml; charset=utf-8', 'application/json; charset=utf-8'];
|
||||
var accepts = ['application/xml; charset=utf-8', 'application/json; charset=utf-8'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/fake', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the testEnumParameters operation.
|
||||
* @callback module:api/FakeApi~testEnumParametersCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param data This operation does not return a value.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* To test enum parameters
|
||||
* To test enum parameters
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {Array.<module:model/String>} opts.enumFormStringArray Form parameter enum test (string array)
|
||||
* @param {module:model/String} opts.enumFormString Form parameter enum test (string) (default to -efg)
|
||||
* @param {Array.<module:model/String>} opts.enumHeaderStringArray Header parameter enum test (string array)
|
||||
* @param {module:model/String} opts.enumHeaderString Header parameter enum test (string) (default to -efg)
|
||||
* @param {Array.<module:model/String>} opts.enumQueryStringArray Query parameter enum test (string array)
|
||||
* @param {module:model/String} opts.enumQueryString Query parameter enum test (string) (default to -efg)
|
||||
* @param {module:model/Number} opts.enumQueryInteger Query parameter enum test (double)
|
||||
* @param {module:model/Number} opts.enumQueryDouble Query parameter enum test (double)
|
||||
* @param {module:api/FakeApi~testEnumParametersCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.testEnumParameters = function(opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
'enum_query_string': opts['enumQueryString'],
|
||||
'enum_query_integer': opts['enumQueryInteger'],
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
'enum_query_string_array': {
|
||||
value: opts['enumQueryStringArray'],
|
||||
collectionFormat: 'csv'
|
||||
},
|
||||
};
|
||||
var headerParams = {
|
||||
'enum_header_string_array': opts['enumHeaderStringArray'],
|
||||
'enum_header_string': opts['enumHeaderString']
|
||||
};
|
||||
var formParams = {
|
||||
'enum_form_string_array': this.apiClient.buildCollectionParam(opts['enumFormStringArray'], 'csv'),
|
||||
'enum_form_string': opts['enumFormString'],
|
||||
'enum_query_double': opts['enumQueryDouble']
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = ['*/*'];
|
||||
var accepts = ['*/*'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/fake', 'GET',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
@ -0,0 +1,99 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/Client'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('../model/Client'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.Fake_classname_tags123Api = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Client);
|
||||
}
|
||||
}(this, function(ApiClient, Client) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Fake_classname_tags123 service.
|
||||
* @module api/Fake_classname_tags123Api
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Fake_classname_tags123Api.
|
||||
* @alias module:api/Fake_classname_tags123Api
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use,
|
||||
* default to {@link module:ApiClient#instance} if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
|
||||
|
||||
/**
|
||||
* Callback function to receive the result of the testClassname operation.
|
||||
* @callback module:api/Fake_classname_tags123Api~testClassnameCallback
|
||||
* @param {String} error Error message, if any.
|
||||
* @param {module:model/Client} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* To test class name in snake case
|
||||
* @param {module:model/Client} body client model
|
||||
* @param {module:api/Fake_classname_tags123Api~testClassnameCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/Client}
|
||||
*/
|
||||
this.testClassname = function(body, callback) {
|
||||
var postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
throw new Error("Missing the required parameter 'body' when calling testClassname");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = ['application/json'];
|
||||
var accepts = ['application/json'];
|
||||
var returnType = Client;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/fake_classname_test', 'PATCH',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
453
samples/client/petstore/javascript-es6/src/api/PetApi.js
Normal file
453
samples/client/petstore/javascript-es6/src/api/PetApi.js
Normal file
@ -0,0 +1,453 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/ApiResponse', 'model/Pet'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('../model/ApiResponse'), require('../model/Pet'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.ApiResponse, root.SwaggerPetstore.Pet);
|
||||
}
|
||||
}(this, function(ApiClient, ApiResponse, Pet) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 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,
|
||||
* default 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 {module:model/Pet} 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
|
||||
*/
|
||||
this.addPet = function(body, callback) {
|
||||
var postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
throw new Error("Missing the required parameter 'body' when calling addPet");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = ['application/json', 'application/xml'];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {Number} petId Pet id to delete
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {String} opts.apiKey
|
||||
* @param {module:api/PetApi~deletePetCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.deletePet = function(petId, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId === undefined || petId === null) {
|
||||
throw new Error("Missing the required parameter 'petId' when calling deletePet");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'petId': petId
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
'api_key': opts['apiKey']
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/{petId}', 'DELETE',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {Array.<module:model/String>} status Status values that need to be considered for filter
|
||||
* @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link Array.<module:model/Pet>}
|
||||
*/
|
||||
this.findPetsByStatus = function(status, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'status' is set
|
||||
if (status === undefined || status === null) {
|
||||
throw new Error("Missing the required parameter 'status' when calling findPetsByStatus");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
'status': {
|
||||
value: status,
|
||||
collectionFormat: 'csv'
|
||||
},
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = [Pet];
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/findByStatus', 'GET',
|
||||
pathParams, queryParams, collectionQueryParams, 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
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param {Array.<String>} tags Tags to filter by
|
||||
* @param {module:api/PetApi~findPetsByTagsCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link Array.<module:model/Pet>}
|
||||
*/
|
||||
this.findPetsByTags = function(tags, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'tags' is set
|
||||
if (tags === undefined || tags === null) {
|
||||
throw new Error("Missing the required parameter 'tags' when calling findPetsByTags");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
'tags': {
|
||||
value: tags,
|
||||
collectionFormat: 'csv'
|
||||
},
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = [Pet];
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/findByTags', 'GET',
|
||||
pathParams, queryParams, collectionQueryParams, 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 single pet
|
||||
* @param {Number} petId ID of pet to return
|
||||
* @param {module:api/PetApi~getPetByIdCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/Pet}
|
||||
*/
|
||||
this.getPetById = function(petId, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId === undefined || petId === null) {
|
||||
throw new Error("Missing the required parameter 'petId' when calling getPetById");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'petId': petId
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['api_key'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = Pet;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/{petId}', 'GET',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {module:model/Pet} 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
|
||||
*/
|
||||
this.updatePet = function(body, callback) {
|
||||
var postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
throw new Error("Missing the required parameter 'body' when calling updatePet");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = ['application/json', 'application/xml'];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet', 'PUT',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {Number} petId ID of pet that needs to be updated
|
||||
* @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
|
||||
*/
|
||||
this.updatePetWithForm = function(petId, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId === undefined || petId === null) {
|
||||
throw new Error("Missing the required parameter 'petId' when calling updatePetWithForm");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'petId': petId
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
'name': opts['name'],
|
||||
'status': opts['status']
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = ['application/x-www-form-urlencoded'];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/{petId}', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {module:model/ApiResponse} data The data returned by the service call.
|
||||
* @param {String} response The complete HTTP response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param {Number} petId ID of pet to update
|
||||
* @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
|
||||
* data is of type: {@link module:model/ApiResponse}
|
||||
*/
|
||||
this.uploadFile = function(petId, opts, callback) {
|
||||
opts = opts || {};
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId === undefined || petId === null) {
|
||||
throw new Error("Missing the required parameter 'petId' when calling uploadFile");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'petId': petId
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
'additionalMetadata': opts['additionalMetadata'],
|
||||
'file': opts['file']
|
||||
};
|
||||
|
||||
var authNames = ['petstore_auth'];
|
||||
var contentTypes = ['multipart/form-data'];
|
||||
var accepts = ['application/json'];
|
||||
var returnType = ApiResponse;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/pet/{petId}/uploadImage', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
236
samples/client/petstore/javascript-es6/src/api/StoreApi.js
Normal file
236
samples/client/petstore/javascript-es6/src/api/StoreApi.js
Normal file
@ -0,0 +1,236 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/Order'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('../model/Order'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.StoreApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Order);
|
||||
}
|
||||
}(this, function(ApiClient, Order) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 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,
|
||||
* default 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 {module:api/StoreApi~deleteOrderCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.deleteOrder = function(orderId, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'orderId' is set
|
||||
if (orderId === undefined || orderId === null) {
|
||||
throw new Error("Missing the required parameter 'orderId' when calling deleteOrder");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'order_id': orderId
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/store/order/{order_id}', 'DELETE',
|
||||
pathParams, queryParams, collectionQueryParams, 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': 'Number'}>} 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 {module:api/StoreApi~getInventoryCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link Object.<String, {'String': 'Number'}>}
|
||||
*/
|
||||
this.getInventory = function(callback) {
|
||||
var postBody = null;
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = ['api_key'];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/json'];
|
||||
var returnType = {'String': 'Number'};
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/store/inventory', 'GET',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {Number} orderId ID of pet that needs to be fetched
|
||||
* @param {module:api/StoreApi~getOrderByIdCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/Order}
|
||||
*/
|
||||
this.getOrderById = function(orderId, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'orderId' is set
|
||||
if (orderId === undefined || orderId === null) {
|
||||
throw new Error("Missing the required parameter 'orderId' when calling getOrderById");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'order_id': orderId
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = Order;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/store/order/{order_id}', 'GET',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {module:model/Order} 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: {@link module:model/Order}
|
||||
*/
|
||||
this.placeOrder = function(body, callback) {
|
||||
var postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
throw new Error("Missing the required parameter 'body' when calling placeOrder");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = Order;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/store/order', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
434
samples/client/petstore/javascript-es6/src/api/UserApi.js
Normal file
434
samples/client/petstore/javascript-es6/src/api/UserApi.js
Normal file
@ -0,0 +1,434 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/User'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('../model/User'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.UserApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.User);
|
||||
}
|
||||
}(this, function(ApiClient, User) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 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,
|
||||
* default 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 {module:model/User} body Created user object
|
||||
* @param {module:api/UserApi~createUserCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.createUser = function(body, callback) {
|
||||
var postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
throw new Error("Missing the required parameter 'body' when calling createUser");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/user', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {Array.<module:model/User>} body List of user object
|
||||
* @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.createUsersWithArrayInput = function(body, callback) {
|
||||
var postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/user/createWithArray', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {Array.<module:model/User>} body List of user object
|
||||
* @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.createUsersWithListInput = function(body, callback) {
|
||||
var postBody = body;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/user/createWithList', 'POST',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {module:api/UserApi~deleteUserCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.deleteUser = function(username, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username === undefined || username === null) {
|
||||
throw new Error("Missing the required parameter 'username' when calling deleteUser");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'username': username
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/user/{username}', 'DELETE',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {module:api/UserApi~getUserByNameCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {@link module:model/User}
|
||||
*/
|
||||
this.getUserByName = function(username, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username === undefined || username === null) {
|
||||
throw new Error("Missing the required parameter 'username' when calling getUserByName");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'username': username
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = User;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/user/{username}', 'GET',
|
||||
pathParams, queryParams, collectionQueryParams, 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} username The user name for login
|
||||
* @param {String} 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: {@link 'String'}
|
||||
*/
|
||||
this.loginUser = function(username, password, callback) {
|
||||
var postBody = null;
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username === undefined || username === null) {
|
||||
throw new Error("Missing the required parameter 'username' when calling loginUser");
|
||||
}
|
||||
|
||||
// verify the required parameter 'password' is set
|
||||
if (password === undefined || password === null) {
|
||||
throw new Error("Missing the required parameter 'password' when calling loginUser");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
'username': username,
|
||||
'password': password,
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = 'String';
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/user/login', 'GET',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {module:api/UserApi~logoutUserCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.logoutUser = function(callback) {
|
||||
var postBody = null;
|
||||
|
||||
|
||||
var pathParams = {
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/user/logout', 'GET',
|
||||
pathParams, queryParams, collectionQueryParams, 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 {module:model/User} body Updated user object
|
||||
* @param {module:api/UserApi~updateUserCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
*/
|
||||
this.updateUser = function(username, body, callback) {
|
||||
var postBody = body;
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username === undefined || username === null) {
|
||||
throw new Error("Missing the required parameter 'username' when calling updateUser");
|
||||
}
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body === undefined || body === null) {
|
||||
throw new Error("Missing the required parameter 'body' when calling updateUser");
|
||||
}
|
||||
|
||||
|
||||
var pathParams = {
|
||||
'username': username
|
||||
};
|
||||
var queryParams = {
|
||||
};
|
||||
var collectionQueryParams = {
|
||||
};
|
||||
var headerParams = {
|
||||
};
|
||||
var formParams = {
|
||||
};
|
||||
|
||||
var authNames = [];
|
||||
var contentTypes = [];
|
||||
var accepts = ['application/xml', 'application/json'];
|
||||
var returnType = null;
|
||||
|
||||
return this.apiClient.callApi(
|
||||
'/user/{username}', 'PUT',
|
||||
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
|
||||
authNames, contentTypes, accepts, returnType, callback
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
273
samples/client/petstore/javascript-es6/src/index.js
Normal file
273
samples/client/petstore/javascript-es6/src/index.js
Normal file
@ -0,0 +1,273 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/AdditionalPropertiesClass', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Capitalization', 'model/Category', 'model/ClassModel', 'model/Client', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/OuterBoolean', 'model/OuterComposite', 'model/OuterEnum', 'model/OuterNumber', 'model/OuterString', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/User', 'model/Cat', 'model/Dog', 'api/FakeApi', 'api/Fake_classname_tags123Api', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesClass'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Capitalization'), require('./model/Category'), require('./model/ClassModel'), require('./model/Client'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/OuterBoolean'), require('./model/OuterComposite'), require('./model/OuterEnum'), require('./model/OuterNumber'), require('./model/OuterString'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./model/Cat'), require('./model/Dog'), require('./api/FakeApi'), require('./api/Fake_classname_tags123Api'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
|
||||
}
|
||||
}(function(ApiClient, AdditionalPropertiesClass, Animal, AnimalFarm, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Capitalization, Category, ClassModel, Client, EnumArrays, EnumClass, EnumTest, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, OuterBoolean, OuterComposite, OuterEnum, OuterNumber, OuterString, Pet, ReadOnlyFirst, SpecialModelName, Tag, User, Cat, Dog, FakeApi, Fake_classname_tags123Api, PetApi, StoreApi, UserApi) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters__.<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 AdditionalPropertiesClass model constructor.
|
||||
* @property {module:model/AdditionalPropertiesClass}
|
||||
*/
|
||||
AdditionalPropertiesClass: AdditionalPropertiesClass,
|
||||
/**
|
||||
* The Animal model constructor.
|
||||
* @property {module:model/Animal}
|
||||
*/
|
||||
Animal: Animal,
|
||||
/**
|
||||
* The AnimalFarm model constructor.
|
||||
* @property {module:model/AnimalFarm}
|
||||
*/
|
||||
AnimalFarm: AnimalFarm,
|
||||
/**
|
||||
* The ApiResponse model constructor.
|
||||
* @property {module:model/ApiResponse}
|
||||
*/
|
||||
ApiResponse: ApiResponse,
|
||||
/**
|
||||
* The ArrayOfArrayOfNumberOnly model constructor.
|
||||
* @property {module:model/ArrayOfArrayOfNumberOnly}
|
||||
*/
|
||||
ArrayOfArrayOfNumberOnly: ArrayOfArrayOfNumberOnly,
|
||||
/**
|
||||
* The ArrayOfNumberOnly model constructor.
|
||||
* @property {module:model/ArrayOfNumberOnly}
|
||||
*/
|
||||
ArrayOfNumberOnly: ArrayOfNumberOnly,
|
||||
/**
|
||||
* The ArrayTest model constructor.
|
||||
* @property {module:model/ArrayTest}
|
||||
*/
|
||||
ArrayTest: ArrayTest,
|
||||
/**
|
||||
* The Capitalization model constructor.
|
||||
* @property {module:model/Capitalization}
|
||||
*/
|
||||
Capitalization: Capitalization,
|
||||
/**
|
||||
* The Category model constructor.
|
||||
* @property {module:model/Category}
|
||||
*/
|
||||
Category: Category,
|
||||
/**
|
||||
* The ClassModel model constructor.
|
||||
* @property {module:model/ClassModel}
|
||||
*/
|
||||
ClassModel: ClassModel,
|
||||
/**
|
||||
* The Client model constructor.
|
||||
* @property {module:model/Client}
|
||||
*/
|
||||
Client: Client,
|
||||
/**
|
||||
* The EnumArrays model constructor.
|
||||
* @property {module:model/EnumArrays}
|
||||
*/
|
||||
EnumArrays: EnumArrays,
|
||||
/**
|
||||
* The EnumClass model constructor.
|
||||
* @property {module:model/EnumClass}
|
||||
*/
|
||||
EnumClass: EnumClass,
|
||||
/**
|
||||
* The EnumTest model constructor.
|
||||
* @property {module:model/EnumTest}
|
||||
*/
|
||||
EnumTest: EnumTest,
|
||||
/**
|
||||
* The FormatTest model constructor.
|
||||
* @property {module:model/FormatTest}
|
||||
*/
|
||||
FormatTest: FormatTest,
|
||||
/**
|
||||
* The HasOnlyReadOnly model constructor.
|
||||
* @property {module:model/HasOnlyReadOnly}
|
||||
*/
|
||||
HasOnlyReadOnly: HasOnlyReadOnly,
|
||||
/**
|
||||
* The List model constructor.
|
||||
* @property {module:model/List}
|
||||
*/
|
||||
List: List,
|
||||
/**
|
||||
* The MapTest model constructor.
|
||||
* @property {module:model/MapTest}
|
||||
*/
|
||||
MapTest: MapTest,
|
||||
/**
|
||||
* The MixedPropertiesAndAdditionalPropertiesClass model constructor.
|
||||
* @property {module:model/MixedPropertiesAndAdditionalPropertiesClass}
|
||||
*/
|
||||
MixedPropertiesAndAdditionalPropertiesClass: MixedPropertiesAndAdditionalPropertiesClass,
|
||||
/**
|
||||
* 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 NumberOnly model constructor.
|
||||
* @property {module:model/NumberOnly}
|
||||
*/
|
||||
NumberOnly: NumberOnly,
|
||||
/**
|
||||
* The Order model constructor.
|
||||
* @property {module:model/Order}
|
||||
*/
|
||||
Order: Order,
|
||||
/**
|
||||
* The OuterBoolean model constructor.
|
||||
* @property {module:model/OuterBoolean}
|
||||
*/
|
||||
OuterBoolean: OuterBoolean,
|
||||
/**
|
||||
* The OuterComposite model constructor.
|
||||
* @property {module:model/OuterComposite}
|
||||
*/
|
||||
OuterComposite: OuterComposite,
|
||||
/**
|
||||
* The OuterEnum model constructor.
|
||||
* @property {module:model/OuterEnum}
|
||||
*/
|
||||
OuterEnum: OuterEnum,
|
||||
/**
|
||||
* The OuterNumber model constructor.
|
||||
* @property {module:model/OuterNumber}
|
||||
*/
|
||||
OuterNumber: OuterNumber,
|
||||
/**
|
||||
* The OuterString model constructor.
|
||||
* @property {module:model/OuterString}
|
||||
*/
|
||||
OuterString: OuterString,
|
||||
/**
|
||||
* The Pet model constructor.
|
||||
* @property {module:model/Pet}
|
||||
*/
|
||||
Pet: Pet,
|
||||
/**
|
||||
* The ReadOnlyFirst model constructor.
|
||||
* @property {module:model/ReadOnlyFirst}
|
||||
*/
|
||||
ReadOnlyFirst: ReadOnlyFirst,
|
||||
/**
|
||||
* 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 Cat model constructor.
|
||||
* @property {module:model/Cat}
|
||||
*/
|
||||
Cat: Cat,
|
||||
/**
|
||||
* The Dog model constructor.
|
||||
* @property {module:model/Dog}
|
||||
*/
|
||||
Dog: Dog,
|
||||
/**
|
||||
* The FakeApi service constructor.
|
||||
* @property {module:api/FakeApi}
|
||||
*/
|
||||
FakeApi: FakeApi,
|
||||
/**
|
||||
* The Fake_classname_tags123Api service constructor.
|
||||
* @property {module:api/Fake_classname_tags123Api}
|
||||
*/
|
||||
Fake_classname_tags123Api: Fake_classname_tags123Api,
|
||||
/**
|
||||
* 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;
|
||||
}));
|
@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.AdditionalPropertiesClass = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The AdditionalPropertiesClass model module.
|
||||
* @module model/AdditionalPropertiesClass
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>AdditionalPropertiesClass</code>.
|
||||
* @alias module:model/AdditionalPropertiesClass
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>AdditionalPropertiesClass</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/AdditionalPropertiesClass} obj Optional instance to populate.
|
||||
* @return {module:model/AdditionalPropertiesClass} The populated <code>AdditionalPropertiesClass</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('map_property')) {
|
||||
obj['map_property'] = ApiClient.convertToType(data['map_property'], {'String': 'String'});
|
||||
}
|
||||
if (data.hasOwnProperty('map_of_map_property')) {
|
||||
obj['map_of_map_property'] = ApiClient.convertToType(data['map_of_map_property'], {'String': {'String': 'String'}});
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {Object.<String, String>} map_property
|
||||
*/
|
||||
exports.prototype['map_property'] = undefined;
|
||||
/**
|
||||
* @member {Object.<String, Object.<String, String>>} map_of_map_property
|
||||
*/
|
||||
exports.prototype['map_of_map_property'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
92
samples/client/petstore/javascript-es6/src/model/Animal.js
Normal file
92
samples/client/petstore/javascript-es6/src/model/Animal.js
Normal file
@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.Animal = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Animal model module.
|
||||
* @module model/Animal
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Animal</code>.
|
||||
* @alias module:model/Animal
|
||||
* @class
|
||||
* @param className {String}
|
||||
*/
|
||||
var exports = function(className) {
|
||||
var _this = this;
|
||||
|
||||
_this['className'] = className;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>Animal</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/Animal} obj Optional instance to populate.
|
||||
* @return {module:model/Animal} The populated <code>Animal</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('className')) {
|
||||
obj['className'] = ApiClient.convertToType(data['className'], 'String');
|
||||
}
|
||||
if (data.hasOwnProperty('color')) {
|
||||
obj['color'] = ApiClient.convertToType(data['color'], 'String');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {String} className
|
||||
*/
|
||||
exports.prototype['className'] = undefined;
|
||||
/**
|
||||
* @member {String} color
|
||||
* @default 'red'
|
||||
*/
|
||||
exports.prototype['color'] = 'red';
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/Animal'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('./Animal'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.AnimalFarm = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal);
|
||||
}
|
||||
}(this, function(ApiClient, Animal) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The AnimalFarm model module.
|
||||
* @module model/AnimalFarm
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>AnimalFarm</code>.
|
||||
* @alias module:model/AnimalFarm
|
||||
* @class
|
||||
* @extends Array
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
_this = new Array();
|
||||
Object.setPrototypeOf(_this, exports);
|
||||
|
||||
return _this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>AnimalFarm</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/AnimalFarm} obj Optional instance to populate.
|
||||
* @return {module:model/AnimalFarm} The populated <code>AnimalFarm</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
ApiClient.constructFromObject(data, obj, 'Animal');
|
||||
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.ApiResponse = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The ApiResponse model module.
|
||||
* @module model/ApiResponse
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>ApiResponse</code>.
|
||||
* @alias module:model/ApiResponse
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>ApiResponse</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/ApiResponse} obj Optional instance to populate.
|
||||
* @return {module:model/ApiResponse} The populated <code>ApiResponse</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('code')) {
|
||||
obj['code'] = ApiClient.convertToType(data['code'], 'Number');
|
||||
}
|
||||
if (data.hasOwnProperty('type')) {
|
||||
obj['type'] = ApiClient.convertToType(data['type'], 'String');
|
||||
}
|
||||
if (data.hasOwnProperty('message')) {
|
||||
obj['message'] = ApiClient.convertToType(data['message'], 'String');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {Number} code
|
||||
*/
|
||||
exports.prototype['code'] = undefined;
|
||||
/**
|
||||
* @member {String} type
|
||||
*/
|
||||
exports.prototype['type'] = undefined;
|
||||
/**
|
||||
* @member {String} message
|
||||
*/
|
||||
exports.prototype['message'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.ArrayOfArrayOfNumberOnly = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The ArrayOfArrayOfNumberOnly model module.
|
||||
* @module model/ArrayOfArrayOfNumberOnly
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>ArrayOfArrayOfNumberOnly</code>.
|
||||
* @alias module:model/ArrayOfArrayOfNumberOnly
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>ArrayOfArrayOfNumberOnly</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/ArrayOfArrayOfNumberOnly} obj Optional instance to populate.
|
||||
* @return {module:model/ArrayOfArrayOfNumberOnly} The populated <code>ArrayOfArrayOfNumberOnly</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('ArrayArrayNumber')) {
|
||||
obj['ArrayArrayNumber'] = ApiClient.convertToType(data['ArrayArrayNumber'], [['Number']]);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {Array.<Array.<Number>>} ArrayArrayNumber
|
||||
*/
|
||||
exports.prototype['ArrayArrayNumber'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.ArrayOfNumberOnly = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The ArrayOfNumberOnly model module.
|
||||
* @module model/ArrayOfNumberOnly
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>ArrayOfNumberOnly</code>.
|
||||
* @alias module:model/ArrayOfNumberOnly
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>ArrayOfNumberOnly</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/ArrayOfNumberOnly} obj Optional instance to populate.
|
||||
* @return {module:model/ArrayOfNumberOnly} The populated <code>ArrayOfNumberOnly</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('ArrayNumber')) {
|
||||
obj['ArrayNumber'] = ApiClient.convertToType(data['ArrayNumber'], ['Number']);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {Array.<Number>} ArrayNumber
|
||||
*/
|
||||
exports.prototype['ArrayNumber'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/ReadOnlyFirst'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('./ReadOnlyFirst'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.ArrayTest = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.ReadOnlyFirst);
|
||||
}
|
||||
}(this, function(ApiClient, ReadOnlyFirst) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The ArrayTest model module.
|
||||
* @module model/ArrayTest
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>ArrayTest</code>.
|
||||
* @alias module:model/ArrayTest
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>ArrayTest</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/ArrayTest} obj Optional instance to populate.
|
||||
* @return {module:model/ArrayTest} The populated <code>ArrayTest</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('array_of_string')) {
|
||||
obj['array_of_string'] = ApiClient.convertToType(data['array_of_string'], ['String']);
|
||||
}
|
||||
if (data.hasOwnProperty('array_array_of_integer')) {
|
||||
obj['array_array_of_integer'] = ApiClient.convertToType(data['array_array_of_integer'], [['Number']]);
|
||||
}
|
||||
if (data.hasOwnProperty('array_array_of_model')) {
|
||||
obj['array_array_of_model'] = ApiClient.convertToType(data['array_array_of_model'], [[ReadOnlyFirst]]);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {Array.<String>} array_of_string
|
||||
*/
|
||||
exports.prototype['array_of_string'] = undefined;
|
||||
/**
|
||||
* @member {Array.<Array.<Number>>} array_array_of_integer
|
||||
*/
|
||||
exports.prototype['array_array_of_integer'] = undefined;
|
||||
/**
|
||||
* @member {Array.<Array.<module:model/ReadOnlyFirst>>} array_array_of_model
|
||||
*/
|
||||
exports.prototype['array_array_of_model'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
@ -0,0 +1,123 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.Capitalization = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Capitalization model module.
|
||||
* @module model/Capitalization
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Capitalization</code>.
|
||||
* @alias module:model/Capitalization
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>Capitalization</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/Capitalization} obj Optional instance to populate.
|
||||
* @return {module:model/Capitalization} The populated <code>Capitalization</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('smallCamel')) {
|
||||
obj['smallCamel'] = ApiClient.convertToType(data['smallCamel'], 'String');
|
||||
}
|
||||
if (data.hasOwnProperty('CapitalCamel')) {
|
||||
obj['CapitalCamel'] = ApiClient.convertToType(data['CapitalCamel'], 'String');
|
||||
}
|
||||
if (data.hasOwnProperty('small_Snake')) {
|
||||
obj['small_Snake'] = ApiClient.convertToType(data['small_Snake'], 'String');
|
||||
}
|
||||
if (data.hasOwnProperty('Capital_Snake')) {
|
||||
obj['Capital_Snake'] = ApiClient.convertToType(data['Capital_Snake'], 'String');
|
||||
}
|
||||
if (data.hasOwnProperty('SCA_ETH_Flow_Points')) {
|
||||
obj['SCA_ETH_Flow_Points'] = ApiClient.convertToType(data['SCA_ETH_Flow_Points'], 'String');
|
||||
}
|
||||
if (data.hasOwnProperty('ATT_NAME')) {
|
||||
obj['ATT_NAME'] = ApiClient.convertToType(data['ATT_NAME'], 'String');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {String} smallCamel
|
||||
*/
|
||||
exports.prototype['smallCamel'] = undefined;
|
||||
/**
|
||||
* @member {String} CapitalCamel
|
||||
*/
|
||||
exports.prototype['CapitalCamel'] = undefined;
|
||||
/**
|
||||
* @member {String} small_Snake
|
||||
*/
|
||||
exports.prototype['small_Snake'] = undefined;
|
||||
/**
|
||||
* @member {String} Capital_Snake
|
||||
*/
|
||||
exports.prototype['Capital_Snake'] = undefined;
|
||||
/**
|
||||
* @member {String} SCA_ETH_Flow_Points
|
||||
*/
|
||||
exports.prototype['SCA_ETH_Flow_Points'] = undefined;
|
||||
/**
|
||||
* Name of the pet
|
||||
* @member {String} ATT_NAME
|
||||
*/
|
||||
exports.prototype['ATT_NAME'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
87
samples/client/petstore/javascript-es6/src/model/Cat.js
Normal file
87
samples/client/petstore/javascript-es6/src/model/Cat.js
Normal file
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/Animal'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('./Animal'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.Cat = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal);
|
||||
}
|
||||
}(this, function(ApiClient, Animal) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Cat model module.
|
||||
* @module model/Cat
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Cat</code>.
|
||||
* @alias module:model/Cat
|
||||
* @class
|
||||
* @extends module:model/Animal
|
||||
* @param className {String}
|
||||
*/
|
||||
var exports = function(className) {
|
||||
var _this = this;
|
||||
Animal.call(_this, className);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>Cat</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/Cat} obj Optional instance to populate.
|
||||
* @return {module:model/Cat} The populated <code>Cat</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
Animal.constructFromObject(data, obj);
|
||||
if (data.hasOwnProperty('declawed')) {
|
||||
obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
exports.prototype = Object.create(Animal.prototype);
|
||||
exports.prototype.constructor = exports;
|
||||
|
||||
/**
|
||||
* @member {Boolean} declawed
|
||||
*/
|
||||
exports.prototype['declawed'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
90
samples/client/petstore/javascript-es6/src/model/Category.js
Normal file
90
samples/client/petstore/javascript-es6/src/model/Category.js
Normal file
@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.Category = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(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 _this = this;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.hasOwnProperty('id')) {
|
||||
obj['id'] = ApiClient.convertToType(data['id'], 'Number');
|
||||
}
|
||||
if (data.hasOwnProperty('name')) {
|
||||
obj['name'] = ApiClient.convertToType(data['name'], 'String');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {Number} id
|
||||
*/
|
||||
exports.prototype['id'] = undefined;
|
||||
/**
|
||||
* @member {String} name
|
||||
*/
|
||||
exports.prototype['name'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.ClassModel = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The ClassModel model module.
|
||||
* @module model/ClassModel
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>ClassModel</code>.
|
||||
* Model for testing model with \"_class\" property
|
||||
* @alias module:model/ClassModel
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>ClassModel</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/ClassModel} obj Optional instance to populate.
|
||||
* @return {module:model/ClassModel} The populated <code>ClassModel</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('_class')) {
|
||||
obj['_class'] = ApiClient.convertToType(data['_class'], 'String');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {String} _class
|
||||
*/
|
||||
exports.prototype['_class'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
82
samples/client/petstore/javascript-es6/src/model/Client.js
Normal file
82
samples/client/petstore/javascript-es6/src/model/Client.js
Normal file
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.Client = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Client model module.
|
||||
* @module model/Client
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Client</code>.
|
||||
* @alias module:model/Client
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>Client</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/Client} obj Optional instance to populate.
|
||||
* @return {module:model/Client} The populated <code>Client</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('client')) {
|
||||
obj['client'] = ApiClient.convertToType(data['client'], 'String');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {String} client
|
||||
*/
|
||||
exports.prototype['client'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
87
samples/client/petstore/javascript-es6/src/model/Dog.js
Normal file
87
samples/client/petstore/javascript-es6/src/model/Dog.js
Normal file
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['ApiClient', 'model/Animal'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('./Animal'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
if (!root.SwaggerPetstore) {
|
||||
root.SwaggerPetstore = {};
|
||||
}
|
||||
root.SwaggerPetstore.Dog = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal);
|
||||
}
|
||||
}(this, function(ApiClient, Animal) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Dog model module.
|
||||
* @module model/Dog
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Dog</code>.
|
||||
* @alias module:model/Dog
|
||||
* @class
|
||||
* @extends module:model/Animal
|
||||
* @param className {String}
|
||||
*/
|
||||
var exports = function(className) {
|
||||
var _this = this;
|
||||
Animal.call(_this, className);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>Dog</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/Dog} obj Optional instance to populate.
|
||||
* @return {module:model/Dog} The populated <code>Dog</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
Animal.constructFromObject(data, obj);
|
||||
if (data.hasOwnProperty('breed')) {
|
||||
obj['breed'] = ApiClient.convertToType(data['breed'], 'String');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
exports.prototype = Object.create(Animal.prototype);
|
||||
exports.prototype.constructor = exports;
|
||||
|
||||
/**
|
||||
* @member {String} breed
|
||||
*/
|
||||
exports.prototype['breed'] = undefined;
|
||||
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
124
samples/client/petstore/javascript-es6/src/model/EnumArrays.js
Normal file
124
samples/client/petstore/javascript-es6/src/model/EnumArrays.js
Normal file
@ -0,0 +1,124 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
* Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
*
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
(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.EnumArrays = factory(root.SwaggerPetstore.ApiClient);
|
||||
}
|
||||
}(this, function(ApiClient) {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The EnumArrays model module.
|
||||
* @module model/EnumArrays
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>EnumArrays</code>.
|
||||
* @alias module:model/EnumArrays
|
||||
* @class
|
||||
*/
|
||||
var exports = function() {
|
||||
var _this = this;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a <code>EnumArrays</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/EnumArrays} obj Optional instance to populate.
|
||||
* @return {module:model/EnumArrays} The populated <code>EnumArrays</code> instance.
|
||||
*/
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new exports();
|
||||
|
||||
if (data.hasOwnProperty('just_symbol')) {
|
||||
obj['just_symbol'] = ApiClient.convertToType(data['just_symbol'], 'String');
|
||||
}
|
||||
if (data.hasOwnProperty('array_enum')) {
|
||||
obj['array_enum'] = ApiClient.convertToType(data['array_enum'], ['String']);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {module:model/EnumArrays.JustSymbolEnum} just_symbol
|
||||
*/
|
||||
exports.prototype['just_symbol'] = undefined;
|
||||
/**
|
||||
* @member {Array.<module:model/EnumArrays.ArrayEnumEnum>} array_enum
|
||||
*/
|
||||
exports.prototype['array_enum'] = undefined;
|
||||
|
||||
|
||||
/**
|
||||
* Allowed values for the <code>just_symbol</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
exports.JustSymbolEnum = {
|
||||
/**
|
||||
* value: ">="
|
||||
* @const
|
||||
*/
|
||||
"GREATER_THAN_OR_EQUAL_TO": ">=",
|
||||
/**
|
||||
* value: "$"
|
||||
* @const
|
||||
*/
|
||||
"DOLLAR": "$" };
|
||||
|
||||
/**
|
||||
* Allowed values for the <code>arrayEnum</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
exports.ArrayEnumEnum = {
|
||||
/**
|
||||
* value: "fish"
|
||||
* @const
|
||||
*/
|
||||
"fish": "fish",
|
||||
/**
|
||||
* value: "crab"
|
||||
* @const
|
||||
*/
|
||||
"crab": "crab" };
|
||||
|
||||
|
||||
return exports;
|
||||
}));
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user