mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-27 20:10:56 +00:00
Merge branch 'master' of https://github.com/demonfiddler/swagger-codegen into demonfiddler-master
Conflicts: samples/client/petstore/javascript-promise/README.md samples/client/petstore/javascript-promise/docs/PetApi.md samples/client/petstore/javascript-promise/docs/StoreApi.md samples/client/petstore/javascript-promise/src/api/PetApi.js samples/client/petstore/javascript-promise/src/index.js samples/client/petstore/javascript/README.md samples/client/petstore/javascript/docs/PetApi.md samples/client/petstore/javascript/docs/StoreApi.md samples/client/petstore/javascript/src/api/PetApi.js samples/client/petstore/javascript/src/index.js
This commit is contained in:
commit
2d5cc50bd1
@ -97,10 +97,10 @@ public class DefaultCodegen {
|
||||
@SuppressWarnings({ "static-method", "unchecked" })
|
||||
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
|
||||
if (supportsInheritance) {
|
||||
// Index all CodegenModels by name.
|
||||
// Index all CodegenModels by model name.
|
||||
Map<String, CodegenModel> allModels = new HashMap<String, CodegenModel>();
|
||||
for (Entry<String, Object> entry : objs.entrySet()) {
|
||||
String modelName = entry.getKey();
|
||||
String modelName = toModelName(entry.getKey());
|
||||
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
|
||||
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
|
||||
for (Map<String, Object> mo : models) {
|
||||
@ -986,7 +986,7 @@ public class DefaultCodegen {
|
||||
m.interfaces.add(interfaceRef);
|
||||
addImport(m, interfaceRef);
|
||||
if (allDefinitions != null) {
|
||||
final Model interfaceModel = allDefinitions.get(interfaceRef);
|
||||
final Model interfaceModel = allDefinitions.get(_interface.getSimpleRef());
|
||||
if (supportsInheritance) {
|
||||
addProperties(allProperties, allRequired, interfaceModel, allDefinitions);
|
||||
} else {
|
||||
@ -1043,7 +1043,7 @@ public class DefaultCodegen {
|
||||
required.addAll(mi.getRequired());
|
||||
}
|
||||
} else if (model instanceof RefModel) {
|
||||
String interfaceRef = toModelName(((RefModel) model).getSimpleRef());
|
||||
String interfaceRef = ((RefModel) model).getSimpleRef();
|
||||
Model interfaceModel = allDefinitions.get(interfaceRef);
|
||||
addProperties(properties, required, interfaceModel, allDefinitions);
|
||||
} else if (model instanceof ComposedModel) {
|
||||
|
@ -12,9 +12,12 @@ import io.swagger.codegen.CodegenProperty;
|
||||
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;
|
||||
import io.swagger.models.ModelImpl;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
@ -63,6 +66,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
protected String projectVersion;
|
||||
protected String projectLicenseName;
|
||||
|
||||
protected String invokerPackage;
|
||||
protected String sourceFolder = "src";
|
||||
protected String localVariablePrefix = "";
|
||||
protected boolean usePromises;
|
||||
@ -137,6 +141,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
|
||||
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC).defaultValue("src"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.LOCAL_VARIABLE_PREFIX, CodegenConstants.LOCAL_VARIABLE_PREFIX_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
||||
cliOptions.add(new CliOption(PROJECT_NAME,
|
||||
@ -203,6 +208,9 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) {
|
||||
setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
|
||||
}
|
||||
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
|
||||
setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
}
|
||||
if (additionalProperties.containsKey(USE_PROMISES)) {
|
||||
setUsePromises(Boolean.parseBoolean((String)additionalProperties.get(USE_PROMISES)));
|
||||
}
|
||||
@ -265,6 +273,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
additionalProperties.put(PROJECT_DESCRIPTION, escapeText(projectDescription));
|
||||
additionalProperties.put(PROJECT_VERSION, projectVersion);
|
||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
|
||||
additionalProperties.put(CodegenConstants.LOCAL_VARIABLE_PREFIX, localVariablePrefix);
|
||||
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
additionalProperties.put(CodegenConstants.SOURCE_FOLDER, sourceFolder);
|
||||
@ -278,8 +287,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
supportingFiles.add(new SupportingFile("package.mustache", "", "package.json"));
|
||||
supportingFiles.add(new SupportingFile("index.mustache", sourceFolder, "index.js"));
|
||||
supportingFiles.add(new SupportingFile("ApiClient.mustache", sourceFolder, "ApiClient.js"));
|
||||
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"));
|
||||
}
|
||||
@ -289,14 +298,41 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
return "_" + name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Concatenates an array of path segments into a path string.
|
||||
* @param segments The path segments to concatenate. A segment may contain either of the file separator characters '\' or '/'.
|
||||
* A segment is ignored if it is <code>null</code>, empty or ".".
|
||||
* @return A path string using the correct platform-specific file separator character.
|
||||
*/
|
||||
private String createPath(String... segments) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (String segment : segments) {
|
||||
if (!StringUtils.isEmpty(segment) && !segment.equals(".")) {
|
||||
if (buf.length() != 0)
|
||||
buf.append(File.separatorChar);
|
||||
buf.append(segment);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < buf.length(); i++) {
|
||||
char c = buf.charAt(i);
|
||||
if ((c == '/' || c == '\\') && c != File.separatorChar)
|
||||
buf.setCharAt(i, File.separatorChar);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + '/' + sourceFolder + '/' + apiPackage().replace('.', '/');
|
||||
return createPath(outputFolder, sourceFolder, invokerPackage, apiPackage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return outputFolder + '/' + sourceFolder + '/' + modelPackage().replace('.', '/');
|
||||
return createPath(outputFolder, sourceFolder, invokerPackage, modelPackage());
|
||||
}
|
||||
|
||||
public void setInvokerPackage(String invokerPackage) {
|
||||
this.invokerPackage = invokerPackage;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
@ -345,12 +381,12 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||
return createPath(outputFolder, apiDocPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||
return createPath(outputFolder, modelDocPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -654,10 +690,23 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
|
||||
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null && codegenModel.hasEnums) {
|
||||
final Model parentModel = allDefinitions.get(toModelName(codegenModel.parent));
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||
final Model parentModel = allDefinitions.get(codegenModel.parentSchema);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel, allDefinitions);
|
||||
codegenModel = JavascriptClientCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||
}
|
||||
if (model instanceof ArrayModel) {
|
||||
ArrayModel am = (ArrayModel) model;
|
||||
if (am.getItems() != null) {
|
||||
codegenModel.vendorExtensions.put("x-isArray", true);
|
||||
codegenModel.vendorExtensions.put("x-itemType", getSwaggerType(am.getItems()));
|
||||
}
|
||||
} else if (model instanceof ModelImpl) {
|
||||
ModelImpl mm = (ModelImpl)model;
|
||||
if (mm.getAdditionalProperties() != null) {
|
||||
codegenModel.vendorExtensions.put("x-isMap", true);
|
||||
codegenModel.vendorExtensions.put("x-itemType", getSwaggerType(mm.getAdditionalProperties()));
|
||||
}
|
||||
}
|
||||
|
||||
return codegenModel;
|
||||
}
|
||||
@ -674,7 +723,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
}
|
||||
|
||||
private String getModelledType(String dataType) {
|
||||
return "module:" + (StringUtils.isEmpty(modelPackage) ? "" : (modelPackage + "/")) + dataType;
|
||||
return "module:" + (StringUtils.isEmpty(invokerPackage) ? "" : (invokerPackage + "/"))
|
||||
+ (StringUtils.isEmpty(modelPackage) ? "" : (modelPackage + "/")) + dataType;
|
||||
}
|
||||
|
||||
private String getJSDocTypeWithBraces(CodegenModel cm, CodegenProperty cp) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
'use strict';
|
||||
|
||||
{{#emitJSDoc}} /**
|
||||
* @module ApiClient
|
||||
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient
|
||||
* @version {{projectVersion}}
|
||||
*/
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
* 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
|
||||
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient
|
||||
* @class
|
||||
*/
|
||||
{{/emitJSDoc}} var exports = function() {
|
||||
@ -218,7 +218,7 @@
|
||||
/**
|
||||
* 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.
|
||||
* @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>.
|
||||
*/
|
||||
@ -309,7 +309,7 @@
|
||||
|
||||
{{#emitJSDoc}}{{^usePromises}} /**
|
||||
* Callback function to receive the result of the operation.
|
||||
* @callback module:ApiClient~callApiCallback
|
||||
* @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.
|
||||
@ -329,7 +329,7 @@
|
||||
* @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:ApiClient~callApiCallback} callback The callback function.
|
||||
* @param {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient~callApiCallback} callback The callback function.
|
||||
{{/usePromises}} * @returns {{#usePromises}}{Promise} A Promise object{{/usePromises}}{{^usePromises}}{Object} The SuperAgent request object{{/usePromises}}.
|
||||
*/
|
||||
{{/emitJSDoc}} exports.prototype.callApi = function callApi(path, httpMethod, pathParams,
|
||||
@ -474,9 +474,28 @@
|
||||
}
|
||||
};
|
||||
|
||||
{{#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}} 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))
|
||||
result[k] = exports.convertToType(data[k], itemType);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
{{#emitJSDoc}} /**
|
||||
* The default API client implementation.
|
||||
* @type {module:ApiClient}
|
||||
* @type {module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient}
|
||||
*/
|
||||
{{/emitJSDoc}} exports.instance = new exports();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{{=< >=}}(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'<#imports>, '../<#modelPackage><modelPackage>/</modelPackage><import>'</imports>], factory);
|
||||
define(['<#invokerPackage><invokerPackage>/</invokerPackage>ApiClient'<#imports>, '<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><import>'</imports>], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient')<#imports>, require('../<#modelPackage><modelPackage>/</modelPackage><import>')</imports>);
|
||||
@ -17,17 +17,17 @@
|
||||
|
||||
<#emitJSDoc> /**
|
||||
* <baseName> service.
|
||||
* @module <#apiPackage><apiPackage>/</apiPackage><classname>
|
||||
* @module <#invokerPackage><invokerPackage>/</invokerPackage><#apiPackage><apiPackage>/</apiPackage><classname>
|
||||
* @version <projectVersion>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <classname>. <#description>
|
||||
* <description></description>
|
||||
* @alias module:<#apiPackage><apiPackage>/</apiPackage><classname>
|
||||
* @alias module:<#invokerPackage><invokerPackage>/</invokerPackage><#apiPackage><apiPackage>/</apiPackage><classname>
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
* @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> var exports = function(apiClient) {
|
||||
this.apiClient = apiClient || ApiClient.instance;
|
||||
@ -35,7 +35,7 @@
|
||||
<#operations><#operation><#emitJSDoc><^usePromises>
|
||||
/**
|
||||
* Callback function to receive the result of the <nickname> operation.
|
||||
* @callback module:<#apiPackage><apiPackage>/</apiPackage><classname>~<nickname>Callback
|
||||
* @callback module:<#invokerPackage><invokerPackage>/</invokerPackage><#apiPackage><apiPackage>/</apiPackage><classname>~<nickname>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.
|
||||
@ -47,7 +47,7 @@
|
||||
* @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:<#apiPackage><apiPackage>/</apiPackage><classname>~<nickname>Callback} callback The callback function, accepting three arguments: error, data, response</usePromises><#returnType>
|
||||
* @param {module:<#invokerPackage><invokerPackage>/</invokerPackage><#apiPackage><apiPackage>/</apiPackage><classname>~<nickname>Callback} callback The callback function, accepting three arguments: error, data, response</usePromises><#returnType>
|
||||
* data is of type: <&vendorExtensions.x-jsdoc-type></returnType>
|
||||
*/
|
||||
</emitJSDoc> this.<nickname> = function(<vendorExtensions.x-codegen-argList>) {<#hasOptionalParams>
|
||||
|
@ -36,7 +36,7 @@ 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 crediential in your environment."
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['./ApiClient'{{#models}}, './{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{importPath}}'{{/models}}{{#apiInfo}}{{#apis}}, './{{#apiPackage}}{{apiPackage}}/{{/apiPackage}}{{importPath}}'{{/apis}}{{/apiInfo}}], factory);
|
||||
define(['{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient'{{#models}}, '{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{importPath}}'{{/models}}{{#apiInfo}}{{#apis}}, '{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#apiPackage}}{{apiPackage}}/{{/apiPackage}}{{importPath}}'{{/apis}}{{/apiInfo}}], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('./ApiClient'){{#models}}, require('./{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{importPath}}'){{/models}}{{#apiInfo}}{{#apis}}, require('./{{#apiPackage}}{{apiPackage}}/{{/apiPackage}}{{importPath}}'){{/apis}}{{/apiInfo}});
|
||||
@ -15,7 +15,7 @@
|
||||
* <p>
|
||||
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
|
||||
* <pre>
|
||||
* var {{moduleName}} = require('./index'); // See note below*.
|
||||
* 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';
|
||||
@ -23,8 +23,8 @@
|
||||
* 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>
|
||||
* <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:
|
||||
@ -37,23 +37,23 @@
|
||||
* ...
|
||||
* </pre>
|
||||
* </p>
|
||||
* @module index
|
||||
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}index
|
||||
* @version {{projectVersion}}
|
||||
*/{{/emitJSDoc}}
|
||||
{{=< >=}} var exports = {<#emitJSDoc>
|
||||
/**
|
||||
* The ApiClient constructor.
|
||||
* @property {module:ApiClient}
|
||||
* @property {module:<#invokerPackage><invokerPackage>/</invokerPackage>ApiClient}
|
||||
*/</emitJSDoc>
|
||||
ApiClient: ApiClient<#models>,<#emitJSDoc>
|
||||
/**
|
||||
* The <importPath> model constructor.
|
||||
* @property {module:<#modelPackage><modelPackage>/</modelPackage><importPath>}
|
||||
* @property {module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><importPath>}
|
||||
*/</emitJSDoc>
|
||||
<importPath>: <importPath></models><#apiInfo><#apis>,<#emitJSDoc>
|
||||
/**
|
||||
* The <importPath> service constructor.
|
||||
* @property {module:<#apiPackage><apiPackage>/</apiPackage><importPath>}
|
||||
* @property {module:<#invokerPackage><invokerPackage>/</invokerPackage><#apiPackage><apiPackage>/</apiPackage><importPath>}
|
||||
*/</emitJSDoc>
|
||||
<importPath>: <importPath></apis></apiInfo>
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'{{#imports}}, './{{import}}'{{/imports}}], factory);
|
||||
define(['{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient'{{#imports}}, '{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{import}}'{{/imports}}], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'){{#imports}}, require('./{{import}}'){{/imports}});
|
||||
@ -17,36 +17,41 @@
|
||||
|
||||
{{#models}}{{#model}}{{#emitJSDoc}} /**
|
||||
* The {{classname}} model module.
|
||||
* @module {{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @version {{projectVersion}}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>{{classname}}</code>.{{#description}}
|
||||
* {{description}}{{/description}}
|
||||
* @alias module:{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @class{{#useInheritance}}{{#parent}}
|
||||
* @extends module:{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{parent}}{{/parent}}{{#interfaces}}
|
||||
* @implements module:{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}}
|
||||
* @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 {{.}}{{/vendorExtensions.x-all-required}}
|
||||
*/{{/emitJSDoc}}
|
||||
var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) {
|
||||
{{#useInheritance}}{{#parentModel}} {{classname}}.call(this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
|
||||
{{#interfaceModels}} {{classname}}.call(this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});
|
||||
{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} this['{{baseName}}'] = {{name}};{{/required}}
|
||||
{{/vars}} };
|
||||
*/
|
||||
{{/emitJSDoc}} var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) {
|
||||
var _this = this;
|
||||
{{#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}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
|
||||
{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/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:<#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
|
||||
* @return {{=< >=}}{module:<#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
|
||||
* @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}} exports.constructFromObject = function(data, obj) {
|
||||
if (data) { {{!// TODO: support polymorphism: discriminator property on data determines class to instantiate.}}
|
||||
if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
|
||||
obj = obj || new exports();
|
||||
{{#useInheritance}}{{#parent}} {{.}}.constructFromObject(data, obj);{{/parent}}
|
||||
{{#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}}}
|
||||
@ -54,10 +59,10 @@
|
||||
{{/vars}} }
|
||||
return obj;
|
||||
}
|
||||
{{#useInheritance}}{{#parent}}
|
||||
exports.prototype = Object.create({{parent}}.prototype);
|
||||
{{#useInheritance}}{{#parentModel}}
|
||||
exports.prototype = Object.create({{classname}}.prototype);
|
||||
exports.prototype.constructor = exports;
|
||||
{{/parent}}{{/useInheritance}}
|
||||
{{/parentModel}}{{/useInheritance}}
|
||||
{{#vars}}{{#emitJSDoc}}
|
||||
/**{{#description}}
|
||||
* {{{description}}}{{/description}}
|
||||
|
@ -3,7 +3,7 @@
|
||||
"version": "{{{projectVersion}}}",
|
||||
"description": "{{{projectDescription}}}",{{#projectLicenseName}}
|
||||
"license": "{{{projectLicenseName}}}",{{/projectLicenseName}}
|
||||
"main": "{{sourceFolder}}/index.js",
|
||||
"main": "{{sourceFolder}}{{#invokerPackage}}/{{invokerPackage}}{{/invokerPackage}}/index.js",
|
||||
"scripts": {
|
||||
"test": "./node_modules/mocha/bin/mocha --recursive"
|
||||
},
|
||||
|
@ -30,6 +30,8 @@ public class JavaScriptClientOptionsTest extends AbstractOptionsTest {
|
||||
protected void setExpectations() {
|
||||
// Commented generic options not yet supported by JavaScript codegen.
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setInvokerPackage(JavaScriptOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setModelPackage(JavaScriptOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(JavaScriptOptionsProvider.API_PACKAGE_VALUE);
|
||||
|
@ -10,9 +10,9 @@ import java.util.Map;
|
||||
|
||||
public class JavaScriptOptionsProvider implements OptionsProvider {
|
||||
public static final String ARTIFACT_ID_VALUE = "swagger-javascript-client-test";
|
||||
public static final String INVOKER_PACKAGE_VALUE = "invoker";
|
||||
public static final String MODEL_PACKAGE_VALUE = "model";
|
||||
public static final String API_PACKAGE_VALUE = "api";
|
||||
// public static final String INVOKER_PACKAGE_VALUE = "js";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String GROUP_ID_VALUE = "io.swagger.test";
|
||||
public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
@ -38,11 +38,11 @@ public class JavaScriptOptionsProvider implements OptionsProvider {
|
||||
public JavaScriptOptionsProvider() {
|
||||
// Commented generic options not yet supported by JavaScript codegen.
|
||||
options = new ImmutableMap.Builder<String, String>()
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||
// .put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
// .put(CodegenConstants.GROUP_ID, GROUP_ID_VALUE)
|
||||
// .put(CodegenConstants.ARTIFACT_ID, ARTIFACT_ID_VALUE)
|
||||
// .put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
|
||||
|
@ -6,7 +6,11 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
<<<<<<< HEAD
|
||||
- Build date: 2016-04-30T20:22:59.696+08:00
|
||||
=======
|
||||
- Build date: 2016-03-25T16:32:33.021Z
|
||||
>>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d
|
||||
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
|
||||
|
||||
## Installation
|
||||
|
@ -59,6 +59,58 @@ null (empty response body)
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
<a name="addPetUsingByteArray"></a>
|
||||
# **addPetUsingByteArray**
|
||||
> addPetUsingByteArray(opts)
|
||||
|
||||
Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var opts = {
|
||||
'body': "B" // {String} Pet object in the form of byte array
|
||||
};
|
||||
apiInstance.addPetUsingByteArray(opts).then(function() {
|
||||
console.log('API called successfully.');
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | **String**| Pet object in the form of byte array | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
>>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
@ -263,6 +315,117 @@ Name | Type | Description | Notes
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
<a name="getPetByIdInObject"></a>
|
||||
# **getPetByIdInObject**
|
||||
> InlineResponse200 getPetByIdInObject(petId)
|
||||
|
||||
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
var api_key = defaultClient.authentications['api_key'];
|
||||
api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
|
||||
apiInstance.getPetByIdInObject(petId).then(function(data) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Integer**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**InlineResponse200**](InlineResponse200.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
<a name="petPetIdtestingByteArraytrueGet"></a>
|
||||
# **petPetIdtestingByteArraytrueGet**
|
||||
> 'String' petPetIdtestingByteArraytrueGet(petId)
|
||||
|
||||
Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
var api_key = defaultClient.authentications['api_key'];
|
||||
api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
|
||||
apiInstance.petPetIdtestingByteArraytrueGet(petId).then(function(data) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Integer**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
**'String'**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
>>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
@ -49,6 +49,66 @@ null (empty response body)
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
<a name="findOrdersByStatus"></a>
|
||||
# **findOrdersByStatus**
|
||||
> [Order] findOrdersByStatus(opts)
|
||||
|
||||
Finds orders by status
|
||||
|
||||
A single status value can be provided as a string
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure API key authorization: test_api_client_id
|
||||
var test_api_client_id = defaultClient.authentications['test_api_client_id'];
|
||||
test_api_client_id.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token"
|
||||
|
||||
// Configure API key authorization: test_api_client_secret
|
||||
var test_api_client_secret = defaultClient.authentications['test_api_client_secret'];
|
||||
test_api_client_secret.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
|
||||
|
||||
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||
|
||||
var opts = {
|
||||
'status': "placed" // {String} Status value that needs to be considered for query
|
||||
};
|
||||
apiInstance.findOrdersByStatus(opts).then(function(data) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | **String**| Status value that needs to be considered for query | [optional] [default to placed]
|
||||
|
||||
### Return type
|
||||
|
||||
[**[Order]**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret)
|
||||
|
||||
### HTTP request headers
|
||||
>>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
@ -93,6 +153,53 @@ This endpoint does not need any parameter.
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
<a name="getInventoryInObject"></a>
|
||||
# **getInventoryInObject**
|
||||
> Object getInventoryInObject
|
||||
|
||||
Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
|
||||
Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
|
||||
// Configure API key authorization: api_key
|
||||
var api_key = defaultClient.authentications['api_key'];
|
||||
api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||
apiInstance.getInventoryInObject().then(function(data) {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**Object**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
>>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
@ -36,7 +36,7 @@ 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 crediential in your environment."
|
||||
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
|
||||
|
@ -1,7 +1,11 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
<<<<<<< HEAD
|
||||
define(['../ApiClient', '../model/Pet'], factory);
|
||||
=======
|
||||
define(['ApiClient', 'model/Pet', 'model/InlineResponse200'], factory);
|
||||
>>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('../model/Pet'));
|
||||
@ -25,8 +29,8 @@
|
||||
* 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.
|
||||
* @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;
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient', '../model/Order'], factory);
|
||||
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'));
|
||||
@ -25,8 +25,8 @@
|
||||
* 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.
|
||||
* @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;
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient', '../model/User'], factory);
|
||||
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'));
|
||||
@ -25,8 +25,8 @@
|
||||
* 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.
|
||||
* @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;
|
||||
|
@ -1,7 +1,11 @@
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
<<<<<<< HEAD
|
||||
define(['./ApiClient', './model/Category', './model/Order', './model/Pet', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory);
|
||||
=======
|
||||
define(['ApiClient', 'model/Category', 'model/InlineResponse200', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/Order', 'model/Pet', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory);
|
||||
>>>>>>> 7dfddd449ddc2ae8e7e35b6d5ab7fc10e52bc93d
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/Order'), require('./model/Pet'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
|
||||
@ -15,7 +19,7 @@
|
||||
* <p>
|
||||
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
|
||||
* <pre>
|
||||
* var SwaggerPetstore = require('./index'); // See note below*.
|
||||
* 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';
|
||||
@ -23,8 +27,8 @@
|
||||
* 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>
|
||||
* <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:
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient', './Tag'], factory);
|
||||
define(['ApiClient', 'model/Tag'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('./Tag'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient', './Category', './Tag'], factory);
|
||||
define(['ApiClient', 'model/Category', 'model/Tag'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('./Category'), require('./Tag'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -36,7 +36,7 @@ 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 crediential in your environment."
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient', '../model/Order'], factory);
|
||||
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'));
|
||||
@ -25,8 +25,8 @@
|
||||
* 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.
|
||||
* @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;
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient', '../model/User'], factory);
|
||||
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'));
|
||||
@ -25,8 +25,8 @@
|
||||
* 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.
|
||||
* @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;
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient', './Tag'], factory);
|
||||
define(['ApiClient', 'model/Tag'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('./Tag'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient', './Category', './Tag'], factory);
|
||||
define(['ApiClient', 'model/Category', 'model/Tag'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'), require('./Category'), require('./Tag'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['../ApiClient'], factory);
|
||||
define(['ApiClient'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
module.exports = factory(require('../ApiClient'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user