diff --git a/.gitignore b/.gitignore index 62978c501be..8760dc40baa 100644 --- a/.gitignore +++ b/.gitignore @@ -76,6 +76,8 @@ samples/client/petstore/java/retrofit2/build/ samples/client/petstore/java/retrofit2rx/build/ samples/client/petstore/java/default/build/ samples/client/petstore/scala/build/ +samples/client/petstore/java/resttemplate/hello.txt +samples/client/petstore/java/retrofit2/hello.txt #PHP samples/client/petstore/php/SwaggerClient-php/composer.lock diff --git a/README.md b/README.md index 2937f082953..366f1d8e06c 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ ## Overview This is the swagger codegen project, which allows generation of API client libraries (SDK generation), server stubs and documentation automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification). Currently, the following languages/frameworks are supported: -- **API clients**: **ActionScript**, **Apex**, **Bash**, **C#** (.net 2.0, 4.0 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart**, **Elixir**, **Go**, **Groovy**, **Haskell**, **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign), **Kotlin**, **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations) **Objective-C**, **Perl**, **PHP**, **Python**, **Ruby**, **Scala**, **Swift** (2.x, 3.x), **Typescript** (Angular1.x, Angular2.x, Fetch, jQuery, Node) +- **API clients**: **ActionScript**, **Apex**, **Bash**, **C#** (.net 2.0, 4.0 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart**, **Elixir**, **Go**, **Groovy**, **Haskell**, **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign), **Kotlin**, **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations) **Objective-C**, **Perl**, **PHP**, **PowerShell**, **Python**, **Ruby**, **Scala**, **Swift** (2.x, 3.x), **Typescript** (Angular1.x, Angular2.x, Fetch, jQuery, Node) - **Server stubs**: **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed), **Erlang**, **Go**, **Haskell**, **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework), **PHP** (Lumen, Slim, Silex, [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Scala** ([Finch](https://github.com/finagle/finch), Scalatra) - **API documentation generators**: **HTML**, **Confluence Wiki** - **Others**: **JMeter** @@ -815,6 +815,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [Upwork](http://upwork.com/) - [uShip](https://www.uship.com/) - [VMware](https://vmware.com/) +- [Viavi Solutions Inc.](https://www.viavisolutions.com) - [W.UP](http://wup.hu/?siteLang=en) - [Wealthfront](https://www.wealthfront.com/) - [Webever GmbH](https://www.webever.de/) @@ -842,6 +843,7 @@ Presentations/Videos/Tutorials/Books - 2017/04/27 - [Swagger Codegen のPHP実装があまりにアレだったので、ライブラリ自作して公開してみた](http://qiita.com/imunew/items/2e9c472e0097e329f2cd) by [imunew](http://qiita.com/imunew) - 2017/05/17 - [Diseño de APIs con OpenAPI](https://www.slideshare.net/pjmolina/diseo-de-apis-con-openapi) by [Pedro J. Molina](https://github.com/pjmolina) @ [JSDayES 2017](http://2017.jsday.es/) - 2017/05/22 - [Presentation of the Vert.x-Swagger project](http://vertx.io/blog/presentation-of-the-vert-x-swagger-project/) by [@phiz71](http://github.com/phiz71) +- 2017/06/21 - [Swagger Presentation (Warsaw Ruby Users Group](https://www.youtube.com/watch?v=uCnnDMFQB8U) by [@rafalpetryka](http://github.com/rafalpetryka) # Swagger Codegen Core Team @@ -902,6 +904,7 @@ Here is a list of template creators: * C++ REST: @Danielku15 * C# (.NET 2.0): @who * C# (.NET Standard 1.3 ): @Gronsak + * C# (.NET 4.5 refactored): @jim * Clojure: @xhh * Dart: @yissachar * Elixir: @niku @@ -915,13 +918,13 @@ Here is a list of template creators: * Java (okhttp-gson): @xhh * Java (RestTemplate): @nbruno * Java (RESTEasy): @gayathrigs - * Kotlin: @jimschubert * Javascript/NodeJS: @jfiala * Javascript (Closure-annotated Angular) @achew22 * JMeter @davidkiss * Kotlin @jimschubert * Perl: @wing328 * PHP (Guzzle): @baartosz + * PowerShell: @beatcracker * Swift: @tkqubo * Swift 3: @hexelon * TypeScript (Node): @mhardorf diff --git a/bin/javascript-es6-petstore.sh b/bin/javascript-es6-petstore.sh index 1844aeca0bb..c9f3b7b6ffd 100755 --- a/bin/javascript-es6-petstore.sh +++ b/bin/javascript-es6-petstore.sh @@ -26,9 +26,9 @@ 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 \ +ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript/es6 \ -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" +--additional-properties useES6=true" java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-petstore.sh b/bin/javascript-petstore.sh index ca961c2484d..984cfca32de 100755 --- a/bin/javascript-petstore.sh +++ b/bin/javascript-petstore.sh @@ -26,6 +26,6 @@ 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 -DappName=PetstoreClient" +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 -DappName=PetstoreClient --additional-properties useES6=false" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-promise-es6-petstore.sh b/bin/javascript-promise-es6-petstore.sh index 177c3f5d89a..ec4e1bda37c 100755 --- a/bin/javascript-promise-es6-petstore.sh +++ b/bin/javascript-promise-es6-petstore.sh @@ -26,10 +26,9 @@ 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 \ +ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript/es6 \ -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" +--additional-properties usePromises=true,useES6=true" java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-promise-petstore.sh b/bin/javascript-promise-petstore.sh index 40ba5a6c137..fa8e346629c 100755 --- a/bin/javascript-promise-petstore.sh +++ b/bin/javascript-promise-petstore.sh @@ -31,7 +31,7 @@ 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 \ ---additional-properties usePromises=true \ +--additional-properties usePromises=true,useES6=false \ -DappName=PetstoreClient" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/powershell-petstore.sh b/bin/powershell-petstore.sh new file mode 100755 index 00000000000..6e4c9b533aa --- /dev/null +++ b/bin/powershell-petstore.sh @@ -0,0 +1,31 @@ +#!/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/powershell -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l powershell -o samples/client/petstore/powershell_test --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5,csharpClientPath=\$ScriptDir\..\..\petstore\csharp\SwaggerClient $@" + +java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/windows/javascript-es6-petstore.bat b/bin/windows/javascript-es6-petstore.bat index ff5d07bc51e..5b2e26bb9c8 100644 --- a/bin/windows/javascript-es6-petstore.bat +++ b/bin/windows/javascript-es6-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) 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 +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% diff --git a/bin/windows/javascript-petstore-all.bat b/bin/windows/javascript-petstore-all.bat index e0181312d7e..efbde1ac83e 100755 --- a/bin/windows/javascript-petstore-all.bat +++ b/bin/windows/javascript-petstore-all.bat @@ -1,3 +1,4 @@ call .\bin\windows\javascript-petstore.bat call .\bin\windows\javascript-promise-petstore.bat call .\bin\windows\javascript-es6-petstore.bat +call .\bin\windows\javascript-promise-es6-petstore.bat diff --git a/bin/windows/javascript-petstore.bat b/bin/windows/javascript-petstore.bat index 4e5e5530f74..66ac74bdccc 100755 --- a/bin/windows/javascript-petstore.bat +++ b/bin/windows/javascript-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) 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 -DappName=PetstoreClient +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 -DappName=PetstoreClient --additional-properties useES6=false java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/javascript-promise-es6-petstore.bat b/bin/windows/javascript-promise-es6-petstore.bat index f827e6b8151..1ace9acacca 100644 --- a/bin/windows/javascript-promise-es6-petstore.bat +++ b/bin/windows/javascript-promise-es6-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) 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 +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,usePromises=true java -DappName=PetstoreClient %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/javascript-promise-petstore.bat b/bin/windows/javascript-promise-petstore.bat index f8bb90bc719..219018032c0 100755 --- a/bin/windows/javascript-promise-petstore.bat +++ b/bin/windows/javascript-promise-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) 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 --additional-properties usePromises=true -DappName=PetstoreClient +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 --additional-properties usePromises=true,useES6=false -DappName=PetstoreClient java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/powershell-petsstore.bat b/bin/windows/powershell-petsstore.bat new file mode 100644 index 00000000000..da7b0f61e03 --- /dev/null +++ b/bin/windows/powershell-petsstore.bat @@ -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 -DloggerPath=conf/log4j.properties +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l powershell -o samples\client\petstore\powershell --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5,csharpClientPath=$ScriptDir\..\..\petstore\csharp\SwaggerClient + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 3f91eaae98a..627139049f1 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -2410,7 +2410,12 @@ public class DefaultCodegen { p.baseType = pr.datatype; p.isContainer = true; p.isListContainer = true; - imports.add(pr.baseType); + + // recursively add import + while (pr != null) { + imports.add(pr.baseType); + pr = pr.items; + } } else if ("object".equals(type)) { // for map parameter Property inner = qp.getItems(); if (inner == null) { @@ -2424,7 +2429,11 @@ public class DefaultCodegen { p.baseType = pr.datatype; p.isContainer = true; p.isMapContainer = true; - imports.add(pr.baseType); + // recursively add import + while (pr != null) { + imports.add(pr.baseType); + pr = pr.items; + } } else { Map args = new HashMap(); String format = qp.getFormat(); @@ -2545,6 +2554,14 @@ public class DefaultCodegen { imports.add(cp.complexType); } imports.add(cp.baseType); + + // recursively add import + CodegenProperty innerCp = cp; + while(innerCp != null) { + imports.add(innerCp.complexType); + innerCp = innerCp.items; + } + p.items = cp; p.dataType = cp.datatype; p.baseType = cp.complexType; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 4b6b067e0d7..1b2bd9af046 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -65,7 +65,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen supportedLibraries.put("jersey1", "HTTP client: Jersey client 1.19.1. JSON processing: Jackson 2.7.0. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); supportedLibraries.put("feign", "HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.7"); supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.22.2. JSON processing: Jackson 2.7.0"); - supportedLibraries.put("okhttp-gson", "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.6.2. Enable Parcelable modles on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); + supportedLibraries.put("okhttp-gson", "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.6.2. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); supportedLibraries.put(RETROFIT_1, "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead."); supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.2.0. JSON processing: Gson 2.6.1 (Retrofit 2.0.2). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)"); supportedLibraries.put("resttemplate", "HTTP client: Spring RestTemplate 4.3.7-RELEASE. JSON processing: Jackson 2.8.8"); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java index 854f0838925..548155035f2 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java @@ -96,7 +96,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo protected String modelDocPath = "docs/"; protected String apiTestPath = "api/"; protected String modelTestPath = "model/"; - protected boolean useES6; + protected boolean useES6 = false; // default is ES5 public JavascriptClientCodegen() { super(); @@ -105,7 +105,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo modelTestTemplateFiles.put("model_test.mustache", ".js"); apiTemplateFiles.put("api.mustache", ".js"); apiTestTemplateFiles.put("api_test.mustache", ".js"); - embeddedTemplateDir = templateDir = "Javascript"; + // subfolder Javascript/es6 + embeddedTemplateDir = templateDir = "Javascript" + File.separator + "es6"; apiPackage = "api"; modelPackage = "model"; modelDocTemplateFiles.put("model_doc.mustache", ".md"); @@ -196,7 +197,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo .defaultValue(Boolean.TRUE.toString())); cliOptions.add(new CliOption(USE_ES6, "use JavaScript ES6 (ECMAScript 6)") - .defaultValue(Boolean.TRUE.toString())); + .defaultValue(Boolean.FALSE.toString())); } @Override @@ -267,6 +268,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo } if (additionalProperties.containsKey(USE_ES6)) { setUseES6(convertPropertyToBooleanAndWriteBack(USE_ES6)); + } else { + setUseES6(false); } } @@ -430,9 +433,11 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo public void setUseES6(boolean useES6) { this.useES6 = useES6; if (useES6) { - embeddedTemplateDir = templateDir = "Javascript-es6"; + embeddedTemplateDir = templateDir = "Javascript/es6"; + LOGGER.info("Using JS ES6 templates"); } else { embeddedTemplateDir = templateDir = "Javascript"; + LOGGER.info("Using JS ES5 templates"); } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PowerShellClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PowerShellClientCodegen.java new file mode 100644 index 00000000000..dcacc549406 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PowerShellClientCodegen.java @@ -0,0 +1,405 @@ +package io.swagger.codegen.languages; + +import io.swagger.codegen.*; +import io.swagger.models.properties.ArrayProperty; +import io.swagger.models.properties.MapProperty; +import io.swagger.models.properties.Property; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import static java.util.UUID.randomUUID; + +public class PowerShellClientCodegen extends DefaultCodegen implements CodegenConfig { + static Logger LOGGER = LoggerFactory.getLogger(PowerShellClientCodegen.class); + + private String packageGuid = "{" + randomUUID().toString().toUpperCase() + "}"; + + protected String sourceFolder = "src"; + protected String packageName = "IO.Swagger"; + protected String csharpClientPath = "$ScriptDir\\csharp\\SwaggerClient"; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; + + /** + * Constructs an instance of `PowerShellClientCodegen`. + */ + public PowerShellClientCodegen() { + super(); + + outputFolder = "generated-code" + File.separator + "powershell"; + modelTemplateFiles.put("model.mustache", ".ps1"); + apiTemplateFiles.put("api.mustache", ".ps1"); + modelTestTemplateFiles.put("model_test.mustache", ".ps1"); + apiTestTemplateFiles.put("api_test.mustache", ".ps1"); + modelDocTemplateFiles.clear(); + apiDocTemplateFiles.clear(); + embeddedTemplateDir = templateDir = "powershell"; + apiPackage = packageName + File.separator + "API"; + modelPackage = packageName + File.separator + "Model"; + + // https://blogs.msdn.microsoft.com/powershell/2010/01/07/how-objects-are-sent-to-and-from-remote-sessions/ + languageSpecificPrimitives = new HashSet(Arrays.asList( + "Byte", + "SByte", + "Byte[]", + "Int16", + "Int32", + "Int64", + "UInt16", + "UInt32", + "UInt64", + "Decimal", + "Single", + "Double", + "TimeSpan", + "System.DateTime", + "ProgressRecord", + "Char", + "String", + "XmlDocument", + "SecureString", + "Boolean", + "Guid", + "Uri", + "Version" + )); + + // https://richardspowershellblog.wordpress.com/2009/05/02/powershell-reserved-words/ + reservedWords = new HashSet(Arrays.asList( + "Begin", + "Break", + "Catch", + "Continue", + "Data", + "Do", + "Dynamicparam", + "Else", + "Elseif", + "End", + "Exit", + "Filter", + "Finally", + "For", + "Foreach", + "From", + "Function", + "If", + "In", + "Param", + "Process", + "Return", + "Switch", + "Throw", + "Trap", + "Try", + "Until", + "While", + "Local", + "Private", + "Where" + )); + + + defaultIncludes = new HashSet(Arrays.asList( + "Byte", + "SByte", + "Byte[]", + "Int16", + "Int32", + "Int64", + "UInt16", + "UInt32", + "UInt64", + "Decimal", + "Single", + "Double", + "TimeSpan", + "System.DateTime", + "ProgressRecord", + "Char", + "String", + "XmlDocument", + "SecureString", + "Boolean", + "Guid", + "Uri", + "Version" + )); + + typeMapping = new HashMap(); + typeMapping.put("string", "String"); + typeMapping.put("boolean", "Boolean"); + typeMapping.put("integer", "Int32"); + typeMapping.put("float", "Double"); + typeMapping.put("long", "Int64"); + typeMapping.put("double", "Double"); + typeMapping.put("number", "Decimal"); + typeMapping.put("date-time", "System.DateTime"); + typeMapping.put("date", "System.DateTime"); + typeMapping.put("file", "String"); + typeMapping.put("object", "String"); + typeMapping.put("binary", "String"); + typeMapping.put("Date", "System.DateTime"); + typeMapping.put("DateTime", "System.DateTime"); + + cliOptions.clear(); + cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Client package name (e.g. io.swagger.client).").defaultValue(this.packageName)); + cliOptions.add(new CliOption(CodegenConstants.OPTIONAL_PROJECT_GUID, "GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default.")); + cliOptions.add(new CliOption("csharpClientPath", "Path to the C# API client generated by Swagger Codegen, e.g. $ScriptDir\\..\\csharp\\SwaggerClient where $ScriptDir is the current directory.").defaultValue(this.csharpClientPath)); + + } + + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + public String getName() { + return "powershell"; + } + + public String getHelp() { + return "Generates a PowerShell API client (beta)."; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + public void setCsharpClientPath(String csharpClientPath) { + this.csharpClientPath = csharpClientPath; + } + + public void setSourceFolder(String sourceFolder) { + this.sourceFolder = sourceFolder; + } + + public void setPackageGuid(String packageGuid) { + this.packageGuid = packageGuid; + } + + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_GUID)) { + setPackageGuid((String) additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_GUID)); + } + additionalProperties.put("packageGuid", packageGuid); + + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { + this.setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); + } else { + additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); + } + + if (additionalProperties.containsKey("csharpClientPath")) { + this.setCsharpClientPath((String) additionalProperties.get("csharpClientPath")); + } else { + additionalProperties.put("csharpClientPath", csharpClientPath); + } + + if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) { + LOGGER.warn(CodegenConstants.MODEL_PACKAGE + " with " + this.getName() + " generator is ignored. Setting this value independently of " + CodegenConstants.PACKAGE_NAME + " is not currently supported."); + } + + if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { + LOGGER.warn(CodegenConstants.API_PACKAGE + " with " + this.getName() + " generator is ignored. Setting this value independently of " + CodegenConstants.PACKAGE_NAME + " is not currently supported."); + } + + additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage()); + additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage()); + + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("Build.ps1.mustache", "", "Build.ps1")); + + final String infrastructureFolder = (sourceFolder + File.separator + packageName + File.separator); + + supportingFiles.add(new SupportingFile("IO.Swagger.psm1.mustache", infrastructureFolder, packageName + ".psm1")); + + // private + supportingFiles.add(new SupportingFile("Get-CommonParameters.ps1", infrastructureFolder + File.separator + "Private" + File.separator, "Get-CommonParameters.ps1")); + supportingFiles.add(new SupportingFile("Out-DebugParameter.ps1", infrastructureFolder + File.separator + "Private" + File.separator, "Out-DebugParameter.ps1")); + + // en-US + supportingFiles.add(new SupportingFile("about_IO.Swagger.help.txt.mustache", infrastructureFolder + File.separator + "en-US" + File.separator + "about_" + packageName + ".help.txt")); + + } + + @Override + public String escapeUnsafeCharacters(String input) { + return input.replace("#>", "#_>").replace("<#", "<_#"); + } + + @Override + public String escapeQuotationMark(String input) { + // remove " to avoid code injection + return input.replace("\"", ""); + } + + @Override + public String apiTestFileFolder() { + return (outputFolder + "/test").replace('/', File.separatorChar); + } + + @Override + public String apiDocFileFolder() { + return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + } + + @Override + public String apiFileFolder() { + return outputFolder + File.separator + sourceFolder + File.separator + apiPackage(); + } + + @Override + public String modelTestFileFolder() { + return (outputFolder + "/test").replace('/', File.separatorChar); + } + + @Override + public String modelDocFileFolder() { + return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + } + + + @Override + public String modelFileFolder() { + return outputFolder + File.separator + sourceFolder + File.separator + modelPackage(); + } + + @Override + public String escapeReservedWord(String name) { + return "_" + name; + } + + /** + * Output the proper model name (capitalized). + * In case the name belongs to the TypeSystem it won't be renamed. + * + * @param name the name of the model + * @return capitalized model name + */ + @Override + public String toModelName(String name) { + if (!StringUtils.isEmpty(modelNamePrefix)) { + name = modelNamePrefix + "_" + name; + } + + if (!StringUtils.isEmpty(modelNameSuffix)) { + name = name + "_" + modelNameSuffix; + } + + name = sanitizeName(name); + + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(name)) { + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + name = "model_" + name; // e.g. return => ModelReturn (after camelize) + } + + // model name starts with number + if (name.matches("^\\d.*")) { + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) + } + + // camelize the model name + // phone_number => PhoneNumber + return camelize(name); + } + + @Override + public String toModelFilename(String name) { + // should be the same as the model name + return "New-" + toModelName(name); + } + + /** + * returns the swagger type for the property + * + * @param p Swagger property object + * @return string presentation of the type + **/ + @Override + public String getSwaggerType(Property p) { + String swaggerType = super.getSwaggerType(p); + String type; + + // This maps, for example, long -> Long based on hashes in this type's constructor + if (typeMapping.containsKey(swaggerType)) { + type = typeMapping.get(swaggerType); + if (languageSpecificPrimitives.contains(type)) { + return type; + } + } else { + type = swaggerType; + } + + // model/object + return toModelName(type); + } + + /** + * Output the type declaration of the property + * + * @param p Swagger Property object + * @return a string presentation of the property type + */ + @Override + public String getTypeDeclaration(Property p) { + if (p instanceof ArrayProperty) { + ArrayProperty ap = (ArrayProperty) p; + Property inner = ap.getItems(); + return getTypeDeclaration(inner) + "[]"; + } else if (p instanceof MapProperty) { + MapProperty mp = (MapProperty) p; + Property inner = mp.getAdditionalProperties(); + // TODO not sure if the following map/hash declaration is correct + return "{String, " + getTypeDeclaration(inner) + "}"; + } else if (!languageSpecificPrimitives.contains(getSwaggerType(p))) { + return packageName + ".Model." + super.getTypeDeclaration(p); + } + return super.getTypeDeclaration(p); + } + + @Override + public String toOperationId(String operationId) { + // throw exception if method name is empty (should not occur as an auto-generated method name will be used) + if (StringUtils.isEmpty(operationId)) { + throw new RuntimeException("Empty method name (operationId) not allowed"); + } + + // method name cannot use reserved keyword, e.g. return + if (isReservedWord(operationId)) { + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId))); + operationId = "call_" + operationId; + } + + return camelize(sanitizeName(operationId)); + } + + @Override + public Map postProcessOperations(Map objs) { + Map operations = (Map) objs.get("operations"); + List operationList = (List) operations.get("operation"); + for (CodegenOperation op : operationList) { + int index = 0; + for (CodegenParameter p : op.allParams) { + p.vendorExtensions.put("x-index", index); + index++; + } + } + return objs; + } +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java index afcf3bdaadc..8fe2e2d849b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java @@ -26,14 +26,11 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod public static final String NPM_VERSION = "npmVersion"; public static final String NPM_REPOSITORY = "npmRepository"; public static final String SNAPSHOT = "snapshot"; - public static final String USE_OPAQUE_TOKEN = "useOpaqueToken"; - public static final String INJECTION_TOKEN = "injectionToken"; public static final String WITH_INTERFACES = "withInterfaces"; protected String npmName = null; protected String npmVersion = "1.0.0"; protected String npmRepository = null; - protected String injectionToken = "InjectionToken"; public TypeScriptAngular2ClientCodegen() { super(); @@ -51,7 +48,6 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); - this.cliOptions.add(new CliOption(USE_OPAQUE_TOKEN, "When setting this property to true, OpaqueToken is used instead of InjectionToken", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); } @@ -86,11 +82,6 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod addNpmPackageGeneration(); } - if(additionalProperties.containsKey(USE_OPAQUE_TOKEN) && Boolean.valueOf(additionalProperties.get(USE_OPAQUE_TOKEN).toString())) { - this.setOpaqueToken(); - } - additionalProperties.put(INJECTION_TOKEN, this.injectionToken); - if(additionalProperties.containsKey(WITH_INTERFACES)) { boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString()); if (withInterfaces) { @@ -253,7 +244,4 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod this.npmRepository = npmRepository; } - public void setOpaqueToken() { - this.injectionToken = "OpaqueToken"; - } } diff --git a/modules/swagger-codegen/src/main/resources/Java/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/build.gradle.mustache index 944f12b3e66..751730ec230 100644 --- a/modules/swagger-codegen/src/main/resources/Java/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/build.gradle.mustache @@ -106,10 +106,10 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.7.5" - jersey_version = "1.19.1" - jodatime_version = "2.9.4" + swagger_annotations_version = "1.5.15" + jackson_version = "2.8.9" + jersey_version = "1.19.4" + jodatime_version = "2.9.9" junit_version = "4.12" } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index 97c6f4edf85..b2db2d26f97 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -105,15 +105,15 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.7.5" - jersey_version = "2.22.2" + swagger_annotations_version = "1.5.15" + jackson_version = "2.8.9" + jersey_version = "2.25.1" {{^java8}} - jodatime_version = "2.9.4" + jodatime_version = "2.9.9" {{/java8}} {{#supportJava6}} commons_io_version=2.5 - commons_lang3_version=3.5 + commons_lang3_version=3.6 {{/supportJava6}} junit_version = "4.12" } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/build.sbt.mustache index c1cb91dd316..22d69f8ba66 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/build.sbt.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/build.sbt.mustache @@ -9,23 +9,23 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.8", - "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", - "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5", + "io.swagger" % "swagger-annotations" % "1.5.15", + "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9", {{#java8}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.7.5", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.8.9", {{/java8}} {{^java8}} - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5", - "joda-time" % "joda-time" % "2.9.4", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.8.9", + "joda-time" % "joda-time" % "2.9.9", {{/java8}} "com.brsanthu" % "migbase64" % "2.2", {{#supportJava6}} - "org.apache.commons" % "commons-lang3" % "3.5", + "org.apache.commons" % "commons-lang3" % "3.6", "commons-io" % "commons-io" % "2.5", {{/supportJava6}} "junit" % "junit" % "4.12" % "test", diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/pom.mustache index c2193af18eb..c990bb13ed8 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -272,14 +272,14 @@ 1.5.15 - 2.22.2 - 2.7.5 + 2.25.1 + 2.8.9 {{^java8}} - 2.9.4 + 2.9.9 {{/java8}} {{#supportJava6}} 2.5 - 3.5 + 3.6 {{/supportJava6}} 1.0.0 4.12 diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache index cf05d647d42..0d169cf9c96 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache @@ -100,12 +100,12 @@ if(hasProperty('target') && target == 'android') { } dependencies { - compile 'io.swagger:swagger-annotations:1.5.8' + compile 'io.swagger:swagger-annotations:1.5.15' compile 'com.squareup.okhttp:okhttp:2.7.5' compile 'com.squareup.okhttp:logging-interceptor:2.7.5' - compile 'com.google.code.gson:gson:2.6.2' + compile 'com.google.code.gson:gson:2.8.1' {{^java8}} - compile 'joda-time:joda-time:2.9.3' + compile 'joda-time:joda-time:2.9.9' {{/java8}} testCompile 'junit:junit:4.12' } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache index 56c712f52d2..c2eef2ede15 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache @@ -9,12 +9,12 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.8", + "io.swagger" % "swagger-annotations" % "1.5.15", "com.squareup.okhttp" % "okhttp" % "2.7.5", "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", - "com.google.code.gson" % "gson" % "2.6.2", + "com.google.code.gson" % "gson" % "2.8.1", {{^java8}} - "joda-time" % "joda-time" % "2.9.3" % "compile", + "joda-time" % "joda-time" % "2.9.9" % "compile", {{/java8}} "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index b1c9d69ed54..e25c5882a06 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -210,7 +210,7 @@ org.hibernate hibernate-validator - 5.2.2.Final + 5.4.1.Final javax.el @@ -241,8 +241,8 @@ ${java.version} 1.5.15 2.7.5 - 2.6.2 - 2.9.3 + 2.8.1 + 2.9.9 1.0.0 4.12 UTF-8 diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/resteasy/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/resteasy/pom.mustache index b5c9a9bb1a9..ffea816e218 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/resteasy/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/resteasy/pom.mustache @@ -192,7 +192,7 @@ org.jboss.resteasy resteasy-jackson-provider - 2.3.4.Final + 3.1.3.Final @@ -203,15 +203,15 @@ - 1.5.9 - 3.0.19.Final + 1.5.15 + 3.1.3.Final 2.7.5 {{^java8}} - 2.9.4 + 2.9.9 {{/java8}} {{#supportJava6}} 2.5 - 3.5 + 3.6 {{/supportJava6}} 1.0.0 4.12 diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache index 687b83ff58f..8f5655d7f73 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache @@ -106,10 +106,10 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.8.8" - spring_web_version = "4.3.7.RELEASE" - jodatime_version = "2.9.4" + swagger_annotations_version = "1.5.15" + jackson_version = "2.8.9" + spring_web_version = "4.3.9.RELEASE" + jodatime_version = "2.9.9" junit_version = "4.12" } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/pom.mustache index 0122c5c9008..62705aadbeb 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/pom.mustache @@ -248,11 +248,11 @@ UTF-8 - 1.5.8 - 4.3.7.RELEASE - 2.8.8 + 1.5.15 + 4.3.9.RELEASE + 2.8.9 {{^java8}} - 2.9.4 + 2.9.9 {{/java8}} 1.0.0 4.12 diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/pom.mustache index a33360e3b2f..672d4b754ca 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/pom.mustache @@ -225,7 +225,7 @@ 1.5.15 1.9.0 2.7.5 - 2.9.3 + 2.9.9 1.0.1 1.0.0 4.12 diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index b9a7fde1a57..9e0ad8a572c 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -102,23 +102,23 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" {{^usePlay24WS}} - retrofit_version = "2.2.0" + retrofit_version = "2.3.0" {{/usePlay24WS}} {{#usePlay24WS}} retrofit_version = "2.1.0" - jackson_version = "2.7.5" + jackson_version = "2.8.9" play_version = "2.4.11" {{/usePlay24WS}} swagger_annotations_version = "1.5.15" junit_version = "4.12" {{#useRxJava}} - rx_java_version = "1.2.9" + rx_java_version = "1.3.0" {{/useRxJava}} {{#useRxJava2}} - rx_java_version = "2.0.7" + rx_java_version = "2.1.1" {{/useRxJava2}} {{^java8}} - jodatime_version = "2.9.4" + jodatime_version = "2.9.9" {{/java8}} } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache index 0888bea465d..2146acd4971 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache @@ -10,9 +10,9 @@ lazy val root = (project in file(".")). resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( {{^usePlay24WS}} - "com.squareup.retrofit2" % "retrofit" % "2.2.0" % "compile", - "com.squareup.retrofit2" % "converter-scalars" % "2.2.0" % "compile", - "com.squareup.retrofit2" % "converter-gson" % "2.2.0" % "compile", + "com.squareup.retrofit2" % "retrofit" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-scalars" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-gson" % "2.3.0" % "compile", {{/usePlay24WS}} {{#usePlay24WS}} "com.typesafe.play" % "play-java-ws_2.11" % "2.4.11" % "compile", @@ -20,22 +20,22 @@ lazy val root = (project in file(".")). "com.squareup.retrofit2" % "converter-scalars" % "2.1.0" % "compile", "com.squareup.retrofit2" % "converter-gson" % "2.1.0" % "compile", "com.squareup.retrofit2" % "converter-jackson" % "2.1.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile", {{/usePlay24WS}} {{#useRxJava}} "com.squareup.retrofit2" % "adapter-rxjava" % "{{^usePlay24WS}}2.2.0{{/usePlay24WS}}{{#usePlay24WS}}2.1.0{{/usePlay24WS}}" % "compile", - "io.reactivex" % "rxjava" % "1.2.9" % "compile", + "io.reactivex" % "rxjava" % "1.3.0" % "compile", {{/useRxJava}} {{#useRxJava2}} "com.jakewharton.retrofit" % "retrofit2-rxjava2-adapter" % "1.0.0" % "compile", - "io.reactivex.rxjava2" % "rxjava" % "2.0.7" % "compile", + "io.reactivex.rxjava2" % "rxjava" % "2.1.1" % "compile", {{/useRxJava2}} "io.swagger" % "swagger-annotations" % "1.5.15" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", {{^java8}} - "joda-time" % "joda-time" % "2.9.4" % "compile", + "joda-time" % "joda-time" % "2.9.9" % "compile", {{/java8}} "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.11" % "test" diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache index 5e1d6999360..a7d846446fe 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -285,18 +285,18 @@ ${java.version} 1.5.15 {{#usePlay24WS}} - 2.7.5 + 2.8.9 2.4.11 {{/usePlay24WS}} - 2.2.0 + 2.3.0 {{#useRxJava}} - 1.2.9 + 1.3.0 {{/useRxJava}} {{#useRxJava2}} - 2.0.7 + 2.1.1 {{/useRxJava2}} {{^java8}} - 2.9.4 + 2.9.9 {{/java8}} 1.0.1 4.12 diff --git a/modules/swagger-codegen/src/main/resources/Java/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/pom.mustache index 9a292b9ddc4..cc834ea3608 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pom.mustache @@ -293,15 +293,15 @@ UTF-8 - 1.5.8 - 1.19.1 - 2.7.5 + 1.5.15 + 1.19.4 + 2.8.9 {{^java8}} - 2.9.4 + 2.9.9 {{/java8}} {{#supportJava6}} 2.5 - 3.5 + 3.6 {{/supportJava6}} 1.0.0 4.12 diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache index b9d4188be75..6f5a46a6f7d 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache @@ -187,7 +187,7 @@ {{#useBeanValidation}} 1.1.0.Final {{/useBeanValidation}} - 3.1.6 + 3.1.11 2.8.4 UTF-8 diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/pom.mustache index 03f56a5d236..e7e0e19e569 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/pom.mustache @@ -244,7 +244,7 @@ {{#generateSpringBootApplication}} 1.3.3.RELEASE {{/generateSpringBootApplication}} - 3.1.8 + 3.1.11 2.8.4 UTF-8 diff --git a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache index a78f20a1b92..01660219ed8 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache @@ -450,7 +450,7 @@ if (_this.enableCookies && typeof window === 'undefined'){ _this.agent.saveCookies(response); } - resolve({data, response}); + resolve({data: data, response: response}); } catch (err) { reject(err); } diff --git a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache index 9bbf4b4f43a..c13314a8960 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache @@ -53,6 +53,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/.babelrc.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/.babelrc.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/.babelrc.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/.babelrc.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/ApiClient.mustache similarity index 97% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/ApiClient.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/ApiClient.mustache index 22cd56bd12c..17e9000179d 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript-es6/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/es6/ApiClient.mustache @@ -347,7 +347,7 @@ export default class ApiClient { data = response.text; } - return exports.convertToType(data, returnType); + return ApiClient.convertToType(data, returnType); } {{#emitJSDoc}}{{^usePromises}}/** @@ -449,7 +449,7 @@ export default class ApiClient { } {{#usePromises}}return new Promise((resolve, reject) => { - request.end(function(error, response) { + request.end((error, response) => { if (error) { reject(error); } else { @@ -521,7 +521,7 @@ export default class ApiClient { case 'String': return String(data); case 'Date': - return this.parseDate(String(data)); + return ApiClient.parseDate(String(data)); case 'Blob': return data; default: @@ -536,7 +536,7 @@ export default class ApiClient { var itemType = type[0]; return data.map((item) => { - return exports.convertToType(item, itemType); + return ApiClient.convertToType(item, itemType); }); } else if (typeof type === 'object') { // for plain object type like: {'String': 'Integer'} @@ -552,8 +552,8 @@ export default class ApiClient { var result = {}; for (var k in data) { if (data.hasOwnProperty(k)) { - var key = exports.convertToType(k, keyType); - var value = exports.convertToType(data[k], valueType); + var key = ApiClient.convertToType(k, keyType); + var value = ApiClient.convertToType(data[k], valueType); result[key] = value; } } @@ -575,12 +575,12 @@ export default class ApiClient { if (Array.isArray(data)) { for (var i = 0; i < data.length; i++) { if (data.hasOwnProperty(i)) - obj[i] = exports.convertToType(data[i], itemType); + obj[i] = ApiClient.convertToType(data[i], itemType); } } else { for (var k in data) { if (data.hasOwnProperty(k)) - obj[k] = exports.convertToType(data[k], itemType); + obj[k] = ApiClient.convertToType(data[k], itemType); } } }; diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/README.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/README.mustache similarity index 94% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/README.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/README.mustache index 9bbf4b4f43a..c13314a8960 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript-es6/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/es6/README.mustache @@ -53,6 +53,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/api.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/api.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/api.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/api.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/api_doc.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/api_doc.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/api_doc.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/api_doc.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/api_test.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/api_test.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/api_test.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/api_test.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/enumClass.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/enumClass.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/enumClass.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/enumClass.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/git_push.sh.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/git_push.sh.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/git_push.sh.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/gitignore.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/gitignore.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/gitignore.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/gitignore.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/index.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/index.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/index.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/index.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/licenseInfo.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/licenseInfo.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/licenseInfo.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/licenseInfo.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/mocha.opts b/modules/swagger-codegen/src/main/resources/Javascript/es6/mocha.opts similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/mocha.opts rename to modules/swagger-codegen/src/main/resources/Javascript/es6/mocha.opts diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/model.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/model.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/model.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/model.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/model_doc.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/model_doc.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/model_doc.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/model_doc.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/model_test.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/model_test.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/model_test.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/model_test.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/package.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/package.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/package.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/package.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/partial_model_enum_class.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/partial_model_enum_class.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/partial_model_enum_class.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/partial_model_enum_class.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/partial_model_generic.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/partial_model_generic.mustache similarity index 97% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/partial_model_generic.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/partial_model_generic.mustache index 7fbfebecf13..5ba893a4542 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript-es6/partial_model_generic.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/es6/partial_model_generic.mustache @@ -20,7 +20,7 @@ export default class {{classname}} { 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}} + Object.setPrototypeOf(this, {{classname}});{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}} {{#useInheritance}} {{#parentModel}}{{classname}}.call(this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});{{/parentModel}} @@ -41,7 +41,7 @@ export default class {{classname}} { */{{/emitJSDoc}} static constructFromObject(data, obj) { if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} { - obj = obj || new exports(); + obj = obj || new {{classname}}(); {{#parent}}{{^parentModel}}ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-itemType}}');{{/parentModel}} {{/parent}} diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/partial_model_inner_enum.mustache b/modules/swagger-codegen/src/main/resources/Javascript/es6/partial_model_inner_enum.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/partial_model_inner_enum.mustache rename to modules/swagger-codegen/src/main/resources/Javascript/es6/partial_model_inner_enum.mustache diff --git a/modules/swagger-codegen/src/main/resources/Javascript-es6/travis.yml b/modules/swagger-codegen/src/main/resources/Javascript/es6/travis.yml similarity index 100% rename from modules/swagger-codegen/src/main/resources/Javascript-es6/travis.yml rename to modules/swagger-codegen/src/main/resources/Javascript/es6/travis.yml diff --git a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig index aaa9f782731..b8c4c7e9397 100644 --- a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig +++ b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig @@ -42,6 +42,7 @@ io.swagger.codegen.languages.NodeJSServerCodegen io.swagger.codegen.languages.ObjcClientCodegen io.swagger.codegen.languages.PerlClientCodegen io.swagger.codegen.languages.PhpClientCodegen +io.swagger.codegen.languages.PowerShellClientCodegen io.swagger.codegen.languages.PistacheServerCodegen io.swagger.codegen.languages.PythonClientCodegen io.swagger.codegen.languages.Qt5CPPGenerator diff --git a/modules/swagger-codegen/src/main/resources/cpprest/model-header.mustache b/modules/swagger-codegen/src/main/resources/cpprest/model-header.mustache index c32084eebc2..aefcec63437 100644 --- a/modules/swagger-codegen/src/main/resources/cpprest/model-header.mustache +++ b/modules/swagger-codegen/src/main/resources/cpprest/model-header.mustache @@ -51,10 +51,10 @@ public: /// {{^isNotContainer}}{{{datatype}}}& {{getter}}(); {{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{getter}}() const; - void {{setter}}({{{datatype}}} value); {{/isNotContainer}}{{^required}}bool {{baseName}}IsSet() const; void unset{{name}}(); {{/required}} + void {{setter}}({{{datatype}}} value); {{/isInherited}} {{/vars}} diff --git a/modules/swagger-codegen/src/main/resources/cpprest/model-source.mustache b/modules/swagger-codegen/src/main/resources/cpprest/model-source.mustache index 33a35a908a2..e90e2a5371c 100644 --- a/modules/swagger-codegen/src/main/resources/cpprest/model-source.mustache +++ b/modules/swagger-codegen/src/main/resources/cpprest/model-source.mustache @@ -9,11 +9,26 @@ namespace {{this}} { {{classname}}::{{classname}}() { - {{#vars}}{{^isInherited}}{{#isNotContainer}}{{#isPrimitiveType}}m_{{name}} = {{{defaultValue}}}; - {{/isPrimitiveType}}{{^isPrimitiveType}}{{#isString}}m_{{name}} = {{{defaultValue}}}; - {{/isString}}{{#isDateTime}}m_{{name}} = {{{defaultValue}}}; - {{/isDateTime}}{{/isPrimitiveType}}{{/isNotContainer}}{{^required}}m_{{name}}IsSet = false; - {{/required}}{{/isInherited}}{{/vars}} + {{#vars}} + {{^isInherited}} + {{#isNotContainer}} + {{#isPrimitiveType}} + m_{{name}} = {{{defaultValue}}}; + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isString}} + m_{{name}} = {{{defaultValue}}}; + {{/isString}} + {{#isDateTime}} + m_{{name}} = {{{defaultValue}}}; + {{/isDateTime}} + {{/isPrimitiveType}} + {{/isNotContainer}} + {{^required}} + m_{{name}}IsSet = false; + {{/required}} + {{/isInherited}} + {{/vars}} } {{classname}}::~{{classname}}() @@ -27,59 +42,135 @@ void {{classname}}::validate() web::json::value {{classname}}::toJson() const { - {{#parent}}web::json::value val = this->{{{parent}}}::toJson(); {{/parent}} - {{^parent}}web::json::value val = web::json::value::object();{{/parent}} + {{#parent}} + web::json::value val = this->{{{parent}}}::toJson(); + {{/parent}} + {{^parent}} + web::json::value val = web::json::value::object(); + {{/parent}} - {{#vars}}{{^isInherited}}{{#isPrimitiveType}}{{^isListContainer}}{{^required}}if(m_{{name}}IsSet) + {{#vars}} + {{^isInherited}} + {{#isPrimitiveType}} + {{^isListContainer}} + {{^isMapContainer}} + {{^required}} + if(m_{{name}}IsSet) { val[U("{{baseName}}")] = ModelBase::toJson(m_{{name}}); } - {{/required}}{{#required}}val[U("{{baseName}}")] = ModelBase::toJson(m_{{name}}); - {{/required}}{{/isListContainer}}{{/isPrimitiveType}}{{#isListContainer}}{ + {{/required}} + {{#required}} + val[U("{{baseName}}")] = ModelBase::toJson(m_{{name}}); + {{/required}} + {{/isMapContainer}} + {{/isListContainer}} + {{/isPrimitiveType}} + {{#isListContainer}} + { std::vector jsonArray; for( auto& item : m_{{name}} ) { jsonArray.push_back(ModelBase::toJson(item)); } - {{#required}}val[U("{{baseName}}")] = web::json::value::array(jsonArray); - {{/required}}{{^required}} + {{#required}} + val[U("{{baseName}}")] = web::json::value::array(jsonArray); + {{/required}} + {{^required}} if(jsonArray.size() > 0) { val[U("{{baseName}}")] = web::json::value::array(jsonArray); } {{/required}} } - {{/isListContainer}}{{^isListContainer}}{{^isPrimitiveType}}{{^required}}if(m_{{name}}IsSet) + {{/isListContainer}} + {{#isMapContainer}} + { + std::vector jsonArray; + for( auto& item : m_{{name}} ) + { + web::json::value tmp = web::json::value::object(); + tmp[U("key")] = ModelBase::toJson(item.first); + tmp[U("value")] = ModelBase::toJson(item.second); + jsonArray.push_back(tmp); + } + {{#required}} + val[U("{{baseName}}")] = web::json::value::array(jsonArray); + {{/required}} + {{^required}} + if(jsonArray.size() > 0) + { + val[U("{{baseName}}")] = web::json::value::array(jsonArray); + } + {{/required}} + } + {{/isMapContainer}} + {{^isListContainer}} + {{^isMapContainer}} + {{^isPrimitiveType}} + {{^required}} + if(m_{{name}}IsSet) { val[U("{{baseName}}")] = ModelBase::toJson(m_{{name}}); } - {{/required}}{{#required}}val[U("{{baseName}}")] = ModelBase::toJson(m_{{name}}); - {{/required}}{{/isPrimitiveType}}{{/isListContainer}}{{/isInherited}}{{/vars}} + {{/required}} + {{#required}} + val[U("{{baseName}}")] = ModelBase::toJson(m_{{name}}); + {{/required}} + {{/isPrimitiveType}} + {{/isMapContainer}} + {{/isListContainer}} + {{/isInherited}} + {{/vars}} return val; } void {{classname}}::fromJson(web::json::value& val) { - {{#parent}}this->{{{parent}}}::fromJson(val); {{/parent}} + {{#parent}} + this->{{{parent}}}::fromJson(val); - {{#vars}}{{^isInherited}}{{#isPrimitiveType}}{{^isListContainer}}{{^required}}if(val.has_field(U("{{baseName}}"))) + {{/parent}} + {{#vars}} + {{^isInherited}} + {{#isPrimitiveType}} + {{^isListContainer}} + {{^isMapContainer}} + {{^required}} + if(val.has_field(U("{{baseName}}"))) { {{setter}}(ModelBase::{{baseType}}FromJson(val[U("{{baseName}}")])); } - {{/required}}{{#required}}{{setter}}(ModelBase::{{baseType}}FromJson(val[U("{{baseName}}")])); - {{/required}}{{/isListContainer}}{{/isPrimitiveType}}{{#isListContainer}}{ + {{/required}} + {{#required}} + {{setter}}(ModelBase::{{baseType}}FromJson(val[U("{{baseName}}")])); + {{/required}} + {{/isMapContainer}} + {{/isListContainer}} + {{/isPrimitiveType}} + {{#isListContainer}} + { m_{{name}}.clear(); std::vector jsonArray; - {{^required}}if(val.has_field(U("{{baseName}}"))) + {{^required}} + if(val.has_field(U("{{baseName}}"))) { {{/required}} for( auto& item : val[U("{{baseName}}")].as_array() ) { - {{#isPrimitiveType}}m_{{name}}.push_back(ModelBase::{{items.baseType}}FromJson(item)); - {{/isPrimitiveType}}{{^isPrimitiveType}}{{#items.isString}}m_{{name}}.push_back(ModelBase::stringFromJson(item)); - {{/items.isString}}{{^items.isString}}{{#items.isDateTime}}m_{{name}}.push_back(ModelBase::dateFromJson(item)); - {{/items.isDateTime}}{{^items.isDateTime}} + {{#items.isPrimitiveType}} + m_{{name}}.push_back(ModelBase::{{items.baseType}}FromJson(item)); + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isString}} + m_{{name}}.push_back(ModelBase::stringFromJson(item)); + {{/items.isString}} + {{^items.isString}} + {{#items.isDateTime}} + m_{{name}}.push_back(ModelBase::dateFromJson(item)); + {{/items.isDateTime}} + {{^items.isDateTime}} if(item.is_null()) { m_{{name}}.push_back( {{{items.datatype}}}(nullptr) ); @@ -90,31 +181,111 @@ void {{classname}}::fromJson(web::json::value& val) newItem->fromJson(item); m_{{name}}.push_back( newItem ); } - {{/items.isDateTime}}{{/items.isString}}{{/isPrimitiveType}} + {{/items.isDateTime}} + {{/items.isString}} + {{/items.isPrimitiveType}} } {{^required}} } {{/required}} } - {{/isListContainer}}{{^isListContainer}}{{^isPrimitiveType}}{{^required}}if(val.has_field(U("{{baseName}}"))) + {{/isListContainer}} + {{#isMapContainer}} { - {{#isString}}{{setter}}(ModelBase::stringFromJson(val[U("{{baseName}}")])); - {{/isString}}{{^isString}}{{#isDateTime}}{{setter}}(ModelBase::dateFromJson(val[U("{{baseName}}")])); - {{/isDateTime}}{{^isDateTime}}if(!val[U("{{baseName}}")].is_null()) + m_{{name}}.clear(); + std::vector jsonArray; + {{^required}} + if(val.has_field(U("{{baseName}}"))) + { + {{/required}} + for( auto& item : val[U("{{baseName}}")].as_array() ) + { + utility::string_t key; + if(item.has_field(U("key"))) + { + key = ModelBase::stringFromJson(item[U("key")]); + } + {{#items.isPrimitiveType}} + m_{{name}}.insert(std::pair( key, ModelBase::{{items.baseType}}FromJson(item[U("value")]))); + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isString}} + m_{{name}}.insert(std::pair( key, ModelBase::stringFromJson(item[U("value")]))); + {{/items.isString}} + {{^items.isString}} + {{#items.isDateTime}} + m_{{name}}.insert(std::pair( key, ModelBase::dateFromJson(item[U("value")]))); + {{/items.isDateTime}} + {{^items.isDateTime}} + if(item.is_null()) + { + m_{{name}}.insert(std::pair( key, {{{items.datatype}}}(nullptr) )); + } + else + { + {{{items.datatype}}} newItem({{{items.defaultValue}}}); + newItem->fromJson(item[U("value")]); + m_{{name}}.insert(std::pair( key, newItem )); + } + {{/items.isDateTime}} + {{/items.isString}} + {{/items.isPrimitiveType}} + } + {{^required}} + } + {{/required}} + } + {{/isMapContainer}} + {{^isListContainer}} + {{^isMapContainer}} + {{^isPrimitiveType}} + {{^required}} + if(val.has_field(U("{{baseName}}"))) + { + {{#isString}} + {{setter}}(ModelBase::stringFromJson(val[U("{{baseName}}")])); + {{/isString}} + {{^isString}} + {{#isDateTime}} + {{setter}}(ModelBase::dateFromJson(val[U("{{baseName}}")])); + {{/isDateTime}} + {{^isDateTime}} + if(!val[U("{{baseName}}")].is_null()) { {{{datatype}}} newItem({{{defaultValue}}}); newItem->fromJson(val[U("{{baseName}}")]); {{setter}}( newItem ); } - {{/isDateTime}}{{/isString}} + {{/isDateTime}} + {{/isString}} } - {{/required}}{{#required}}{{#isString}}{{setter}}(ModelBase::stringFromJson(val[U("{{baseName}}")])); - {{/isString}}{{^isString}}{{#isDateTime}}{{setter}}(ModelBase::dateFromJson(val[U("{{baseName}}")])); - {{/isDateTime}}{{^isDateTime}}{{#vendorExtensions.x-codegen-file}}{{setter}}(ModelBase::fileFromJson(val[U("{{baseName}}")])); - {{/vendorExtensions.x-codegen-file}}{{^vendorExtensions.x-codegen-file}}{{{datatype}}} new{{name}}({{{defaultValue}}}); + {{/required}} + {{#required}} + {{#isString}} + {{setter}}(ModelBase::stringFromJson(val[U("{{baseName}}")])); + {{/isString}} + {{^isString}} + {{#isDateTime}} + {{setter}} + (ModelBase::dateFromJson(val[U("{{baseName}}")])); + {{/isDateTime}} + {{^isDateTime}} + {{#vendorExtensions.x-codegen-file}} + {{setter}}(ModelBase::fileFromJson(val[U("{{baseName}}")])); + {{/vendorExtensions.x-codegen-file}} + {{^vendorExtensions.x-codegen-file}} + {{{datatype}}} new{{name}}({{{defaultValue}}}); new{{name}}->fromJson(val[U("{{baseName}}")]); {{setter}}( new{{name}} ); - {{/vendorExtensions.x-codegen-file}}{{/isDateTime}}{{/isString}}{{/required}}{{/isPrimitiveType}}{{/isListContainer}}{{/isInherited}}{{/vars}} + {{/vendorExtensions.x-codegen-file}} + {{/isDateTime}} + {{/isString}} + {{/required}} + {{/isPrimitiveType}} + {{/isMapContainer}} + {{/isListContainer}} + {{/isInherited}} + {{/vars}} } void {{classname}}::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const @@ -125,12 +296,24 @@ void {{classname}}::toMultipart(std::shared_ptr multipart, co namePrefix += U("."); } - {{#vars}}{{#isPrimitiveType}}{{^isListContainer}}{{^required}}if(m_{{name}}IsSet) + {{#vars}} + {{#isPrimitiveType}} + {{^isMapContainer}} + {{^isListContainer}} + {{^required}} + if(m_{{name}}IsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); } - {{/required}}{{#required}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); - {{/required}}{{/isListContainer}}{{/isPrimitiveType}}{{#isListContainer}}{ + {{/required}} + {{#required}} + multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); + {{/required}} + {{/isListContainer}} + {{/isMapContainer}} + {{/isPrimitiveType}} + {{#isListContainer}} + { std::vector jsonArray; for( auto& item : m_{{name}} ) { @@ -144,7 +327,31 @@ void {{classname}}::toMultipart(std::shared_ptr multipart, co } {{/required}} } - {{/isListContainer}}{{^isListContainer}}{{^isPrimitiveType}}{{^required}}if(m_{{name}}IsSet) + {{/isListContainer}} + {{#isMapContainer}} + { + std::vector jsonArray; + for( auto& item : m_{{name}} ) + { + web::json::value tmp = web::json::value::object(); + tmp[U("key")] = ModelBase::toJson(item.first); + tmp[U("value")] = ModelBase::toJson(item.second); + jsonArray.push_back(tmp); + } + {{#required}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), web::json::value::array(jsonArray), U("application/json"))); + {{/required}}{{^required}} + if(jsonArray.size() > 0) + { + multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), web::json::value::array(jsonArray), U("application/json"))); + } + {{/required}} + } + {{/isMapContainer}} + {{^isListContainer}} + {{^isMapContainer}} + {{^isPrimitiveType}} + {{^required}} + if(m_{{name}}IsSet) { {{#isString}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); {{/isString}}{{^isString}}{{#isDateTime}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); @@ -154,11 +361,29 @@ void {{classname}}::toMultipart(std::shared_ptr multipart, co } {{/isDateTime}}{{/isString}} } - {{/required}}{{#required}}{{#isString}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); - {{/isString}}{{^isString}}{{#isDateTime}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); - {{/isDateTime}}{{^isDateTime}}{{#vendorExtensions.x-codegen-file}}multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); - {{/vendorExtensions.x-codegen-file}}{{^vendorExtensions.x-codegen-file}}m_{{name}}->toMultipart(multipart, U("{{baseName}}.")); - {{/vendorExtensions.x-codegen-file}}{{/isDateTime}}{{/isString}}{{/required}}{{/isPrimitiveType}}{{/isListContainer}}{{/vars}} + {{/required}} + {{#required}} + {{#isString}} + multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); + {{/isString}} + {{^isString}} + {{#isDateTime}} + multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); + {{/isDateTime}} + {{^isDateTime}} + {{#vendorExtensions.x-codegen-file}} + multipart->add(ModelBase::toHttpContent(namePrefix + U("{{baseName}}"), m_{{name}})); + {{/vendorExtensions.x-codegen-file}} + {{^vendorExtensions.x-codegen-file}} + m_{{name}}->toMultipart(multipart, U("{{baseName}}.")); + {{/vendorExtensions.x-codegen-file}} + {{/isDateTime}} + {{/isString}} + {{/required}} + {{/isPrimitiveType}} + {{/isMapContainer}} + {{/isListContainer}} + {{/vars}} } void {{classname}}::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) @@ -169,24 +394,45 @@ void {{classname}}::fromMultiPart(std::shared_ptr multipart, namePrefix += U("."); } - {{#vars}}{{#isPrimitiveType}}{{^isListContainer}}{{^required}}if(multipart->hasContent(U("{{baseName}}"))) + {{#vars}} + {{#isPrimitiveType}} + {{^isListContainer}} + {{^isMapContainer}} + {{^required}} + if(multipart->hasContent(U("{{baseName}}"))) { {{setter}}(ModelBase::{{baseType}}FromHttpContent(multipart->getContent(U("{{baseName}}")))); } - {{/required}}{{#required}}{{setter}}(ModelBase::{{baseType}}FromHttpContent(multipart->getContent(U("{{baseName}}")))); - {{/required}}{{/isListContainer}}{{/isPrimitiveType}}{{#isListContainer}}{ + {{/required}} + {{#required}} + {{setter}}(ModelBase::{{baseType}}FromHttpContent(multipart->getContent(U("{{baseName}}")))); + {{/required}} + {{/isMapContainer}} + {{/isListContainer}} + {{/isPrimitiveType}} + {{#isListContainer}} + { m_{{name}}.clear(); - {{^required}}if(multipart->hasContent(U("{{baseName}}"))) + {{^required}} + if(multipart->hasContent(U("{{baseName}}"))) { {{/required}} web::json::value jsonArray = web::json::value::parse(ModelBase::stringFromHttpContent(multipart->getContent(U("{{baseName}}")))); for( auto& item : jsonArray.as_array() ) { - {{#isPrimitiveType}}m_{{name}}.push_back(ModelBase::{{items.baseType}}FromJson(item)); - {{/isPrimitiveType}}{{^isPrimitiveType}}{{#items.isString}}m_{{name}}.push_back(ModelBase::stringFromJson(item)); - {{/items.isString}}{{^items.isString}}{{#items.isDateTime}}m_{{name}}.push_back(ModelBase::dateFromJson(item)); - {{/items.isDateTime}}{{^items.isDateTime}} + {{#isPrimitiveType}} + m_{{name}}.push_back(ModelBase::{{items.baseType}}FromJson(item)); + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#items.isString}} + m_{{name}}.push_back(ModelBase::stringFromJson(item)); + {{/items.isString}} + {{^items.isString}} + {{#items.isDateTime}} + m_{{name}}.push_back(ModelBase::dateFromJson(item)); + {{/items.isDateTime}} + {{^items.isDateTime}} if(item.is_null()) { m_{{name}}.push_back( {{{items.datatype}}}(nullptr) ); @@ -197,60 +443,153 @@ void {{classname}}::fromMultiPart(std::shared_ptr multipart, newItem->fromJson(item); m_{{name}}.push_back( newItem ); } - {{/items.isDateTime}}{{/items.isString}}{{/isPrimitiveType}} + {{/items.isDateTime}} + {{/items.isString}} + {{/isPrimitiveType}} } {{^required}} } {{/required}} } - {{/isListContainer}}{{^isListContainer}}{{^isPrimitiveType}}{{^required}}if(multipart->hasContent(U("{{baseName}}"))) + {{/isListContainer}} + {{#isMapContainer}} { - {{#isString}}{{setter}}(ModelBase::stringFromHttpContent(multipart->getContent(U("{{baseName}}")))); - {{/isString}}{{^isString}}{{#isDateTime}}{{setter}}(ModelBase::dateFromHttpContent(multipart->getContent(U("{{baseName}}")))); - {{/isDateTime}}{{^isDateTime}}if(multipart->hasContent(U("{{baseName}}"))) + m_{{name}}.clear(); + {{^required}} + if(multipart->hasContent(U("{{baseName}}"))) + { + {{/required}} + + web::json::value jsonArray = web::json::value::parse(ModelBase::stringFromHttpContent(multipart->getContent(U("{{baseName}}")))); + for( auto& item : jsonArray.as_array() ) + { + utility::string_t key; + if(item.has_field(U("key"))) + { + key = ModelBase::stringFromJson(item[U("key")]); + } + {{#items.isPrimitiveType}} + m_{{name}}.insert(std::pair( key, ModelBase::{{items.baseType}}FromJson(item[U("value")]))); + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isString}} + m_{{name}}.insert(std::pair( key, ModelBase::stringFromJson(item[U("value")]))); + {{/items.isString}} + {{^items.isString}} + {{#items.isDateTime}} + m_{{name}}.insert(std::pair( key, ModelBase::dateFromJson(item[U("value")]))); + {{/items.isDateTime}} + {{^items.isDateTime}} + if(item.is_null()) + { + m_{{name}}.insert(std::pair( key, {{{items.datatype}}}(nullptr) )); + } + else + { + {{{items.datatype}}} newItem({{{items.defaultValue}}}); + newItem->fromJson(item[U("value")]); + m_{{name}}.insert(std::pair( key, newItem )); + } + {{/items.isDateTime}} + {{/items.isString}} + {{/items.isPrimitiveType}} + } + {{^required}} + } + {{/required}} + } + {{/isMapContainer}} + {{^isListContainer}} + {{^isMapContainer}} + {{^isPrimitiveType}} + {{^required}} + if(multipart->hasContent(U("{{baseName}}"))) + { + {{#isString}} + {{setter}}(ModelBase::stringFromHttpContent(multipart->getContent(U("{{baseName}}")))); + {{/isString}} + {{^isString}} + {{#isDateTime}} + {{setter}}(ModelBase::dateFromHttpContent(multipart->getContent(U("{{baseName}}")))); + {{/isDateTime}} + {{^isDateTime}} + if(multipart->hasContent(U("{{baseName}}"))) { {{{datatype}}} newItem({{{defaultValue}}}); newItem->fromMultiPart(multipart, U("{{baseName}}.")); {{setter}}( newItem ); } - {{/isDateTime}}{{/isString}} + {{/isDateTime}} + {{/isString}} } - {{/required}}{{#required}}{{#isString}}{{setter}}(ModelBase::stringFromHttpContent(multipart->getContent(U("{{baseName}}")))); - {{/isString}}{{^isString}}{{#isDateTime}}{{setter}}(ModelBase::dateFromHttpContent(multipart->getContent(U("{{baseName}}")))); - {{/isDateTime}}{{^isDateTime}}{{#vendorExtensions.x-codegen-file}}{{setter}}(multipart->getContent(U("{{baseName}}"))); - {{/vendorExtensions.x-codegen-file}}{{^vendorExtensions.x-codegen-file}}{{{datatype}}} new{{name}}({{{defaultValue}}}); + {{/required}} + {{#required}} + {{#isString}} + {{setter}}(ModelBase::stringFromHttpContent(multipart->getContent(U("{{baseName}}")))); + {{/isString}} + {{^isString}} + {{#isDateTime}} + {{setter}}(ModelBase::dateFromHttpContent(multipart->getContent(U("{{baseName}}")))); + {{/isDateTime}} + {{^isDateTime}} + {{#vendorExtensions.x-codegen-file}} + {{setter}}(multipart->getContent(U("{{baseName}}"))); + {{/vendorExtensions.x-codegen-file}} + {{^vendorExtensions.x-codegen-file}} + {{{datatype}}} new{{name}}({{{defaultValue}}}); new{{name}}->fromMultiPart(multipart, U("{{baseName}}.")); {{setter}}( new{{name}} ); - {{/vendorExtensions.x-codegen-file}}{{/isDateTime}}{{/isString}}{{/required}}{{/isPrimitiveType}}{{/isListContainer}}{{/vars}} + {{/vendorExtensions.x-codegen-file}} + {{/isDateTime}} + {{/isString}} + {{/required}} + {{/isPrimitiveType}} + {{/isMapContainer}} + {{/isListContainer}} + {{/vars}} } - -{{#vars}}{{^isInherited}}{{^isNotContainer}}{{{datatype}}}& {{classname}}::{{getter}}() -{ - return m_{{name}}; -} -{{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{classname}}::{{getter}}() const +{{#vars}} +{{^isInherited}} +{{^isNotContainer}} +{{{datatype}}}& {{classname}}::{{getter}}() { return m_{{name}}; } + void {{classname}}::{{setter}}({{{datatype}}} value) { m_{{name}} = value; {{^required}}m_{{name}}IsSet = true;{{/required}} } {{/isNotContainer}} -{{^required}}bool {{classname}}::{{baseName}}IsSet() const +{{#isNotContainer}} +{{{datatype}}} {{classname}}::{{getter}}() const +{ + return m_{{name}}; +} + + +void {{classname}}::{{setter}}({{{datatype}}} value) +{ + m_{{name}} = value; + {{^required}}m_{{name}}IsSet = true;{{/required}} +} +{{/isNotContainer}} +{{^required}} +bool {{classname}}::{{baseName}}IsSet() const { return m_{{name}}IsSet; } + void {{classname}}::unset{{name}}() { m_{{name}}IsSet = false; } + {{/required}} {{/isInherited}} {{/vars}} - {{#modelNamespaceDeclarations}} } {{/modelNamespaceDeclarations}} diff --git a/modules/swagger-codegen/src/main/resources/powershell/Build.ps1.mustache b/modules/swagger-codegen/src/main/resources/powershell/Build.ps1.mustache new file mode 100644 index 00000000000..4cb78dce827 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/Build.ps1.mustache @@ -0,0 +1,86 @@ +function Get-FunctionsToExport { + [CmdletBinding()] + Param ( + [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [Alias('FullName')] + $Path + ) + + Process { + $Token = $null + $ParserErr = $null + + $Ast = [System.Management.Automation.Language.Parser]::ParseFile( + $Path, + [ref]$Token, + [ref]$ParserErr + ) + + if ($ParserErr) { + throw $ParserErr + } else { + foreach ($name in 'Begin', 'Process', 'End') { + foreach ($Statement in $Ast."${name}Block".Statements) { + if ( + [String]::IsNullOrWhiteSpace($Statement.Name) -or + $Statement.Extent.ToString() -notmatch + ('function\W+{0}' -f $Statement.Name) + ) { + continue + } + + $Statement.Name + } + } + } + } +} + +$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path +$ClientPath = ("{{{csharpClientPath}}}" | Resolve-Path).ProviderPath +$FunctionPath = 'API', 'Model' | ForEach-Object {Join-Path "$ScriptDir\src\{{{packageName}}}\" $_} +$BinPath = "$ScriptDir\src\{{{packageName}}}\Bin" + +Start-Process -FilePath "$ClientPath\build.bat" -WorkingDirectory $ClientPath -Wait -NoNewWindow + +if (!(Test-Path "$ScriptDir\src\{{{packageName}}}\Bin" -PathType Container)) { + New-Item "$ScriptDir\src\{{{packageName}}}\Bin" -ItemType Directory > $null +} + +Copy-Item "$ClientPath\bin\*.dll" $BinPath + +$Manifest = @{ + Path = "$ScriptDir\src\{{{packageName}}}\{{{packageName}}}.psd1" + + Author = 'Swagger Codegen Team' + CompanyName = 'swagger.io' + Description = '{{{packageName}}} - the PowerShell module for {{{appName}}}' + + RootModule = '{{{packageName}}}.psm1' + Guid = '{{packageGuid}}' # Has to be static, otherwise each new build will be considered different module + + PowerShellVersion = '3.0' + + RequiredAssemblies = Get-ChildItem "$BinPath\*.dll" | ForEach-Object { + Join-Path $_.Directory.Name $_.Name + } + + FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport + + VariablesToExport = @() + AliasesToExport = @() + CmdletsToExport = @() + + # Should we use prefix to prevent command name collisions? + # https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/ + # + # Kirk Munro recommends against it: + # https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/#comment-20820 + # + # If not, we'd need to generate functions name with prefix. + # + # DefaultCommandPrefix = 'PetStore' +} + +New-ModuleManifest @Manifest diff --git a/modules/swagger-codegen/src/main/resources/powershell/Get-CommonParameters.ps1 b/modules/swagger-codegen/src/main/resources/powershell/Get-CommonParameters.ps1 new file mode 100644 index 00000000000..31a0a1ff3af --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/Get-CommonParameters.ps1 @@ -0,0 +1,14 @@ +<# +.Synopsis + Helper function to get common parameters (Verbose, Debug, etc.) +.Example + Get-CommonParameters +#> +function Get-CommonParameters { + function tmp { + [CmdletBinding()] + Param () + } + + (Get-Command -Name tmp -CommandType Function).Parameters.Keys +} diff --git a/modules/swagger-codegen/src/main/resources/powershell/IO.Swagger.psm1.mustache b/modules/swagger-codegen/src/main/resources/powershell/IO.Swagger.psm1.mustache new file mode 100644 index 00000000000..6d0339a2b4e --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/IO.Swagger.psm1.mustache @@ -0,0 +1,33 @@ +#region Import functions + +'API', 'Model', 'Private' | Get-ChildItem -Path { + Join-Path $PSScriptRoot $_ +} -Filter '*.ps1' | ForEach-Object { + Write-Verbose "Importing file: $($_.BaseName)" + try { + . $_.FullName + } catch { + Write-Verbose "Can't import function!" + } +} + +#endregion + + +#region Initialize APIs + +{{#apiInfo}} +{{#apis}} +{{#operations}} +{{#operation}} +{{#-first}} +'Creating object: {{{packageName}}}.Api.{{{classname}}}' | Write-Verbose +$Script:{{{classname}}}= New-Object -TypeName {{{packageName}}}.Api.{{{classname}}} -ArgumentList @($null) + +{{/-first}} +{{/operation}} +{{/operations}} +{{/apis}} +{{/apiInfo}} + +#endregion diff --git a/modules/swagger-codegen/src/main/resources/powershell/Out-DebugParameter.ps1 b/modules/swagger-codegen/src/main/resources/powershell/Out-DebugParameter.ps1 new file mode 100644 index 00000000000..ca18c391cc1 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/Out-DebugParameter.ps1 @@ -0,0 +1,37 @@ +<# +.Synopsis + Helper function to format debug parameter output. +.Example + $PSBoundParameters | Out-DebugParameter | Write-Debug +#> +function Out-DebugParameter { + [CmdletBinding()] + Param ( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [AllowEmptyCollection()] + $InputObject + ) + + Begin { + $CommonParameters = Get-CommonParameters + } + + Process { + $InputObject.GetEnumerator() | Where-Object { + $CommonParameters -notcontains $_.Key + } | Format-Table -AutoSize -Property ( + @{ + Name = 'Parameter' + Expression = {$_.Key} + }, + @{ + Name = 'Value' + Expression = {$_.Value} + } + ) | Out-String -Stream | ForEach-Object { + if ($_.Trim()) { + $_ + } + } + } +} diff --git a/modules/swagger-codegen/src/main/resources/powershell/README.mustache b/modules/swagger-codegen/src/main/resources/powershell/README.mustache new file mode 100644 index 00000000000..e1351f54373 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/README.mustache @@ -0,0 +1,38 @@ +# {{packageName}} - the PowerShell module for the {{appName}} + +{{#appDescription}} +{{{appDescription}}} +{{/appDescription}} + +This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: {{appVersion}} +- SDK version: {{packageVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + + +## Frameworks supported +- PowerShell 3.0 or later + + +## Dependencies +- C# API client generated by Swagger Codegen AND should be located in {{{csharpClientPath}}} as stated in Build.ps1 + + +## Installation +Run the following command to generate the DLL +- [Windows] `Build.ps1` + +Then import module from the .\src\{{{packageName}}} folder: +```powershell +using {{packageName}}.{{apiPackage}}; +using {{packageName}}.Client; +using {{packageName}}.{{modelPackage}}; +``` + diff --git a/modules/swagger-codegen/src/main/resources/powershell/about_IO.Swagger.help.txt.mustache b/modules/swagger-codegen/src/main/resources/powershell/about_IO.Swagger.help.txt.mustache new file mode 100644 index 00000000000..c711fad9169 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/about_IO.Swagger.help.txt.mustache @@ -0,0 +1,27 @@ +PSTOPIC + about_{{{packageName}}} + +SHORT DESCRIPTION + {{{packageName}}} - the PowerShell module for the {{{appName}}} + +LONG DESCRIPTION +{{#appDescription}} + {{{appDescription}}} + +{{/appDescription}} + This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + + - API version: {{appVersion}} + - SDK version: {{packageVersion}} + {{^hideGenerationTimestamp}} + - Build date: {{generatedDate}} + {{/hideGenerationTimestamp}} + - Build package: {{{generatorClass}}} + {{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) + {{/infoUrl}} + + Frameworks supported: + + * PowerShell 3.0+ + * .NET 4.0 or later diff --git a/modules/swagger-codegen/src/main/resources/powershell/api.mustache b/modules/swagger-codegen/src/main/resources/powershell/api.mustache new file mode 100644 index 00000000000..98fb6bb7d16 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/api.mustache @@ -0,0 +1,30 @@ +{{#operations}} +{{#operation}} +function Invoke-{{{classname}}}{{{operationId}}} { + [CmdletBinding()] + Param ( + {{#allParams}} + [Parameter(Position = {{vendorExtensions.x-index}}, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = {{#required}}$true{{/required}}{{^required}}$false{{/required}})] + [{{^isContainer}}{{^isPrimitiveType}}{{^isFile}}{{{packageName}}}.Model.{{/isFile}}{{/isPrimitiveType}}{{/isContainer}}{{{dataType}}}] + {{=<% %>=}} + ${<%paramName%>}<%^-last%>,<%/-last%> + <%={{ }}=%> + {{/allParams}} + ) + + Process { + 'Calling method: {{{classname}}}-{{{operationId}}}' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:{{{classname}}}.{{{operationId}}}( + {{#allParams}} + {{=<% %>=}} + ${<%paramName%>}<%^-last%>,<%/-last%> + <%={{ }}=%> + {{/allParams}} + ) + } +} + +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/powershell/api_doc.mustache b/modules/swagger-codegen/src/main/resources/powershell/api_doc.mustache new file mode 100644 index 00000000000..ff3cf4fc60a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/api_doc.mustache @@ -0,0 +1,105 @@ +# {{packageName}}.{{apiPackage}}.{{classname}}{{#description}} +{{description}}{{/description}} + +All URIs are relative to *{{{basePath}}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} + +# **{{{operationId}}}** +> {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + +### Example +```csharp +using System; +using System.Diagnostics; +using {{packageName}}.{{apiPackage}}; +using {{packageName}}.Client; +using {{packageName}}.{{modelPackage}}; + +namespace Example +{ + public class {{operationId}}Example + { + public void main() + { + {{#hasAuthMethods}} + {{#authMethods}} + {{#isBasic}} + // Configure HTTP basic authorization: {{{name}}} + Configuration.Default.Username = "YOUR_USERNAME"; + Configuration.Default.Password = "YOUR_PASSWORD"; + {{/isBasic}} + {{#isApiKey}} + // Configure API key authorization: {{{name}}} + Configuration.Default.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer"); + {{/isApiKey}} + {{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + {{/isOAuth}} + {{/authMethods}} + + {{/hasAuthMethods}} + var apiInstance = new {{classname}}(); + {{#allParams}} + {{#isPrimitiveType}} + var {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/isPrimitiveType}} + {{/allParams}} + + try + { + {{#summary}} + // {{{.}}} + {{/summary}} + {{#returnType}}{{returnType}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + Debug.WriteLine(result);{{/returnType}} + } + catch (Exception e) + { + Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message ); + } + } + } +} +``` + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{#isContainer}}{{baseType}}{{/isContainer}}{{^isContainer}}{{dataType}}{{/isContainer}}.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}}void (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}} + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/powershell/api_test.mustache b/modules/swagger-codegen/src/main/resources/powershell/api_test.mustache new file mode 100644 index 00000000000..b85e6df53df --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/api_test.mustache @@ -0,0 +1,17 @@ +# This file is auto-generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen) +# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function + +Describe '{{{packageName}}} {{{classname}}}' { +{{#operations}} +{{#operation}} + Context '{{{classname}}}' { + It 'Invoke-{{{classname}}}{{{operationId}}}' { + $ret = Invoke-PetApiGetPetById{{#allParams}} -{{{paramName}}} "TEST_VALUE"{{/allParams}} + #$ret | Should BeOfType {{{packageName}}}.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + +{{/operation}} +{{/operations}} +} diff --git a/modules/swagger-codegen/src/main/resources/powershell/model.mustache b/modules/swagger-codegen/src/main/resources/powershell/model.mustache new file mode 100644 index 00000000000..f3580e2a4c4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/model.mustache @@ -0,0 +1,29 @@ +{{#models}} +{{#model}} +function New-{{{classname}}} { + [CmdletBinding()] + Param ( +{{#vars}} + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true{{#required}}, Mandatory = $true{{/required}})] + [{{#isString}}{{{datatype}}}{{/isString}}{{^isString}}{{^required}}System.Nullable[{{/required}}{{datatype}}{{^required}}]{{/required}}{{/isString}}] + {{=<% %>=}} + ${<%name%>}<%^-last%>,<%/-last%> + <%={{ }}=%> +{{/vars}} + ) + + Process { + 'Creating object: {{{packageName}}}.Model.{{{classname}}}' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName {{{packageName}}}.Model.{{{classname}}} -ArgumentList @( +{{#vars}} + {{=<% %>=}} + ${<%name%>}<%^-last%>,<%/-last%> + <%={{ }}=%> +{{/vars}} + ) + } +} +{{/model}} +{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/powershell/model_doc.mustache b/modules/swagger-codegen/src/main/resources/powershell/model_doc.mustache new file mode 100644 index 00000000000..112d4725495 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/model_doc.mustache @@ -0,0 +1,14 @@ +{{#models}} +{{#model}} +# {{{packageName}}}.{{modelPackage}}.{{{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}} +{{/vars}} + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}} +{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/powershell/model_test.mustache b/modules/swagger-codegen/src/main/resources/powershell/model_test.mustache new file mode 100644 index 00000000000..e61c02beb47 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/powershell/model_test.mustache @@ -0,0 +1,6 @@ +{{#models}} +{{#model}} +## TODO we need to update the template to test the model files + +{{/model}} +{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/python/rest.mustache b/modules/swagger-codegen/src/main/resources/python/rest.mustache index 6c2c21d3055..b801938dc52 100644 --- a/modules/swagger-codegen/src/main/resources/python/rest.mustache +++ b/modules/swagger-codegen/src/main/resources/python/rest.mustache @@ -206,7 +206,7 @@ class RESTClientObject(object): # log response body logger.debug("response body: %s", r.data) - if r.status not in range(200, 206): + if not 200 <= r.status <= 299: raise ApiException(http_resp=r) return r diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache index 3efdde28cc3..998defc4828 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/HttpRequest.cpp.mustache @@ -4,6 +4,7 @@ #include #include #include +#include {{#cppNamespaceDeclarations}} @@ -283,8 +284,16 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { manager->deleteResource(request); } else { - QBuffer buff(&request_content); - manager->sendCustomRequest(request, input->http_method.toLatin1(), &buff); +#if (QT_VERSION >= 0x050800) + manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); +#else + QBuffer *buffer = new QBuffer; + buffer->setData(request_content); + buffer->open(QIODevice::ReadOnly); + + QNetworkReply* reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); + buffer->setParent(reply); +#endif } } diff --git a/modules/swagger-codegen/src/main/resources/restbed/model-header.mustache b/modules/swagger-codegen/src/main/resources/restbed/model-header.mustache index 634472e9a3a..30f586fb5e8 100644 --- a/modules/swagger-codegen/src/main/resources/restbed/model-header.mustache +++ b/modules/swagger-codegen/src/main/resources/restbed/model-header.mustache @@ -37,10 +37,8 @@ public: /// /// {{description}} /// - {{^isNotContainer}}{{{datatype}}}& {{getter}}(); - {{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{getter}}() const; + {{{datatype}}} {{getter}}() const; void {{setter}}({{{datatype}}} value); - {{/isNotContainer}} {{/vars}} protected: diff --git a/modules/swagger-codegen/src/main/resources/restbed/model-source.mustache b/modules/swagger-codegen/src/main/resources/restbed/model-source.mustache index c93f8d79321..ea2f969c189 100644 --- a/modules/swagger-codegen/src/main/resources/restbed/model-source.mustache +++ b/modules/swagger-codegen/src/main/resources/restbed/model-source.mustache @@ -73,11 +73,8 @@ void {{classname}}::fromJsonString(std::string const& jsonString) {{/vars}} } -{{#vars}}{{^isNotContainer}}{{{datatype}}}& {{classname}}::{{getter}}() -{ - return m_{{name}}; -} -{{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{classname}}::{{getter}}() const +{{#vars}} +{{{datatype}}} {{classname}}::{{getter}}() const { return m_{{name}}; } @@ -85,7 +82,6 @@ void {{classname}}::{{setter}}({{{datatype}}} value) { m_{{name}} = value; } -{{/isNotContainer}} {{/vars}} {{#modelNamespaceDeclarations}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache index 2f3b55bbccf..eac59ada743 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache @@ -133,14 +133,14 @@ export class {{classname}} { // to determine the Content-Type header let consumes: string[] = [ {{#consumes}} - '{{{mediaType}}}'{{#hasMore}}, {{/hasMore}} + '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} {{/consumes}} ]; // to determine the Accept header let produces: string[] = [ {{#produces}} - '{{{mediaType}}}'{{#hasMore}}, {{/hasMore}} + '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} {{/produces}} ]; diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache index f5cdcf76e94..29b7e5b1d71 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache @@ -1,9 +1,9 @@ -import { {{{injectionToken}}} } from '@angular/core'; +import { OpaqueToken } from '@angular/core'; -export const BASE_PATH = new {{{injectionToken}}}('basePath'); +export const BASE_PATH = new OpaqueToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java index f7d430c1f4c..fd5961b99bd 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java @@ -36,7 +36,6 @@ public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider .put(TypeScriptAngular2ClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString()) .put(TypeScriptAngular2ClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) - .put(TypeScriptAngular2ClientCodegen.USE_OPAQUE_TOKEN, Boolean.FALSE.toString()) .build(); } diff --git a/pom.xml b/pom.xml index 5be36e059f9..df759a700ca 100644 --- a/pom.xml +++ b/pom.xml @@ -814,8 +814,9 @@ samples/client/petstore/swift/default/SwaggerClientTests samples/client/petstore/swift/promisekit/SwaggerClientTests samples/client/petstore/swift/rxswift/SwaggerClientTests + diff --git a/run-in-docker.sh b/run-in-docker.sh index 8cf6cc64de2..6777d9a31b5 100755 --- a/run-in-docker.sh +++ b/run-in-docker.sh @@ -11,7 +11,7 @@ docker run --rm -it \ -w /gen \ -e GEN_DIR=/gen \ -e MAVEN_CONFIG=/var/maven/.m2 \ - -u "$(id -u):$(id -u)" \ + -u "$(id -u):$(id -g)" \ -v "${PWD}:/gen" \ -v "${maven_cache_repo}:/var/maven/.m2/repository" \ --entrypoint /gen/docker-entrypoint.sh \ diff --git a/samples/client/petstore-security-test/javascript/src/ApiClient.js b/samples/client/petstore-security-test/javascript/src/ApiClient.js index 4557fa86df5..b7eb8adcbdc 100644 --- a/samples/client/petstore-security-test/javascript/src/ApiClient.js +++ b/samples/client/petstore-security-test/javascript/src/ApiClient.js @@ -173,12 +173,15 @@ * @returns {Boolean} true if param 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; + // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) + if (typeof require === 'function') { + var fs; + try { + fs = require('fs'); + } catch (err) {} + if (fs && fs.ReadStream && param instanceof fs.ReadStream) { + return true; + } } // Buffer in Node.js if (typeof Buffer === 'function' && param instanceof Buffer) { diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp b/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp index 589921db798..2300fb2753b 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGHttpRequest.cpp @@ -15,6 +15,7 @@ #include #include #include +#include namespace Swagger { @@ -292,8 +293,16 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { manager->deleteResource(request); } else { - QBuffer buff(&request_content); - manager->sendCustomRequest(request, input->http_method.toLatin1(), &buff); +#if (QT_VERSION >= 0x050800) + manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); +#else + QBuffer *buffer = new QBuffer; + buffer->setData(request_content); + buffer->open(QIODevice::ReadOnly); + + QNetworkReply* reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); + buffer->setParent(reply); +#endif } } diff --git a/samples/client/petstore/cpprest/model/ApiResponse.cpp b/samples/client/petstore/cpprest/model/ApiResponse.cpp index d7aea45f956..d2f4238deeb 100644 --- a/samples/client/petstore/cpprest/model/ApiResponse.cpp +++ b/samples/client/petstore/cpprest/model/ApiResponse.cpp @@ -27,7 +27,6 @@ ApiResponse::ApiResponse() m_TypeIsSet = false; m_Message = U(""); m_MessageIsSet = false; - } ApiResponse::~ApiResponse() @@ -41,7 +40,6 @@ void ApiResponse::validate() web::json::value ApiResponse::toJson() const { - web::json::value val = web::json::value::object(); if(m_CodeIsSet) @@ -56,15 +54,12 @@ web::json::value ApiResponse::toJson() const { val[U("message")] = ModelBase::toJson(m_Message); } - return val; } void ApiResponse::fromJson(web::json::value& val) { - - if(val.has_field(U("code"))) { setCode(ModelBase::int32_tFromJson(val[U("code")])); @@ -72,14 +67,11 @@ void ApiResponse::fromJson(web::json::value& val) if(val.has_field(U("type"))) { setType(ModelBase::stringFromJson(val[U("type")])); - } if(val.has_field(U("message"))) { setMessage(ModelBase::stringFromJson(val[U("message")])); - } - } void ApiResponse::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const @@ -104,7 +96,6 @@ void ApiResponse::toMultipart(std::shared_ptr multipart, cons multipart->add(ModelBase::toHttpContent(namePrefix + U("message"), m_Message)); } - } void ApiResponse::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) @@ -122,21 +113,19 @@ void ApiResponse::fromMultiPart(std::shared_ptr multipart, co if(multipart->hasContent(U("type"))) { setType(ModelBase::stringFromHttpContent(multipart->getContent(U("type")))); - } if(multipart->hasContent(U("message"))) { setMessage(ModelBase::stringFromHttpContent(multipart->getContent(U("message")))); - } - } - int32_t ApiResponse::getCode() const { return m_Code; } + + void ApiResponse::setCode(int32_t value) { m_Code = value; @@ -146,14 +135,18 @@ bool ApiResponse::codeIsSet() const { return m_CodeIsSet; } + void ApiResponse::unsetCode() { m_CodeIsSet = false; } + utility::string_t ApiResponse::getType() const { return m_Type; } + + void ApiResponse::setType(utility::string_t value) { m_Type = value; @@ -163,14 +156,18 @@ bool ApiResponse::typeIsSet() const { return m_TypeIsSet; } + void ApiResponse::unsetType() { m_TypeIsSet = false; } + utility::string_t ApiResponse::getMessage() const { return m_Message; } + + void ApiResponse::setMessage(utility::string_t value) { m_Message = value; @@ -180,6 +177,7 @@ bool ApiResponse::messageIsSet() const { return m_MessageIsSet; } + void ApiResponse::unsetMessage() { m_MessageIsSet = false; diff --git a/samples/client/petstore/cpprest/model/ApiResponse.h b/samples/client/petstore/cpprest/model/ApiResponse.h index 1f8e7feb2bc..ec0a3a1b012 100644 --- a/samples/client/petstore/cpprest/model/ApiResponse.h +++ b/samples/client/petstore/cpprest/model/ApiResponse.h @@ -57,23 +57,23 @@ public: /// /// int32_t getCode() const; - void setCode(int32_t value); bool codeIsSet() const; void unsetCode(); + void setCode(int32_t value); /// /// /// utility::string_t getType() const; - void setType(utility::string_t value); bool typeIsSet() const; void unsetType(); + void setType(utility::string_t value); /// /// /// utility::string_t getMessage() const; - void setMessage(utility::string_t value); bool messageIsSet() const; void unsetMessage(); + void setMessage(utility::string_t value); protected: int32_t m_Code; diff --git a/samples/client/petstore/cpprest/model/Category.cpp b/samples/client/petstore/cpprest/model/Category.cpp index 57777c42271..4d185607149 100644 --- a/samples/client/petstore/cpprest/model/Category.cpp +++ b/samples/client/petstore/cpprest/model/Category.cpp @@ -25,7 +25,6 @@ Category::Category() m_IdIsSet = false; m_Name = U(""); m_NameIsSet = false; - } Category::~Category() @@ -39,7 +38,6 @@ void Category::validate() web::json::value Category::toJson() const { - web::json::value val = web::json::value::object(); if(m_IdIsSet) @@ -50,15 +48,12 @@ web::json::value Category::toJson() const { val[U("name")] = ModelBase::toJson(m_Name); } - return val; } void Category::fromJson(web::json::value& val) { - - if(val.has_field(U("id"))) { setId(ModelBase::int64_tFromJson(val[U("id")])); @@ -66,9 +61,7 @@ void Category::fromJson(web::json::value& val) if(val.has_field(U("name"))) { setName(ModelBase::stringFromJson(val[U("name")])); - } - } void Category::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const @@ -88,7 +81,6 @@ void Category::toMultipart(std::shared_ptr multipart, const u multipart->add(ModelBase::toHttpContent(namePrefix + U("name"), m_Name)); } - } void Category::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) @@ -106,16 +98,15 @@ void Category::fromMultiPart(std::shared_ptr multipart, const if(multipart->hasContent(U("name"))) { setName(ModelBase::stringFromHttpContent(multipart->getContent(U("name")))); - } - } - int64_t Category::getId() const { return m_Id; } + + void Category::setId(int64_t value) { m_Id = value; @@ -125,14 +116,18 @@ bool Category::idIsSet() const { return m_IdIsSet; } + void Category::unsetId() { m_IdIsSet = false; } + utility::string_t Category::getName() const { return m_Name; } + + void Category::setName(utility::string_t value) { m_Name = value; @@ -142,6 +137,7 @@ bool Category::nameIsSet() const { return m_NameIsSet; } + void Category::unsetName() { m_NameIsSet = false; diff --git a/samples/client/petstore/cpprest/model/Category.h b/samples/client/petstore/cpprest/model/Category.h index 88cc7148202..860918c0822 100644 --- a/samples/client/petstore/cpprest/model/Category.h +++ b/samples/client/petstore/cpprest/model/Category.h @@ -57,16 +57,16 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// utility::string_t getName() const; - void setName(utility::string_t value); bool nameIsSet() const; void unsetName(); + void setName(utility::string_t value); protected: int64_t m_Id; diff --git a/samples/client/petstore/cpprest/model/Order.cpp b/samples/client/petstore/cpprest/model/Order.cpp index a64b12f3683..b205701b76f 100644 --- a/samples/client/petstore/cpprest/model/Order.cpp +++ b/samples/client/petstore/cpprest/model/Order.cpp @@ -33,7 +33,6 @@ Order::Order() m_StatusIsSet = false; m_Complete = false; m_CompleteIsSet = false; - } Order::~Order() @@ -47,7 +46,6 @@ void Order::validate() web::json::value Order::toJson() const { - web::json::value val = web::json::value::object(); if(m_IdIsSet) @@ -74,15 +72,12 @@ web::json::value Order::toJson() const { val[U("complete")] = ModelBase::toJson(m_Complete); } - return val; } void Order::fromJson(web::json::value& val) { - - if(val.has_field(U("id"))) { setId(ModelBase::int64_tFromJson(val[U("id")])); @@ -98,18 +93,15 @@ void Order::fromJson(web::json::value& val) if(val.has_field(U("shipDate"))) { setShipDate(ModelBase::dateFromJson(val[U("shipDate")])); - } if(val.has_field(U("status"))) { setStatus(ModelBase::stringFromJson(val[U("status")])); - } if(val.has_field(U("complete"))) { setComplete(ModelBase::boolFromJson(val[U("complete")])); } - } void Order::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const @@ -146,7 +138,6 @@ void Order::toMultipart(std::shared_ptr multipart, const util { multipart->add(ModelBase::toHttpContent(namePrefix + U("complete"), m_Complete)); } - } void Order::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) @@ -172,25 +163,23 @@ void Order::fromMultiPart(std::shared_ptr multipart, const ut if(multipart->hasContent(U("shipDate"))) { setShipDate(ModelBase::dateFromHttpContent(multipart->getContent(U("shipDate")))); - } if(multipart->hasContent(U("status"))) { setStatus(ModelBase::stringFromHttpContent(multipart->getContent(U("status")))); - } if(multipart->hasContent(U("complete"))) { setComplete(ModelBase::boolFromHttpContent(multipart->getContent(U("complete")))); } - } - int64_t Order::getId() const { return m_Id; } + + void Order::setId(int64_t value) { m_Id = value; @@ -200,14 +189,18 @@ bool Order::idIsSet() const { return m_IdIsSet; } + void Order::unsetId() { m_IdIsSet = false; } + int64_t Order::getPetId() const { return m_PetId; } + + void Order::setPetId(int64_t value) { m_PetId = value; @@ -217,14 +210,18 @@ bool Order::petIdIsSet() const { return m_PetIdIsSet; } + void Order::unsetPetId() { m_PetIdIsSet = false; } + int32_t Order::getQuantity() const { return m_Quantity; } + + void Order::setQuantity(int32_t value) { m_Quantity = value; @@ -234,14 +231,18 @@ bool Order::quantityIsSet() const { return m_QuantityIsSet; } + void Order::unsetQuantity() { m_QuantityIsSet = false; } + utility::datetime Order::getShipDate() const { return m_ShipDate; } + + void Order::setShipDate(utility::datetime value) { m_ShipDate = value; @@ -251,14 +252,18 @@ bool Order::shipDateIsSet() const { return m_ShipDateIsSet; } + void Order::unsetShipDate() { m_ShipDateIsSet = false; } + utility::string_t Order::getStatus() const { return m_Status; } + + void Order::setStatus(utility::string_t value) { m_Status = value; @@ -268,14 +273,18 @@ bool Order::statusIsSet() const { return m_StatusIsSet; } + void Order::unsetStatus() { m_StatusIsSet = false; } + bool Order::getComplete() const { return m_Complete; } + + void Order::setComplete(bool value) { m_Complete = value; @@ -285,6 +294,7 @@ bool Order::completeIsSet() const { return m_CompleteIsSet; } + void Order::unsetComplete() { m_CompleteIsSet = false; diff --git a/samples/client/petstore/cpprest/model/Order.h b/samples/client/petstore/cpprest/model/Order.h index bd838e920e7..da065593b84 100644 --- a/samples/client/petstore/cpprest/model/Order.h +++ b/samples/client/petstore/cpprest/model/Order.h @@ -57,44 +57,44 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// int64_t getPetId() const; - void setPetId(int64_t value); bool petIdIsSet() const; void unsetPetId(); + void setPetId(int64_t value); /// /// /// int32_t getQuantity() const; - void setQuantity(int32_t value); bool quantityIsSet() const; void unsetQuantity(); + void setQuantity(int32_t value); /// /// /// utility::datetime getShipDate() const; - void setShipDate(utility::datetime value); bool shipDateIsSet() const; void unsetShipDate(); + void setShipDate(utility::datetime value); /// /// Order Status /// utility::string_t getStatus() const; - void setStatus(utility::string_t value); bool statusIsSet() const; void unsetStatus(); + void setStatus(utility::string_t value); /// /// /// bool getComplete() const; - void setComplete(bool value); bool completeIsSet() const; void unsetComplete(); + void setComplete(bool value); protected: int64_t m_Id; diff --git a/samples/client/petstore/cpprest/model/Pet.cpp b/samples/client/petstore/cpprest/model/Pet.cpp index 6414c9bb35c..5d8a4bb9725 100644 --- a/samples/client/petstore/cpprest/model/Pet.cpp +++ b/samples/client/petstore/cpprest/model/Pet.cpp @@ -28,7 +28,6 @@ Pet::Pet() m_TagsIsSet = false; m_Status = U(""); m_StatusIsSet = false; - } Pet::~Pet() @@ -42,7 +41,6 @@ void Pet::validate() web::json::value Pet::toJson() const { - web::json::value val = web::json::value::object(); if(m_IdIsSet) @@ -61,14 +59,13 @@ web::json::value Pet::toJson() const jsonArray.push_back(ModelBase::toJson(item)); } val[U("photoUrls")] = web::json::value::array(jsonArray); - } + } { std::vector jsonArray; for( auto& item : m_Tags ) { jsonArray.push_back(ModelBase::toJson(item)); } - if(jsonArray.size() > 0) { val[U("tags")] = web::json::value::array(jsonArray); @@ -78,15 +75,12 @@ web::json::value Pet::toJson() const { val[U("status")] = ModelBase::toJson(m_Status); } - return val; } void Pet::fromJson(web::json::value& val) { - - if(val.has_field(U("id"))) { setId(ModelBase::int64_tFromJson(val[U("id")])); @@ -99,16 +93,14 @@ void Pet::fromJson(web::json::value& val) newItem->fromJson(val[U("category")]); setCategory( newItem ); } - } setName(ModelBase::stringFromJson(val[U("name")])); { m_PhotoUrls.clear(); std::vector jsonArray; - for( auto& item : val[U("photoUrls")].as_array() ) + for( auto& item : val[U("photoUrls")].as_array() ) { m_PhotoUrls.push_back(ModelBase::stringFromJson(item)); - } } { @@ -118,7 +110,6 @@ void Pet::fromJson(web::json::value& val) { for( auto& item : val[U("tags")].as_array() ) { - if(item.is_null()) { m_Tags.push_back( std::shared_ptr(nullptr) ); @@ -129,16 +120,13 @@ void Pet::fromJson(web::json::value& val) newItem->fromJson(item); m_Tags.push_back( newItem ); } - } } } if(val.has_field(U("status"))) { setStatus(ModelBase::stringFromJson(val[U("status")])); - } - } void Pet::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const @@ -187,7 +175,6 @@ void Pet::toMultipart(std::shared_ptr multipart, const utilit multipart->add(ModelBase::toHttpContent(namePrefix + U("status"), m_Status)); } - } void Pet::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) @@ -210,17 +197,15 @@ void Pet::fromMultiPart(std::shared_ptr multipart, const util newItem->fromMultiPart(multipart, U("category.")); setCategory( newItem ); } - } setName(ModelBase::stringFromHttpContent(multipart->getContent(U("name")))); { m_PhotoUrls.clear(); - + web::json::value jsonArray = web::json::value::parse(ModelBase::stringFromHttpContent(multipart->getContent(U("photoUrls")))); for( auto& item : jsonArray.as_array() ) { m_PhotoUrls.push_back(ModelBase::stringFromJson(item)); - } } { @@ -231,7 +216,6 @@ void Pet::fromMultiPart(std::shared_ptr multipart, const util web::json::value jsonArray = web::json::value::parse(ModelBase::stringFromHttpContent(multipart->getContent(U("tags")))); for( auto& item : jsonArray.as_array() ) { - if(item.is_null()) { m_Tags.push_back( std::shared_ptr(nullptr) ); @@ -242,23 +226,21 @@ void Pet::fromMultiPart(std::shared_ptr multipart, const util newItem->fromJson(item); m_Tags.push_back( newItem ); } - } } } if(multipart->hasContent(U("status"))) { setStatus(ModelBase::stringFromHttpContent(multipart->getContent(U("status")))); - } - } - int64_t Pet::getId() const { return m_Id; } + + void Pet::setId(int64_t value) { m_Id = value; @@ -268,14 +250,18 @@ bool Pet::idIsSet() const { return m_IdIsSet; } + void Pet::unsetId() { m_IdIsSet = false; } + std::shared_ptr Pet::getCategory() const { return m_Category; } + + void Pet::setCategory(std::shared_ptr value) { m_Category = value; @@ -285,14 +271,18 @@ bool Pet::categoryIsSet() const { return m_CategoryIsSet; } + void Pet::unsetCategory() { m_CategoryIsSet = false; } + utility::string_t Pet::getName() const { return m_Name; } + + void Pet::setName(utility::string_t value) { m_Name = value; @@ -302,22 +292,38 @@ std::vector& Pet::getPhotoUrls() { return m_PhotoUrls; } + +void Pet::setPhotoUrls(std::vector value) +{ + m_PhotoUrls = value; + +} std::vector>& Pet::getTags() { return m_Tags; } + +void Pet::setTags(std::vector> value) +{ + m_Tags = value; + m_TagsIsSet = true; +} bool Pet::tagsIsSet() const { return m_TagsIsSet; } + void Pet::unsetTags() { m_TagsIsSet = false; } + utility::string_t Pet::getStatus() const { return m_Status; } + + void Pet::setStatus(utility::string_t value) { m_Status = value; @@ -327,6 +333,7 @@ bool Pet::statusIsSet() const { return m_StatusIsSet; } + void Pet::unsetStatus() { m_StatusIsSet = false; diff --git a/samples/client/petstore/cpprest/model/Pet.h b/samples/client/petstore/cpprest/model/Pet.h index 403db5b0236..61ae8b92f17 100644 --- a/samples/client/petstore/cpprest/model/Pet.h +++ b/samples/client/petstore/cpprest/model/Pet.h @@ -60,38 +60,40 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// std::shared_ptr getCategory() const; - void setCategory(std::shared_ptr value); bool categoryIsSet() const; void unsetCategory(); + void setCategory(std::shared_ptr value); /// /// /// utility::string_t getName() const; - void setName(utility::string_t value); - /// + void setName(utility::string_t value); + /// /// /// std::vector& getPhotoUrls(); - /// + void setPhotoUrls(std::vector value); + /// /// /// std::vector>& getTags(); bool tagsIsSet() const; void unsetTags(); + void setTags(std::vector> value); /// /// pet status in the store /// utility::string_t getStatus() const; - void setStatus(utility::string_t value); bool statusIsSet() const; void unsetStatus(); + void setStatus(utility::string_t value); protected: int64_t m_Id; diff --git a/samples/client/petstore/cpprest/model/Tag.cpp b/samples/client/petstore/cpprest/model/Tag.cpp index 8c77f0a4b4a..6d5e350ab91 100644 --- a/samples/client/petstore/cpprest/model/Tag.cpp +++ b/samples/client/petstore/cpprest/model/Tag.cpp @@ -25,7 +25,6 @@ Tag::Tag() m_IdIsSet = false; m_Name = U(""); m_NameIsSet = false; - } Tag::~Tag() @@ -39,7 +38,6 @@ void Tag::validate() web::json::value Tag::toJson() const { - web::json::value val = web::json::value::object(); if(m_IdIsSet) @@ -50,15 +48,12 @@ web::json::value Tag::toJson() const { val[U("name")] = ModelBase::toJson(m_Name); } - return val; } void Tag::fromJson(web::json::value& val) { - - if(val.has_field(U("id"))) { setId(ModelBase::int64_tFromJson(val[U("id")])); @@ -66,9 +61,7 @@ void Tag::fromJson(web::json::value& val) if(val.has_field(U("name"))) { setName(ModelBase::stringFromJson(val[U("name")])); - } - } void Tag::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const @@ -88,7 +81,6 @@ void Tag::toMultipart(std::shared_ptr multipart, const utilit multipart->add(ModelBase::toHttpContent(namePrefix + U("name"), m_Name)); } - } void Tag::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) @@ -106,16 +98,15 @@ void Tag::fromMultiPart(std::shared_ptr multipart, const util if(multipart->hasContent(U("name"))) { setName(ModelBase::stringFromHttpContent(multipart->getContent(U("name")))); - } - } - int64_t Tag::getId() const { return m_Id; } + + void Tag::setId(int64_t value) { m_Id = value; @@ -125,14 +116,18 @@ bool Tag::idIsSet() const { return m_IdIsSet; } + void Tag::unsetId() { m_IdIsSet = false; } + utility::string_t Tag::getName() const { return m_Name; } + + void Tag::setName(utility::string_t value) { m_Name = value; @@ -142,6 +137,7 @@ bool Tag::nameIsSet() const { return m_NameIsSet; } + void Tag::unsetName() { m_NameIsSet = false; diff --git a/samples/client/petstore/cpprest/model/Tag.h b/samples/client/petstore/cpprest/model/Tag.h index 311a05461c2..30159052950 100644 --- a/samples/client/petstore/cpprest/model/Tag.h +++ b/samples/client/petstore/cpprest/model/Tag.h @@ -57,16 +57,16 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// utility::string_t getName() const; - void setName(utility::string_t value); bool nameIsSet() const; void unsetName(); + void setName(utility::string_t value); protected: int64_t m_Id; diff --git a/samples/client/petstore/cpprest/model/User.cpp b/samples/client/petstore/cpprest/model/User.cpp index c03ba1ada72..3cf4e4258d5 100644 --- a/samples/client/petstore/cpprest/model/User.cpp +++ b/samples/client/petstore/cpprest/model/User.cpp @@ -37,7 +37,6 @@ User::User() m_PhoneIsSet = false; m_UserStatus = 0; m_UserStatusIsSet = false; - } User::~User() @@ -51,7 +50,6 @@ void User::validate() web::json::value User::toJson() const { - web::json::value val = web::json::value::object(); if(m_IdIsSet) @@ -86,15 +84,12 @@ web::json::value User::toJson() const { val[U("userStatus")] = ModelBase::toJson(m_UserStatus); } - return val; } void User::fromJson(web::json::value& val) { - - if(val.has_field(U("id"))) { setId(ModelBase::int64_tFromJson(val[U("id")])); @@ -102,38 +97,31 @@ void User::fromJson(web::json::value& val) if(val.has_field(U("username"))) { setUsername(ModelBase::stringFromJson(val[U("username")])); - } if(val.has_field(U("firstName"))) { setFirstName(ModelBase::stringFromJson(val[U("firstName")])); - } if(val.has_field(U("lastName"))) { setLastName(ModelBase::stringFromJson(val[U("lastName")])); - } if(val.has_field(U("email"))) { setEmail(ModelBase::stringFromJson(val[U("email")])); - } if(val.has_field(U("password"))) { setPassword(ModelBase::stringFromJson(val[U("password")])); - } if(val.has_field(U("phone"))) { setPhone(ModelBase::stringFromJson(val[U("phone")])); - } if(val.has_field(U("userStatus"))) { setUserStatus(ModelBase::int32_tFromJson(val[U("userStatus")])); } - } void User::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const @@ -182,7 +170,6 @@ void User::toMultipart(std::shared_ptr multipart, const utili { multipart->add(ModelBase::toHttpContent(namePrefix + U("userStatus"), m_UserStatus)); } - } void User::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) @@ -200,45 +187,39 @@ void User::fromMultiPart(std::shared_ptr multipart, const uti if(multipart->hasContent(U("username"))) { setUsername(ModelBase::stringFromHttpContent(multipart->getContent(U("username")))); - } if(multipart->hasContent(U("firstName"))) { setFirstName(ModelBase::stringFromHttpContent(multipart->getContent(U("firstName")))); - } if(multipart->hasContent(U("lastName"))) { setLastName(ModelBase::stringFromHttpContent(multipart->getContent(U("lastName")))); - } if(multipart->hasContent(U("email"))) { setEmail(ModelBase::stringFromHttpContent(multipart->getContent(U("email")))); - } if(multipart->hasContent(U("password"))) { setPassword(ModelBase::stringFromHttpContent(multipart->getContent(U("password")))); - } if(multipart->hasContent(U("phone"))) { setPhone(ModelBase::stringFromHttpContent(multipart->getContent(U("phone")))); - } if(multipart->hasContent(U("userStatus"))) { setUserStatus(ModelBase::int32_tFromHttpContent(multipart->getContent(U("userStatus")))); } - } - int64_t User::getId() const { return m_Id; } + + void User::setId(int64_t value) { m_Id = value; @@ -248,14 +229,18 @@ bool User::idIsSet() const { return m_IdIsSet; } + void User::unsetId() { m_IdIsSet = false; } + utility::string_t User::getUsername() const { return m_Username; } + + void User::setUsername(utility::string_t value) { m_Username = value; @@ -265,14 +250,18 @@ bool User::usernameIsSet() const { return m_UsernameIsSet; } + void User::unsetUsername() { m_UsernameIsSet = false; } + utility::string_t User::getFirstName() const { return m_FirstName; } + + void User::setFirstName(utility::string_t value) { m_FirstName = value; @@ -282,14 +271,18 @@ bool User::firstNameIsSet() const { return m_FirstNameIsSet; } + void User::unsetFirstName() { m_FirstNameIsSet = false; } + utility::string_t User::getLastName() const { return m_LastName; } + + void User::setLastName(utility::string_t value) { m_LastName = value; @@ -299,14 +292,18 @@ bool User::lastNameIsSet() const { return m_LastNameIsSet; } + void User::unsetLastName() { m_LastNameIsSet = false; } + utility::string_t User::getEmail() const { return m_Email; } + + void User::setEmail(utility::string_t value) { m_Email = value; @@ -316,14 +313,18 @@ bool User::emailIsSet() const { return m_EmailIsSet; } + void User::unsetEmail() { m_EmailIsSet = false; } + utility::string_t User::getPassword() const { return m_Password; } + + void User::setPassword(utility::string_t value) { m_Password = value; @@ -333,14 +334,18 @@ bool User::passwordIsSet() const { return m_PasswordIsSet; } + void User::unsetPassword() { m_PasswordIsSet = false; } + utility::string_t User::getPhone() const { return m_Phone; } + + void User::setPhone(utility::string_t value) { m_Phone = value; @@ -350,14 +355,18 @@ bool User::phoneIsSet() const { return m_PhoneIsSet; } + void User::unsetPhone() { m_PhoneIsSet = false; } + int32_t User::getUserStatus() const { return m_UserStatus; } + + void User::setUserStatus(int32_t value) { m_UserStatus = value; @@ -367,6 +376,7 @@ bool User::userStatusIsSet() const { return m_UserStatusIsSet; } + void User::unsetUserStatus() { m_UserStatusIsSet = false; diff --git a/samples/client/petstore/cpprest/model/User.h b/samples/client/petstore/cpprest/model/User.h index c3c0ee8aeea..3ecd51ce96d 100644 --- a/samples/client/petstore/cpprest/model/User.h +++ b/samples/client/petstore/cpprest/model/User.h @@ -57,58 +57,58 @@ public: /// /// int64_t getId() const; - void setId(int64_t value); bool idIsSet() const; void unsetId(); + void setId(int64_t value); /// /// /// utility::string_t getUsername() const; - void setUsername(utility::string_t value); bool usernameIsSet() const; void unsetUsername(); + void setUsername(utility::string_t value); /// /// /// utility::string_t getFirstName() const; - void setFirstName(utility::string_t value); bool firstNameIsSet() const; void unsetFirstName(); + void setFirstName(utility::string_t value); /// /// /// utility::string_t getLastName() const; - void setLastName(utility::string_t value); bool lastNameIsSet() const; void unsetLastName(); + void setLastName(utility::string_t value); /// /// /// utility::string_t getEmail() const; - void setEmail(utility::string_t value); bool emailIsSet() const; void unsetEmail(); + void setEmail(utility::string_t value); /// /// /// utility::string_t getPassword() const; - void setPassword(utility::string_t value); bool passwordIsSet() const; void unsetPassword(); + void setPassword(utility::string_t value); /// /// /// utility::string_t getPhone() const; - void setPhone(utility::string_t value); bool phoneIsSet() const; void unsetPhone(); + void setPhone(utility::string_t value); /// /// User Status /// int32_t getUserStatus() const; - void setUserStatus(int32_t value); bool userStatusIsSet() const; void unsetUserStatus(); + void setUserStatus(int32_t value); protected: int64_t m_Id; diff --git a/samples/client/petstore/java/jersey1/build.gradle b/samples/client/petstore/java/jersey1/build.gradle index eeba1d21fa5..3931ba2abe4 100644 --- a/samples/client/petstore/java/jersey1/build.gradle +++ b/samples/client/petstore/java/jersey1/build.gradle @@ -94,10 +94,10 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.7.5" - jersey_version = "1.19.1" - jodatime_version = "2.9.4" + swagger_annotations_version = "1.5.15" + jackson_version = "2.8.9" + jersey_version = "1.19.4" + jodatime_version = "2.9.9" junit_version = "4.12" } diff --git a/samples/client/petstore/java/jersey1/pom.xml b/samples/client/petstore/java/jersey1/pom.xml index 2347df728d3..3c041747f54 100644 --- a/samples/client/petstore/java/jersey1/pom.xml +++ b/samples/client/petstore/java/jersey1/pom.xml @@ -247,10 +247,10 @@ UTF-8 - 1.5.8 - 1.19.1 - 2.7.5 - 2.9.4 + 1.5.15 + 1.19.4 + 2.8.9 + 2.9.9 1.0.0 4.12 diff --git a/samples/client/petstore/java/jersey2-java6/build.gradle b/samples/client/petstore/java/jersey2-java6/build.gradle index 88d95188b88..7910021321e 100644 --- a/samples/client/petstore/java/jersey2-java6/build.gradle +++ b/samples/client/petstore/java/jersey2-java6/build.gradle @@ -93,12 +93,12 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.7.5" - jersey_version = "2.22.2" - jodatime_version = "2.9.4" + swagger_annotations_version = "1.5.15" + jackson_version = "2.8.9" + jersey_version = "2.25.1" + jodatime_version = "2.9.9" commons_io_version=2.5 - commons_lang3_version=3.5 + commons_lang3_version=3.6 junit_version = "4.12" } diff --git a/samples/client/petstore/java/jersey2-java6/build.sbt b/samples/client/petstore/java/jersey2-java6/build.sbt index d1d444bee2b..05f502ac4ab 100644 --- a/samples/client/petstore/java/jersey2-java6/build.sbt +++ b/samples/client/petstore/java/jersey2-java6/build.sbt @@ -9,17 +9,17 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.8", - "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", - "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5", - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5", - "joda-time" % "joda-time" % "2.9.4", + "io.swagger" % "swagger-annotations" % "1.5.15", + "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.8.9", + "joda-time" % "joda-time" % "2.9.9", "com.brsanthu" % "migbase64" % "2.2", - "org.apache.commons" % "commons-lang3" % "3.5", + "org.apache.commons" % "commons-lang3" % "3.6", "commons-io" % "commons-io" % "2.5", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/client/petstore/java/jersey2-java6/pom.xml b/samples/client/petstore/java/jersey2-java6/pom.xml index f56f3947882..1eae180b676 100644 --- a/samples/client/petstore/java/jersey2-java6/pom.xml +++ b/samples/client/petstore/java/jersey2-java6/pom.xml @@ -255,11 +255,11 @@ 1.5.15 - 2.22.2 - 2.7.5 - 2.9.4 + 2.25.1 + 2.8.9 + 2.9.9 2.5 - 3.5 + 3.6 1.0.0 4.12 diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java index 938b7521e6f..79df237e1dd 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java @@ -671,48 +671,56 @@ public class ApiClient { Entity entity = serialize(body, formParams, contentType); - Response response; + Response response = null; - if ("GET".equals(method)) { - response = invocationBuilder.get(); - } else if ("POST".equals(method)) { - response = invocationBuilder.post(entity); - } else if ("PUT".equals(method)) { - response = invocationBuilder.put(entity); - } else if ("DELETE".equals(method)) { - response = invocationBuilder.delete(); - } else if ("PATCH".equals(method)) { - response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); - } else { - throw new ApiException(500, "unknown method type " + method); - } - - statusCode = response.getStatusInfo().getStatusCode(); - responseHeaders = buildResponseHeaders(response); - - if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { - return null; - } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { - if (returnType == null) - return null; - else - return deserialize(response, returnType); - } else { - String message = "error"; - String respBody = null; - if (response.hasEntity()) { - try { - respBody = String.valueOf(response.readEntity(String.class)); - message = respBody; - } catch (RuntimeException e) { - // e.printStackTrace(); - } + try { + if ("GET".equals(method)) { + response = invocationBuilder.get(); + } else if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.delete(); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); + } else { + throw new ApiException(500, "unknown method type " + method); + } + + statusCode = response.getStatusInfo().getStatusCode(); + responseHeaders = buildResponseHeaders(response); + + if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { + return null; + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { + if (returnType == null) + return null; + else + return deserialize(response, returnType); + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), + message, + buildResponseHeaders(response), + respBody); + } + } finally { + try { + response.close(); + } catch (Exception e) { + // it's not critical, since the response object is local in method invokeAPI; that's fine, just continue } - throw new ApiException( - response.getStatus(), - message, - buildResponseHeaders(response), - respBody); } } diff --git a/samples/client/petstore/java/jersey2-java8/build.gradle b/samples/client/petstore/java/jersey2-java8/build.gradle index 072e608d1cb..13ad1675cd5 100644 --- a/samples/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/client/petstore/java/jersey2-java8/build.gradle @@ -93,9 +93,9 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.7.5" - jersey_version = "2.22.2" + swagger_annotations_version = "1.5.15" + jackson_version = "2.8.9" + jersey_version = "2.25.1" junit_version = "4.12" } diff --git a/samples/client/petstore/java/jersey2-java8/build.sbt b/samples/client/petstore/java/jersey2-java8/build.sbt index b187fb67ae2..4d2a46846fa 100644 --- a/samples/client/petstore/java/jersey2-java8/build.sbt +++ b/samples/client/petstore/java/jersey2-java8/build.sbt @@ -9,14 +9,14 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.8", - "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", - "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5", - "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.7.5", + "io.swagger" % "swagger-annotations" % "1.5.15", + "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.8.9", "com.brsanthu" % "migbase64" % "2.2", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/client/petstore/java/jersey2-java8/pom.xml b/samples/client/petstore/java/jersey2-java8/pom.xml index c8d29ad89de..547cb4cbefd 100644 --- a/samples/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/client/petstore/java/jersey2-java8/pom.xml @@ -239,8 +239,8 @@ 1.5.15 - 2.22.2 - 2.7.5 + 2.25.1 + 2.8.9 1.0.0 4.12 diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/ApiClient.java index 0995fbc3df7..16b5e5796d9 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/ApiClient.java @@ -671,48 +671,56 @@ public class ApiClient { Entity entity = serialize(body, formParams, contentType); - Response response; + Response response = null; - if ("GET".equals(method)) { - response = invocationBuilder.get(); - } else if ("POST".equals(method)) { - response = invocationBuilder.post(entity); - } else if ("PUT".equals(method)) { - response = invocationBuilder.put(entity); - } else if ("DELETE".equals(method)) { - response = invocationBuilder.delete(); - } else if ("PATCH".equals(method)) { - response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); - } else { - throw new ApiException(500, "unknown method type " + method); - } - - statusCode = response.getStatusInfo().getStatusCode(); - responseHeaders = buildResponseHeaders(response); - - if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { - return null; - } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { - if (returnType == null) - return null; - else - return deserialize(response, returnType); - } else { - String message = "error"; - String respBody = null; - if (response.hasEntity()) { - try { - respBody = String.valueOf(response.readEntity(String.class)); - message = respBody; - } catch (RuntimeException e) { - // e.printStackTrace(); - } + try { + if ("GET".equals(method)) { + response = invocationBuilder.get(); + } else if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.delete(); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); + } else { + throw new ApiException(500, "unknown method type " + method); + } + + statusCode = response.getStatusInfo().getStatusCode(); + responseHeaders = buildResponseHeaders(response); + + if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { + return null; + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { + if (returnType == null) + return null; + else + return deserialize(response, returnType); + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), + message, + buildResponseHeaders(response), + respBody); + } + } finally { + try { + response.close(); + } catch (Exception e) { + // it's not critical, since the response object is local in method invokeAPI; that's fine, just continue } - throw new ApiException( - response.getStatus(), - message, - buildResponseHeaders(response), - respBody); } } diff --git a/samples/client/petstore/java/jersey2/build.gradle b/samples/client/petstore/java/jersey2/build.gradle index f20bda6db15..2290cd0f1e6 100644 --- a/samples/client/petstore/java/jersey2/build.gradle +++ b/samples/client/petstore/java/jersey2/build.gradle @@ -93,10 +93,10 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.7.5" - jersey_version = "2.22.2" - jodatime_version = "2.9.4" + swagger_annotations_version = "1.5.15" + jackson_version = "2.8.9" + jersey_version = "2.25.1" + jodatime_version = "2.9.9" junit_version = "4.12" } diff --git a/samples/client/petstore/java/jersey2/build.sbt b/samples/client/petstore/java/jersey2/build.sbt index 555b44f16db..9a516c92cf5 100644 --- a/samples/client/petstore/java/jersey2/build.sbt +++ b/samples/client/petstore/java/jersey2/build.sbt @@ -9,15 +9,15 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.8", - "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", - "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", - "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5", - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5", - "joda-time" % "joda-time" % "2.9.4", + "io.swagger" % "swagger-annotations" % "1.5.15", + "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.8.9", + "joda-time" % "joda-time" % "2.9.9", "com.brsanthu" % "migbase64" % "2.2", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/client/petstore/java/jersey2/pom.xml b/samples/client/petstore/java/jersey2/pom.xml index a2c45727dd6..b665825c4f4 100644 --- a/samples/client/petstore/java/jersey2/pom.xml +++ b/samples/client/petstore/java/jersey2/pom.xml @@ -244,9 +244,9 @@ 1.5.15 - 2.22.2 - 2.7.5 - 2.9.4 + 2.25.1 + 2.8.9 + 2.9.9 1.0.0 4.12 diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle index 0f403ed63f3..1d7eb55f31d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle @@ -94,10 +94,10 @@ if(hasProperty('target') && target == 'android') { } dependencies { - compile 'io.swagger:swagger-annotations:1.5.8' + compile 'io.swagger:swagger-annotations:1.5.15' compile 'com.squareup.okhttp:okhttp:2.7.5' compile 'com.squareup.okhttp:logging-interceptor:2.7.5' - compile 'com.google.code.gson:gson:2.6.2' - compile 'joda-time:joda-time:2.9.3' + compile 'com.google.code.gson:gson:2.8.1' + compile 'joda-time:joda-time:2.9.9' testCompile 'junit:junit:4.12' } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt index 01a1095f8a4..0cb2e949949 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt @@ -9,11 +9,11 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.8", + "io.swagger" % "swagger-annotations" % "1.5.15", "com.squareup.okhttp" % "okhttp" % "2.7.5", "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", - "com.google.code.gson" % "gson" % "2.6.2", - "joda-time" % "joda-time" % "2.9.3" % "compile", + "com.google.code.gson" % "gson" % "2.8.1", + "joda-time" % "joda-time" % "2.9.9" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml index 6dae3554881..50033a27242 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml @@ -215,8 +215,8 @@ ${java.version} 1.5.15 2.7.5 - 2.6.2 - 2.9.3 + 2.8.1 + 2.9.9 1.0.0 4.12 UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson/build.gradle b/samples/client/petstore/java/okhttp-gson/build.gradle index 0f403ed63f3..1d7eb55f31d 100644 --- a/samples/client/petstore/java/okhttp-gson/build.gradle +++ b/samples/client/petstore/java/okhttp-gson/build.gradle @@ -94,10 +94,10 @@ if(hasProperty('target') && target == 'android') { } dependencies { - compile 'io.swagger:swagger-annotations:1.5.8' + compile 'io.swagger:swagger-annotations:1.5.15' compile 'com.squareup.okhttp:okhttp:2.7.5' compile 'com.squareup.okhttp:logging-interceptor:2.7.5' - compile 'com.google.code.gson:gson:2.6.2' - compile 'joda-time:joda-time:2.9.3' + compile 'com.google.code.gson:gson:2.8.1' + compile 'joda-time:joda-time:2.9.9' testCompile 'junit:junit:4.12' } diff --git a/samples/client/petstore/java/okhttp-gson/build.sbt b/samples/client/petstore/java/okhttp-gson/build.sbt index 01a1095f8a4..0cb2e949949 100644 --- a/samples/client/petstore/java/okhttp-gson/build.sbt +++ b/samples/client/petstore/java/okhttp-gson/build.sbt @@ -9,11 +9,11 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.8", + "io.swagger" % "swagger-annotations" % "1.5.15", "com.squareup.okhttp" % "okhttp" % "2.7.5", "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", - "com.google.code.gson" % "gson" % "2.6.2", - "joda-time" % "joda-time" % "2.9.3" % "compile", + "com.google.code.gson" % "gson" % "2.8.1", + "joda-time" % "joda-time" % "2.9.9" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index 6dc312c25e1..d9cf3f47c33 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -208,8 +208,8 @@ ${java.version} 1.5.15 2.7.5 - 2.6.2 - 2.9.3 + 2.8.1 + 2.9.9 1.0.0 4.12 UTF-8 diff --git a/samples/client/petstore/java/resteasy/pom.xml b/samples/client/petstore/java/resteasy/pom.xml index 8421dc14798..aba73d0ed9e 100644 --- a/samples/client/petstore/java/resteasy/pom.xml +++ b/samples/client/petstore/java/resteasy/pom.xml @@ -164,7 +164,7 @@ org.jboss.resteasy resteasy-jackson-provider - 2.3.4.Final + 3.1.3.Final @@ -175,10 +175,10 @@ - 1.5.9 - 3.0.19.Final + 1.5.15 + 3.1.3.Final 2.7.5 - 2.9.4 + 2.9.9 1.0.0 4.12 diff --git a/samples/client/petstore/java/resttemplate/build.gradle b/samples/client/petstore/java/resttemplate/build.gradle index ab711893226..eeb852d3092 100644 --- a/samples/client/petstore/java/resttemplate/build.gradle +++ b/samples/client/petstore/java/resttemplate/build.gradle @@ -94,10 +94,10 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.8" - jackson_version = "2.8.8" - spring_web_version = "4.3.7.RELEASE" - jodatime_version = "2.9.4" + swagger_annotations_version = "1.5.15" + jackson_version = "2.8.9" + spring_web_version = "4.3.9.RELEASE" + jodatime_version = "2.9.9" junit_version = "4.12" } diff --git a/samples/client/petstore/java/resttemplate/pom.xml b/samples/client/petstore/java/resttemplate/pom.xml index f5b77cc1e71..01059b5fcb9 100644 --- a/samples/client/petstore/java/resttemplate/pom.xml +++ b/samples/client/petstore/java/resttemplate/pom.xml @@ -233,10 +233,10 @@ UTF-8 - 1.5.8 - 4.3.7.RELEASE - 2.8.8 - 2.9.4 + 1.5.15 + 4.3.9.RELEASE + 2.8.9 + 2.9.9 1.0.0 4.12 diff --git a/samples/client/petstore/java/retrofit/pom.xml b/samples/client/petstore/java/retrofit/pom.xml index 17c2d00fb59..ffb62b3f28f 100644 --- a/samples/client/petstore/java/retrofit/pom.xml +++ b/samples/client/petstore/java/retrofit/pom.xml @@ -216,7 +216,7 @@ 1.5.15 1.9.0 2.7.5 - 2.9.3 + 2.9.9 1.0.1 1.0.0 4.12 diff --git a/samples/client/petstore/java/retrofit2-play24/build.gradle b/samples/client/petstore/java/retrofit2-play24/build.gradle index d5624f8999b..660aa9a74f3 100644 --- a/samples/client/petstore/java/retrofit2-play24/build.gradle +++ b/samples/client/petstore/java/retrofit2-play24/build.gradle @@ -96,11 +96,11 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" retrofit_version = "2.1.0" - jackson_version = "2.7.5" + jackson_version = "2.8.9" play_version = "2.4.11" - swagger_annotations_version = "1.5.12" + swagger_annotations_version = "1.5.15" junit_version = "4.12" - jodatime_version = "2.9.4" + jodatime_version = "2.9.9" } dependencies { diff --git a/samples/client/petstore/java/retrofit2-play24/build.sbt b/samples/client/petstore/java/retrofit2-play24/build.sbt index feceac08cf1..60a3d4c78ec 100644 --- a/samples/client/petstore/java/retrofit2-play24/build.sbt +++ b/samples/client/petstore/java/retrofit2-play24/build.sbt @@ -14,12 +14,12 @@ lazy val root = (project in file(".")). "com.squareup.retrofit2" % "converter-scalars" % "2.1.0" % "compile", "com.squareup.retrofit2" % "converter-gson" % "2.1.0" % "compile", "com.squareup.retrofit2" % "converter-jackson" % "2.1.0" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.12" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.15" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", - "joda-time" % "joda-time" % "2.9.4" % "compile", + "joda-time" % "joda-time" % "2.9.9" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.11" % "test" ) diff --git a/samples/client/petstore/java/retrofit2-play24/pom.xml b/samples/client/petstore/java/retrofit2-play24/pom.xml index 5a121dae152..f711d861787 100644 --- a/samples/client/petstore/java/retrofit2-play24/pom.xml +++ b/samples/client/petstore/java/retrofit2-play24/pom.xml @@ -247,10 +247,10 @@ ${java.version} ${java.version} 1.5.15 - 2.7.5 + 2.8.9 2.4.11 - 2.2.0 - 2.9.4 + 2.3.0 + 2.9.9 1.0.1 4.12 diff --git a/samples/client/petstore/java/retrofit2/build.gradle b/samples/client/petstore/java/retrofit2/build.gradle index 75dcea187e5..32fa566abd0 100644 --- a/samples/client/petstore/java/retrofit2/build.gradle +++ b/samples/client/petstore/java/retrofit2/build.gradle @@ -95,10 +95,10 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" - retrofit_version = "2.2.0" - swagger_annotations_version = "1.5.12" + retrofit_version = "2.3.0" + swagger_annotations_version = "1.5.15" junit_version = "4.12" - jodatime_version = "2.9.4" + jodatime_version = "2.9.9" } dependencies { diff --git a/samples/client/petstore/java/retrofit2/build.sbt b/samples/client/petstore/java/retrofit2/build.sbt index dc9ee6dee8f..84cf4872581 100644 --- a/samples/client/petstore/java/retrofit2/build.sbt +++ b/samples/client/petstore/java/retrofit2/build.sbt @@ -9,12 +9,12 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "com.squareup.retrofit2" % "retrofit" % "2.2.0" % "compile", - "com.squareup.retrofit2" % "converter-scalars" % "2.2.0" % "compile", - "com.squareup.retrofit2" % "converter-gson" % "2.2.0" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.12" % "compile", + "com.squareup.retrofit2" % "retrofit" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-scalars" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-gson" % "2.3.0" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.15" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", - "joda-time" % "joda-time" % "2.9.4" % "compile", + "joda-time" % "joda-time" % "2.9.9" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.11" % "test" ) diff --git a/samples/client/petstore/java/retrofit2/pom.xml b/samples/client/petstore/java/retrofit2/pom.xml index 6d8d5036d2b..c9a8b343c8d 100644 --- a/samples/client/petstore/java/retrofit2/pom.xml +++ b/samples/client/petstore/java/retrofit2/pom.xml @@ -216,8 +216,8 @@ ${java.version} ${java.version} 1.5.15 - 2.2.0 - 2.9.4 + 2.3.0 + 2.9.9 1.0.1 4.12 diff --git a/samples/client/petstore/java/retrofit2rx/build.gradle b/samples/client/petstore/java/retrofit2rx/build.gradle index bc5eb287684..42f189e96f5 100644 --- a/samples/client/petstore/java/retrofit2rx/build.gradle +++ b/samples/client/petstore/java/retrofit2rx/build.gradle @@ -95,11 +95,11 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" - retrofit_version = "2.2.0" - swagger_annotations_version = "1.5.12" + retrofit_version = "2.3.0" + swagger_annotations_version = "1.5.15" junit_version = "4.12" - rx_java_version = "1.2.9" - jodatime_version = "2.9.4" + rx_java_version = "1.3.0" + jodatime_version = "2.9.9" } dependencies { diff --git a/samples/client/petstore/java/retrofit2rx/build.sbt b/samples/client/petstore/java/retrofit2rx/build.sbt index 30e122bb085..3f65cae002b 100644 --- a/samples/client/petstore/java/retrofit2rx/build.sbt +++ b/samples/client/petstore/java/retrofit2rx/build.sbt @@ -9,14 +9,14 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "com.squareup.retrofit2" % "retrofit" % "2.2.0" % "compile", - "com.squareup.retrofit2" % "converter-scalars" % "2.2.0" % "compile", - "com.squareup.retrofit2" % "converter-gson" % "2.2.0" % "compile", + "com.squareup.retrofit2" % "retrofit" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-scalars" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-gson" % "2.3.0" % "compile", "com.squareup.retrofit2" % "adapter-rxjava" % "2.2.0" % "compile", - "io.reactivex" % "rxjava" % "1.2.9" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.12" % "compile", + "io.reactivex" % "rxjava" % "1.3.0" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.15" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", - "joda-time" % "joda-time" % "2.9.4" % "compile", + "joda-time" % "joda-time" % "2.9.9" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.11" % "test" ) diff --git a/samples/client/petstore/java/retrofit2rx/pom.xml b/samples/client/petstore/java/retrofit2rx/pom.xml index 3eb4087ef0d..e7275be1be3 100644 --- a/samples/client/petstore/java/retrofit2rx/pom.xml +++ b/samples/client/petstore/java/retrofit2rx/pom.xml @@ -226,9 +226,9 @@ ${java.version} ${java.version} 1.5.15 - 2.2.0 - 1.2.9 - 2.9.4 + 2.3.0 + 1.3.0 + 2.9.9 1.0.1 4.12 diff --git a/samples/client/petstore/java/retrofit2rx2/build.gradle b/samples/client/petstore/java/retrofit2rx2/build.gradle index a36e978c9a6..7d35c759233 100644 --- a/samples/client/petstore/java/retrofit2rx2/build.gradle +++ b/samples/client/petstore/java/retrofit2rx2/build.gradle @@ -95,11 +95,11 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" - retrofit_version = "2.2.0" - swagger_annotations_version = "1.5.12" + retrofit_version = "2.3.0" + swagger_annotations_version = "1.5.15" junit_version = "4.12" - rx_java_version = "2.0.7" - jodatime_version = "2.9.4" + rx_java_version = "2.1.1" + jodatime_version = "2.9.9" } dependencies { diff --git a/samples/client/petstore/java/retrofit2rx2/build.sbt b/samples/client/petstore/java/retrofit2rx2/build.sbt index b989cdf3269..181f8040a71 100644 --- a/samples/client/petstore/java/retrofit2rx2/build.sbt +++ b/samples/client/petstore/java/retrofit2rx2/build.sbt @@ -9,14 +9,14 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "com.squareup.retrofit2" % "retrofit" % "2.2.0" % "compile", - "com.squareup.retrofit2" % "converter-scalars" % "2.2.0" % "compile", - "com.squareup.retrofit2" % "converter-gson" % "2.2.0" % "compile", + "com.squareup.retrofit2" % "retrofit" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-scalars" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-gson" % "2.3.0" % "compile", "com.jakewharton.retrofit" % "retrofit2-rxjava2-adapter" % "1.0.0" % "compile", - "io.reactivex.rxjava2" % "rxjava" % "2.0.7" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.12" % "compile", + "io.reactivex.rxjava2" % "rxjava" % "2.1.1" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.15" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", - "joda-time" % "joda-time" % "2.9.4" % "compile", + "joda-time" % "joda-time" % "2.9.9" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.11" % "test" ) diff --git a/samples/client/petstore/java/retrofit2rx2/pom.xml b/samples/client/petstore/java/retrofit2rx2/pom.xml index 555738a751e..e30ee231a55 100644 --- a/samples/client/petstore/java/retrofit2rx2/pom.xml +++ b/samples/client/petstore/java/retrofit2rx2/pom.xml @@ -226,9 +226,9 @@ ${java.version} ${java.version} 1.5.15 - 2.2.0 - 2.0.7 - 2.9.4 + 2.3.0 + 2.1.1 + 2.9.9 1.0.1 4.12 diff --git a/samples/client/petstore/javascript-es6/.babelrc b/samples/client/petstore/javascript-es6/.babelrc new file mode 100644 index 00000000000..bcb6ee8de93 --- /dev/null +++ b/samples/client/petstore/javascript-es6/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015", "stage-0"] +} \ No newline at end of file diff --git a/samples/client/petstore/javascript-es6/README.md b/samples/client/petstore/javascript-es6/README.md index 740edf8857d..a58e731b223 100644 --- a/samples/client/petstore/javascript-es6/README.md +++ b/samples/client/petstore/javascript-es6/README.md @@ -45,6 +45,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/samples/client/petstore/javascript-es6/docs/FakeApi.md b/samples/client/petstore/javascript-es6/docs/FakeApi.md index 85ac0b3d8a2..159eabe7058 100644 --- a/samples/client/petstore/javascript-es6/docs/FakeApi.md +++ b/samples/client/petstore/javascript-es6/docs/FakeApi.md @@ -23,22 +23,21 @@ Test serialization of outer boolean types ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let opts = { 'body': new SwaggerPetstore.OuterBoolean() // OuterBoolean | Input boolean as post body }; -var callback = function(error, data, response) { +apiInstance.fakeOuterBooleanSerialize(opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.fakeOuterBooleanSerialize(opts, callback); +}); ``` ### Parameters @@ -70,22 +69,21 @@ Test serialization of object with outer number type ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let opts = { 'body': new SwaggerPetstore.OuterComposite() // OuterComposite | Input composite as post body }; -var callback = function(error, data, response) { +apiInstance.fakeOuterCompositeSerialize(opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.fakeOuterCompositeSerialize(opts, callback); +}); ``` ### Parameters @@ -117,22 +115,21 @@ Test serialization of outer number types ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let opts = { 'body': new SwaggerPetstore.OuterNumber() // OuterNumber | Input number as post body }; -var callback = function(error, data, response) { +apiInstance.fakeOuterNumberSerialize(opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.fakeOuterNumberSerialize(opts, callback); +}); ``` ### Parameters @@ -164,22 +161,21 @@ Test serialization of outer string types ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let opts = { 'body': new SwaggerPetstore.OuterString() // OuterString | Input string as post body }; -var callback = function(error, data, response) { +apiInstance.fakeOuterStringSerialize(opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.fakeOuterStringSerialize(opts, callback); +}); ``` ### Parameters @@ -211,21 +207,20 @@ To test \"client\" model ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var body = new SwaggerPetstore.Client(); // Client | client model +let body = new SwaggerPetstore.Client(); // Client | client model -var callback = function(error, data, response) { +apiInstance.testClientModel(body, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.testClientModel(body, callback); +}); ``` ### Parameters @@ -257,25 +252,25 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure HTTP basic authorization: http_basic_test -var http_basic_test = defaultClient.authentications['http_basic_test']; +let 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(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var _number = 3.4; // Number | None +let _number = 3.4; // Number | None -var _double = 1.2; // Number | None +let _double = 1.2; // Number | None -var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None +let patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -var _byte = B; // Blob | None +let _byte = B; // Blob | None -var opts = { +let opts = { 'integer': 56, // Number | None 'int32': 56, // Number | None 'int64': 789, // Number | None @@ -288,14 +283,13 @@ var opts = { 'callback': "callback_example" // String | None }; -var callback = function(error, data, response) { +apiInstance.testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts, callback); +}); ``` ### Parameters @@ -340,11 +334,11 @@ To test enum parameters ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let 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) @@ -355,14 +349,13 @@ var opts = { 'enumQueryDouble': 1.2 // Number | Query parameter enum test (double) }; -var callback = function(error, data, response) { +apiInstance.testEnumParameters(opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.testEnumParameters(opts, callback); +}); ``` ### Parameters diff --git a/samples/client/petstore/javascript-es6/docs/PetApi.md b/samples/client/petstore/javascript-es6/docs/PetApi.md index fee9b40dbbc..9901993bf12 100644 --- a/samples/client/petstore/javascript-es6/docs/PetApi.md +++ b/samples/client/petstore/javascript-es6/docs/PetApi.md @@ -24,26 +24,25 @@ Add a new pet to the store ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store +let body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store -var callback = function(error, data, response) { +apiInstance.addPet(body, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.addPet(body, callback); +}); ``` ### Parameters @@ -75,29 +74,28 @@ Deletes a pet ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Number | Pet id to delete +let petId = 789; // Number | Pet id to delete -var opts = { +let opts = { 'apiKey': "apiKey_example" // String | }; -var callback = function(error, data, response) { +apiInstance.deletePet(petId, opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.deletePet(petId, opts, callback); +}); ``` ### Parameters @@ -130,26 +128,25 @@ Multiple status values can be provided with comma separated strings ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var status = ["status_example"]; // [String] | Status values that need to be considered for filter +let status = ["status_example"]; // [String] | Status values that need to be considered for filter -var callback = function(error, data, response) { +apiInstance.findPetsByStatus(status, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.findPetsByStatus(status, callback); +}); ``` ### Parameters @@ -181,26 +178,25 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var tags = ["tags_example"]; // [String] | Tags to filter by +let tags = ["tags_example"]; // [String] | Tags to filter by -var callback = function(error, data, response) { +apiInstance.findPetsByTags(tags, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.findPetsByTags(tags, callback); +}); ``` ### Parameters @@ -232,28 +228,27 @@ Returns a single pet ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; +let 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(); +let apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Number | ID of pet to return +let petId = 789; // Number | ID of pet to return -var callback = function(error, data, response) { +apiInstance.getPetById(petId, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.getPetById(petId, callback); +}); ``` ### Parameters @@ -285,26 +280,25 @@ Update an existing pet ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store +let body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store -var callback = function(error, data, response) { +apiInstance.updatePet(body, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.updatePet(body, callback); +}); ``` ### Parameters @@ -336,30 +330,29 @@ Updates a pet in the store with form data ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Number | ID of pet that needs to be updated +let petId = 789; // Number | ID of pet that needs to be updated -var opts = { +let 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) { +apiInstance.updatePetWithForm(petId, opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.updatePetWithForm(petId, opts, callback); +}); ``` ### Parameters @@ -393,30 +386,29 @@ uploads an image ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Number | ID of pet to update +let petId = 789; // Number | ID of pet to update -var opts = { +let 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) { +apiInstance.uploadFile(petId, opts, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.uploadFile(petId, opts, callback); +}); ``` ### Parameters diff --git a/samples/client/petstore/javascript-es6/docs/StoreApi.md b/samples/client/petstore/javascript-es6/docs/StoreApi.md index 64d4658232d..2581dc0b7d3 100644 --- a/samples/client/petstore/javascript-es6/docs/StoreApi.md +++ b/samples/client/petstore/javascript-es6/docs/StoreApi.md @@ -20,21 +20,20 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.StoreApi(); +let apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = "orderId_example"; // String | ID of the order that needs to be deleted +let orderId = "orderId_example"; // String | ID of the order that needs to be deleted -var callback = function(error, data, response) { +apiInstance.deleteOrder(orderId, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.deleteOrder(orderId, callback); +}); ``` ### Parameters @@ -66,25 +65,24 @@ Returns a map of status codes to quantities ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; +let 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(); +let apiInstance = new SwaggerPetstore.StoreApi(); -var callback = function(error, data, response) { +apiInstance.getInventory((error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.getInventory(callback); +}); ``` ### Parameters @@ -113,21 +111,20 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.StoreApi(); +let apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = 789; // Number | ID of pet that needs to be fetched +let orderId = 789; // Number | ID of pet that needs to be fetched -var callback = function(error, data, response) { +apiInstance.getOrderById(orderId, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.getOrderById(orderId, callback); +}); ``` ### Parameters @@ -159,21 +156,20 @@ Place an order for a pet ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.StoreApi(); +let apiInstance = new SwaggerPetstore.StoreApi(); -var body = new SwaggerPetstore.Order(); // Order | order placed for purchasing the pet +let body = new SwaggerPetstore.Order(); // Order | order placed for purchasing the pet -var callback = function(error, data, response) { +apiInstance.placeOrder(body, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.placeOrder(body, callback); +}); ``` ### Parameters diff --git a/samples/client/petstore/javascript-es6/docs/UserApi.md b/samples/client/petstore/javascript-es6/docs/UserApi.md index d0ff1003b0c..d77e8413fd3 100644 --- a/samples/client/petstore/javascript-es6/docs/UserApi.md +++ b/samples/client/petstore/javascript-es6/docs/UserApi.md @@ -24,21 +24,20 @@ This can only be done by the logged in user. ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var body = new SwaggerPetstore.User(); // User | Created user object +let body = new SwaggerPetstore.User(); // User | Created user object -var callback = function(error, data, response) { +apiInstance.createUser(body, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.createUser(body, callback); +}); ``` ### Parameters @@ -70,21 +69,20 @@ Creates list of users with given input array ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var body = [new SwaggerPetstore.User()]; // [User] | List of user object +let body = [new SwaggerPetstore.User()]; // [User] | List of user object -var callback = function(error, data, response) { +apiInstance.createUsersWithArrayInput(body, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.createUsersWithArrayInput(body, callback); +}); ``` ### Parameters @@ -116,21 +114,20 @@ Creates list of users with given input array ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var body = [new SwaggerPetstore.User()]; // [User] | List of user object +let body = [new SwaggerPetstore.User()]; // [User] | List of user object -var callback = function(error, data, response) { +apiInstance.createUsersWithListInput(body, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.createUsersWithListInput(body, callback); +}); ``` ### Parameters @@ -162,21 +159,20 @@ This can only be done by the logged in user. ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // String | The name that needs to be deleted +let username = "username_example"; // String | The name that needs to be deleted -var callback = function(error, data, response) { +apiInstance.deleteUser(username, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.deleteUser(username, callback); +}); ``` ### Parameters @@ -208,21 +204,20 @@ Get user by user name ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. +let username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -var callback = function(error, data, response) { +apiInstance.getUserByName(username, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.getUserByName(username, callback); +}); ``` ### Parameters @@ -254,23 +249,22 @@ Logs user into the system ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // String | The user name for login +let username = "username_example"; // String | The user name for login -var password = "password_example"; // String | The password for login in clear text +let password = "password_example"; // String | The password for login in clear text -var callback = function(error, data, response) { +apiInstance.loginUser(username, password, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } -}; -apiInstance.loginUser(username, password, callback); +}); ``` ### Parameters @@ -303,18 +297,17 @@ Logs out current logged in user session ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var callback = function(error, data, response) { +apiInstance.logoutUser((error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.logoutUser(callback); +}); ``` ### Parameters @@ -343,23 +336,22 @@ This can only be done by the logged in user. ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // String | name that need to be deleted +let username = "username_example"; // String | name that need to be deleted -var body = new SwaggerPetstore.User(); // User | Updated user object +let body = new SwaggerPetstore.User(); // User | Updated user object -var callback = function(error, data, response) { +apiInstance.updateUser(username, body, (error, data, response) => { if (error) { console.error(error); } else { console.log('API called successfully.'); } -}; -apiInstance.updateUser(username, body, callback); +}); ``` ### Parameters diff --git a/samples/client/petstore/javascript-es6/package.json b/samples/client/petstore/javascript-es6/package.json index 881163c02f4..0332217891a 100644 --- a/samples/client/petstore/javascript-es6/package.json +++ b/samples/client/petstore/javascript-es6/package.json @@ -5,17 +5,22 @@ "license": "Unlicense", "main": "src/index.js", "scripts": { - "test": "./node_modules/mocha/bin/mocha --recursive" + "test": "mocha --compilers js:babel-core/register --recursive" }, "browser": { "fs": false }, "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", - "expect.js": "~0.3.1" + "sinon": "1.17.3" } } diff --git a/samples/client/petstore/javascript-es6/src/ApiClient.js b/samples/client/petstore/javascript-es6/src/ApiClient.js index 5abc81c7dba..d47828d2a41 100644 --- a/samples/client/petstore/javascript-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-es6/src/ApiClient.js @@ -7,564 +7,570 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import superagent from "superagent"; +import querystring from "querystring"; + +/** +* @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 +*/ +export default class ApiClient { + constructor() { + /** + * 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.} + */ + 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.} + * @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(); + } } - 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.} - */ - this.authentications = { - 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, - 'http_basic_test': {type: 'basic'}, - 'petstore_auth': {type: 'oauth2'} + * Returns a string representation for an actual parameter. + * @param param The actual parameter. + * @returns {String} The string representation of param. + */ + paramToString(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. + */ + 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; + } + + /** + * Checks whether the given content type represents JSON.
+ * JSON content type examples:
+ *
    + *
  • application/json
  • + *
  • application/json; charset=UTF8
  • + *
  • APPLICATION/JSON
  • + *
+ * @param {String} contentType The MIME content type to check. + * @returns {Boolean} true if contentType represents JSON, otherwise false. + */ + isJsonMime(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.} contentTypes + * @returns {String} The chosen content type, preferring JSON. + */ + jsonPreferredMime(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} true if param represents a file. + */ + isFileParam(param) { + // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) + if (typeof require === 'function') { + let fs; + try { + fs = require('fs'); + } catch (err) {} + if (fs && fs.ReadStream && param instanceof 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: + *
    + *
  • remove nils
  • + *
  • keep files and arrays
  • + *
  • format to string with `paramToString` for other cases
  • + *
+ * @param {Object.} params The parameters as object properties. + * @returns {Object.} normalized parameters. + */ + 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; + } + + /** + * Enumeration of collection format separator strategies. + * @enum {String} + * @readonly + */ + static CollectionFormatEnum = { + /** + * Comma-separated values. Value: csv + * @const + */ + CSV: ',', + + /** + * Space-separated values. Value: ssv + * @const + */ + SSV: ' ', + + /** + * Tab-separated values. Value: tsv + * @const + */ + TSV: '\t', + + /** + * Pipe(|)-separated values. Value: pipes + * @const + */ + PIPES: '|', + + /** + * Native array. Value: multi + * @const + */ + MULTI: 'multi' }; - /** - * The default HTTP headers to be included for all API calls. - * @type {Array.} - * @default {} - */ - this.defaultHeaders = {}; /** - * The default HTTP timeout for all API calls. - * @type {Number} - * @default 60000 - */ - this.timeout = 60000; + * 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 + * param as is if collectionFormat is multi. + */ + 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); + } + } /** - * 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; + * Applies authentication headers to the request. + * @param {Object} request The request object created by a superagent() call. + * @param {Array.} authNames An array of authentication method names. + */ + 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); + } + }); + } /** - * 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; + * Deserializes an HTTP response body into a value of the specified type. + * @param {Object} response A SuperAgent response object. + * @param {(String|Array.|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 data will be converted to this type. + * @returns A value of the specified type. + */ + deserialize(response, returnType) { + if (response == null || returnType == null || response.status == 204) { + return null; + } - /* - * 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(); + // 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 ApiClient.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. + */ - /** - * Returns a string representation for an actual parameter. - * @param param The actual parameter. - * @returns {String} The string representation of param. - */ - exports.prototype.paramToString = function(param) { - if (param == undefined || param == null) { - return ''; - } - if (param instanceof Date) { - return param.toJSON(); - } - return param.toString(); - }; + /** + * 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.} pathParams A map of path parameters and their values. + * @param {Object.} queryParams A map of query parameters and their values. + * @param {Object.} headerParams A map of header parameters and their values. + * @param {Object.} formParams A map of form parameters and their values. + * @param {Object} bodyParam The value to pass as the request body. + * @param {Array.} authNames An array of authentication type names. + * @param {Array.} contentTypes An array of request MIME types. + * @param {Array.} 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. + */ + callApi(path, httpMethod, pathParams, + queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, + returnType, callback) { - /** - * 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; - }; + var url = this.buildUrl(path, pathParams); + var request = superagent(httpMethod, url); - /** - * Checks whether the given content type represents JSON.
- * JSON content type examples:
- *
    - *
  • application/json
  • - *
  • application/json; charset=UTF8
  • - *
  • APPLICATION/JSON
  • - *
- * @param {String} contentType The MIME content type to check. - * @returns {Boolean} true if contentType represents JSON, otherwise false. - */ - exports.prototype.isJsonMime = function(contentType) { - return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); - }; + // apply authentications + this.applyAuthToRequest(request, authNames); - /** - * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first. - * @param {Array.} 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]; - }; + // set query parameters + if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { + queryParams['_'] = new Date().getTime(); + } - /** - * Checks whether the given parameter value represents file-like content. - * @param param The parameter to check. - * @returns {Boolean} true if param represents a file. - */ - exports.prototype.isFileParam = function(param) { - // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) - if (typeof require === 'function') { - var fs; - try { - fs = require('fs'); - } catch (err) {} - if (fs && fs.ReadStream && param instanceof 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; - }; + request.query(this.normalizeParams(queryParams)); - /** - * Normalizes parameter values: - *
    - *
  • remove nils
  • - *
  • keep files and arrays
  • - *
  • format to string with `paramToString` for other cases
  • - *
- * @param {Object.} params The parameters as object properties. - * @returns {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; + // 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'); + } else if (returnType === 'String') { + request.responseType('string'); + } + + // Attach previously saved cookies, if enabled + if (this.enableCookies){ + if (typeof window === 'undefined') { + this.agent.attachCookies(request); + } + else { + request.withCredentials(); + } + } + + + + 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; + } + + /** + * 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. + */ + static parseDate(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.|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 data will be converted to this type. + * @returns An instance of the specified type or null or undefined if data is null or undefined. + */ + 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 ApiClient.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 ApiClient.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 = ApiClient.convertToType(k, keyType); + var value = ApiClient.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. + */ + static constructFromObject(data, obj, itemType) { + if (Array.isArray(data)) { + for (var i = 0; i < data.length; i++) { + if (data.hasOwnProperty(i)) + obj[i] = ApiClient.convertToType(data[i], itemType); + } } else { - newParams[key] = this.paramToString(value); + for (var k in data) { + if (data.hasOwnProperty(k)) + obj[k] = ApiClient.convertToType(data[k], itemType); + } } - } - } - return newParams; - }; + }; +} - /** - * Enumeration of collection format separator strategies. - * @enum {String} - * @readonly - */ - exports.CollectionFormatEnum = { - /** - * Comma-separated values. Value: csv - * @const - */ - CSV: ',', - /** - * Space-separated values. Value: ssv - * @const - */ - SSV: ' ', - /** - * Tab-separated values. Value: tsv - * @const - */ - TSV: '\t', - /** - * Pipe(|)-separated values. Value: pipes - * @const - */ - PIPES: '|', - /** - * Native array. Value: multi - * @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 - * param as is if collectionFormat is multi. - */ - 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 superagent() call. - * @param {Array.} 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.|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 data 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.} pathParams A map of path parameters and their values. - * @param {Object.} queryParams A map of query parameters and their values. - * @param {Object.} headerParams A map of header parameters and their values. - * @param {Object.} formParams A map of form parameters and their values. - * @param {Object} bodyParam The value to pass as the request body. - * @param {Array.} authNames An array of authentication type names. - * @param {Array.} contentTypes An array of request MIME types. - * @param {Array.} accepts An array of acceptable response MIME types. - * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the - * constructor for a complex type. - * @param {module:ApiClient~callApiCallback} callback The callback function. - * @returns {Object} The SuperAgent request object. - */ - exports.prototype.callApi = function callApi(path, httpMethod, pathParams, - queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, - returnType, callback) { - - var _this = this; - var url = this.buildUrl(path, pathParams); - var request = superagent(httpMethod, url); - - // 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'); - } else if (returnType === 'String') { - request.responseType('string'); - } - - // 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.|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 data 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; -})); +/** +* The default API client implementation. +* @type {module:ApiClient} +*/ +ApiClient.instance = new ApiClient(); diff --git a/samples/client/petstore/javascript-es6/src/api/FakeApi.js b/samples/client/petstore/javascript-es6/src/api/FakeApi.js index 579a8f87289..6c3d3384fa6 100644 --- a/samples/client/petstore/javascript-es6/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-es6/src/api/FakeApi.js @@ -7,45 +7,35 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from "../ApiClient"; +import Client from '../model/Client'; +import OuterBoolean from '../model/OuterBoolean'; +import OuterComposite from '../model/OuterComposite'; +import OuterNumber from '../model/OuterNumber'; +import OuterString from '../model/OuterString'; + +/** +* Fake service. +* @module api/FakeApi +* @version 1.0.0 +*/ +export default class FakeApi { + + /** + * 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. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; } - 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; /** @@ -63,24 +53,24 @@ * @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) { + fakeOuterBooleanSerialize(opts, callback) { opts = opts || {}; - var postBody = opts['body']; + let postBody = opts['body']; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = []; - var returnType = OuterBoolean; + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = OuterBoolean; return this.apiClient.callApi( '/fake/outer/boolean', 'POST', @@ -104,24 +94,24 @@ * @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) { + fakeOuterCompositeSerialize(opts, callback) { opts = opts || {}; - var postBody = opts['body']; + let postBody = opts['body']; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = []; - var returnType = OuterComposite; + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = OuterComposite; return this.apiClient.callApi( '/fake/outer/composite', 'POST', @@ -145,24 +135,24 @@ * @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) { + fakeOuterNumberSerialize(opts, callback) { opts = opts || {}; - var postBody = opts['body']; + let postBody = opts['body']; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = []; - var returnType = OuterNumber; + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = OuterNumber; return this.apiClient.callApi( '/fake/outer/number', 'POST', @@ -186,24 +176,24 @@ * @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) { + fakeOuterStringSerialize(opts, callback) { opts = opts || {}; - var postBody = opts['body']; + let postBody = opts['body']; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = []; - var returnType = OuterString; + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = OuterString; return this.apiClient.callApi( '/fake/outer/string', 'POST', @@ -227,8 +217,8 @@ * @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; + testClientModel(body, callback) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -236,19 +226,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = ['application/json']; - var accepts = ['application/json']; - var returnType = Client; + let authNames = []; + let contentTypes = ['application/json']; + let accepts = ['application/json']; + let returnType = Client; return this.apiClient.callApi( '/fake', 'PATCH', @@ -285,9 +275,9 @@ * @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) { + testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts, callback) { opts = opts || {}; - var postBody = null; + let postBody = null; // verify the required parameter '_number' is set if (_number === undefined || _number === null) { @@ -310,13 +300,13 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { 'integer': opts['integer'], 'int32': opts['int32'], 'int64': opts['int64'], @@ -333,10 +323,10 @@ '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; + let authNames = ['http_basic_test']; + let contentTypes = ['application/xml; charset=utf-8', 'application/json; charset=utf-8']; + let accepts = ['application/xml; charset=utf-8', 'application/json; charset=utf-8']; + let returnType = null; return this.apiClient.callApi( '/fake', 'POST', @@ -367,32 +357,32 @@ * @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) { + testEnumParameters(opts, callback) { opts = opts || {}; - var postBody = null; + let postBody = null; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { 'enum_query_string_array': this.apiClient.buildCollectionParam(opts['enumQueryStringArray'], 'csv'), 'enum_query_string': opts['enumQueryString'], 'enum_query_integer': opts['enumQueryInteger'] }; - var headerParams = { + let headerParams = { 'enum_header_string_array': opts['enumHeaderStringArray'], 'enum_header_string': opts['enumHeaderString'] }; - var formParams = { + let 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; + let authNames = []; + let contentTypes = ['*/*']; + let accepts = ['*/*']; + let returnType = null; return this.apiClient.callApi( '/fake', 'GET', @@ -400,7 +390,6 @@ authNames, contentTypes, accepts, returnType, callback ); } - }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-es6/src/api/PetApi.js b/samples/client/petstore/javascript-es6/src/api/PetApi.js index fecf45f6e30..e59d99bcc38 100644 --- a/samples/client/petstore/javascript-es6/src/api/PetApi.js +++ b/samples/client/petstore/javascript-es6/src/api/PetApi.js @@ -7,45 +7,32 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from "../ApiClient"; +import ApiResponse from '../model/ApiResponse'; +import Pet from '../model/Pet'; + +/** +* Pet service. +* @module api/PetApi +* @version 1.0.0 +*/ +export default class PetApi { + + /** + * 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. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; } - 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; /** @@ -62,8 +49,8 @@ * @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; + addPet(body, callback) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -71,19 +58,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = ['petstore_auth']; + let contentTypes = ['application/json', 'application/xml']; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/pet', 'POST', @@ -108,9 +95,9 @@ * @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) { + deletePet(petId, opts, callback) { opts = opts || {}; - var postBody = null; + let postBody = null; // verify the required parameter 'petId' is set if (petId === undefined || petId === null) { @@ -118,21 +105,21 @@ } - var pathParams = { + let pathParams = { 'petId': petId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { 'api_key': opts['apiKey'] }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = ['petstore_auth']; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/pet/{petId}', 'DELETE', @@ -156,8 +143,8 @@ * @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.} */ - this.findPetsByStatus = function(status, callback) { - var postBody = null; + findPetsByStatus(status, callback) { + let postBody = null; // verify the required parameter 'status' is set if (status === undefined || status === null) { @@ -165,20 +152,20 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { 'status': this.apiClient.buildCollectionParam(status, 'csv') }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = [Pet]; + let authNames = ['petstore_auth']; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = [Pet]; return this.apiClient.callApi( '/pet/findByStatus', 'GET', @@ -202,8 +189,8 @@ * @param {module:api/PetApi~findPetsByTagsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.} */ - this.findPetsByTags = function(tags, callback) { - var postBody = null; + findPetsByTags(tags, callback) { + let postBody = null; // verify the required parameter 'tags' is set if (tags === undefined || tags === null) { @@ -211,20 +198,20 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { 'tags': this.apiClient.buildCollectionParam(tags, 'csv') }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = [Pet]; + let authNames = ['petstore_auth']; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = [Pet]; return this.apiClient.callApi( '/pet/findByTags', 'GET', @@ -248,8 +235,8 @@ * @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; + getPetById(petId, callback) { + let postBody = null; // verify the required parameter 'petId' is set if (petId === undefined || petId === null) { @@ -257,20 +244,20 @@ } - var pathParams = { + let pathParams = { 'petId': petId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['api_key']; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = Pet; + let authNames = ['api_key']; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = Pet; return this.apiClient.callApi( '/pet/{petId}', 'GET', @@ -293,8 +280,8 @@ * @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; + updatePet(body, callback) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -302,19 +289,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = ['petstore_auth']; + let contentTypes = ['application/json', 'application/xml']; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/pet', 'PUT', @@ -340,9 +327,9 @@ * @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) { + updatePetWithForm(petId, opts, callback) { opts = opts || {}; - var postBody = null; + let postBody = null; // verify the required parameter 'petId' is set if (petId === undefined || petId === null) { @@ -350,22 +337,22 @@ } - var pathParams = { + let pathParams = { 'petId': petId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let 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; + let authNames = ['petstore_auth']; + let contentTypes = ['application/x-www-form-urlencoded']; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/pet/{petId}', 'POST', @@ -392,9 +379,9 @@ * @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) { + uploadFile(petId, opts, callback) { opts = opts || {}; - var postBody = null; + let postBody = null; // verify the required parameter 'petId' is set if (petId === undefined || petId === null) { @@ -402,22 +389,22 @@ } - var pathParams = { + let pathParams = { 'petId': petId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { 'additionalMetadata': opts['additionalMetadata'], 'file': opts['file'] }; - var authNames = ['petstore_auth']; - var contentTypes = ['multipart/form-data']; - var accepts = ['application/json']; - var returnType = ApiResponse; + let authNames = ['petstore_auth']; + let contentTypes = ['multipart/form-data']; + let accepts = ['application/json']; + let returnType = ApiResponse; return this.apiClient.callApi( '/pet/{petId}/uploadImage', 'POST', @@ -425,7 +412,6 @@ authNames, contentTypes, accepts, returnType, callback ); } - }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-es6/src/api/StoreApi.js b/samples/client/petstore/javascript-es6/src/api/StoreApi.js index 1f7359be1ae..b70fc4c0883 100644 --- a/samples/client/petstore/javascript-es6/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-es6/src/api/StoreApi.js @@ -7,45 +7,31 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from "../ApiClient"; +import Order from '../model/Order'; + +/** +* Store service. +* @module api/StoreApi +* @version 1.0.0 +*/ +export default class StoreApi { + + /** + * 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. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; } - 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; /** @@ -62,8 +48,8 @@ * @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; + deleteOrder(orderId, callback) { + let postBody = null; // verify the required parameter 'orderId' is set if (orderId === undefined || orderId === null) { @@ -71,20 +57,20 @@ } - var pathParams = { + let pathParams = { 'order_id': orderId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/store/order/{order_id}', 'DELETE', @@ -107,23 +93,23 @@ * @param {module:api/StoreApi~getInventoryCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Object.} */ - this.getInventory = function(callback) { - var postBody = null; + getInventory(callback) { + let postBody = null; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['api_key']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = {'String': 'Number'}; + let authNames = ['api_key']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = {'String': 'Number'}; return this.apiClient.callApi( '/store/inventory', 'GET', @@ -147,8 +133,8 @@ * @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; + getOrderById(orderId, callback) { + let postBody = null; // verify the required parameter 'orderId' is set if (orderId === undefined || orderId === null) { @@ -156,20 +142,20 @@ } - var pathParams = { + let pathParams = { 'order_id': orderId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = Order; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = Order; return this.apiClient.callApi( '/store/order/{order_id}', 'GET', @@ -193,8 +179,8 @@ * @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; + placeOrder(body, callback) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -202,19 +188,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = Order; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = Order; return this.apiClient.callApi( '/store/order', 'POST', @@ -222,7 +208,6 @@ authNames, contentTypes, accepts, returnType, callback ); } - }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-es6/src/api/UserApi.js b/samples/client/petstore/javascript-es6/src/api/UserApi.js index a2195636b6c..54c9b110d7b 100644 --- a/samples/client/petstore/javascript-es6/src/api/UserApi.js +++ b/samples/client/petstore/javascript-es6/src/api/UserApi.js @@ -7,45 +7,31 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from "../ApiClient"; +import User from '../model/User'; + +/** +* User service. +* @module api/UserApi +* @version 1.0.0 +*/ +export default class UserApi { + + /** + * 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. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; } - 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; /** @@ -62,8 +48,8 @@ * @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; + createUser(body, callback) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -71,19 +57,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user', 'POST', @@ -106,8 +92,8 @@ * @param {Array.} 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; + createUsersWithArrayInput(body, callback) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -115,19 +101,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/createWithArray', 'POST', @@ -150,8 +136,8 @@ * @param {Array.} 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; + createUsersWithListInput(body, callback) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -159,19 +145,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/createWithList', 'POST', @@ -194,8 +180,8 @@ * @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; + deleteUser(username, callback) { + let postBody = null; // verify the required parameter 'username' is set if (username === undefined || username === null) { @@ -203,20 +189,20 @@ } - var pathParams = { + let pathParams = { 'username': username }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/{username}', 'DELETE', @@ -240,8 +226,8 @@ * @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; + getUserByName(username, callback) { + let postBody = null; // verify the required parameter 'username' is set if (username === undefined || username === null) { @@ -249,20 +235,20 @@ } - var pathParams = { + let pathParams = { 'username': username }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = User; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = User; return this.apiClient.callApi( '/user/{username}', 'GET', @@ -287,8 +273,8 @@ * @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; + loginUser(username, password, callback) { + let postBody = null; // verify the required parameter 'username' is set if (username === undefined || username === null) { @@ -301,21 +287,21 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { 'username': username, 'password': password }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = 'String'; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = 'String'; return this.apiClient.callApi( '/user/login', 'GET', @@ -337,23 +323,23 @@ * * @param {module:api/UserApi~logoutUserCallback} callback The callback function, accepting three arguments: error, data, response */ - this.logoutUser = function(callback) { - var postBody = null; + logoutUser(callback) { + let postBody = null; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/logout', 'GET', @@ -377,8 +363,8 @@ * @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; + updateUser(username, body, callback) { + let postBody = body; // verify the required parameter 'username' is set if (username === undefined || username === null) { @@ -391,20 +377,20 @@ } - var pathParams = { + let pathParams = { 'username': username }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/{username}', 'PUT', @@ -412,7 +398,6 @@ authNames, contentTypes, accepts, returnType, callback ); } - }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-es6/src/index.js b/samples/client/petstore/javascript-es6/src/index.js index 6acae4aaaf4..3a016977a34 100644 --- a/samples/client/petstore/javascript-es6/src/index.js +++ b/samples/client/petstore/javascript-es6/src/index.js @@ -7,262 +7,329 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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/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/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, 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__.
- * The index module provides access to constructors for all the classes which comprise the public API. - *

- * An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: - *

-   * 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.
-   * ...
-   * 
- * *NOTE: For a top-level AMD script, use require(['index'], function(){...}) - * and put the application logic within the callback function. - *

- *

- * A non-AMD browser application (discouraged) might do something like this: - *

-   * 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.
-   * ...
-   * 
- *

- * @module index - * @version 1.0.0 - */ - var exports = { +import ApiClient from './ApiClient'; +import AdditionalPropertiesClass from './model/AdditionalPropertiesClass'; +import Animal from './model/Animal'; +import AnimalFarm from './model/AnimalFarm'; +import ApiResponse from './model/ApiResponse'; +import ArrayOfArrayOfNumberOnly from './model/ArrayOfArrayOfNumberOnly'; +import ArrayOfNumberOnly from './model/ArrayOfNumberOnly'; +import ArrayTest from './model/ArrayTest'; +import Capitalization from './model/Capitalization'; +import Category from './model/Category'; +import ClassModel from './model/ClassModel'; +import Client from './model/Client'; +import EnumArrays from './model/EnumArrays'; +import EnumClass from './model/EnumClass'; +import EnumTest from './model/EnumTest'; +import FormatTest from './model/FormatTest'; +import HasOnlyReadOnly from './model/HasOnlyReadOnly'; +import List from './model/List'; +import MapTest from './model/MapTest'; +import MixedPropertiesAndAdditionalPropertiesClass from './model/MixedPropertiesAndAdditionalPropertiesClass'; +import Model200Response from './model/Model200Response'; +import ModelReturn from './model/ModelReturn'; +import Name from './model/Name'; +import NumberOnly from './model/NumberOnly'; +import Order from './model/Order'; +import OuterBoolean from './model/OuterBoolean'; +import OuterComposite from './model/OuterComposite'; +import OuterEnum from './model/OuterEnum'; +import OuterNumber from './model/OuterNumber'; +import OuterString from './model/OuterString'; +import Pet from './model/Pet'; +import ReadOnlyFirst from './model/ReadOnlyFirst'; +import SpecialModelName from './model/SpecialModelName'; +import Tag from './model/Tag'; +import User from './model/User'; +import Cat from './model/Cat'; +import Dog from './model/Dog'; +import FakeApi from './api/FakeApi'; +import PetApi from './api/PetApi'; +import StoreApi from './api/StoreApi'; +import UserApi from './api/UserApi'; + + +/** +* This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters__.
+* The index module provides access to constructors for all the classes which comprise the public API. +*

+* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: +*

+* 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.
+* ...
+* 
+* *NOTE: For a top-level AMD script, use require(['index'], function(){...}) +* and put the application logic within the callback function. +*

+*

+* A non-AMD browser application (discouraged) might do something like this: +*

+* 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.
+* ...
+* 
+*

+* @module index +* @version 1.0.0 +*/ +export { /** * The ApiClient constructor. * @property {module:ApiClient} */ - ApiClient: ApiClient, + ApiClient, + /** * The AdditionalPropertiesClass model constructor. * @property {module:model/AdditionalPropertiesClass} */ - AdditionalPropertiesClass: AdditionalPropertiesClass, + AdditionalPropertiesClass, + /** * The Animal model constructor. * @property {module:model/Animal} */ - Animal: Animal, + Animal, + /** * The AnimalFarm model constructor. * @property {module:model/AnimalFarm} */ - AnimalFarm: AnimalFarm, + AnimalFarm, + /** * The ApiResponse model constructor. * @property {module:model/ApiResponse} */ - ApiResponse: ApiResponse, + ApiResponse, + /** * The ArrayOfArrayOfNumberOnly model constructor. * @property {module:model/ArrayOfArrayOfNumberOnly} */ - ArrayOfArrayOfNumberOnly: ArrayOfArrayOfNumberOnly, + ArrayOfArrayOfNumberOnly, + /** * The ArrayOfNumberOnly model constructor. * @property {module:model/ArrayOfNumberOnly} */ - ArrayOfNumberOnly: ArrayOfNumberOnly, + ArrayOfNumberOnly, + /** * The ArrayTest model constructor. * @property {module:model/ArrayTest} */ - ArrayTest: ArrayTest, + ArrayTest, + /** * The Capitalization model constructor. * @property {module:model/Capitalization} */ - Capitalization: Capitalization, + Capitalization, + /** * The Category model constructor. * @property {module:model/Category} */ - Category: Category, + Category, + /** * The ClassModel model constructor. * @property {module:model/ClassModel} */ - ClassModel: ClassModel, + ClassModel, + /** * The Client model constructor. * @property {module:model/Client} */ - Client: Client, + Client, + /** * The EnumArrays model constructor. * @property {module:model/EnumArrays} */ - EnumArrays: EnumArrays, + EnumArrays, + /** * The EnumClass model constructor. * @property {module:model/EnumClass} */ - EnumClass: EnumClass, + EnumClass, + /** * The EnumTest model constructor. * @property {module:model/EnumTest} */ - EnumTest: EnumTest, + EnumTest, + /** * The FormatTest model constructor. * @property {module:model/FormatTest} */ - FormatTest: FormatTest, + FormatTest, + /** * The HasOnlyReadOnly model constructor. * @property {module:model/HasOnlyReadOnly} */ - HasOnlyReadOnly: HasOnlyReadOnly, + HasOnlyReadOnly, + /** * The List model constructor. * @property {module:model/List} */ - List: List, + List, + /** * The MapTest model constructor. * @property {module:model/MapTest} */ - MapTest: MapTest, + MapTest, + /** * The MixedPropertiesAndAdditionalPropertiesClass model constructor. * @property {module:model/MixedPropertiesAndAdditionalPropertiesClass} */ - MixedPropertiesAndAdditionalPropertiesClass: MixedPropertiesAndAdditionalPropertiesClass, + MixedPropertiesAndAdditionalPropertiesClass, + /** * The Model200Response model constructor. * @property {module:model/Model200Response} */ - Model200Response: Model200Response, + Model200Response, + /** * The ModelReturn model constructor. * @property {module:model/ModelReturn} */ - ModelReturn: ModelReturn, + ModelReturn, + /** * The Name model constructor. * @property {module:model/Name} */ - Name: Name, + Name, + /** * The NumberOnly model constructor. * @property {module:model/NumberOnly} */ - NumberOnly: NumberOnly, + NumberOnly, + /** * The Order model constructor. * @property {module:model/Order} */ - Order: Order, + Order, + /** * The OuterBoolean model constructor. * @property {module:model/OuterBoolean} */ - OuterBoolean: OuterBoolean, + OuterBoolean, + /** * The OuterComposite model constructor. * @property {module:model/OuterComposite} */ - OuterComposite: OuterComposite, + OuterComposite, + /** * The OuterEnum model constructor. * @property {module:model/OuterEnum} */ - OuterEnum: OuterEnum, + OuterEnum, + /** * The OuterNumber model constructor. * @property {module:model/OuterNumber} */ - OuterNumber: OuterNumber, + OuterNumber, + /** * The OuterString model constructor. * @property {module:model/OuterString} */ - OuterString: OuterString, + OuterString, + /** * The Pet model constructor. * @property {module:model/Pet} */ - Pet: Pet, + Pet, + /** * The ReadOnlyFirst model constructor. * @property {module:model/ReadOnlyFirst} */ - ReadOnlyFirst: ReadOnlyFirst, + ReadOnlyFirst, + /** * The SpecialModelName model constructor. * @property {module:model/SpecialModelName} */ - SpecialModelName: SpecialModelName, + SpecialModelName, + /** * The Tag model constructor. * @property {module:model/Tag} */ - Tag: Tag, + Tag, + /** * The User model constructor. * @property {module:model/User} */ - User: User, + User, + /** * The Cat model constructor. * @property {module:model/Cat} */ - Cat: Cat, + Cat, + /** * The Dog model constructor. * @property {module:model/Dog} */ - Dog: Dog, - /** - * The FakeApi service constructor. - * @property {module:api/FakeApi} - */ - FakeApi: FakeApi, - /** - * 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 - }; + Dog, - return exports; -})); + /** + * The FakeApi service constructor. + * @property {module:api/FakeApi} + */ + FakeApi, + + /** + * The PetApi service constructor. + * @property {module:api/PetApi} + */ + PetApi, + + /** + * The StoreApi service constructor. + * @property {module:api/StoreApi} + */ + StoreApi, + + /** + * The UserApi service constructor. + * @property {module:api/UserApi} + */ + UserApi +}; diff --git a/samples/client/petstore/javascript-es6/src/model/AdditionalPropertiesClass.js b/samples/client/petstore/javascript-es6/src/model/AdditionalPropertiesClass.js index 2744647b18a..088cbb29b35 100644 --- a/samples/client/petstore/javascript-es6/src/model/AdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript-es6/src/model/AdditionalPropertiesClass.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The AdditionalPropertiesClass model module. +* @module model/AdditionalPropertiesClass +* @version 1.0.0 +*/ +export default class AdditionalPropertiesClass { + /** + * Constructs a new AdditionalPropertiesClass. + * @alias module:model/AdditionalPropertiesClass + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.AdditionalPropertiesClass = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a AdditionalPropertiesClass from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 AdditionalPropertiesClass instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new AdditionalPropertiesClass(); + + + - - /** - * The AdditionalPropertiesClass model module. - * @module model/AdditionalPropertiesClass - * @version 1.0.0 - */ - - /** - * Constructs a new AdditionalPropertiesClass. - * @alias module:model/AdditionalPropertiesClass - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a AdditionalPropertiesClass from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 AdditionalPropertiesClass 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'}}); - } + 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; } - return obj; - } - /** - * @member {Object.} map_property - */ - exports.prototype['map_property'] = undefined; - /** - * @member {Object.>} map_of_map_property - */ - exports.prototype['map_of_map_property'] = undefined; + /** + * @member {Object.} map_property + */ + map_property = undefined; + /** + * @member {Object.>} map_of_map_property + */ + map_of_map_property = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Animal.js b/samples/client/petstore/javascript-es6/src/model/Animal.js index 09119420568..b3fb1a63f32 100644 --- a/samples/client/petstore/javascript-es6/src/model/Animal.js +++ b/samples/client/petstore/javascript-es6/src/model/Animal.js @@ -7,86 +7,83 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Animal model module. +* @module model/Animal +* @version 1.0.0 +*/ +export default class Animal { + /** + * Constructs a new Animal. + * @alias module:model/Animal + * @class + * @param className {String} + */ + + constructor(className) { + + + + + + this['className'] = className; + + } - root.SwaggerPetstore.Animal = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Animal from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Animal instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Animal(); + + + - - /** - * The Animal model module. - * @module model/Animal - * @version 1.0.0 - */ - - /** - * Constructs a new Animal. - * @alias module:model/Animal - * @class - * @param className {String} - */ - var exports = function(className) { - var _this = this; - - _this['className'] = className; - - }; - - /** - * Constructs a Animal from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Animal 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'); - } + if (data.hasOwnProperty('className')) { + obj['className'] = ApiClient.convertToType(data['className'], 'String'); + } + if (data.hasOwnProperty('color')) { + obj['color'] = ApiClient.convertToType(data['color'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} className - */ - exports.prototype['className'] = undefined; - /** - * @member {String} color - * @default 'red' - */ - exports.prototype['color'] = 'red'; + /** + * @member {String} className + */ + className = undefined; + /** + * @member {String} color + * @default 'red' + */ + color = 'red'; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/AnimalFarm.js b/samples/client/petstore/javascript-es6/src/model/AnimalFarm.js index 891009dab71..8dc9f00cadb 100644 --- a/samples/client/petstore/javascript-es6/src/model/AnimalFarm.js +++ b/samples/client/petstore/javascript-es6/src/model/AnimalFarm.js @@ -7,73 +7,72 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import Animal from './Animal'; + + + + + +/** +* The AnimalFarm model module. +* @module model/AnimalFarm +* @version 1.0.0 +*/ +export default class AnimalFarm { + /** + * Constructs a new AnimalFarm. + * @alias module:model/AnimalFarm + * @class + * @extends Array + */ + + constructor() { + + this = new Array(); + Object.setPrototypeOf(this, AnimalFarm); + + + + + + + return this; } - root.SwaggerPetstore.AnimalFarm = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); - } -}(this, function(ApiClient, Animal) { - 'use strict'; + /** + * Constructs a AnimalFarm from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 AnimalFarm instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new AnimalFarm(); + ApiClient.constructFromObject(data, obj, 'Animal'); + + - /** - * The AnimalFarm model module. - * @module model/AnimalFarm - * @version 1.0.0 - */ - - /** - * Constructs a new AnimalFarm. - * @alias module:model/AnimalFarm - * @class - * @extends Array - */ - var exports = function() { - var _this = this; - _this = new Array(); - Object.setPrototypeOf(_this, exports); - - return _this; - }; - - /** - * Constructs a AnimalFarm from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 AnimalFarm instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - ApiClient.constructFromObject(data, obj, 'Animal'); - + } + return obj; } - return obj; - } - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/ApiResponse.js b/samples/client/petstore/javascript-es6/src/model/ApiResponse.js index 12e9e16275f..49ddd1ac27f 100644 --- a/samples/client/petstore/javascript-es6/src/model/ApiResponse.js +++ b/samples/client/petstore/javascript-es6/src/model/ApiResponse.js @@ -7,92 +7,88 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ApiResponse model module. +* @module model/ApiResponse +* @version 1.0.0 +*/ +export default class ApiResponse { + /** + * Constructs a new ApiResponse. + * @alias module:model/ApiResponse + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ApiResponse = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ApiResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ApiResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ApiResponse(); + + + - - /** - * The ApiResponse model module. - * @module model/ApiResponse - * @version 1.0.0 - */ - - /** - * Constructs a new ApiResponse. - * @alias module:model/ApiResponse - * @class - */ - var exports = function() { - var _this = this; - - - - - }; - - /** - * Constructs a ApiResponse from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ApiResponse 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'); - } + 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; } - return obj; - } - /** - * @member {Number} code - */ - exports.prototype['code'] = undefined; - /** - * @member {String} type - */ - exports.prototype['type'] = undefined; - /** - * @member {String} message - */ - exports.prototype['message'] = undefined; + /** + * @member {Number} code + */ + code = undefined; + /** + * @member {String} type + */ + type = undefined; + /** + * @member {String} message + */ + message = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/ArrayOfArrayOfNumberOnly.js b/samples/client/petstore/javascript-es6/src/model/ArrayOfArrayOfNumberOnly.js index c620c19e667..1dfd4487c62 100644 --- a/samples/client/petstore/javascript-es6/src/model/ArrayOfArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript-es6/src/model/ArrayOfArrayOfNumberOnly.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ArrayOfArrayOfNumberOnly model module. +* @module model/ArrayOfArrayOfNumberOnly +* @version 1.0.0 +*/ +export default class ArrayOfArrayOfNumberOnly { + /** + * Constructs a new ArrayOfArrayOfNumberOnly. + * @alias module:model/ArrayOfArrayOfNumberOnly + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ArrayOfArrayOfNumberOnly = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ArrayOfArrayOfNumberOnly from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ArrayOfArrayOfNumberOnly instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ArrayOfArrayOfNumberOnly(); + + + - - /** - * The ArrayOfArrayOfNumberOnly model module. - * @module model/ArrayOfArrayOfNumberOnly - * @version 1.0.0 - */ - - /** - * Constructs a new ArrayOfArrayOfNumberOnly. - * @alias module:model/ArrayOfArrayOfNumberOnly - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a ArrayOfArrayOfNumberOnly from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ArrayOfArrayOfNumberOnly instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('ArrayArrayNumber')) { - obj['ArrayArrayNumber'] = ApiClient.convertToType(data['ArrayArrayNumber'], [['Number']]); - } + if (data.hasOwnProperty('ArrayArrayNumber')) { + obj['ArrayArrayNumber'] = ApiClient.convertToType(data['ArrayArrayNumber'], [['Number']]); + } + } + return obj; } - return obj; - } - /** - * @member {Array.>} ArrayArrayNumber - */ - exports.prototype['ArrayArrayNumber'] = undefined; + /** + * @member {Array.>} ArrayArrayNumber + */ + ArrayArrayNumber = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/ArrayOfNumberOnly.js b/samples/client/petstore/javascript-es6/src/model/ArrayOfNumberOnly.js index 66980b9b8d1..379a19ba3ff 100644 --- a/samples/client/petstore/javascript-es6/src/model/ArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript-es6/src/model/ArrayOfNumberOnly.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ArrayOfNumberOnly model module. +* @module model/ArrayOfNumberOnly +* @version 1.0.0 +*/ +export default class ArrayOfNumberOnly { + /** + * Constructs a new ArrayOfNumberOnly. + * @alias module:model/ArrayOfNumberOnly + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ArrayOfNumberOnly = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ArrayOfNumberOnly from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ArrayOfNumberOnly instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ArrayOfNumberOnly(); + + + - - /** - * The ArrayOfNumberOnly model module. - * @module model/ArrayOfNumberOnly - * @version 1.0.0 - */ - - /** - * Constructs a new ArrayOfNumberOnly. - * @alias module:model/ArrayOfNumberOnly - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a ArrayOfNumberOnly from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ArrayOfNumberOnly instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('ArrayNumber')) { - obj['ArrayNumber'] = ApiClient.convertToType(data['ArrayNumber'], ['Number']); - } + if (data.hasOwnProperty('ArrayNumber')) { + obj['ArrayNumber'] = ApiClient.convertToType(data['ArrayNumber'], ['Number']); + } + } + return obj; } - return obj; - } - /** - * @member {Array.} ArrayNumber - */ - exports.prototype['ArrayNumber'] = undefined; + /** + * @member {Array.} ArrayNumber + */ + ArrayNumber = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/ArrayTest.js b/samples/client/petstore/javascript-es6/src/model/ArrayTest.js index 2fb4ecb6c24..58e9ac58840 100644 --- a/samples/client/petstore/javascript-es6/src/model/ArrayTest.js +++ b/samples/client/petstore/javascript-es6/src/model/ArrayTest.js @@ -7,92 +7,89 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import ReadOnlyFirst from './ReadOnlyFirst'; + + + + + +/** +* The ArrayTest model module. +* @module model/ArrayTest +* @version 1.0.0 +*/ +export default class ArrayTest { + /** + * Constructs a new ArrayTest. + * @alias module:model/ArrayTest + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ArrayTest = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.ReadOnlyFirst); - } -}(this, function(ApiClient, ReadOnlyFirst) { - 'use strict'; + /** + * Constructs a ArrayTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ArrayTest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ArrayTest(); + + + - - /** - * The ArrayTest model module. - * @module model/ArrayTest - * @version 1.0.0 - */ - - /** - * Constructs a new ArrayTest. - * @alias module:model/ArrayTest - * @class - */ - var exports = function() { - var _this = this; - - - - - }; - - /** - * Constructs a ArrayTest from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ArrayTest 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]]); - } + 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; } - return obj; - } - /** - * @member {Array.} array_of_string - */ - exports.prototype['array_of_string'] = undefined; - /** - * @member {Array.>} array_array_of_integer - */ - exports.prototype['array_array_of_integer'] = undefined; - /** - * @member {Array.>} array_array_of_model - */ - exports.prototype['array_array_of_model'] = undefined; + /** + * @member {Array.} array_of_string + */ + array_of_string = undefined; + /** + * @member {Array.>} array_array_of_integer + */ + array_array_of_integer = undefined; + /** + * @member {Array.>} array_array_of_model + */ + array_array_of_model = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Capitalization.js b/samples/client/petstore/javascript-es6/src/model/Capitalization.js index 54154d396f8..12f3f3f5593 100644 --- a/samples/client/petstore/javascript-es6/src/model/Capitalization.js +++ b/samples/client/petstore/javascript-es6/src/model/Capitalization.js @@ -7,117 +7,110 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Capitalization model module. +* @module model/Capitalization +* @version 1.0.0 +*/ +export default class Capitalization { + /** + * Constructs a new Capitalization. + * @alias module:model/Capitalization + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Capitalization = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Capitalization from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Capitalization instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Capitalization(); + + + - - /** - * The Capitalization model module. - * @module model/Capitalization - * @version 1.0.0 - */ - - /** - * Constructs a new Capitalization. - * @alias module:model/Capitalization - * @class - */ - var exports = function() { - var _this = this; - - - - - - - - }; - - /** - * Constructs a Capitalization from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Capitalization 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'); - } + 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; } - 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; + /** + * @member {String} smallCamel + */ + smallCamel = undefined; + /** + * @member {String} CapitalCamel + */ + CapitalCamel = undefined; + /** + * @member {String} small_Snake + */ + small_Snake = undefined; + /** + * @member {String} Capital_Snake + */ + Capital_Snake = undefined; + /** + * @member {String} SCA_ETH_Flow_Points + */ + SCA_ETH_Flow_Points = undefined; + /** + * Name of the pet + * @member {String} ATT_NAME + */ + ATT_NAME = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Cat.js b/samples/client/petstore/javascript-es6/src/model/Cat.js index 862e7b0c910..da946664d08 100644 --- a/samples/client/petstore/javascript-es6/src/model/Cat.js +++ b/samples/client/petstore/javascript-es6/src/model/Cat.js @@ -7,81 +7,78 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import Animal from './Animal'; + + + + + +/** +* The Cat model module. +* @module model/Cat +* @version 1.0.0 +*/ +export default class Cat { + /** + * Constructs a new Cat. + * @alias module:model/Cat + * @class + * @extends module:model/Animal + * @param className {String} + */ + + constructor(className) { + + + Animal.call(this, className); + + + + + } - root.SwaggerPetstore.Cat = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); - } -}(this, function(ApiClient, Animal) { - 'use strict'; + /** + * Constructs a Cat from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Cat instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Cat(); + + Animal.constructFromObject(data, obj); + - /** - * The Cat model module. - * @module model/Cat - * @version 1.0.0 - */ - - /** - * Constructs a new Cat. - * @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 Cat from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Cat 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'); - } + if (data.hasOwnProperty('declawed')) { + obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean'); + } + } + return obj; } - return obj; - } - exports.prototype = Object.create(Animal.prototype); - exports.prototype.constructor = exports; - - /** - * @member {Boolean} declawed - */ - exports.prototype['declawed'] = undefined; + /** + * @member {Boolean} declawed + */ + declawed = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Category.js b/samples/client/petstore/javascript-es6/src/model/Category.js index d7ecc2207da..a281817b72f 100644 --- a/samples/client/petstore/javascript-es6/src/model/Category.js +++ b/samples/client/petstore/javascript-es6/src/model/Category.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Category model module. +* @module model/Category +* @version 1.0.0 +*/ +export default class Category { + /** + * Constructs a new Category. + * @alias module:model/Category + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Category = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Category from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Category instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Category(); + + + - - /** - * The Category model module. - * @module model/Category - * @version 1.0.0 - */ - - /** - * Constructs a new Category. - * @alias module:model/Category - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a Category from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Category 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'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {String} name - */ - exports.prototype['name'] = undefined; + /** + * @member {Number} id + */ + id = undefined; + /** + * @member {String} name + */ + name = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/ClassModel.js b/samples/client/petstore/javascript-es6/src/model/ClassModel.js index c3b7b83f9c5..6a558444ade 100644 --- a/samples/client/petstore/javascript-es6/src/model/ClassModel.js +++ b/samples/client/petstore/javascript-es6/src/model/ClassModel.js @@ -7,77 +7,75 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ClassModel model module. +* @module model/ClassModel +* @version 1.0.0 +*/ +export default class ClassModel { + /** + * Constructs a new ClassModel. + * Model for testing model with \"_class\" property + * @alias module:model/ClassModel + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ClassModel = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ClassModel from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ClassModel instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ClassModel(); + + + - - /** - * The ClassModel model module. - * @module model/ClassModel - * @version 1.0.0 - */ - - /** - * Constructs a new ClassModel. - * Model for testing model with \"_class\" property - * @alias module:model/ClassModel - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a ClassModel from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ClassModel instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('_class')) { - obj['_class'] = ApiClient.convertToType(data['_class'], 'String'); - } + if (data.hasOwnProperty('_class')) { + obj['_class'] = ApiClient.convertToType(data['_class'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} _class - */ - exports.prototype['_class'] = undefined; + /** + * @member {String} _class + */ + _class = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Client.js b/samples/client/petstore/javascript-es6/src/model/Client.js index a2912224910..a4f9b235154 100644 --- a/samples/client/petstore/javascript-es6/src/model/Client.js +++ b/samples/client/petstore/javascript-es6/src/model/Client.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Client model module. +* @module model/Client +* @version 1.0.0 +*/ +export default class Client { + /** + * Constructs a new Client. + * @alias module:model/Client + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Client = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Client from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Client instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Client(); + + + - - /** - * The Client model module. - * @module model/Client - * @version 1.0.0 - */ - - /** - * Constructs a new Client. - * @alias module:model/Client - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a Client from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Client instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('client')) { - obj['client'] = ApiClient.convertToType(data['client'], 'String'); - } + if (data.hasOwnProperty('client')) { + obj['client'] = ApiClient.convertToType(data['client'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} client - */ - exports.prototype['client'] = undefined; + /** + * @member {String} client + */ + client = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Dog.js b/samples/client/petstore/javascript-es6/src/model/Dog.js index 2cd286fb741..e5bc0d3cecf 100644 --- a/samples/client/petstore/javascript-es6/src/model/Dog.js +++ b/samples/client/petstore/javascript-es6/src/model/Dog.js @@ -7,81 +7,78 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import Animal from './Animal'; + + + + + +/** +* The Dog model module. +* @module model/Dog +* @version 1.0.0 +*/ +export default class Dog { + /** + * Constructs a new Dog. + * @alias module:model/Dog + * @class + * @extends module:model/Animal + * @param className {String} + */ + + constructor(className) { + + + Animal.call(this, className); + + + + + } - root.SwaggerPetstore.Dog = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); - } -}(this, function(ApiClient, Animal) { - 'use strict'; + /** + * Constructs a Dog from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Dog instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Dog(); + + Animal.constructFromObject(data, obj); + - /** - * The Dog model module. - * @module model/Dog - * @version 1.0.0 - */ - - /** - * Constructs a new Dog. - * @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 Dog from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Dog 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'); - } + if (data.hasOwnProperty('breed')) { + obj['breed'] = ApiClient.convertToType(data['breed'], 'String'); + } + } + return obj; } - return obj; - } - exports.prototype = Object.create(Animal.prototype); - exports.prototype.constructor = exports; - - /** - * @member {String} breed - */ - exports.prototype['breed'] = undefined; + /** + * @member {String} breed + */ + breed = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/EnumArrays.js b/samples/client/petstore/javascript-es6/src/model/EnumArrays.js index 079cfe25084..20a74f0d883 100644 --- a/samples/client/petstore/javascript-es6/src/model/EnumArrays.js +++ b/samples/client/petstore/javascript-es6/src/model/EnumArrays.js @@ -7,118 +7,121 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The EnumArrays model module. +* @module model/EnumArrays +* @version 1.0.0 +*/ +export default class EnumArrays { + /** + * Constructs a new EnumArrays. + * @alias module:model/EnumArrays + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.EnumArrays = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a EnumArrays from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 EnumArrays instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EnumArrays(); + + + - - /** - * The EnumArrays model module. - * @module model/EnumArrays - * @version 1.0.0 - */ - - /** - * Constructs a new EnumArrays. - * @alias module:model/EnumArrays - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a EnumArrays from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 EnumArrays 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']); - } + 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; } - return obj; - } - /** - * @member {module:model/EnumArrays.JustSymbolEnum} just_symbol - */ - exports.prototype['just_symbol'] = undefined; - /** - * @member {Array.} array_enum - */ - exports.prototype['array_enum'] = undefined; - - - /** - * Allowed values for the just_symbol property. - * @enum {String} - * @readonly - */ - exports.JustSymbolEnum = { /** - * value: ">=" - * @const - */ - "GREATER_THAN_OR_EQUAL_TO": ">=", + * @member {module:model/EnumArrays.JustSymbolEnum} just_symbol + */ + just_symbol = undefined; /** - * value: "$" - * @const - */ - "DOLLAR": "$" }; + * @member {Array.} array_enum + */ + array_enum = undefined; + + + + + - /** - * Allowed values for the arrayEnum property. - * @enum {String} - * @readonly - */ - exports.ArrayEnumEnum = { /** - * value: "fish" - * @const - */ - "fish": "fish", + * Allowed values for the just_symbol property. + * @enum {String} + * @readonly + */ + static JustSymbolEnum = { + + /** + * value: ">=" + * @const + */ + "GREATER_THAN_OR_EQUAL_TO": ">=", + + /** + * value: "$" + * @const + */ + "DOLLAR": "$" + }; + /** - * value: "crab" - * @const - */ - "crab": "crab" }; + * Allowed values for the arrayEnum property. + * @enum {String} + * @readonly + */ + static ArrayEnumEnum = { + + /** + * value: "fish" + * @const + */ + "fish": "fish", + + /** + * value: "crab" + * @const + */ + "crab": "crab" + }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-es6/src/model/EnumClass.js b/samples/client/petstore/javascript-es6/src/model/EnumClass.js index 881a7503047..eeb08ca2864 100644 --- a/samples/client/petstore/javascript-es6/src/model/EnumClass.js +++ b/samples/client/petstore/javascript-es6/src/model/EnumClass.js @@ -7,63 +7,51 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + +/** +* Enum class EnumClass. +* @enum {} +* @readonly +*/ +export default class EnumClass { + + /** + * value: "_abc" + * @const + */ + _abc = "_abc"; + + + /** + * value: "-efg" + * @const + */ + -efg = "-efg"; + + + /** + * value: "(xyz)" + * @const + */ + (xyz) = "(xyz)"; + + + + /** + * Returns a EnumClass enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/EnumClass} The enum EnumClass value. + */ + static constructFromObject(object) { + return object; } - root.SwaggerPetstore.EnumClass = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - - /** - * Enum class EnumClass. - * @enum {} - * @readonly - */ - var exports = { - /** - * value: "_abc" - * @const - */ - "_abc": "_abc", - /** - * value: "-efg" - * @const - */ - "-efg": "-efg", - /** - * value: "(xyz)" - * @const - */ - "(xyz)": "(xyz)" }; - - /** - * Returns a EnumClass enum value from a Javascript object name. - * @param {Object} data The plain JavaScript object containing the name of the enum value. - * @return {module:model/EnumClass} The enum EnumClass value. - */ - exports.constructFromObject = function(object) { - return object; - } - - return exports; -})); +} diff --git a/samples/client/petstore/javascript-es6/src/model/EnumTest.js b/samples/client/petstore/javascript-es6/src/model/EnumTest.js index 215bea59d38..b1f9b0b6c69 100644 --- a/samples/client/petstore/javascript-es6/src/model/EnumTest.js +++ b/samples/client/petstore/javascript-es6/src/model/EnumTest.js @@ -7,156 +7,162 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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/OuterEnum'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('./OuterEnum')); - } else { - // Browser globals (root is window) - if (!root.SwaggerPetstore) { - root.SwaggerPetstore = {}; + +import ApiClient from '../ApiClient'; +import OuterEnum from './OuterEnum'; + + + + + +/** +* The EnumTest model module. +* @module model/EnumTest +* @version 1.0.0 +*/ +export default class EnumTest { + /** + * Constructs a new EnumTest. + * @alias module:model/EnumTest + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.EnumTest = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.OuterEnum); - } -}(this, function(ApiClient, OuterEnum) { - 'use strict'; + /** + * Constructs a EnumTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/EnumTest} obj Optional instance to populate. + * @return {module:model/EnumTest} The populated EnumTest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EnumTest(); + + + - - /** - * The EnumTest model module. - * @module model/EnumTest - * @version 1.0.0 - */ - - /** - * Constructs a new EnumTest. - * @alias module:model/EnumTest - * @class - */ - var exports = function() { - var _this = this; - - - - - - }; - - /** - * Constructs a EnumTest from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/EnumTest} obj Optional instance to populate. - * @return {module:model/EnumTest} The populated EnumTest instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('enum_string')) { - obj['enum_string'] = ApiClient.convertToType(data['enum_string'], 'String'); - } - if (data.hasOwnProperty('enum_integer')) { - obj['enum_integer'] = ApiClient.convertToType(data['enum_integer'], 'Number'); - } - if (data.hasOwnProperty('enum_number')) { - obj['enum_number'] = ApiClient.convertToType(data['enum_number'], 'Number'); - } - if (data.hasOwnProperty('outerEnum')) { - obj['outerEnum'] = OuterEnum.constructFromObject(data['outerEnum']); - } + if (data.hasOwnProperty('enum_string')) { + obj['enum_string'] = ApiClient.convertToType(data['enum_string'], 'String'); + } + if (data.hasOwnProperty('enum_integer')) { + obj['enum_integer'] = ApiClient.convertToType(data['enum_integer'], 'Number'); + } + if (data.hasOwnProperty('enum_number')) { + obj['enum_number'] = ApiClient.convertToType(data['enum_number'], 'Number'); + } + if (data.hasOwnProperty('outerEnum')) { + obj['outerEnum'] = OuterEnum.constructFromObject(data['outerEnum']); + } + } + return obj; } - return obj; - } - /** - * @member {module:model/EnumTest.EnumStringEnum} enum_string - */ - exports.prototype['enum_string'] = undefined; - /** - * @member {module:model/EnumTest.EnumIntegerEnum} enum_integer - */ - exports.prototype['enum_integer'] = undefined; - /** - * @member {module:model/EnumTest.EnumNumberEnum} enum_number - */ - exports.prototype['enum_number'] = undefined; - /** - * @member {module:model/OuterEnum} outerEnum - */ - exports.prototype['outerEnum'] = undefined; - - - /** - * Allowed values for the enum_string property. - * @enum {String} - * @readonly - */ - exports.EnumStringEnum = { /** - * value: "UPPER" - * @const - */ - "UPPER": "UPPER", + * @member {module:model/EnumTest.EnumStringEnum} enum_string + */ + enum_string = undefined; /** - * value: "lower" - * @const - */ - "lower": "lower", + * @member {module:model/EnumTest.EnumIntegerEnum} enum_integer + */ + enum_integer = undefined; /** - * value: "" - * @const - */ - "empty": "" }; - - /** - * Allowed values for the enum_integer property. - * @enum {Number} - * @readonly - */ - exports.EnumIntegerEnum = { + * @member {module:model/EnumTest.EnumNumberEnum} enum_number + */ + enum_number = undefined; /** - * value: 1 - * @const - */ - "1": 1, - /** - * value: -1 - * @const - */ - "-1": -1 }; - - /** - * Allowed values for the enum_number property. - * @enum {Number} - * @readonly - */ - exports.EnumNumberEnum = { - /** - * value: 1.1 - * @const - */ - "1.1": 1.1, - /** - * value: -1.2 - * @const - */ - "-1.2": -1.2 }; + * @member {module:model/OuterEnum} outerEnum + */ + outerEnum = undefined; - return exports; -})); + + + + + /** + * Allowed values for the enum_string property. + * @enum {String} + * @readonly + */ + static EnumStringEnum = { + + /** + * value: "UPPER" + * @const + */ + "UPPER": "UPPER", + + /** + * value: "lower" + * @const + */ + "lower": "lower", + + /** + * value: "" + * @const + */ + "empty": "" + }; + + /** + * Allowed values for the enum_integer property. + * @enum {Number} + * @readonly + */ + static EnumIntegerEnum = { + + /** + * value: 1 + * @const + */ + "1": 1, + + /** + * value: -1 + * @const + */ + "-1": -1 + }; + + /** + * Allowed values for the enum_number property. + * @enum {Number} + * @readonly + */ + static EnumNumberEnum = { + + /** + * value: 1.1 + * @const + */ + "1.1": 1.1, + + /** + * value: -1.2 + * @const + */ + "-1.2": -1.2 + }; + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/FormatTest.js b/samples/client/petstore/javascript-es6/src/model/FormatTest.js index 238224d0132..8773a3a7755 100644 --- a/samples/client/petstore/javascript-es6/src/model/FormatTest.js +++ b/samples/client/petstore/javascript-es6/src/model/FormatTest.js @@ -7,176 +7,162 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The FormatTest model module. +* @module model/FormatTest +* @version 1.0.0 +*/ +export default class FormatTest { + /** + * Constructs a new FormatTest. + * @alias module:model/FormatTest + * @class + * @param _number {Number} + * @param _byte {Blob} + * @param _date {Date} + * @param password {String} + */ + + constructor(_number, _byte, _date, password) { + + + + + + this['number'] = _number;this['byte'] = _byte;this['date'] = _date;this['password'] = password; + + } - root.SwaggerPetstore.FormatTest = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a FormatTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/FormatTest} obj Optional instance to populate. + * @return {module:model/FormatTest} The populated FormatTest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new FormatTest(); + + + - - /** - * The FormatTest model module. - * @module model/FormatTest - * @version 1.0.0 - */ - - /** - * Constructs a new FormatTest. - * @alias module:model/FormatTest - * @class - * @param _number {Number} - * @param _byte {Blob} - * @param _date {Date} - * @param password {String} - */ - var exports = function(_number, _byte, _date, password) { - var _this = this; - - - - - _this['number'] = _number; - - - - _this['byte'] = _byte; - - _this['date'] = _date; - - - _this['password'] = password; - }; - - /** - * Constructs a FormatTest from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/FormatTest} obj Optional instance to populate. - * @return {module:model/FormatTest} The populated FormatTest instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('integer')) { - obj['integer'] = ApiClient.convertToType(data['integer'], 'Number'); - } - if (data.hasOwnProperty('int32')) { - obj['int32'] = ApiClient.convertToType(data['int32'], 'Number'); - } - if (data.hasOwnProperty('int64')) { - obj['int64'] = ApiClient.convertToType(data['int64'], 'Number'); - } - if (data.hasOwnProperty('number')) { - obj['number'] = ApiClient.convertToType(data['number'], 'Number'); - } - if (data.hasOwnProperty('float')) { - obj['float'] = ApiClient.convertToType(data['float'], 'Number'); - } - if (data.hasOwnProperty('double')) { - obj['double'] = ApiClient.convertToType(data['double'], 'Number'); - } - if (data.hasOwnProperty('string')) { - obj['string'] = ApiClient.convertToType(data['string'], 'String'); - } - if (data.hasOwnProperty('byte')) { - obj['byte'] = ApiClient.convertToType(data['byte'], 'Blob'); - } - if (data.hasOwnProperty('binary')) { - obj['binary'] = ApiClient.convertToType(data['binary'], 'Blob'); - } - if (data.hasOwnProperty('date')) { - obj['date'] = ApiClient.convertToType(data['date'], 'Date'); - } - if (data.hasOwnProperty('dateTime')) { - obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); - } - if (data.hasOwnProperty('uuid')) { - obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); - } - if (data.hasOwnProperty('password')) { - obj['password'] = ApiClient.convertToType(data['password'], 'String'); - } + if (data.hasOwnProperty('integer')) { + obj['integer'] = ApiClient.convertToType(data['integer'], 'Number'); + } + if (data.hasOwnProperty('int32')) { + obj['int32'] = ApiClient.convertToType(data['int32'], 'Number'); + } + if (data.hasOwnProperty('int64')) { + obj['int64'] = ApiClient.convertToType(data['int64'], 'Number'); + } + if (data.hasOwnProperty('number')) { + obj['number'] = ApiClient.convertToType(data['number'], 'Number'); + } + if (data.hasOwnProperty('float')) { + obj['float'] = ApiClient.convertToType(data['float'], 'Number'); + } + if (data.hasOwnProperty('double')) { + obj['double'] = ApiClient.convertToType(data['double'], 'Number'); + } + if (data.hasOwnProperty('string')) { + obj['string'] = ApiClient.convertToType(data['string'], 'String'); + } + if (data.hasOwnProperty('byte')) { + obj['byte'] = ApiClient.convertToType(data['byte'], 'Blob'); + } + if (data.hasOwnProperty('binary')) { + obj['binary'] = ApiClient.convertToType(data['binary'], 'Blob'); + } + if (data.hasOwnProperty('date')) { + obj['date'] = ApiClient.convertToType(data['date'], 'Date'); + } + if (data.hasOwnProperty('dateTime')) { + obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); + } + if (data.hasOwnProperty('uuid')) { + obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); + } + if (data.hasOwnProperty('password')) { + obj['password'] = ApiClient.convertToType(data['password'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} integer - */ - exports.prototype['integer'] = undefined; - /** - * @member {Number} int32 - */ - exports.prototype['int32'] = undefined; - /** - * @member {Number} int64 - */ - exports.prototype['int64'] = undefined; - /** - * @member {Number} number - */ - exports.prototype['number'] = undefined; - /** - * @member {Number} float - */ - exports.prototype['float'] = undefined; - /** - * @member {Number} double - */ - exports.prototype['double'] = undefined; - /** - * @member {String} string - */ - exports.prototype['string'] = undefined; - /** - * @member {Blob} byte - */ - exports.prototype['byte'] = undefined; - /** - * @member {Blob} binary - */ - exports.prototype['binary'] = undefined; - /** - * @member {Date} date - */ - exports.prototype['date'] = undefined; - /** - * @member {Date} dateTime - */ - exports.prototype['dateTime'] = undefined; - /** - * @member {String} uuid - */ - exports.prototype['uuid'] = undefined; - /** - * @member {String} password - */ - exports.prototype['password'] = undefined; + /** + * @member {Number} integer + */ + integer = undefined; + /** + * @member {Number} int32 + */ + int32 = undefined; + /** + * @member {Number} int64 + */ + int64 = undefined; + /** + * @member {Number} number + */ + number = undefined; + /** + * @member {Number} float + */ + float = undefined; + /** + * @member {Number} double + */ + double = undefined; + /** + * @member {String} string + */ + string = undefined; + /** + * @member {Blob} byte + */ + byte = undefined; + /** + * @member {Blob} binary + */ + binary = undefined; + /** + * @member {Date} date + */ + date = undefined; + /** + * @member {Date} dateTime + */ + dateTime = undefined; + /** + * @member {String} uuid + */ + uuid = undefined; + /** + * @member {String} password + */ + password = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/HasOnlyReadOnly.js b/samples/client/petstore/javascript-es6/src/model/HasOnlyReadOnly.js index 566e0663de0..cb859fe3e50 100644 --- a/samples/client/petstore/javascript-es6/src/model/HasOnlyReadOnly.js +++ b/samples/client/petstore/javascript-es6/src/model/HasOnlyReadOnly.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The HasOnlyReadOnly model module. +* @module model/HasOnlyReadOnly +* @version 1.0.0 +*/ +export default class HasOnlyReadOnly { + /** + * Constructs a new HasOnlyReadOnly. + * @alias module:model/HasOnlyReadOnly + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.HasOnlyReadOnly = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a HasOnlyReadOnly from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/HasOnlyReadOnly} obj Optional instance to populate. + * @return {module:model/HasOnlyReadOnly} The populated HasOnlyReadOnly instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new HasOnlyReadOnly(); + + + - - /** - * The HasOnlyReadOnly model module. - * @module model/HasOnlyReadOnly - * @version 1.0.0 - */ - - /** - * Constructs a new HasOnlyReadOnly. - * @alias module:model/HasOnlyReadOnly - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a HasOnlyReadOnly from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/HasOnlyReadOnly} obj Optional instance to populate. - * @return {module:model/HasOnlyReadOnly} The populated HasOnlyReadOnly instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('bar')) { - obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); - } - if (data.hasOwnProperty('foo')) { - obj['foo'] = ApiClient.convertToType(data['foo'], 'String'); - } + if (data.hasOwnProperty('bar')) { + obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); + } + if (data.hasOwnProperty('foo')) { + obj['foo'] = ApiClient.convertToType(data['foo'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} bar - */ - exports.prototype['bar'] = undefined; - /** - * @member {String} foo - */ - exports.prototype['foo'] = undefined; + /** + * @member {String} bar + */ + bar = undefined; + /** + * @member {String} foo + */ + foo = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/List.js b/samples/client/petstore/javascript-es6/src/model/List.js index b5db0490fe4..513acd45aff 100644 --- a/samples/client/petstore/javascript-es6/src/model/List.js +++ b/samples/client/petstore/javascript-es6/src/model/List.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The List model module. +* @module model/List +* @version 1.0.0 +*/ +export default class List { + /** + * Constructs a new List. + * @alias module:model/List + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.List = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a List from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/List} obj Optional instance to populate. + * @return {module:model/List} The populated List instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new List(); + + + - - /** - * The List model module. - * @module model/List - * @version 1.0.0 - */ - - /** - * Constructs a new List. - * @alias module:model/List - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a List from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/List} obj Optional instance to populate. - * @return {module:model/List} The populated List instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('123-list')) { - obj['123-list'] = ApiClient.convertToType(data['123-list'], 'String'); - } + if (data.hasOwnProperty('123-list')) { + obj['123-list'] = ApiClient.convertToType(data['123-list'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} 123-list - */ - exports.prototype['123-list'] = undefined; + /** + * @member {String} 123-list + */ + 123-list = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/MapTest.js b/samples/client/petstore/javascript-es6/src/model/MapTest.js index 59f089976c1..b7a60cd8d9d 100644 --- a/samples/client/petstore/javascript-es6/src/model/MapTest.js +++ b/samples/client/petstore/javascript-es6/src/model/MapTest.js @@ -7,101 +7,101 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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.MapTest = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + +import ApiClient from '../ApiClient'; - /** - * The MapTest model module. - * @module model/MapTest - * @version 1.0.0 - */ - /** - * Constructs a new MapTest. - * @alias module:model/MapTest - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a MapTest from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/MapTest} obj Optional instance to populate. - * @return {module:model/MapTest} The populated MapTest instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('map_map_of_string')) { - obj['map_map_of_string'] = ApiClient.convertToType(data['map_map_of_string'], {'String': {'String': 'String'}}); - } - if (data.hasOwnProperty('map_of_enum_string')) { - obj['map_of_enum_string'] = ApiClient.convertToType(data['map_of_enum_string'], {'String': 'String'}); - } - } - return obj; - } - - /** - * @member {Object.>} map_map_of_string - */ - exports.prototype['map_map_of_string'] = undefined; - /** - * @member {Object.} map_of_enum_string - */ - exports.prototype['map_of_enum_string'] = undefined; - - - /** - * Allowed values for the inner property. - * @enum {String} - * @readonly - */ - exports.InnerEnum = { +/** +* The MapTest model module. +* @module model/MapTest +* @version 1.0.0 +*/ +export default class MapTest { /** - * value: "UPPER" - * @const - */ - "UPPER": "UPPER", + * Constructs a new MapTest. + * @alias module:model/MapTest + * @class + */ + + constructor() { + + + + + + + + + } + /** - * value: "lower" - * @const - */ - "lower": "lower" }; + * Constructs a MapTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/MapTest} obj Optional instance to populate. + * @return {module:model/MapTest} The populated MapTest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new MapTest(); + + + + + + if (data.hasOwnProperty('map_map_of_string')) { + obj['map_map_of_string'] = ApiClient.convertToType(data['map_map_of_string'], {'String': {'String': 'String'}}); + } + if (data.hasOwnProperty('map_of_enum_string')) { + obj['map_of_enum_string'] = ApiClient.convertToType(data['map_of_enum_string'], {'String': 'String'}); + } + } + return obj; + } + + /** + * @member {Object.>} map_map_of_string + */ + map_map_of_string = undefined; + /** + * @member {Object.} map_of_enum_string + */ + map_of_enum_string = undefined; - return exports; -})); + + + + + /** + * Allowed values for the inner property. + * @enum {String} + * @readonly + */ + static InnerEnum = { + + /** + * value: "UPPER" + * @const + */ + "UPPER": "UPPER", + + /** + * value: "lower" + * @const + */ + "lower": "lower" + }; + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/MixedPropertiesAndAdditionalPropertiesClass.js b/samples/client/petstore/javascript-es6/src/model/MixedPropertiesAndAdditionalPropertiesClass.js index 334b0773a04..6d912ceeb9b 100644 --- a/samples/client/petstore/javascript-es6/src/model/MixedPropertiesAndAdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript-es6/src/model/MixedPropertiesAndAdditionalPropertiesClass.js @@ -7,92 +7,89 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import Animal from './Animal'; + + + + + +/** +* The MixedPropertiesAndAdditionalPropertiesClass model module. +* @module model/MixedPropertiesAndAdditionalPropertiesClass +* @version 1.0.0 +*/ +export default class MixedPropertiesAndAdditionalPropertiesClass { + /** + * Constructs a new MixedPropertiesAndAdditionalPropertiesClass. + * @alias module:model/MixedPropertiesAndAdditionalPropertiesClass + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.MixedPropertiesAndAdditionalPropertiesClass = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); - } -}(this, function(ApiClient, Animal) { - 'use strict'; + /** + * Constructs a MixedPropertiesAndAdditionalPropertiesClass from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/MixedPropertiesAndAdditionalPropertiesClass} obj Optional instance to populate. + * @return {module:model/MixedPropertiesAndAdditionalPropertiesClass} The populated MixedPropertiesAndAdditionalPropertiesClass instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new MixedPropertiesAndAdditionalPropertiesClass(); + + + - - /** - * The MixedPropertiesAndAdditionalPropertiesClass model module. - * @module model/MixedPropertiesAndAdditionalPropertiesClass - * @version 1.0.0 - */ - - /** - * Constructs a new MixedPropertiesAndAdditionalPropertiesClass. - * @alias module:model/MixedPropertiesAndAdditionalPropertiesClass - * @class - */ - var exports = function() { - var _this = this; - - - - - }; - - /** - * Constructs a MixedPropertiesAndAdditionalPropertiesClass from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/MixedPropertiesAndAdditionalPropertiesClass} obj Optional instance to populate. - * @return {module:model/MixedPropertiesAndAdditionalPropertiesClass} The populated MixedPropertiesAndAdditionalPropertiesClass instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('uuid')) { - obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); - } - if (data.hasOwnProperty('dateTime')) { - obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); - } - if (data.hasOwnProperty('map')) { - obj['map'] = ApiClient.convertToType(data['map'], {'String': Animal}); - } + if (data.hasOwnProperty('uuid')) { + obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); + } + if (data.hasOwnProperty('dateTime')) { + obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); + } + if (data.hasOwnProperty('map')) { + obj['map'] = ApiClient.convertToType(data['map'], {'String': Animal}); + } + } + return obj; } - return obj; - } - /** - * @member {String} uuid - */ - exports.prototype['uuid'] = undefined; - /** - * @member {Date} dateTime - */ - exports.prototype['dateTime'] = undefined; - /** - * @member {Object.} map - */ - exports.prototype['map'] = undefined; + /** + * @member {String} uuid + */ + uuid = undefined; + /** + * @member {Date} dateTime + */ + dateTime = undefined; + /** + * @member {Object.} map + */ + map = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Model200Response.js b/samples/client/petstore/javascript-es6/src/model/Model200Response.js index a10e470be5c..df4d957df7c 100644 --- a/samples/client/petstore/javascript-es6/src/model/Model200Response.js +++ b/samples/client/petstore/javascript-es6/src/model/Model200Response.js @@ -7,85 +7,82 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Model200Response model module. +* @module model/Model200Response +* @version 1.0.0 +*/ +export default class Model200Response { + /** + * Constructs a new Model200Response. + * Model for testing model name starting with number + * @alias module:model/Model200Response + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Model200Response = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Model200Response from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Model200Response} obj Optional instance to populate. + * @return {module:model/Model200Response} The populated Model200Response instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Model200Response(); + + + - - /** - * The Model200Response model module. - * @module model/Model200Response - * @version 1.0.0 - */ - - /** - * Constructs a new Model200Response. - * Model for testing model name starting with number - * @alias module:model/Model200Response - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a Model200Response from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Model200Response} obj Optional instance to populate. - * @return {module:model/Model200Response} The populated Model200Response instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'Number'); - } - if (data.hasOwnProperty('class')) { - obj['class'] = ApiClient.convertToType(data['class'], 'String'); - } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'Number'); + } + if (data.hasOwnProperty('class')) { + obj['class'] = ApiClient.convertToType(data['class'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} name - */ - exports.prototype['name'] = undefined; - /** - * @member {String} class - */ - exports.prototype['class'] = undefined; + /** + * @member {Number} name + */ + name = undefined; + /** + * @member {String} class + */ + class = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/ModelReturn.js b/samples/client/petstore/javascript-es6/src/model/ModelReturn.js index 07467bbaa63..88fd97ab85f 100644 --- a/samples/client/petstore/javascript-es6/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript-es6/src/model/ModelReturn.js @@ -7,77 +7,75 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ModelReturn model module. +* @module model/ModelReturn +* @version 1.0.0 +*/ +export default class ModelReturn { + /** + * Constructs a new ModelReturn. + * Model for testing reserved words + * @alias module:model/ModelReturn + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ModelReturn = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ModelReturn from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ModelReturn} obj Optional instance to populate. + * @return {module:model/ModelReturn} The populated ModelReturn instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ModelReturn(); + + + - - /** - * The ModelReturn model module. - * @module model/ModelReturn - * @version 1.0.0 - */ - - /** - * Constructs a new ModelReturn. - * Model for testing reserved words - * @alias module:model/ModelReturn - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a ModelReturn from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/ModelReturn} obj Optional instance to populate. - * @return {module:model/ModelReturn} The populated ModelReturn instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('return')) { - obj['return'] = ApiClient.convertToType(data['return'], 'Number'); - } + if (data.hasOwnProperty('return')) { + obj['return'] = ApiClient.convertToType(data['return'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} return - */ - exports.prototype['return'] = undefined; + /** + * @member {Number} return + */ + return = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Name.js b/samples/client/petstore/javascript-es6/src/model/Name.js index d79c05387fe..f355fbdd403 100644 --- a/samples/client/petstore/javascript-es6/src/model/Name.js +++ b/samples/client/petstore/javascript-es6/src/model/Name.js @@ -7,102 +7,97 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Name model module. +* @module model/Name +* @version 1.0.0 +*/ +export default class Name { + /** + * Constructs a new Name. + * Model for testing model name same as property name + * @alias module:model/Name + * @class + * @param name {Number} + */ + + constructor(name) { + + + + + + this['name'] = name; + + } - root.SwaggerPetstore.Name = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Name from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Name} obj Optional instance to populate. + * @return {module:model/Name} The populated Name instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Name(); + + + - - /** - * The Name model module. - * @module model/Name - * @version 1.0.0 - */ - - /** - * Constructs a new Name. - * Model for testing model name same as property name - * @alias module:model/Name - * @class - * @param name {Number} - */ - var exports = function(name) { - var _this = this; - - _this['name'] = name; - - - - }; - - /** - * Constructs a Name from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Name} obj Optional instance to populate. - * @return {module:model/Name} The populated Name instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'Number'); - } - if (data.hasOwnProperty('snake_case')) { - obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Number'); - } - if (data.hasOwnProperty('property')) { - obj['property'] = ApiClient.convertToType(data['property'], 'String'); - } - if (data.hasOwnProperty('123Number')) { - obj['123Number'] = ApiClient.convertToType(data['123Number'], 'Number'); - } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'Number'); + } + if (data.hasOwnProperty('snake_case')) { + obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Number'); + } + if (data.hasOwnProperty('property')) { + obj['property'] = ApiClient.convertToType(data['property'], 'String'); + } + if (data.hasOwnProperty('123Number')) { + obj['123Number'] = ApiClient.convertToType(data['123Number'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} name - */ - exports.prototype['name'] = undefined; - /** - * @member {Number} snake_case - */ - exports.prototype['snake_case'] = undefined; - /** - * @member {String} property - */ - exports.prototype['property'] = undefined; - /** - * @member {Number} 123Number - */ - exports.prototype['123Number'] = undefined; + /** + * @member {Number} name + */ + name = undefined; + /** + * @member {Number} snake_case + */ + snake_case = undefined; + /** + * @member {String} property + */ + property = undefined; + /** + * @member {Number} 123Number + */ + 123Number = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/NumberOnly.js b/samples/client/petstore/javascript-es6/src/model/NumberOnly.js index c5edb0b0a50..bee66870891 100644 --- a/samples/client/petstore/javascript-es6/src/model/NumberOnly.js +++ b/samples/client/petstore/javascript-es6/src/model/NumberOnly.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The NumberOnly model module. +* @module model/NumberOnly +* @version 1.0.0 +*/ +export default class NumberOnly { + /** + * Constructs a new NumberOnly. + * @alias module:model/NumberOnly + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.NumberOnly = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a NumberOnly from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/NumberOnly} obj Optional instance to populate. + * @return {module:model/NumberOnly} The populated NumberOnly instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new NumberOnly(); + + + - - /** - * The NumberOnly model module. - * @module model/NumberOnly - * @version 1.0.0 - */ - - /** - * Constructs a new NumberOnly. - * @alias module:model/NumberOnly - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a NumberOnly from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/NumberOnly} obj Optional instance to populate. - * @return {module:model/NumberOnly} The populated NumberOnly instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('JustNumber')) { - obj['JustNumber'] = ApiClient.convertToType(data['JustNumber'], 'Number'); - } + if (data.hasOwnProperty('JustNumber')) { + obj['JustNumber'] = ApiClient.convertToType(data['JustNumber'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} JustNumber - */ - exports.prototype['JustNumber'] = undefined; + /** + * @member {Number} JustNumber + */ + JustNumber = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Order.js b/samples/client/petstore/javascript-es6/src/model/Order.js index f4f9087001d..ff704900bbc 100644 --- a/samples/client/petstore/javascript-es6/src/model/Order.js +++ b/samples/client/petstore/javascript-es6/src/model/Order.js @@ -7,140 +7,137 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Order model module. +* @module model/Order +* @version 1.0.0 +*/ +export default class Order { + /** + * Constructs a new Order. + * @alias module:model/Order + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Order = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Order from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Order} obj Optional instance to populate. + * @return {module:model/Order} The populated Order instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Order(); + + + - - /** - * The Order model module. - * @module model/Order - * @version 1.0.0 - */ - - /** - * Constructs a new Order. - * @alias module:model/Order - * @class - */ - var exports = function() { - var _this = this; - - - - - - - - }; - - /** - * Constructs a Order from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Order} obj Optional instance to populate. - * @return {module:model/Order} The populated Order 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('petId')) { - obj['petId'] = ApiClient.convertToType(data['petId'], 'Number'); - } - if (data.hasOwnProperty('quantity')) { - obj['quantity'] = ApiClient.convertToType(data['quantity'], 'Number'); - } - if (data.hasOwnProperty('shipDate')) { - obj['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date'); - } - if (data.hasOwnProperty('status')) { - obj['status'] = ApiClient.convertToType(data['status'], 'String'); - } - if (data.hasOwnProperty('complete')) { - obj['complete'] = ApiClient.convertToType(data['complete'], 'Boolean'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('petId')) { + obj['petId'] = ApiClient.convertToType(data['petId'], 'Number'); + } + if (data.hasOwnProperty('quantity')) { + obj['quantity'] = ApiClient.convertToType(data['quantity'], 'Number'); + } + if (data.hasOwnProperty('shipDate')) { + obj['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date'); + } + if (data.hasOwnProperty('status')) { + obj['status'] = ApiClient.convertToType(data['status'], 'String'); + } + if (data.hasOwnProperty('complete')) { + obj['complete'] = ApiClient.convertToType(data['complete'], 'Boolean'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {Number} petId - */ - exports.prototype['petId'] = undefined; - /** - * @member {Number} quantity - */ - exports.prototype['quantity'] = undefined; - /** - * @member {Date} shipDate - */ - exports.prototype['shipDate'] = undefined; - /** - * Order Status - * @member {module:model/Order.StatusEnum} status - */ - exports.prototype['status'] = undefined; - /** - * @member {Boolean} complete - * @default false - */ - exports.prototype['complete'] = false; - - - /** - * Allowed values for the status property. - * @enum {String} - * @readonly - */ - exports.StatusEnum = { /** - * value: "placed" - * @const - */ - "placed": "placed", + * @member {Number} id + */ + id = undefined; /** - * value: "approved" - * @const - */ - "approved": "approved", + * @member {Number} petId + */ + petId = undefined; /** - * value: "delivered" - * @const - */ - "delivered": "delivered" }; + * @member {Number} quantity + */ + quantity = undefined; + /** + * @member {Date} shipDate + */ + shipDate = undefined; + /** + * Order Status + * @member {module:model/Order.StatusEnum} status + */ + status = undefined; + /** + * @member {Boolean} complete + * @default false + */ + complete = false; - return exports; -})); + + + + + /** + * Allowed values for the status property. + * @enum {String} + * @readonly + */ + static StatusEnum = { + + /** + * value: "placed" + * @const + */ + "placed": "placed", + + /** + * value: "approved" + * @const + */ + "approved": "approved", + + /** + * value: "delivered" + * @const + */ + "delivered": "delivered" + }; + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/OuterBoolean.js b/samples/client/petstore/javascript-es6/src/model/OuterBoolean.js index 80f1a64b99b..592a0b69864 100644 --- a/samples/client/petstore/javascript-es6/src/model/OuterBoolean.js +++ b/samples/client/petstore/javascript-es6/src/model/OuterBoolean.js @@ -7,68 +7,67 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The OuterBoolean model module. +* @module model/OuterBoolean +* @version 1.0.0 +*/ +export default class OuterBoolean { + /** + * Constructs a new OuterBoolean. + * @alias module:model/OuterBoolean + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.OuterBoolean = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a OuterBoolean from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterBoolean} obj Optional instance to populate. + * @return {module:model/OuterBoolean} The populated OuterBoolean instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OuterBoolean(); + + + - - /** - * The OuterBoolean model module. - * @module model/OuterBoolean - * @version 1.0.0 - */ - - /** - * Constructs a new OuterBoolean. - * @alias module:model/OuterBoolean - * @class - */ - var exports = function() { - var _this = this; - - }; - - /** - * Constructs a OuterBoolean from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/OuterBoolean} obj Optional instance to populate. - * @return {module:model/OuterBoolean} The populated OuterBoolean instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - + } + return obj; } - return obj; - } - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/OuterComposite.js b/samples/client/petstore/javascript-es6/src/model/OuterComposite.js index 2a40ec942b5..327e303467a 100644 --- a/samples/client/petstore/javascript-es6/src/model/OuterComposite.js +++ b/samples/client/petstore/javascript-es6/src/model/OuterComposite.js @@ -7,92 +7,91 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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/OuterBoolean', '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('./OuterBoolean'), require('./OuterNumber'), require('./OuterString')); - } else { - // Browser globals (root is window) - if (!root.SwaggerPetstore) { - root.SwaggerPetstore = {}; + +import ApiClient from '../ApiClient'; +import OuterBoolean from './OuterBoolean'; +import OuterNumber from './OuterNumber'; +import OuterString from './OuterString'; + + + + + +/** +* The OuterComposite model module. +* @module model/OuterComposite +* @version 1.0.0 +*/ +export default class OuterComposite { + /** + * Constructs a new OuterComposite. + * @alias module:model/OuterComposite + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.OuterComposite = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.OuterBoolean, root.SwaggerPetstore.OuterNumber, root.SwaggerPetstore.OuterString); - } -}(this, function(ApiClient, OuterBoolean, OuterNumber, OuterString) { - 'use strict'; + /** + * Constructs a OuterComposite from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterComposite} obj Optional instance to populate. + * @return {module:model/OuterComposite} The populated OuterComposite instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OuterComposite(); + + + - - /** - * The OuterComposite model module. - * @module model/OuterComposite - * @version 1.0.0 - */ - - /** - * Constructs a new OuterComposite. - * @alias module:model/OuterComposite - * @class - */ - var exports = function() { - var _this = this; - - - - - }; - - /** - * Constructs a OuterComposite from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/OuterComposite} obj Optional instance to populate. - * @return {module:model/OuterComposite} The populated OuterComposite instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('my_number')) { - obj['my_number'] = OuterNumber.constructFromObject(data['my_number']); - } - if (data.hasOwnProperty('my_string')) { - obj['my_string'] = OuterString.constructFromObject(data['my_string']); - } - if (data.hasOwnProperty('my_boolean')) { - obj['my_boolean'] = OuterBoolean.constructFromObject(data['my_boolean']); - } + if (data.hasOwnProperty('my_number')) { + obj['my_number'] = OuterNumber.constructFromObject(data['my_number']); + } + if (data.hasOwnProperty('my_string')) { + obj['my_string'] = OuterString.constructFromObject(data['my_string']); + } + if (data.hasOwnProperty('my_boolean')) { + obj['my_boolean'] = OuterBoolean.constructFromObject(data['my_boolean']); + } + } + return obj; } - return obj; - } - /** - * @member {module:model/OuterNumber} my_number - */ - exports.prototype['my_number'] = undefined; - /** - * @member {module:model/OuterString} my_string - */ - exports.prototype['my_string'] = undefined; - /** - * @member {module:model/OuterBoolean} my_boolean - */ - exports.prototype['my_boolean'] = undefined; + /** + * @member {module:model/OuterNumber} my_number + */ + my_number = undefined; + /** + * @member {module:model/OuterString} my_string + */ + my_string = undefined; + /** + * @member {module:model/OuterBoolean} my_boolean + */ + my_boolean = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/OuterEnum.js b/samples/client/petstore/javascript-es6/src/model/OuterEnum.js index 4ba975cf97a..bf264fd8f64 100644 --- a/samples/client/petstore/javascript-es6/src/model/OuterEnum.js +++ b/samples/client/petstore/javascript-es6/src/model/OuterEnum.js @@ -7,63 +7,51 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + +/** +* Enum class OuterEnum. +* @enum {} +* @readonly +*/ +export default class OuterEnum { + + /** + * value: "placed" + * @const + */ + placed = "placed"; + + + /** + * value: "approved" + * @const + */ + approved = "approved"; + + + /** + * value: "delivered" + * @const + */ + delivered = "delivered"; + + + + /** + * Returns a OuterEnum enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/OuterEnum} The enum OuterEnum value. + */ + static constructFromObject(object) { + return object; } - root.SwaggerPetstore.OuterEnum = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - - /** - * Enum class OuterEnum. - * @enum {} - * @readonly - */ - var exports = { - /** - * value: "placed" - * @const - */ - "placed": "placed", - /** - * value: "approved" - * @const - */ - "approved": "approved", - /** - * value: "delivered" - * @const - */ - "delivered": "delivered" }; - - /** - * Returns a OuterEnum enum value from a Javascript object name. - * @param {Object} data The plain JavaScript object containing the name of the enum value. - * @return {module:model/OuterEnum} The enum OuterEnum value. - */ - exports.constructFromObject = function(object) { - return object; - } - - return exports; -})); +} diff --git a/samples/client/petstore/javascript-es6/src/model/OuterNumber.js b/samples/client/petstore/javascript-es6/src/model/OuterNumber.js index f3ab0768253..ff65b1588b7 100644 --- a/samples/client/petstore/javascript-es6/src/model/OuterNumber.js +++ b/samples/client/petstore/javascript-es6/src/model/OuterNumber.js @@ -7,68 +7,67 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The OuterNumber model module. +* @module model/OuterNumber +* @version 1.0.0 +*/ +export default class OuterNumber { + /** + * Constructs a new OuterNumber. + * @alias module:model/OuterNumber + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.OuterNumber = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a OuterNumber from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterNumber} obj Optional instance to populate. + * @return {module:model/OuterNumber} The populated OuterNumber instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OuterNumber(); + + + - - /** - * The OuterNumber model module. - * @module model/OuterNumber - * @version 1.0.0 - */ - - /** - * Constructs a new OuterNumber. - * @alias module:model/OuterNumber - * @class - */ - var exports = function() { - var _this = this; - - }; - - /** - * Constructs a OuterNumber from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/OuterNumber} obj Optional instance to populate. - * @return {module:model/OuterNumber} The populated OuterNumber instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - + } + return obj; } - return obj; - } - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/OuterString.js b/samples/client/petstore/javascript-es6/src/model/OuterString.js index 9edb9747a67..6921029ede1 100644 --- a/samples/client/petstore/javascript-es6/src/model/OuterString.js +++ b/samples/client/petstore/javascript-es6/src/model/OuterString.js @@ -7,68 +7,67 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The OuterString model module. +* @module model/OuterString +* @version 1.0.0 +*/ +export default class OuterString { + /** + * Constructs a new OuterString. + * @alias module:model/OuterString + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.OuterString = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a OuterString from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterString} obj Optional instance to populate. + * @return {module:model/OuterString} The populated OuterString instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OuterString(); + + + - - /** - * The OuterString model module. - * @module model/OuterString - * @version 1.0.0 - */ - - /** - * Constructs a new OuterString. - * @alias module:model/OuterString - * @class - */ - var exports = function() { - var _this = this; - - }; - - /** - * Constructs a OuterString from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/OuterString} obj Optional instance to populate. - * @return {module:model/OuterString} The populated OuterString instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - + } + return obj; } - return obj; - } - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Pet.js b/samples/client/petstore/javascript-es6/src/model/Pet.js index d5e8d5010ac..bb849152027 100644 --- a/samples/client/petstore/javascript-es6/src/model/Pet.js +++ b/samples/client/petstore/javascript-es6/src/model/Pet.js @@ -7,141 +7,140 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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/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')); - } else { - // Browser globals (root is window) - if (!root.SwaggerPetstore) { - root.SwaggerPetstore = {}; + +import ApiClient from '../ApiClient'; +import Category from './Category'; +import Tag from './Tag'; + + + + + +/** +* The Pet model module. +* @module model/Pet +* @version 1.0.0 +*/ +export default class Pet { + /** + * Constructs a new Pet. + * @alias module:model/Pet + * @class + * @param name {String} + * @param photoUrls {Array.} + */ + + constructor(name, photoUrls) { + + + + + + this['name'] = name;this['photoUrls'] = photoUrls; + + } - root.SwaggerPetstore.Pet = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Category, root.SwaggerPetstore.Tag); - } -}(this, function(ApiClient, Category, Tag) { - 'use strict'; + /** + * Constructs a Pet from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Pet} obj Optional instance to populate. + * @return {module:model/Pet} The populated Pet instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Pet(); + + + - - /** - * The Pet model module. - * @module model/Pet - * @version 1.0.0 - */ - - /** - * Constructs a new Pet. - * @alias module:model/Pet - * @class - * @param name {String} - * @param photoUrls {Array.} - */ - var exports = function(name, photoUrls) { - var _this = this; - - - - _this['name'] = name; - _this['photoUrls'] = photoUrls; - - - }; - - /** - * Constructs a Pet from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Pet} obj Optional instance to populate. - * @return {module:model/Pet} The populated Pet 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('category')) { - obj['category'] = Category.constructFromObject(data['category']); - } - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'String'); - } - if (data.hasOwnProperty('photoUrls')) { - obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']); - } - if (data.hasOwnProperty('tags')) { - obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]); - } - if (data.hasOwnProperty('status')) { - obj['status'] = ApiClient.convertToType(data['status'], 'String'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('category')) { + obj['category'] = Category.constructFromObject(data['category']); + } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + if (data.hasOwnProperty('photoUrls')) { + obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']); + } + if (data.hasOwnProperty('tags')) { + obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]); + } + if (data.hasOwnProperty('status')) { + obj['status'] = ApiClient.convertToType(data['status'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {module:model/Category} category - */ - exports.prototype['category'] = undefined; - /** - * @member {String} name - */ - exports.prototype['name'] = undefined; - /** - * @member {Array.} photoUrls - */ - exports.prototype['photoUrls'] = undefined; - /** - * @member {Array.} tags - */ - exports.prototype['tags'] = undefined; - /** - * pet status in the store - * @member {module:model/Pet.StatusEnum} status - */ - exports.prototype['status'] = undefined; - - - /** - * Allowed values for the status property. - * @enum {String} - * @readonly - */ - exports.StatusEnum = { /** - * value: "available" - * @const - */ - "available": "available", + * @member {Number} id + */ + id = undefined; /** - * value: "pending" - * @const - */ - "pending": "pending", + * @member {module:model/Category} category + */ + category = undefined; /** - * value: "sold" - * @const - */ - "sold": "sold" }; + * @member {String} name + */ + name = undefined; + /** + * @member {Array.} photoUrls + */ + photoUrls = undefined; + /** + * @member {Array.} tags + */ + tags = undefined; + /** + * pet status in the store + * @member {module:model/Pet.StatusEnum} status + */ + status = undefined; - return exports; -})); + + + + + /** + * Allowed values for the status property. + * @enum {String} + * @readonly + */ + static StatusEnum = { + + /** + * value: "available" + * @const + */ + "available": "available", + + /** + * value: "pending" + * @const + */ + "pending": "pending", + + /** + * value: "sold" + * @const + */ + "sold": "sold" + }; + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/ReadOnlyFirst.js b/samples/client/petstore/javascript-es6/src/model/ReadOnlyFirst.js index 91612f15351..143b34f3eb1 100644 --- a/samples/client/petstore/javascript-es6/src/model/ReadOnlyFirst.js +++ b/samples/client/petstore/javascript-es6/src/model/ReadOnlyFirst.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ReadOnlyFirst model module. +* @module model/ReadOnlyFirst +* @version 1.0.0 +*/ +export default class ReadOnlyFirst { + /** + * Constructs a new ReadOnlyFirst. + * @alias module:model/ReadOnlyFirst + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ReadOnlyFirst = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ReadOnlyFirst from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ReadOnlyFirst} obj Optional instance to populate. + * @return {module:model/ReadOnlyFirst} The populated ReadOnlyFirst instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ReadOnlyFirst(); + + + - - /** - * The ReadOnlyFirst model module. - * @module model/ReadOnlyFirst - * @version 1.0.0 - */ - - /** - * Constructs a new ReadOnlyFirst. - * @alias module:model/ReadOnlyFirst - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a ReadOnlyFirst from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/ReadOnlyFirst} obj Optional instance to populate. - * @return {module:model/ReadOnlyFirst} The populated ReadOnlyFirst instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('bar')) { - obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); - } - if (data.hasOwnProperty('baz')) { - obj['baz'] = ApiClient.convertToType(data['baz'], 'String'); - } + if (data.hasOwnProperty('bar')) { + obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); + } + if (data.hasOwnProperty('baz')) { + obj['baz'] = ApiClient.convertToType(data['baz'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} bar - */ - exports.prototype['bar'] = undefined; - /** - * @member {String} baz - */ - exports.prototype['baz'] = undefined; + /** + * @member {String} bar + */ + bar = undefined; + /** + * @member {String} baz + */ + baz = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/SpecialModelName.js b/samples/client/petstore/javascript-es6/src/model/SpecialModelName.js index bb13c09d956..4e0dd379b19 100644 --- a/samples/client/petstore/javascript-es6/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript-es6/src/model/SpecialModelName.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The SpecialModelName model module. +* @module model/SpecialModelName +* @version 1.0.0 +*/ +export default class SpecialModelName { + /** + * Constructs a new SpecialModelName. + * @alias module:model/SpecialModelName + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.SpecialModelName = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a SpecialModelName from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/SpecialModelName} obj Optional instance to populate. + * @return {module:model/SpecialModelName} The populated SpecialModelName instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new SpecialModelName(); + + + - - /** - * The SpecialModelName model module. - * @module model/SpecialModelName - * @version 1.0.0 - */ - - /** - * Constructs a new SpecialModelName. - * @alias module:model/SpecialModelName - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a SpecialModelName from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/SpecialModelName} obj Optional instance to populate. - * @return {module:model/SpecialModelName} The populated SpecialModelName instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('$special[property.name]')) { - obj['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Number'); - } + if (data.hasOwnProperty('$special[property.name]')) { + obj['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} $special[property.name] - */ - exports.prototype['$special[property.name]'] = undefined; + /** + * @member {Number} $special[property.name] + */ + $special[property.name] = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/Tag.js b/samples/client/petstore/javascript-es6/src/model/Tag.js index 1066827e11e..759b3fa04e3 100644 --- a/samples/client/petstore/javascript-es6/src/model/Tag.js +++ b/samples/client/petstore/javascript-es6/src/model/Tag.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Tag model module. +* @module model/Tag +* @version 1.0.0 +*/ +export default class Tag { + /** + * Constructs a new Tag. + * @alias module:model/Tag + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Tag = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Tag from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Tag} obj Optional instance to populate. + * @return {module:model/Tag} The populated Tag instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Tag(); + + + - - /** - * The Tag model module. - * @module model/Tag - * @version 1.0.0 - */ - - /** - * Constructs a new Tag. - * @alias module:model/Tag - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a Tag from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Tag} obj Optional instance to populate. - * @return {module:model/Tag} The populated Tag 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'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {String} name - */ - exports.prototype['name'] = undefined; + /** + * @member {Number} id + */ + id = undefined; + /** + * @member {String} name + */ + name = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-es6/src/model/User.js b/samples/client/petstore/javascript-es6/src/model/User.js index e96af875697..36311e75938 100644 --- a/samples/client/petstore/javascript-es6/src/model/User.js +++ b/samples/client/petstore/javascript-es6/src/model/User.js @@ -7,133 +7,124 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The User model module. +* @module model/User +* @version 1.0.0 +*/ +export default class User { + /** + * Constructs a new User. + * @alias module:model/User + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.User = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a User from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/User} obj Optional instance to populate. + * @return {module:model/User} The populated User instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new User(); + + + - - /** - * The User model module. - * @module model/User - * @version 1.0.0 - */ - - /** - * Constructs a new User. - * @alias module:model/User - * @class - */ - var exports = function() { - var _this = this; - - - - - - - - - - }; - - /** - * Constructs a User from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/User} obj Optional instance to populate. - * @return {module:model/User} The populated User 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('username')) { - obj['username'] = ApiClient.convertToType(data['username'], 'String'); - } - if (data.hasOwnProperty('firstName')) { - obj['firstName'] = ApiClient.convertToType(data['firstName'], 'String'); - } - if (data.hasOwnProperty('lastName')) { - obj['lastName'] = ApiClient.convertToType(data['lastName'], 'String'); - } - if (data.hasOwnProperty('email')) { - obj['email'] = ApiClient.convertToType(data['email'], 'String'); - } - if (data.hasOwnProperty('password')) { - obj['password'] = ApiClient.convertToType(data['password'], 'String'); - } - if (data.hasOwnProperty('phone')) { - obj['phone'] = ApiClient.convertToType(data['phone'], 'String'); - } - if (data.hasOwnProperty('userStatus')) { - obj['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Number'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('username')) { + obj['username'] = ApiClient.convertToType(data['username'], 'String'); + } + if (data.hasOwnProperty('firstName')) { + obj['firstName'] = ApiClient.convertToType(data['firstName'], 'String'); + } + if (data.hasOwnProperty('lastName')) { + obj['lastName'] = ApiClient.convertToType(data['lastName'], 'String'); + } + if (data.hasOwnProperty('email')) { + obj['email'] = ApiClient.convertToType(data['email'], 'String'); + } + if (data.hasOwnProperty('password')) { + obj['password'] = ApiClient.convertToType(data['password'], 'String'); + } + if (data.hasOwnProperty('phone')) { + obj['phone'] = ApiClient.convertToType(data['phone'], 'String'); + } + if (data.hasOwnProperty('userStatus')) { + obj['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {String} username - */ - exports.prototype['username'] = undefined; - /** - * @member {String} firstName - */ - exports.prototype['firstName'] = undefined; - /** - * @member {String} lastName - */ - exports.prototype['lastName'] = undefined; - /** - * @member {String} email - */ - exports.prototype['email'] = undefined; - /** - * @member {String} password - */ - exports.prototype['password'] = undefined; - /** - * @member {String} phone - */ - exports.prototype['phone'] = undefined; - /** - * User Status - * @member {Number} userStatus - */ - exports.prototype['userStatus'] = undefined; + /** + * @member {Number} id + */ + id = undefined; + /** + * @member {String} username + */ + username = undefined; + /** + * @member {String} firstName + */ + firstName = undefined; + /** + * @member {String} lastName + */ + lastName = undefined; + /** + * @member {String} email + */ + email = undefined; + /** + * @member {String} password + */ + password = undefined; + /** + * @member {String} phone + */ + phone = undefined; + /** + * User Status + * @member {Number} userStatus + */ + userStatus = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/.babelrc b/samples/client/petstore/javascript-promise-es6/.babelrc new file mode 100644 index 00000000000..bcb6ee8de93 --- /dev/null +++ b/samples/client/petstore/javascript-promise-es6/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015", "stage-0"] +} \ No newline at end of file diff --git a/samples/client/petstore/javascript-promise-es6/README.md b/samples/client/petstore/javascript-promise-es6/README.md index 05378564d17..6ad6f81b3f5 100644 --- a/samples/client/petstore/javascript-promise-es6/README.md +++ b/samples/client/petstore/javascript-promise-es6/README.md @@ -45,6 +45,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md b/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md index 7bfea4df889..d26ee4e74bf 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md @@ -23,16 +23,16 @@ Test serialization of outer boolean types ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let opts = { 'body': new SwaggerPetstore.OuterBoolean() // OuterBoolean | Input boolean as post body }; -apiInstance.fakeOuterBooleanSerialize(opts).then(function(data) { +apiInstance.fakeOuterBooleanSerialize(opts).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -67,16 +67,16 @@ Test serialization of object with outer number type ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let opts = { 'body': new SwaggerPetstore.OuterComposite() // OuterComposite | Input composite as post body }; -apiInstance.fakeOuterCompositeSerialize(opts).then(function(data) { +apiInstance.fakeOuterCompositeSerialize(opts).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -111,16 +111,16 @@ Test serialization of outer number types ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let opts = { 'body': new SwaggerPetstore.OuterNumber() // OuterNumber | Input number as post body }; -apiInstance.fakeOuterNumberSerialize(opts).then(function(data) { +apiInstance.fakeOuterNumberSerialize(opts).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -155,16 +155,16 @@ Test serialization of outer string types ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let opts = { 'body': new SwaggerPetstore.OuterString() // OuterString | Input string as post body }; -apiInstance.fakeOuterStringSerialize(opts).then(function(data) { +apiInstance.fakeOuterStringSerialize(opts).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -199,15 +199,15 @@ To test \"client\" model ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var body = new SwaggerPetstore.Client(); // Client | client model +let body = new SwaggerPetstore.Client(); // Client | client model -apiInstance.testClientModel(body).then(function(data) { +apiInstance.testClientModel(body).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -242,25 +242,25 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure HTTP basic authorization: http_basic_test -var http_basic_test = defaultClient.authentications['http_basic_test']; +let 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(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var _number = 3.4; // Number | None +let _number = 3.4; // Number | None -var _double = 1.2; // Number | None +let _double = 1.2; // Number | None -var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None +let patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -var _byte = B; // Blob | None +let _byte = B; // Blob | None -var opts = { +let opts = { 'integer': 56, // Number | None 'int32': 56, // Number | None 'int64': 789, // Number | None @@ -272,9 +272,9 @@ var opts = { 'password': "password_example", // String | None 'callback': "callback_example" // String | None }; -apiInstance.testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts).then(function() { +apiInstance.testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -322,11 +322,11 @@ To test enum parameters ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.FakeApi(); +let apiInstance = new SwaggerPetstore.FakeApi(); -var opts = { +let 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) @@ -336,9 +336,9 @@ var opts = { 'enumQueryInteger': 56, // Number | Query parameter enum test (double) 'enumQueryDouble': 1.2 // Number | Query parameter enum test (double) }; -apiInstance.testEnumParameters(opts).then(function() { +apiInstance.testEnumParameters(opts).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); diff --git a/samples/client/petstore/javascript-promise-es6/docs/PetApi.md b/samples/client/petstore/javascript-promise-es6/docs/PetApi.md index 8b88dab5f5c..1d5d78f6d7a 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/PetApi.md @@ -24,20 +24,20 @@ Add a new pet to the store ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store +let body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store -apiInstance.addPet(body).then(function() { +apiInstance.addPet(body).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -72,23 +72,23 @@ Deletes a pet ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Number | Pet id to delete +let petId = 789; // Number | Pet id to delete -var opts = { +let opts = { 'apiKey': "apiKey_example" // String | }; -apiInstance.deletePet(petId, opts).then(function() { +apiInstance.deletePet(petId, opts).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -124,20 +124,20 @@ Multiple status values can be provided with comma separated strings ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var status = ["status_example"]; // [String] | Status values that need to be considered for filter +let status = ["status_example"]; // [String] | Status values that need to be considered for filter -apiInstance.findPetsByStatus(status).then(function(data) { +apiInstance.findPetsByStatus(status).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -172,20 +172,20 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var tags = ["tags_example"]; // [String] | Tags to filter by +let tags = ["tags_example"]; // [String] | Tags to filter by -apiInstance.findPetsByTags(tags).then(function(data) { +apiInstance.findPetsByTags(tags).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -220,22 +220,22 @@ Returns a single pet ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; +let 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(); +let apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Number | ID of pet to return +let petId = 789; // Number | ID of pet to return -apiInstance.getPetById(petId).then(function(data) { +apiInstance.getPetById(petId).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -270,20 +270,20 @@ Update an existing pet ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store +let body = new SwaggerPetstore.Pet(); // Pet | Pet object that needs to be added to the store -apiInstance.updatePet(body).then(function() { +apiInstance.updatePet(body).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -318,24 +318,24 @@ Updates a pet in the store with form data ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Number | ID of pet that needs to be updated +let petId = 789; // Number | ID of pet that needs to be updated -var opts = { +let opts = { 'name': "name_example", // String | Updated name of the pet 'status': "status_example" // String | Updated status of the pet }; -apiInstance.updatePetWithForm(petId, opts).then(function() { +apiInstance.updatePetWithForm(petId, opts).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -372,24 +372,24 @@ uploads an image ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; +let petstore_auth = defaultClient.authentications['petstore_auth']; petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi(); +let apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // Number | ID of pet to update +let petId = 789; // Number | ID of pet to update -var opts = { +let opts = { 'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server 'file': "/path/to/file.txt" // File | file to upload }; -apiInstance.uploadFile(petId, opts).then(function(data) { +apiInstance.uploadFile(petId, opts).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); diff --git a/samples/client/petstore/javascript-promise-es6/docs/StoreApi.md b/samples/client/petstore/javascript-promise-es6/docs/StoreApi.md index e0771378536..9f931097e03 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/StoreApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/StoreApi.md @@ -20,15 +20,15 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.StoreApi(); +let apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = "orderId_example"; // String | ID of the order that needs to be deleted +let orderId = "orderId_example"; // String | ID of the order that needs to be deleted -apiInstance.deleteOrder(orderId).then(function() { +apiInstance.deleteOrder(orderId).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -63,19 +63,19 @@ Returns a map of status codes to quantities ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); -var defaultClient = SwaggerPetstore.ApiClient.instance; +import SwaggerPetstore from 'swagger_petstore'; +let defaultClient = SwaggerPetstore.ApiClient.instance; // Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; +let 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(); -apiInstance.getInventory().then(function(data) { +let apiInstance = new SwaggerPetstore.StoreApi(); +apiInstance.getInventory().then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -107,15 +107,15 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.StoreApi(); +let apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = 789; // Number | ID of pet that needs to be fetched +let orderId = 789; // Number | ID of pet that needs to be fetched -apiInstance.getOrderById(orderId).then(function(data) { +apiInstance.getOrderById(orderId).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -150,15 +150,15 @@ Place an order for a pet ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.StoreApi(); +let apiInstance = new SwaggerPetstore.StoreApi(); -var body = new SwaggerPetstore.Order(); // Order | order placed for purchasing the pet +let body = new SwaggerPetstore.Order(); // Order | order placed for purchasing the pet -apiInstance.placeOrder(body).then(function(data) { +apiInstance.placeOrder(body).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); diff --git a/samples/client/petstore/javascript-promise-es6/docs/UserApi.md b/samples/client/petstore/javascript-promise-es6/docs/UserApi.md index 3102a61d648..df53e06d15b 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/UserApi.md @@ -24,15 +24,15 @@ This can only be done by the logged in user. ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var body = new SwaggerPetstore.User(); // User | Created user object +let body = new SwaggerPetstore.User(); // User | Created user object -apiInstance.createUser(body).then(function() { +apiInstance.createUser(body).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -67,15 +67,15 @@ Creates list of users with given input array ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var body = [new SwaggerPetstore.User()]; // [User] | List of user object +let body = [new SwaggerPetstore.User()]; // [User] | List of user object -apiInstance.createUsersWithArrayInput(body).then(function() { +apiInstance.createUsersWithArrayInput(body).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -110,15 +110,15 @@ Creates list of users with given input array ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var body = [new SwaggerPetstore.User()]; // [User] | List of user object +let body = [new SwaggerPetstore.User()]; // [User] | List of user object -apiInstance.createUsersWithListInput(body).then(function() { +apiInstance.createUsersWithListInput(body).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -153,15 +153,15 @@ This can only be done by the logged in user. ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // String | The name that needs to be deleted +let username = "username_example"; // String | The name that needs to be deleted -apiInstance.deleteUser(username).then(function() { +apiInstance.deleteUser(username).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -196,15 +196,15 @@ Get user by user name ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. +let username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -apiInstance.getUserByName(username).then(function(data) { +apiInstance.getUserByName(username).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -239,17 +239,17 @@ Logs user into the system ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // String | The user name for login +let username = "username_example"; // String | The user name for login -var password = "password_example"; // String | The password for login in clear text +let password = "password_example"; // String | The password for login in clear text -apiInstance.loginUser(username, password).then(function(data) { +apiInstance.loginUser(username, password).then((data) => { console.log('API called successfully. Returned data: ' + data); -}, function(error) { +}, (error) => { console.error(error); }); @@ -285,12 +285,12 @@ Logs out current logged in user session ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); -apiInstance.logoutUser().then(function() { +let apiInstance = new SwaggerPetstore.UserApi(); +apiInstance.logoutUser().then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); @@ -322,17 +322,17 @@ This can only be done by the logged in user. ### Example ```javascript -var SwaggerPetstore = require('swagger_petstore'); +import SwaggerPetstore from 'swagger_petstore'; -var apiInstance = new SwaggerPetstore.UserApi(); +let apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // String | name that need to be deleted +let username = "username_example"; // String | name that need to be deleted -var body = new SwaggerPetstore.User(); // User | Updated user object +let body = new SwaggerPetstore.User(); // User | Updated user object -apiInstance.updateUser(username, body).then(function() { +apiInstance.updateUser(username, body).then(() => { console.log('API called successfully.'); -}, function(error) { +}, (error) => { console.error(error); }); diff --git a/samples/client/petstore/javascript-promise-es6/package.json b/samples/client/petstore/javascript-promise-es6/package.json index 881163c02f4..0332217891a 100644 --- a/samples/client/petstore/javascript-promise-es6/package.json +++ b/samples/client/petstore/javascript-promise-es6/package.json @@ -5,17 +5,22 @@ "license": "Unlicense", "main": "src/index.js", "scripts": { - "test": "./node_modules/mocha/bin/mocha --recursive" + "test": "mocha --compilers js:babel-core/register --recursive" }, "browser": { "fs": false }, "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", - "expect.js": "~0.3.1" + "sinon": "1.17.3" } } diff --git a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js index 76e1384fdb1..c7dcea0de86 100644 --- a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js @@ -7,553 +7,562 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import superagent from "superagent"; +import querystring from "querystring"; + +/** +* @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 +*/ +export default class ApiClient { + constructor() { + /** + * 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.} + */ + 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.} + * @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(); + } } - 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.} - */ - this.authentications = { - 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, - 'http_basic_test': {type: 'basic'}, - 'petstore_auth': {type: 'oauth2'} + * Returns a string representation for an actual parameter. + * @param param The actual parameter. + * @returns {String} The string representation of param. + */ + paramToString(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. + */ + 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; + } + + /** + * Checks whether the given content type represents JSON.
+ * JSON content type examples:
+ *
    + *
  • application/json
  • + *
  • application/json; charset=UTF8
  • + *
  • APPLICATION/JSON
  • + *
+ * @param {String} contentType The MIME content type to check. + * @returns {Boolean} true if contentType represents JSON, otherwise false. + */ + isJsonMime(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.} contentTypes + * @returns {String} The chosen content type, preferring JSON. + */ + jsonPreferredMime(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} true if param represents a file. + */ + isFileParam(param) { + // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) + if (typeof require === 'function') { + let fs; + try { + fs = require('fs'); + } catch (err) {} + if (fs && fs.ReadStream && param instanceof 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: + *
    + *
  • remove nils
  • + *
  • keep files and arrays
  • + *
  • format to string with `paramToString` for other cases
  • + *
+ * @param {Object.} params The parameters as object properties. + * @returns {Object.} normalized parameters. + */ + 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; + } + + /** + * Enumeration of collection format separator strategies. + * @enum {String} + * @readonly + */ + static CollectionFormatEnum = { + /** + * Comma-separated values. Value: csv + * @const + */ + CSV: ',', + + /** + * Space-separated values. Value: ssv + * @const + */ + SSV: ' ', + + /** + * Tab-separated values. Value: tsv + * @const + */ + TSV: '\t', + + /** + * Pipe(|)-separated values. Value: pipes + * @const + */ + PIPES: '|', + + /** + * Native array. Value: multi + * @const + */ + MULTI: 'multi' }; - /** - * The default HTTP headers to be included for all API calls. - * @type {Array.} - * @default {} - */ - this.defaultHeaders = {}; /** - * The default HTTP timeout for all API calls. - * @type {Number} - * @default 60000 - */ - this.timeout = 60000; + * 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 + * param as is if collectionFormat is multi. + */ + 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); + } + } /** - * 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; + * Applies authentication headers to the request. + * @param {Object} request The request object created by a superagent() call. + * @param {Array.} authNames An array of authentication method names. + */ + 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); + } + }); + } /** - * 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; + * Deserializes an HTTP response body into a value of the specified type. + * @param {Object} response A SuperAgent response object. + * @param {(String|Array.|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 data will be converted to this type. + * @returns A value of the specified type. + */ + deserialize(response, returnType) { + if (response == null || returnType == null || response.status == 204) { + return null; + } - /* - * 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(); + // 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 ApiClient.convertToType(data, returnType); } - }; + - /** - * Returns a string representation for an actual parameter. - * @param param The actual parameter. - * @returns {String} The string representation of param. - */ - exports.prototype.paramToString = function(param) { - if (param == undefined || param == null) { - return ''; - } - if (param instanceof Date) { - return param.toJSON(); - } - return param.toString(); - }; + /** + * 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.} pathParams A map of path parameters and their values. + * @param {Object.} queryParams A map of query parameters and their values. + * @param {Object.} headerParams A map of header parameters and their values. + * @param {Object.} formParams A map of form parameters and their values. + * @param {Object} bodyParam The value to pass as the request body. + * @param {Array.} authNames An array of authentication type names. + * @param {Array.} contentTypes An array of request MIME types. + * @param {Array.} accepts An array of acceptable response MIME types. + * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the + * constructor for a complex type. + * @returns {Promise} A {@link https://www.promisejs.org/|Promise} object. + */ + callApi(path, httpMethod, pathParams, + queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, + returnType) { - /** - * 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; - }; + var url = this.buildUrl(path, pathParams); + var request = superagent(httpMethod, url); - /** - * Checks whether the given content type represents JSON.
- * JSON content type examples:
- *
    - *
  • application/json
  • - *
  • application/json; charset=UTF8
  • - *
  • APPLICATION/JSON
  • - *
- * @param {String} contentType The MIME content type to check. - * @returns {Boolean} true if contentType represents JSON, otherwise false. - */ - exports.prototype.isJsonMime = function(contentType) { - return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); - }; + // apply authentications + this.applyAuthToRequest(request, authNames); - /** - * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first. - * @param {Array.} 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]; - }; + // set query parameters + if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { + queryParams['_'] = new Date().getTime(); + } - /** - * Checks whether the given parameter value represents file-like content. - * @param param The parameter to check. - * @returns {Boolean} true if param represents a file. - */ - exports.prototype.isFileParam = function(param) { - // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) - if (typeof require === 'function') { - var fs; - try { - fs = require('fs'); - } catch (err) {} - if (fs && fs.ReadStream && param instanceof 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; - }; + request.query(this.normalizeParams(queryParams)); - /** - * Normalizes parameter values: - *
    - *
  • remove nils
  • - *
  • keep files and arrays
  • - *
  • format to string with `paramToString` for other cases
  • - *
- * @param {Object.} params The parameters as object properties. - * @returns {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; + // 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'); + } else if (returnType === 'String') { + request.responseType('string'); + } + + // Attach previously saved cookies, if enabled + if (this.enableCookies){ + if (typeof window === 'undefined') { + this.agent.attachCookies(request); + } + else { + request.withCredentials(); + } + } + + return new Promise((resolve, reject) => { + request.end((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); + } + } + }); + }); + + + } + + /** + * 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. + */ + static parseDate(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.|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 data will be converted to this type. + * @returns An instance of the specified type or null or undefined if data is null or undefined. + */ + 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 ApiClient.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 ApiClient.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 = ApiClient.convertToType(k, keyType); + var value = ApiClient.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. + */ + static constructFromObject(data, obj, itemType) { + if (Array.isArray(data)) { + for (var i = 0; i < data.length; i++) { + if (data.hasOwnProperty(i)) + obj[i] = ApiClient.convertToType(data[i], itemType); + } } else { - newParams[key] = this.paramToString(value); + for (var k in data) { + if (data.hasOwnProperty(k)) + obj[k] = ApiClient.convertToType(data[k], itemType); + } } - } - } - return newParams; - }; + }; +} - /** - * Enumeration of collection format separator strategies. - * @enum {String} - * @readonly - */ - exports.CollectionFormatEnum = { - /** - * Comma-separated values. Value: csv - * @const - */ - CSV: ',', - /** - * Space-separated values. Value: ssv - * @const - */ - SSV: ' ', - /** - * Tab-separated values. Value: tsv - * @const - */ - TSV: '\t', - /** - * Pipe(|)-separated values. Value: pipes - * @const - */ - PIPES: '|', - /** - * Native array. Value: multi - * @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 - * param as is if collectionFormat is multi. - */ - 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 superagent() call. - * @param {Array.} 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.|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 data 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); - }; - - /** - * 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.} pathParams A map of path parameters and their values. - * @param {Object.} queryParams A map of query parameters and their values. - * @param {Object.} headerParams A map of header parameters and their values. - * @param {Object.} formParams A map of form parameters and their values. - * @param {Object} bodyParam The value to pass as the request body. - * @param {Array.} authNames An array of authentication type names. - * @param {Array.} contentTypes An array of request MIME types. - * @param {Array.} accepts An array of acceptable response MIME types. - * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the - * constructor for a complex type. - * @returns {Promise} A {@link https://www.promisejs.org/|Promise} object. - */ - exports.prototype.callApi = function callApi(path, httpMethod, pathParams, - queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, - returnType) { - - var _this = this; - var url = this.buildUrl(path, pathParams); - var request = superagent(httpMethod, url); - - // 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'); - } else if (returnType === 'String') { - request.responseType('string'); - } - - // Attach previously saved cookies, if enabled - if (this.enableCookies){ - if (typeof window === 'undefined') { - this.agent.attachCookies(request); - } - else { - request.withCredentials(); - } - } - - return new Promise(function(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); - } - } - }); - }); - }; - - /** - * 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.|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 data 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; -})); +/** +* The default API client implementation. +* @type {module:ApiClient} +*/ +ApiClient.instance = new ApiClient(); diff --git a/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js b/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js index 5d02c0d220f..2cdc729a803 100644 --- a/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js @@ -7,45 +7,35 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from "../ApiClient"; +import Client from '../model/Client'; +import OuterBoolean from '../model/OuterBoolean'; +import OuterComposite from '../model/OuterComposite'; +import OuterNumber from '../model/OuterNumber'; +import OuterString from '../model/OuterString'; + +/** +* Fake service. +* @module api/FakeApi +* @version 1.0.0 +*/ +export default class FakeApi { + + /** + * 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. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; } - 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; @@ -55,24 +45,24 @@ * @param {module:model/OuterBoolean} opts.body Input boolean as post body * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OuterBoolean} and HTTP response */ - this.fakeOuterBooleanSerializeWithHttpInfo = function(opts) { + fakeOuterBooleanSerializeWithHttpInfo(opts) { opts = opts || {}; - var postBody = opts['body']; + let postBody = opts['body']; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = []; - var returnType = OuterBoolean; + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = OuterBoolean; return this.apiClient.callApi( '/fake/outer/boolean', 'POST', @@ -87,7 +77,7 @@ * @param {module:model/OuterBoolean} opts.body Input boolean as post body * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OuterBoolean} */ - this.fakeOuterBooleanSerialize = function(opts) { + fakeOuterBooleanSerialize(opts) { return this.fakeOuterBooleanSerializeWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; @@ -101,24 +91,24 @@ * @param {module:model/OuterComposite} opts.body Input composite as post body * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OuterComposite} and HTTP response */ - this.fakeOuterCompositeSerializeWithHttpInfo = function(opts) { + fakeOuterCompositeSerializeWithHttpInfo(opts) { opts = opts || {}; - var postBody = opts['body']; + let postBody = opts['body']; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = []; - var returnType = OuterComposite; + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = OuterComposite; return this.apiClient.callApi( '/fake/outer/composite', 'POST', @@ -133,7 +123,7 @@ * @param {module:model/OuterComposite} opts.body Input composite as post body * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OuterComposite} */ - this.fakeOuterCompositeSerialize = function(opts) { + fakeOuterCompositeSerialize(opts) { return this.fakeOuterCompositeSerializeWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; @@ -147,24 +137,24 @@ * @param {module:model/OuterNumber} opts.body Input number as post body * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OuterNumber} and HTTP response */ - this.fakeOuterNumberSerializeWithHttpInfo = function(opts) { + fakeOuterNumberSerializeWithHttpInfo(opts) { opts = opts || {}; - var postBody = opts['body']; + let postBody = opts['body']; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = []; - var returnType = OuterNumber; + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = OuterNumber; return this.apiClient.callApi( '/fake/outer/number', 'POST', @@ -179,7 +169,7 @@ * @param {module:model/OuterNumber} opts.body Input number as post body * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OuterNumber} */ - this.fakeOuterNumberSerialize = function(opts) { + fakeOuterNumberSerialize(opts) { return this.fakeOuterNumberSerializeWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; @@ -193,24 +183,24 @@ * @param {module:model/OuterString} opts.body Input string as post body * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OuterString} and HTTP response */ - this.fakeOuterStringSerializeWithHttpInfo = function(opts) { + fakeOuterStringSerializeWithHttpInfo(opts) { opts = opts || {}; - var postBody = opts['body']; + let postBody = opts['body']; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = []; - var returnType = OuterString; + let authNames = []; + let contentTypes = []; + let accepts = []; + let returnType = OuterString; return this.apiClient.callApi( '/fake/outer/string', 'POST', @@ -225,7 +215,7 @@ * @param {module:model/OuterString} opts.body Input string as post body * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OuterString} */ - this.fakeOuterStringSerialize = function(opts) { + fakeOuterStringSerialize(opts) { return this.fakeOuterStringSerializeWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; @@ -239,8 +229,8 @@ * @param {module:model/Client} body client model * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Client} and HTTP response */ - this.testClientModelWithHttpInfo = function(body) { - var postBody = body; + testClientModelWithHttpInfo(body) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -248,19 +238,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = ['application/json']; - var accepts = ['application/json']; - var returnType = Client; + let authNames = []; + let contentTypes = ['application/json']; + let accepts = ['application/json']; + let returnType = Client; return this.apiClient.callApi( '/fake', 'PATCH', @@ -275,7 +265,7 @@ * @param {module:model/Client} body client model * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Client} */ - this.testClientModel = function(body) { + testClientModel(body) { return this.testClientModelWithHttpInfo(body) .then(function(response_and_data) { return response_and_data.data; @@ -303,9 +293,9 @@ * @param {String} opts.callback None * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.testEndpointParametersWithHttpInfo = function(_number, _double, patternWithoutDelimiter, _byte, opts) { + testEndpointParametersWithHttpInfo(_number, _double, patternWithoutDelimiter, _byte, opts) { opts = opts || {}; - var postBody = null; + let postBody = null; // verify the required parameter '_number' is set if (_number === undefined || _number === null) { @@ -328,13 +318,13 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { 'integer': opts['integer'], 'int32': opts['int32'], 'int64': opts['int64'], @@ -351,10 +341,10 @@ '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; + let authNames = ['http_basic_test']; + let contentTypes = ['application/xml; charset=utf-8', 'application/json; charset=utf-8']; + let accepts = ['application/xml; charset=utf-8', 'application/json; charset=utf-8']; + let returnType = null; return this.apiClient.callApi( '/fake', 'POST', @@ -383,7 +373,7 @@ * @param {String} opts.callback None * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.testEndpointParameters = function(_number, _double, patternWithoutDelimiter, _byte, opts) { + testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts) { return this.testEndpointParametersWithHttpInfo(_number, _double, patternWithoutDelimiter, _byte, opts) .then(function(response_and_data) { return response_and_data.data; @@ -405,32 +395,32 @@ * @param {module:model/Number} opts.enumQueryDouble Query parameter enum test (double) * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.testEnumParametersWithHttpInfo = function(opts) { + testEnumParametersWithHttpInfo(opts) { opts = opts || {}; - var postBody = null; + let postBody = null; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { 'enum_query_string_array': this.apiClient.buildCollectionParam(opts['enumQueryStringArray'], 'csv'), 'enum_query_string': opts['enumQueryString'], 'enum_query_integer': opts['enumQueryInteger'] }; - var headerParams = { + let headerParams = { 'enum_header_string_array': opts['enumHeaderStringArray'], 'enum_header_string': opts['enumHeaderString'] }; - var formParams = { + let 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; + let authNames = []; + let contentTypes = ['*/*']; + let accepts = ['*/*']; + let returnType = null; return this.apiClient.callApi( '/fake', 'GET', @@ -453,13 +443,12 @@ * @param {module:model/Number} opts.enumQueryDouble Query parameter enum test (double) * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.testEnumParameters = function(opts) { + testEnumParameters(opts) { return this.testEnumParametersWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; }); } - }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/api/PetApi.js b/samples/client/petstore/javascript-promise-es6/src/api/PetApi.js index fbf0ae9516a..53e385ef2cd 100644 --- a/samples/client/petstore/javascript-promise-es6/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise-es6/src/api/PetApi.js @@ -7,45 +7,32 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from "../ApiClient"; +import ApiResponse from '../model/ApiResponse'; +import Pet from '../model/Pet'; + +/** +* Pet service. +* @module api/PetApi +* @version 1.0.0 +*/ +export default class PetApi { + + /** + * 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. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; } - 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; @@ -55,8 +42,8 @@ * @param {module:model/Pet} body Pet object that needs to be added to the store * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.addPetWithHttpInfo = function(body) { - var postBody = body; + addPetWithHttpInfo(body) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -64,19 +51,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = ['petstore_auth']; + let contentTypes = ['application/json', 'application/xml']; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/pet', 'POST', @@ -91,7 +78,7 @@ * @param {module:model/Pet} body Pet object that needs to be added to the store * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.addPet = function(body) { + addPet(body) { return this.addPetWithHttpInfo(body) .then(function(response_and_data) { return response_and_data.data; @@ -107,9 +94,9 @@ * @param {String} opts.apiKey * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.deletePetWithHttpInfo = function(petId, opts) { + deletePetWithHttpInfo(petId, opts) { opts = opts || {}; - var postBody = null; + let postBody = null; // verify the required parameter 'petId' is set if (petId === undefined || petId === null) { @@ -117,21 +104,21 @@ } - var pathParams = { + let pathParams = { 'petId': petId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { 'api_key': opts['apiKey'] }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = ['petstore_auth']; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/pet/{petId}', 'DELETE', @@ -148,7 +135,7 @@ * @param {String} opts.apiKey * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.deletePet = function(petId, opts) { + deletePet(petId, opts) { return this.deletePetWithHttpInfo(petId, opts) .then(function(response_and_data) { return response_and_data.data; @@ -162,8 +149,8 @@ * @param {Array.} status Status values that need to be considered for filter * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.} and HTTP response */ - this.findPetsByStatusWithHttpInfo = function(status) { - var postBody = null; + findPetsByStatusWithHttpInfo(status) { + let postBody = null; // verify the required parameter 'status' is set if (status === undefined || status === null) { @@ -171,20 +158,20 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { 'status': this.apiClient.buildCollectionParam(status, 'csv') }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = [Pet]; + let authNames = ['petstore_auth']; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = [Pet]; return this.apiClient.callApi( '/pet/findByStatus', 'GET', @@ -199,7 +186,7 @@ * @param {Array.} status Status values that need to be considered for filter * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.} */ - this.findPetsByStatus = function(status) { + findPetsByStatus(status) { return this.findPetsByStatusWithHttpInfo(status) .then(function(response_and_data) { return response_and_data.data; @@ -213,8 +200,8 @@ * @param {Array.} tags Tags to filter by * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.} and HTTP response */ - this.findPetsByTagsWithHttpInfo = function(tags) { - var postBody = null; + findPetsByTagsWithHttpInfo(tags) { + let postBody = null; // verify the required parameter 'tags' is set if (tags === undefined || tags === null) { @@ -222,20 +209,20 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { 'tags': this.apiClient.buildCollectionParam(tags, 'csv') }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = [Pet]; + let authNames = ['petstore_auth']; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = [Pet]; return this.apiClient.callApi( '/pet/findByTags', 'GET', @@ -250,7 +237,7 @@ * @param {Array.} tags Tags to filter by * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.} */ - this.findPetsByTags = function(tags) { + findPetsByTags(tags) { return this.findPetsByTagsWithHttpInfo(tags) .then(function(response_and_data) { return response_and_data.data; @@ -264,8 +251,8 @@ * @param {Number} petId ID of pet to return * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Pet} and HTTP response */ - this.getPetByIdWithHttpInfo = function(petId) { - var postBody = null; + getPetByIdWithHttpInfo(petId) { + let postBody = null; // verify the required parameter 'petId' is set if (petId === undefined || petId === null) { @@ -273,20 +260,20 @@ } - var pathParams = { + let pathParams = { 'petId': petId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['api_key']; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = Pet; + let authNames = ['api_key']; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = Pet; return this.apiClient.callApi( '/pet/{petId}', 'GET', @@ -301,7 +288,7 @@ * @param {Number} petId ID of pet to return * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Pet} */ - this.getPetById = function(petId) { + getPetById(petId) { return this.getPetByIdWithHttpInfo(petId) .then(function(response_and_data) { return response_and_data.data; @@ -315,8 +302,8 @@ * @param {module:model/Pet} body Pet object that needs to be added to the store * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.updatePetWithHttpInfo = function(body) { - var postBody = body; + updatePetWithHttpInfo(body) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -324,19 +311,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['petstore_auth']; - var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = ['petstore_auth']; + let contentTypes = ['application/json', 'application/xml']; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/pet', 'PUT', @@ -351,7 +338,7 @@ * @param {module:model/Pet} body Pet object that needs to be added to the store * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.updatePet = function(body) { + updatePet(body) { return this.updatePetWithHttpInfo(body) .then(function(response_and_data) { return response_and_data.data; @@ -368,9 +355,9 @@ * @param {String} opts.status Updated status of the pet * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.updatePetWithFormWithHttpInfo = function(petId, opts) { + updatePetWithFormWithHttpInfo(petId, opts) { opts = opts || {}; - var postBody = null; + let postBody = null; // verify the required parameter 'petId' is set if (petId === undefined || petId === null) { @@ -378,22 +365,22 @@ } - var pathParams = { + let pathParams = { 'petId': petId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let 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; + let authNames = ['petstore_auth']; + let contentTypes = ['application/x-www-form-urlencoded']; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/pet/{petId}', 'POST', @@ -411,7 +398,7 @@ * @param {String} opts.status Updated status of the pet * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.updatePetWithForm = function(petId, opts) { + updatePetWithForm(petId, opts) { return this.updatePetWithFormWithHttpInfo(petId, opts) .then(function(response_and_data) { return response_and_data.data; @@ -428,9 +415,9 @@ * @param {File} opts.file file to upload * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ApiResponse} and HTTP response */ - this.uploadFileWithHttpInfo = function(petId, opts) { + uploadFileWithHttpInfo(petId, opts) { opts = opts || {}; - var postBody = null; + let postBody = null; // verify the required parameter 'petId' is set if (petId === undefined || petId === null) { @@ -438,22 +425,22 @@ } - var pathParams = { + let pathParams = { 'petId': petId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { 'additionalMetadata': opts['additionalMetadata'], 'file': opts['file'] }; - var authNames = ['petstore_auth']; - var contentTypes = ['multipart/form-data']; - var accepts = ['application/json']; - var returnType = ApiResponse; + let authNames = ['petstore_auth']; + let contentTypes = ['multipart/form-data']; + let accepts = ['application/json']; + let returnType = ApiResponse; return this.apiClient.callApi( '/pet/{petId}/uploadImage', 'POST', @@ -471,13 +458,12 @@ * @param {File} opts.file file to upload * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ApiResponse} */ - this.uploadFile = function(petId, opts) { + uploadFile(petId, opts) { return this.uploadFileWithHttpInfo(petId, opts) .then(function(response_and_data) { return response_and_data.data; }); } - }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/api/StoreApi.js b/samples/client/petstore/javascript-promise-es6/src/api/StoreApi.js index fd07229b31f..0b55929a8a4 100644 --- a/samples/client/petstore/javascript-promise-es6/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise-es6/src/api/StoreApi.js @@ -7,45 +7,31 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from "../ApiClient"; +import Order from '../model/Order'; + +/** +* Store service. +* @module api/StoreApi +* @version 1.0.0 +*/ +export default class StoreApi { + + /** + * 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. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; } - 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; @@ -55,8 +41,8 @@ * @param {String} orderId ID of the order that needs to be deleted * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.deleteOrderWithHttpInfo = function(orderId) { - var postBody = null; + deleteOrderWithHttpInfo(orderId) { + let postBody = null; // verify the required parameter 'orderId' is set if (orderId === undefined || orderId === null) { @@ -64,20 +50,20 @@ } - var pathParams = { + let pathParams = { 'order_id': orderId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/store/order/{order_id}', 'DELETE', @@ -92,7 +78,7 @@ * @param {String} orderId ID of the order that needs to be deleted * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.deleteOrder = function(orderId) { + deleteOrder(orderId) { return this.deleteOrderWithHttpInfo(orderId) .then(function(response_and_data) { return response_and_data.data; @@ -105,23 +91,23 @@ * Returns a map of status codes to quantities * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Object.} and HTTP response */ - this.getInventoryWithHttpInfo = function() { - var postBody = null; + getInventoryWithHttpInfo() { + let postBody = null; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = ['api_key']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = {'String': 'Number'}; + let authNames = ['api_key']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = {'String': 'Number'}; return this.apiClient.callApi( '/store/inventory', 'GET', @@ -135,7 +121,7 @@ * Returns a map of status codes to quantities * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object.} */ - this.getInventory = function() { + getInventory() { return this.getInventoryWithHttpInfo() .then(function(response_and_data) { return response_and_data.data; @@ -149,8 +135,8 @@ * @param {Number} orderId ID of pet that needs to be fetched * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Order} and HTTP response */ - this.getOrderByIdWithHttpInfo = function(orderId) { - var postBody = null; + getOrderByIdWithHttpInfo(orderId) { + let postBody = null; // verify the required parameter 'orderId' is set if (orderId === undefined || orderId === null) { @@ -158,20 +144,20 @@ } - var pathParams = { + let pathParams = { 'order_id': orderId }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = Order; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = Order; return this.apiClient.callApi( '/store/order/{order_id}', 'GET', @@ -186,7 +172,7 @@ * @param {Number} orderId ID of pet that needs to be fetched * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Order} */ - this.getOrderById = function(orderId) { + getOrderById(orderId) { return this.getOrderByIdWithHttpInfo(orderId) .then(function(response_and_data) { return response_and_data.data; @@ -200,8 +186,8 @@ * @param {module:model/Order} body order placed for purchasing the pet * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Order} and HTTP response */ - this.placeOrderWithHttpInfo = function(body) { - var postBody = body; + placeOrderWithHttpInfo(body) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -209,19 +195,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = Order; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = Order; return this.apiClient.callApi( '/store/order', 'POST', @@ -236,13 +222,12 @@ * @param {module:model/Order} body order placed for purchasing the pet * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Order} */ - this.placeOrder = function(body) { + placeOrder(body) { return this.placeOrderWithHttpInfo(body) .then(function(response_and_data) { return response_and_data.data; }); } - }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js b/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js index beac00797f9..1c1fe593e26 100644 --- a/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js @@ -7,45 +7,31 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from "../ApiClient"; +import User from '../model/User'; + +/** +* User service. +* @module api/UserApi +* @version 1.0.0 +*/ +export default class UserApi { + + /** + * 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. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; } - 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; @@ -55,8 +41,8 @@ * @param {module:model/User} body Created user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.createUserWithHttpInfo = function(body) { - var postBody = body; + createUserWithHttpInfo(body) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -64,19 +50,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user', 'POST', @@ -91,7 +77,7 @@ * @param {module:model/User} body Created user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.createUser = function(body) { + createUser(body) { return this.createUserWithHttpInfo(body) .then(function(response_and_data) { return response_and_data.data; @@ -105,8 +91,8 @@ * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.createUsersWithArrayInputWithHttpInfo = function(body) { - var postBody = body; + createUsersWithArrayInputWithHttpInfo(body) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -114,19 +100,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/createWithArray', 'POST', @@ -141,7 +127,7 @@ * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.createUsersWithArrayInput = function(body) { + createUsersWithArrayInput(body) { return this.createUsersWithArrayInputWithHttpInfo(body) .then(function(response_and_data) { return response_and_data.data; @@ -155,8 +141,8 @@ * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.createUsersWithListInputWithHttpInfo = function(body) { - var postBody = body; + createUsersWithListInputWithHttpInfo(body) { + let postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { @@ -164,19 +150,19 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/createWithList', 'POST', @@ -191,7 +177,7 @@ * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.createUsersWithListInput = function(body) { + createUsersWithListInput(body) { return this.createUsersWithListInputWithHttpInfo(body) .then(function(response_and_data) { return response_and_data.data; @@ -205,8 +191,8 @@ * @param {String} username The name that needs to be deleted * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.deleteUserWithHttpInfo = function(username) { - var postBody = null; + deleteUserWithHttpInfo(username) { + let postBody = null; // verify the required parameter 'username' is set if (username === undefined || username === null) { @@ -214,20 +200,20 @@ } - var pathParams = { + let pathParams = { 'username': username }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/{username}', 'DELETE', @@ -242,7 +228,7 @@ * @param {String} username The name that needs to be deleted * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.deleteUser = function(username) { + deleteUser(username) { return this.deleteUserWithHttpInfo(username) .then(function(response_and_data) { return response_and_data.data; @@ -256,8 +242,8 @@ * @param {String} username The name that needs to be fetched. Use user1 for testing. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/User} and HTTP response */ - this.getUserByNameWithHttpInfo = function(username) { - var postBody = null; + getUserByNameWithHttpInfo(username) { + let postBody = null; // verify the required parameter 'username' is set if (username === undefined || username === null) { @@ -265,20 +251,20 @@ } - var pathParams = { + let pathParams = { 'username': username }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = User; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = User; return this.apiClient.callApi( '/user/{username}', 'GET', @@ -293,7 +279,7 @@ * @param {String} username The name that needs to be fetched. Use user1 for testing. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/User} */ - this.getUserByName = function(username) { + getUserByName(username) { return this.getUserByNameWithHttpInfo(username) .then(function(response_and_data) { return response_and_data.data; @@ -308,8 +294,8 @@ * @param {String} password The password for login in clear text * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link 'String'} and HTTP response */ - this.loginUserWithHttpInfo = function(username, password) { - var postBody = null; + loginUserWithHttpInfo(username, password) { + let postBody = null; // verify the required parameter 'username' is set if (username === undefined || username === null) { @@ -322,21 +308,21 @@ } - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { 'username': username, 'password': password }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = 'String'; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = 'String'; return this.apiClient.callApi( '/user/login', 'GET', @@ -352,7 +338,7 @@ * @param {String} password The password for login in clear text * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link 'String'} */ - this.loginUser = function(username, password) { + loginUser(username, password) { return this.loginUserWithHttpInfo(username, password) .then(function(response_and_data) { return response_and_data.data; @@ -365,23 +351,23 @@ * * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.logoutUserWithHttpInfo = function() { - var postBody = null; + logoutUserWithHttpInfo() { + let postBody = null; - var pathParams = { + let pathParams = { }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/logout', 'GET', @@ -395,7 +381,7 @@ * * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.logoutUser = function() { + logoutUser() { return this.logoutUserWithHttpInfo() .then(function(response_and_data) { return response_and_data.data; @@ -410,8 +396,8 @@ * @param {module:model/User} body Updated user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ - this.updateUserWithHttpInfo = function(username, body) { - var postBody = body; + updateUserWithHttpInfo(username, body) { + let postBody = body; // verify the required parameter 'username' is set if (username === undefined || username === null) { @@ -424,20 +410,20 @@ } - var pathParams = { + let pathParams = { 'username': username }; - var queryParams = { + let queryParams = { }; - var headerParams = { + let headerParams = { }; - var formParams = { + let formParams = { }; - var authNames = []; - var contentTypes = []; - var accepts = ['application/xml', 'application/json']; - var returnType = null; + let authNames = []; + let contentTypes = []; + let accepts = ['application/xml', 'application/json']; + let returnType = null; return this.apiClient.callApi( '/user/{username}', 'PUT', @@ -453,13 +439,12 @@ * @param {module:model/User} body Updated user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ - this.updateUser = function(username, body) { + updateUser(username, body) { return this.updateUserWithHttpInfo(username, body) .then(function(response_and_data) { return response_and_data.data; }); } - }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/index.js b/samples/client/petstore/javascript-promise-es6/src/index.js index 6acae4aaaf4..3a016977a34 100644 --- a/samples/client/petstore/javascript-promise-es6/src/index.js +++ b/samples/client/petstore/javascript-promise-es6/src/index.js @@ -7,262 +7,329 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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/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/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, 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__.
- * The index module provides access to constructors for all the classes which comprise the public API. - *

- * An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: - *

-   * 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.
-   * ...
-   * 
- * *NOTE: For a top-level AMD script, use require(['index'], function(){...}) - * and put the application logic within the callback function. - *

- *

- * A non-AMD browser application (discouraged) might do something like this: - *

-   * 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.
-   * ...
-   * 
- *

- * @module index - * @version 1.0.0 - */ - var exports = { +import ApiClient from './ApiClient'; +import AdditionalPropertiesClass from './model/AdditionalPropertiesClass'; +import Animal from './model/Animal'; +import AnimalFarm from './model/AnimalFarm'; +import ApiResponse from './model/ApiResponse'; +import ArrayOfArrayOfNumberOnly from './model/ArrayOfArrayOfNumberOnly'; +import ArrayOfNumberOnly from './model/ArrayOfNumberOnly'; +import ArrayTest from './model/ArrayTest'; +import Capitalization from './model/Capitalization'; +import Category from './model/Category'; +import ClassModel from './model/ClassModel'; +import Client from './model/Client'; +import EnumArrays from './model/EnumArrays'; +import EnumClass from './model/EnumClass'; +import EnumTest from './model/EnumTest'; +import FormatTest from './model/FormatTest'; +import HasOnlyReadOnly from './model/HasOnlyReadOnly'; +import List from './model/List'; +import MapTest from './model/MapTest'; +import MixedPropertiesAndAdditionalPropertiesClass from './model/MixedPropertiesAndAdditionalPropertiesClass'; +import Model200Response from './model/Model200Response'; +import ModelReturn from './model/ModelReturn'; +import Name from './model/Name'; +import NumberOnly from './model/NumberOnly'; +import Order from './model/Order'; +import OuterBoolean from './model/OuterBoolean'; +import OuterComposite from './model/OuterComposite'; +import OuterEnum from './model/OuterEnum'; +import OuterNumber from './model/OuterNumber'; +import OuterString from './model/OuterString'; +import Pet from './model/Pet'; +import ReadOnlyFirst from './model/ReadOnlyFirst'; +import SpecialModelName from './model/SpecialModelName'; +import Tag from './model/Tag'; +import User from './model/User'; +import Cat from './model/Cat'; +import Dog from './model/Dog'; +import FakeApi from './api/FakeApi'; +import PetApi from './api/PetApi'; +import StoreApi from './api/StoreApi'; +import UserApi from './api/UserApi'; + + +/** +* This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters__.
+* The index module provides access to constructors for all the classes which comprise the public API. +*

+* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: +*

+* 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.
+* ...
+* 
+* *NOTE: For a top-level AMD script, use require(['index'], function(){...}) +* and put the application logic within the callback function. +*

+*

+* A non-AMD browser application (discouraged) might do something like this: +*

+* 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.
+* ...
+* 
+*

+* @module index +* @version 1.0.0 +*/ +export { /** * The ApiClient constructor. * @property {module:ApiClient} */ - ApiClient: ApiClient, + ApiClient, + /** * The AdditionalPropertiesClass model constructor. * @property {module:model/AdditionalPropertiesClass} */ - AdditionalPropertiesClass: AdditionalPropertiesClass, + AdditionalPropertiesClass, + /** * The Animal model constructor. * @property {module:model/Animal} */ - Animal: Animal, + Animal, + /** * The AnimalFarm model constructor. * @property {module:model/AnimalFarm} */ - AnimalFarm: AnimalFarm, + AnimalFarm, + /** * The ApiResponse model constructor. * @property {module:model/ApiResponse} */ - ApiResponse: ApiResponse, + ApiResponse, + /** * The ArrayOfArrayOfNumberOnly model constructor. * @property {module:model/ArrayOfArrayOfNumberOnly} */ - ArrayOfArrayOfNumberOnly: ArrayOfArrayOfNumberOnly, + ArrayOfArrayOfNumberOnly, + /** * The ArrayOfNumberOnly model constructor. * @property {module:model/ArrayOfNumberOnly} */ - ArrayOfNumberOnly: ArrayOfNumberOnly, + ArrayOfNumberOnly, + /** * The ArrayTest model constructor. * @property {module:model/ArrayTest} */ - ArrayTest: ArrayTest, + ArrayTest, + /** * The Capitalization model constructor. * @property {module:model/Capitalization} */ - Capitalization: Capitalization, + Capitalization, + /** * The Category model constructor. * @property {module:model/Category} */ - Category: Category, + Category, + /** * The ClassModel model constructor. * @property {module:model/ClassModel} */ - ClassModel: ClassModel, + ClassModel, + /** * The Client model constructor. * @property {module:model/Client} */ - Client: Client, + Client, + /** * The EnumArrays model constructor. * @property {module:model/EnumArrays} */ - EnumArrays: EnumArrays, + EnumArrays, + /** * The EnumClass model constructor. * @property {module:model/EnumClass} */ - EnumClass: EnumClass, + EnumClass, + /** * The EnumTest model constructor. * @property {module:model/EnumTest} */ - EnumTest: EnumTest, + EnumTest, + /** * The FormatTest model constructor. * @property {module:model/FormatTest} */ - FormatTest: FormatTest, + FormatTest, + /** * The HasOnlyReadOnly model constructor. * @property {module:model/HasOnlyReadOnly} */ - HasOnlyReadOnly: HasOnlyReadOnly, + HasOnlyReadOnly, + /** * The List model constructor. * @property {module:model/List} */ - List: List, + List, + /** * The MapTest model constructor. * @property {module:model/MapTest} */ - MapTest: MapTest, + MapTest, + /** * The MixedPropertiesAndAdditionalPropertiesClass model constructor. * @property {module:model/MixedPropertiesAndAdditionalPropertiesClass} */ - MixedPropertiesAndAdditionalPropertiesClass: MixedPropertiesAndAdditionalPropertiesClass, + MixedPropertiesAndAdditionalPropertiesClass, + /** * The Model200Response model constructor. * @property {module:model/Model200Response} */ - Model200Response: Model200Response, + Model200Response, + /** * The ModelReturn model constructor. * @property {module:model/ModelReturn} */ - ModelReturn: ModelReturn, + ModelReturn, + /** * The Name model constructor. * @property {module:model/Name} */ - Name: Name, + Name, + /** * The NumberOnly model constructor. * @property {module:model/NumberOnly} */ - NumberOnly: NumberOnly, + NumberOnly, + /** * The Order model constructor. * @property {module:model/Order} */ - Order: Order, + Order, + /** * The OuterBoolean model constructor. * @property {module:model/OuterBoolean} */ - OuterBoolean: OuterBoolean, + OuterBoolean, + /** * The OuterComposite model constructor. * @property {module:model/OuterComposite} */ - OuterComposite: OuterComposite, + OuterComposite, + /** * The OuterEnum model constructor. * @property {module:model/OuterEnum} */ - OuterEnum: OuterEnum, + OuterEnum, + /** * The OuterNumber model constructor. * @property {module:model/OuterNumber} */ - OuterNumber: OuterNumber, + OuterNumber, + /** * The OuterString model constructor. * @property {module:model/OuterString} */ - OuterString: OuterString, + OuterString, + /** * The Pet model constructor. * @property {module:model/Pet} */ - Pet: Pet, + Pet, + /** * The ReadOnlyFirst model constructor. * @property {module:model/ReadOnlyFirst} */ - ReadOnlyFirst: ReadOnlyFirst, + ReadOnlyFirst, + /** * The SpecialModelName model constructor. * @property {module:model/SpecialModelName} */ - SpecialModelName: SpecialModelName, + SpecialModelName, + /** * The Tag model constructor. * @property {module:model/Tag} */ - Tag: Tag, + Tag, + /** * The User model constructor. * @property {module:model/User} */ - User: User, + User, + /** * The Cat model constructor. * @property {module:model/Cat} */ - Cat: Cat, + Cat, + /** * The Dog model constructor. * @property {module:model/Dog} */ - Dog: Dog, - /** - * The FakeApi service constructor. - * @property {module:api/FakeApi} - */ - FakeApi: FakeApi, - /** - * 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 - }; + Dog, - return exports; -})); + /** + * The FakeApi service constructor. + * @property {module:api/FakeApi} + */ + FakeApi, + + /** + * The PetApi service constructor. + * @property {module:api/PetApi} + */ + PetApi, + + /** + * The StoreApi service constructor. + * @property {module:api/StoreApi} + */ + StoreApi, + + /** + * The UserApi service constructor. + * @property {module:api/UserApi} + */ + UserApi +}; diff --git a/samples/client/petstore/javascript-promise-es6/src/model/AdditionalPropertiesClass.js b/samples/client/petstore/javascript-promise-es6/src/model/AdditionalPropertiesClass.js index 2744647b18a..088cbb29b35 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/AdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/AdditionalPropertiesClass.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The AdditionalPropertiesClass model module. +* @module model/AdditionalPropertiesClass +* @version 1.0.0 +*/ +export default class AdditionalPropertiesClass { + /** + * Constructs a new AdditionalPropertiesClass. + * @alias module:model/AdditionalPropertiesClass + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.AdditionalPropertiesClass = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a AdditionalPropertiesClass from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 AdditionalPropertiesClass instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new AdditionalPropertiesClass(); + + + - - /** - * The AdditionalPropertiesClass model module. - * @module model/AdditionalPropertiesClass - * @version 1.0.0 - */ - - /** - * Constructs a new AdditionalPropertiesClass. - * @alias module:model/AdditionalPropertiesClass - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a AdditionalPropertiesClass from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 AdditionalPropertiesClass 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'}}); - } + 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; } - return obj; - } - /** - * @member {Object.} map_property - */ - exports.prototype['map_property'] = undefined; - /** - * @member {Object.>} map_of_map_property - */ - exports.prototype['map_of_map_property'] = undefined; + /** + * @member {Object.} map_property + */ + map_property = undefined; + /** + * @member {Object.>} map_of_map_property + */ + map_of_map_property = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Animal.js b/samples/client/petstore/javascript-promise-es6/src/model/Animal.js index 09119420568..b3fb1a63f32 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Animal.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Animal.js @@ -7,86 +7,83 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Animal model module. +* @module model/Animal +* @version 1.0.0 +*/ +export default class Animal { + /** + * Constructs a new Animal. + * @alias module:model/Animal + * @class + * @param className {String} + */ + + constructor(className) { + + + + + + this['className'] = className; + + } - root.SwaggerPetstore.Animal = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Animal from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Animal instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Animal(); + + + - - /** - * The Animal model module. - * @module model/Animal - * @version 1.0.0 - */ - - /** - * Constructs a new Animal. - * @alias module:model/Animal - * @class - * @param className {String} - */ - var exports = function(className) { - var _this = this; - - _this['className'] = className; - - }; - - /** - * Constructs a Animal from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Animal 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'); - } + if (data.hasOwnProperty('className')) { + obj['className'] = ApiClient.convertToType(data['className'], 'String'); + } + if (data.hasOwnProperty('color')) { + obj['color'] = ApiClient.convertToType(data['color'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} className - */ - exports.prototype['className'] = undefined; - /** - * @member {String} color - * @default 'red' - */ - exports.prototype['color'] = 'red'; + /** + * @member {String} className + */ + className = undefined; + /** + * @member {String} color + * @default 'red' + */ + color = 'red'; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/AnimalFarm.js b/samples/client/petstore/javascript-promise-es6/src/model/AnimalFarm.js index 891009dab71..8dc9f00cadb 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/AnimalFarm.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/AnimalFarm.js @@ -7,73 +7,72 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import Animal from './Animal'; + + + + + +/** +* The AnimalFarm model module. +* @module model/AnimalFarm +* @version 1.0.0 +*/ +export default class AnimalFarm { + /** + * Constructs a new AnimalFarm. + * @alias module:model/AnimalFarm + * @class + * @extends Array + */ + + constructor() { + + this = new Array(); + Object.setPrototypeOf(this, AnimalFarm); + + + + + + + return this; } - root.SwaggerPetstore.AnimalFarm = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); - } -}(this, function(ApiClient, Animal) { - 'use strict'; + /** + * Constructs a AnimalFarm from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 AnimalFarm instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new AnimalFarm(); + ApiClient.constructFromObject(data, obj, 'Animal'); + + - /** - * The AnimalFarm model module. - * @module model/AnimalFarm - * @version 1.0.0 - */ - - /** - * Constructs a new AnimalFarm. - * @alias module:model/AnimalFarm - * @class - * @extends Array - */ - var exports = function() { - var _this = this; - _this = new Array(); - Object.setPrototypeOf(_this, exports); - - return _this; - }; - - /** - * Constructs a AnimalFarm from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 AnimalFarm instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - ApiClient.constructFromObject(data, obj, 'Animal'); - + } + return obj; } - return obj; - } - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/ApiResponse.js b/samples/client/petstore/javascript-promise-es6/src/model/ApiResponse.js index 12e9e16275f..49ddd1ac27f 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/ApiResponse.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/ApiResponse.js @@ -7,92 +7,88 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ApiResponse model module. +* @module model/ApiResponse +* @version 1.0.0 +*/ +export default class ApiResponse { + /** + * Constructs a new ApiResponse. + * @alias module:model/ApiResponse + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ApiResponse = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ApiResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ApiResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ApiResponse(); + + + - - /** - * The ApiResponse model module. - * @module model/ApiResponse - * @version 1.0.0 - */ - - /** - * Constructs a new ApiResponse. - * @alias module:model/ApiResponse - * @class - */ - var exports = function() { - var _this = this; - - - - - }; - - /** - * Constructs a ApiResponse from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ApiResponse 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'); - } + 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; } - return obj; - } - /** - * @member {Number} code - */ - exports.prototype['code'] = undefined; - /** - * @member {String} type - */ - exports.prototype['type'] = undefined; - /** - * @member {String} message - */ - exports.prototype['message'] = undefined; + /** + * @member {Number} code + */ + code = undefined; + /** + * @member {String} type + */ + type = undefined; + /** + * @member {String} message + */ + message = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/ArrayOfArrayOfNumberOnly.js b/samples/client/petstore/javascript-promise-es6/src/model/ArrayOfArrayOfNumberOnly.js index c620c19e667..1dfd4487c62 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/ArrayOfArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/ArrayOfArrayOfNumberOnly.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ArrayOfArrayOfNumberOnly model module. +* @module model/ArrayOfArrayOfNumberOnly +* @version 1.0.0 +*/ +export default class ArrayOfArrayOfNumberOnly { + /** + * Constructs a new ArrayOfArrayOfNumberOnly. + * @alias module:model/ArrayOfArrayOfNumberOnly + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ArrayOfArrayOfNumberOnly = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ArrayOfArrayOfNumberOnly from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ArrayOfArrayOfNumberOnly instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ArrayOfArrayOfNumberOnly(); + + + - - /** - * The ArrayOfArrayOfNumberOnly model module. - * @module model/ArrayOfArrayOfNumberOnly - * @version 1.0.0 - */ - - /** - * Constructs a new ArrayOfArrayOfNumberOnly. - * @alias module:model/ArrayOfArrayOfNumberOnly - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a ArrayOfArrayOfNumberOnly from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ArrayOfArrayOfNumberOnly instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('ArrayArrayNumber')) { - obj['ArrayArrayNumber'] = ApiClient.convertToType(data['ArrayArrayNumber'], [['Number']]); - } + if (data.hasOwnProperty('ArrayArrayNumber')) { + obj['ArrayArrayNumber'] = ApiClient.convertToType(data['ArrayArrayNumber'], [['Number']]); + } + } + return obj; } - return obj; - } - /** - * @member {Array.>} ArrayArrayNumber - */ - exports.prototype['ArrayArrayNumber'] = undefined; + /** + * @member {Array.>} ArrayArrayNumber + */ + ArrayArrayNumber = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/ArrayOfNumberOnly.js b/samples/client/petstore/javascript-promise-es6/src/model/ArrayOfNumberOnly.js index 66980b9b8d1..379a19ba3ff 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/ArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/ArrayOfNumberOnly.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ArrayOfNumberOnly model module. +* @module model/ArrayOfNumberOnly +* @version 1.0.0 +*/ +export default class ArrayOfNumberOnly { + /** + * Constructs a new ArrayOfNumberOnly. + * @alias module:model/ArrayOfNumberOnly + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ArrayOfNumberOnly = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ArrayOfNumberOnly from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ArrayOfNumberOnly instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ArrayOfNumberOnly(); + + + - - /** - * The ArrayOfNumberOnly model module. - * @module model/ArrayOfNumberOnly - * @version 1.0.0 - */ - - /** - * Constructs a new ArrayOfNumberOnly. - * @alias module:model/ArrayOfNumberOnly - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a ArrayOfNumberOnly from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ArrayOfNumberOnly instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('ArrayNumber')) { - obj['ArrayNumber'] = ApiClient.convertToType(data['ArrayNumber'], ['Number']); - } + if (data.hasOwnProperty('ArrayNumber')) { + obj['ArrayNumber'] = ApiClient.convertToType(data['ArrayNumber'], ['Number']); + } + } + return obj; } - return obj; - } - /** - * @member {Array.} ArrayNumber - */ - exports.prototype['ArrayNumber'] = undefined; + /** + * @member {Array.} ArrayNumber + */ + ArrayNumber = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/ArrayTest.js b/samples/client/petstore/javascript-promise-es6/src/model/ArrayTest.js index 2fb4ecb6c24..58e9ac58840 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/ArrayTest.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/ArrayTest.js @@ -7,92 +7,89 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import ReadOnlyFirst from './ReadOnlyFirst'; + + + + + +/** +* The ArrayTest model module. +* @module model/ArrayTest +* @version 1.0.0 +*/ +export default class ArrayTest { + /** + * Constructs a new ArrayTest. + * @alias module:model/ArrayTest + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ArrayTest = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.ReadOnlyFirst); - } -}(this, function(ApiClient, ReadOnlyFirst) { - 'use strict'; + /** + * Constructs a ArrayTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ArrayTest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ArrayTest(); + + + - - /** - * The ArrayTest model module. - * @module model/ArrayTest - * @version 1.0.0 - */ - - /** - * Constructs a new ArrayTest. - * @alias module:model/ArrayTest - * @class - */ - var exports = function() { - var _this = this; - - - - - }; - - /** - * Constructs a ArrayTest from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ArrayTest 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]]); - } + 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; } - return obj; - } - /** - * @member {Array.} array_of_string - */ - exports.prototype['array_of_string'] = undefined; - /** - * @member {Array.>} array_array_of_integer - */ - exports.prototype['array_array_of_integer'] = undefined; - /** - * @member {Array.>} array_array_of_model - */ - exports.prototype['array_array_of_model'] = undefined; + /** + * @member {Array.} array_of_string + */ + array_of_string = undefined; + /** + * @member {Array.>} array_array_of_integer + */ + array_array_of_integer = undefined; + /** + * @member {Array.>} array_array_of_model + */ + array_array_of_model = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Capitalization.js b/samples/client/petstore/javascript-promise-es6/src/model/Capitalization.js index 54154d396f8..12f3f3f5593 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Capitalization.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Capitalization.js @@ -7,117 +7,110 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Capitalization model module. +* @module model/Capitalization +* @version 1.0.0 +*/ +export default class Capitalization { + /** + * Constructs a new Capitalization. + * @alias module:model/Capitalization + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Capitalization = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Capitalization from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Capitalization instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Capitalization(); + + + - - /** - * The Capitalization model module. - * @module model/Capitalization - * @version 1.0.0 - */ - - /** - * Constructs a new Capitalization. - * @alias module:model/Capitalization - * @class - */ - var exports = function() { - var _this = this; - - - - - - - - }; - - /** - * Constructs a Capitalization from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Capitalization 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'); - } + 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; } - 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; + /** + * @member {String} smallCamel + */ + smallCamel = undefined; + /** + * @member {String} CapitalCamel + */ + CapitalCamel = undefined; + /** + * @member {String} small_Snake + */ + small_Snake = undefined; + /** + * @member {String} Capital_Snake + */ + Capital_Snake = undefined; + /** + * @member {String} SCA_ETH_Flow_Points + */ + SCA_ETH_Flow_Points = undefined; + /** + * Name of the pet + * @member {String} ATT_NAME + */ + ATT_NAME = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Cat.js b/samples/client/petstore/javascript-promise-es6/src/model/Cat.js index 862e7b0c910..da946664d08 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Cat.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Cat.js @@ -7,81 +7,78 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import Animal from './Animal'; + + + + + +/** +* The Cat model module. +* @module model/Cat +* @version 1.0.0 +*/ +export default class Cat { + /** + * Constructs a new Cat. + * @alias module:model/Cat + * @class + * @extends module:model/Animal + * @param className {String} + */ + + constructor(className) { + + + Animal.call(this, className); + + + + + } - root.SwaggerPetstore.Cat = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); - } -}(this, function(ApiClient, Animal) { - 'use strict'; + /** + * Constructs a Cat from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Cat instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Cat(); + + Animal.constructFromObject(data, obj); + - /** - * The Cat model module. - * @module model/Cat - * @version 1.0.0 - */ - - /** - * Constructs a new Cat. - * @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 Cat from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Cat 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'); - } + if (data.hasOwnProperty('declawed')) { + obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean'); + } + } + return obj; } - return obj; - } - exports.prototype = Object.create(Animal.prototype); - exports.prototype.constructor = exports; - - /** - * @member {Boolean} declawed - */ - exports.prototype['declawed'] = undefined; + /** + * @member {Boolean} declawed + */ + declawed = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Category.js b/samples/client/petstore/javascript-promise-es6/src/model/Category.js index d7ecc2207da..a281817b72f 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Category.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Category.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Category model module. +* @module model/Category +* @version 1.0.0 +*/ +export default class Category { + /** + * Constructs a new Category. + * @alias module:model/Category + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Category = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Category from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Category instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Category(); + + + - - /** - * The Category model module. - * @module model/Category - * @version 1.0.0 - */ - - /** - * Constructs a new Category. - * @alias module:model/Category - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a Category from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Category 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'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {String} name - */ - exports.prototype['name'] = undefined; + /** + * @member {Number} id + */ + id = undefined; + /** + * @member {String} name + */ + name = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/ClassModel.js b/samples/client/petstore/javascript-promise-es6/src/model/ClassModel.js index c3b7b83f9c5..6a558444ade 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/ClassModel.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/ClassModel.js @@ -7,77 +7,75 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ClassModel model module. +* @module model/ClassModel +* @version 1.0.0 +*/ +export default class ClassModel { + /** + * Constructs a new ClassModel. + * Model for testing model with \"_class\" property + * @alias module:model/ClassModel + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ClassModel = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ClassModel from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 ClassModel instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ClassModel(); + + + - - /** - * The ClassModel model module. - * @module model/ClassModel - * @version 1.0.0 - */ - - /** - * Constructs a new ClassModel. - * Model for testing model with \"_class\" property - * @alias module:model/ClassModel - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a ClassModel from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 ClassModel instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('_class')) { - obj['_class'] = ApiClient.convertToType(data['_class'], 'String'); - } + if (data.hasOwnProperty('_class')) { + obj['_class'] = ApiClient.convertToType(data['_class'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} _class - */ - exports.prototype['_class'] = undefined; + /** + * @member {String} _class + */ + _class = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Client.js b/samples/client/petstore/javascript-promise-es6/src/model/Client.js index a2912224910..a4f9b235154 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Client.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Client.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Client model module. +* @module model/Client +* @version 1.0.0 +*/ +export default class Client { + /** + * Constructs a new Client. + * @alias module:model/Client + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Client = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Client from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Client instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Client(); + + + - - /** - * The Client model module. - * @module model/Client - * @version 1.0.0 - */ - - /** - * Constructs a new Client. - * @alias module:model/Client - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a Client from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Client instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('client')) { - obj['client'] = ApiClient.convertToType(data['client'], 'String'); - } + if (data.hasOwnProperty('client')) { + obj['client'] = ApiClient.convertToType(data['client'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} client - */ - exports.prototype['client'] = undefined; + /** + * @member {String} client + */ + client = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Dog.js b/samples/client/petstore/javascript-promise-es6/src/model/Dog.js index 2cd286fb741..e5bc0d3cecf 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Dog.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Dog.js @@ -7,81 +7,78 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import Animal from './Animal'; + + + + + +/** +* The Dog model module. +* @module model/Dog +* @version 1.0.0 +*/ +export default class Dog { + /** + * Constructs a new Dog. + * @alias module:model/Dog + * @class + * @extends module:model/Animal + * @param className {String} + */ + + constructor(className) { + + + Animal.call(this, className); + + + + + } - root.SwaggerPetstore.Dog = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); - } -}(this, function(ApiClient, Animal) { - 'use strict'; + /** + * Constructs a Dog from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 Dog instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Dog(); + + Animal.constructFromObject(data, obj); + - /** - * The Dog model module. - * @module model/Dog - * @version 1.0.0 - */ - - /** - * Constructs a new Dog. - * @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 Dog from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 Dog 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'); - } + if (data.hasOwnProperty('breed')) { + obj['breed'] = ApiClient.convertToType(data['breed'], 'String'); + } + } + return obj; } - return obj; - } - exports.prototype = Object.create(Animal.prototype); - exports.prototype.constructor = exports; - - /** - * @member {String} breed - */ - exports.prototype['breed'] = undefined; + /** + * @member {String} breed + */ + breed = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/EnumArrays.js b/samples/client/petstore/javascript-promise-es6/src/model/EnumArrays.js index 079cfe25084..20a74f0d883 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/EnumArrays.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/EnumArrays.js @@ -7,118 +7,121 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The EnumArrays model module. +* @module model/EnumArrays +* @version 1.0.0 +*/ +export default class EnumArrays { + /** + * Constructs a new EnumArrays. + * @alias module:model/EnumArrays + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.EnumArrays = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a EnumArrays from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj 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 EnumArrays instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EnumArrays(); + + + - - /** - * The EnumArrays model module. - * @module model/EnumArrays - * @version 1.0.0 - */ - - /** - * Constructs a new EnumArrays. - * @alias module:model/EnumArrays - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a EnumArrays from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj 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 EnumArrays 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']); - } + 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; } - return obj; - } - /** - * @member {module:model/EnumArrays.JustSymbolEnum} just_symbol - */ - exports.prototype['just_symbol'] = undefined; - /** - * @member {Array.} array_enum - */ - exports.prototype['array_enum'] = undefined; - - - /** - * Allowed values for the just_symbol property. - * @enum {String} - * @readonly - */ - exports.JustSymbolEnum = { /** - * value: ">=" - * @const - */ - "GREATER_THAN_OR_EQUAL_TO": ">=", + * @member {module:model/EnumArrays.JustSymbolEnum} just_symbol + */ + just_symbol = undefined; /** - * value: "$" - * @const - */ - "DOLLAR": "$" }; + * @member {Array.} array_enum + */ + array_enum = undefined; + + + + + - /** - * Allowed values for the arrayEnum property. - * @enum {String} - * @readonly - */ - exports.ArrayEnumEnum = { /** - * value: "fish" - * @const - */ - "fish": "fish", + * Allowed values for the just_symbol property. + * @enum {String} + * @readonly + */ + static JustSymbolEnum = { + + /** + * value: ">=" + * @const + */ + "GREATER_THAN_OR_EQUAL_TO": ">=", + + /** + * value: "$" + * @const + */ + "DOLLAR": "$" + }; + /** - * value: "crab" - * @const - */ - "crab": "crab" }; + * Allowed values for the arrayEnum property. + * @enum {String} + * @readonly + */ + static ArrayEnumEnum = { + + /** + * value: "fish" + * @const + */ + "fish": "fish", + + /** + * value: "crab" + * @const + */ + "crab": "crab" + }; - return exports; -})); + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/EnumClass.js b/samples/client/petstore/javascript-promise-es6/src/model/EnumClass.js index 881a7503047..eeb08ca2864 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/EnumClass.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/EnumClass.js @@ -7,63 +7,51 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + +/** +* Enum class EnumClass. +* @enum {} +* @readonly +*/ +export default class EnumClass { + + /** + * value: "_abc" + * @const + */ + _abc = "_abc"; + + + /** + * value: "-efg" + * @const + */ + -efg = "-efg"; + + + /** + * value: "(xyz)" + * @const + */ + (xyz) = "(xyz)"; + + + + /** + * Returns a EnumClass enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/EnumClass} The enum EnumClass value. + */ + static constructFromObject(object) { + return object; } - root.SwaggerPetstore.EnumClass = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - - /** - * Enum class EnumClass. - * @enum {} - * @readonly - */ - var exports = { - /** - * value: "_abc" - * @const - */ - "_abc": "_abc", - /** - * value: "-efg" - * @const - */ - "-efg": "-efg", - /** - * value: "(xyz)" - * @const - */ - "(xyz)": "(xyz)" }; - - /** - * Returns a EnumClass enum value from a Javascript object name. - * @param {Object} data The plain JavaScript object containing the name of the enum value. - * @return {module:model/EnumClass} The enum EnumClass value. - */ - exports.constructFromObject = function(object) { - return object; - } - - return exports; -})); +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/EnumTest.js b/samples/client/petstore/javascript-promise-es6/src/model/EnumTest.js index 215bea59d38..b1f9b0b6c69 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/EnumTest.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/EnumTest.js @@ -7,156 +7,162 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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/OuterEnum'], factory); - } else if (typeof module === 'object' && module.exports) { - // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('./OuterEnum')); - } else { - // Browser globals (root is window) - if (!root.SwaggerPetstore) { - root.SwaggerPetstore = {}; + +import ApiClient from '../ApiClient'; +import OuterEnum from './OuterEnum'; + + + + + +/** +* The EnumTest model module. +* @module model/EnumTest +* @version 1.0.0 +*/ +export default class EnumTest { + /** + * Constructs a new EnumTest. + * @alias module:model/EnumTest + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.EnumTest = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.OuterEnum); - } -}(this, function(ApiClient, OuterEnum) { - 'use strict'; + /** + * Constructs a EnumTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/EnumTest} obj Optional instance to populate. + * @return {module:model/EnumTest} The populated EnumTest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EnumTest(); + + + - - /** - * The EnumTest model module. - * @module model/EnumTest - * @version 1.0.0 - */ - - /** - * Constructs a new EnumTest. - * @alias module:model/EnumTest - * @class - */ - var exports = function() { - var _this = this; - - - - - - }; - - /** - * Constructs a EnumTest from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/EnumTest} obj Optional instance to populate. - * @return {module:model/EnumTest} The populated EnumTest instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('enum_string')) { - obj['enum_string'] = ApiClient.convertToType(data['enum_string'], 'String'); - } - if (data.hasOwnProperty('enum_integer')) { - obj['enum_integer'] = ApiClient.convertToType(data['enum_integer'], 'Number'); - } - if (data.hasOwnProperty('enum_number')) { - obj['enum_number'] = ApiClient.convertToType(data['enum_number'], 'Number'); - } - if (data.hasOwnProperty('outerEnum')) { - obj['outerEnum'] = OuterEnum.constructFromObject(data['outerEnum']); - } + if (data.hasOwnProperty('enum_string')) { + obj['enum_string'] = ApiClient.convertToType(data['enum_string'], 'String'); + } + if (data.hasOwnProperty('enum_integer')) { + obj['enum_integer'] = ApiClient.convertToType(data['enum_integer'], 'Number'); + } + if (data.hasOwnProperty('enum_number')) { + obj['enum_number'] = ApiClient.convertToType(data['enum_number'], 'Number'); + } + if (data.hasOwnProperty('outerEnum')) { + obj['outerEnum'] = OuterEnum.constructFromObject(data['outerEnum']); + } + } + return obj; } - return obj; - } - /** - * @member {module:model/EnumTest.EnumStringEnum} enum_string - */ - exports.prototype['enum_string'] = undefined; - /** - * @member {module:model/EnumTest.EnumIntegerEnum} enum_integer - */ - exports.prototype['enum_integer'] = undefined; - /** - * @member {module:model/EnumTest.EnumNumberEnum} enum_number - */ - exports.prototype['enum_number'] = undefined; - /** - * @member {module:model/OuterEnum} outerEnum - */ - exports.prototype['outerEnum'] = undefined; - - - /** - * Allowed values for the enum_string property. - * @enum {String} - * @readonly - */ - exports.EnumStringEnum = { /** - * value: "UPPER" - * @const - */ - "UPPER": "UPPER", + * @member {module:model/EnumTest.EnumStringEnum} enum_string + */ + enum_string = undefined; /** - * value: "lower" - * @const - */ - "lower": "lower", + * @member {module:model/EnumTest.EnumIntegerEnum} enum_integer + */ + enum_integer = undefined; /** - * value: "" - * @const - */ - "empty": "" }; - - /** - * Allowed values for the enum_integer property. - * @enum {Number} - * @readonly - */ - exports.EnumIntegerEnum = { + * @member {module:model/EnumTest.EnumNumberEnum} enum_number + */ + enum_number = undefined; /** - * value: 1 - * @const - */ - "1": 1, - /** - * value: -1 - * @const - */ - "-1": -1 }; - - /** - * Allowed values for the enum_number property. - * @enum {Number} - * @readonly - */ - exports.EnumNumberEnum = { - /** - * value: 1.1 - * @const - */ - "1.1": 1.1, - /** - * value: -1.2 - * @const - */ - "-1.2": -1.2 }; + * @member {module:model/OuterEnum} outerEnum + */ + outerEnum = undefined; - return exports; -})); + + + + + /** + * Allowed values for the enum_string property. + * @enum {String} + * @readonly + */ + static EnumStringEnum = { + + /** + * value: "UPPER" + * @const + */ + "UPPER": "UPPER", + + /** + * value: "lower" + * @const + */ + "lower": "lower", + + /** + * value: "" + * @const + */ + "empty": "" + }; + + /** + * Allowed values for the enum_integer property. + * @enum {Number} + * @readonly + */ + static EnumIntegerEnum = { + + /** + * value: 1 + * @const + */ + "1": 1, + + /** + * value: -1 + * @const + */ + "-1": -1 + }; + + /** + * Allowed values for the enum_number property. + * @enum {Number} + * @readonly + */ + static EnumNumberEnum = { + + /** + * value: 1.1 + * @const + */ + "1.1": 1.1, + + /** + * value: -1.2 + * @const + */ + "-1.2": -1.2 + }; + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/FormatTest.js b/samples/client/petstore/javascript-promise-es6/src/model/FormatTest.js index 238224d0132..8773a3a7755 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/FormatTest.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/FormatTest.js @@ -7,176 +7,162 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The FormatTest model module. +* @module model/FormatTest +* @version 1.0.0 +*/ +export default class FormatTest { + /** + * Constructs a new FormatTest. + * @alias module:model/FormatTest + * @class + * @param _number {Number} + * @param _byte {Blob} + * @param _date {Date} + * @param password {String} + */ + + constructor(_number, _byte, _date, password) { + + + + + + this['number'] = _number;this['byte'] = _byte;this['date'] = _date;this['password'] = password; + + } - root.SwaggerPetstore.FormatTest = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a FormatTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/FormatTest} obj Optional instance to populate. + * @return {module:model/FormatTest} The populated FormatTest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new FormatTest(); + + + - - /** - * The FormatTest model module. - * @module model/FormatTest - * @version 1.0.0 - */ - - /** - * Constructs a new FormatTest. - * @alias module:model/FormatTest - * @class - * @param _number {Number} - * @param _byte {Blob} - * @param _date {Date} - * @param password {String} - */ - var exports = function(_number, _byte, _date, password) { - var _this = this; - - - - - _this['number'] = _number; - - - - _this['byte'] = _byte; - - _this['date'] = _date; - - - _this['password'] = password; - }; - - /** - * Constructs a FormatTest from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/FormatTest} obj Optional instance to populate. - * @return {module:model/FormatTest} The populated FormatTest instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('integer')) { - obj['integer'] = ApiClient.convertToType(data['integer'], 'Number'); - } - if (data.hasOwnProperty('int32')) { - obj['int32'] = ApiClient.convertToType(data['int32'], 'Number'); - } - if (data.hasOwnProperty('int64')) { - obj['int64'] = ApiClient.convertToType(data['int64'], 'Number'); - } - if (data.hasOwnProperty('number')) { - obj['number'] = ApiClient.convertToType(data['number'], 'Number'); - } - if (data.hasOwnProperty('float')) { - obj['float'] = ApiClient.convertToType(data['float'], 'Number'); - } - if (data.hasOwnProperty('double')) { - obj['double'] = ApiClient.convertToType(data['double'], 'Number'); - } - if (data.hasOwnProperty('string')) { - obj['string'] = ApiClient.convertToType(data['string'], 'String'); - } - if (data.hasOwnProperty('byte')) { - obj['byte'] = ApiClient.convertToType(data['byte'], 'Blob'); - } - if (data.hasOwnProperty('binary')) { - obj['binary'] = ApiClient.convertToType(data['binary'], 'Blob'); - } - if (data.hasOwnProperty('date')) { - obj['date'] = ApiClient.convertToType(data['date'], 'Date'); - } - if (data.hasOwnProperty('dateTime')) { - obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); - } - if (data.hasOwnProperty('uuid')) { - obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); - } - if (data.hasOwnProperty('password')) { - obj['password'] = ApiClient.convertToType(data['password'], 'String'); - } + if (data.hasOwnProperty('integer')) { + obj['integer'] = ApiClient.convertToType(data['integer'], 'Number'); + } + if (data.hasOwnProperty('int32')) { + obj['int32'] = ApiClient.convertToType(data['int32'], 'Number'); + } + if (data.hasOwnProperty('int64')) { + obj['int64'] = ApiClient.convertToType(data['int64'], 'Number'); + } + if (data.hasOwnProperty('number')) { + obj['number'] = ApiClient.convertToType(data['number'], 'Number'); + } + if (data.hasOwnProperty('float')) { + obj['float'] = ApiClient.convertToType(data['float'], 'Number'); + } + if (data.hasOwnProperty('double')) { + obj['double'] = ApiClient.convertToType(data['double'], 'Number'); + } + if (data.hasOwnProperty('string')) { + obj['string'] = ApiClient.convertToType(data['string'], 'String'); + } + if (data.hasOwnProperty('byte')) { + obj['byte'] = ApiClient.convertToType(data['byte'], 'Blob'); + } + if (data.hasOwnProperty('binary')) { + obj['binary'] = ApiClient.convertToType(data['binary'], 'Blob'); + } + if (data.hasOwnProperty('date')) { + obj['date'] = ApiClient.convertToType(data['date'], 'Date'); + } + if (data.hasOwnProperty('dateTime')) { + obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); + } + if (data.hasOwnProperty('uuid')) { + obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); + } + if (data.hasOwnProperty('password')) { + obj['password'] = ApiClient.convertToType(data['password'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} integer - */ - exports.prototype['integer'] = undefined; - /** - * @member {Number} int32 - */ - exports.prototype['int32'] = undefined; - /** - * @member {Number} int64 - */ - exports.prototype['int64'] = undefined; - /** - * @member {Number} number - */ - exports.prototype['number'] = undefined; - /** - * @member {Number} float - */ - exports.prototype['float'] = undefined; - /** - * @member {Number} double - */ - exports.prototype['double'] = undefined; - /** - * @member {String} string - */ - exports.prototype['string'] = undefined; - /** - * @member {Blob} byte - */ - exports.prototype['byte'] = undefined; - /** - * @member {Blob} binary - */ - exports.prototype['binary'] = undefined; - /** - * @member {Date} date - */ - exports.prototype['date'] = undefined; - /** - * @member {Date} dateTime - */ - exports.prototype['dateTime'] = undefined; - /** - * @member {String} uuid - */ - exports.prototype['uuid'] = undefined; - /** - * @member {String} password - */ - exports.prototype['password'] = undefined; + /** + * @member {Number} integer + */ + integer = undefined; + /** + * @member {Number} int32 + */ + int32 = undefined; + /** + * @member {Number} int64 + */ + int64 = undefined; + /** + * @member {Number} number + */ + number = undefined; + /** + * @member {Number} float + */ + float = undefined; + /** + * @member {Number} double + */ + double = undefined; + /** + * @member {String} string + */ + string = undefined; + /** + * @member {Blob} byte + */ + byte = undefined; + /** + * @member {Blob} binary + */ + binary = undefined; + /** + * @member {Date} date + */ + date = undefined; + /** + * @member {Date} dateTime + */ + dateTime = undefined; + /** + * @member {String} uuid + */ + uuid = undefined; + /** + * @member {String} password + */ + password = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/HasOnlyReadOnly.js b/samples/client/petstore/javascript-promise-es6/src/model/HasOnlyReadOnly.js index 566e0663de0..cb859fe3e50 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/HasOnlyReadOnly.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/HasOnlyReadOnly.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The HasOnlyReadOnly model module. +* @module model/HasOnlyReadOnly +* @version 1.0.0 +*/ +export default class HasOnlyReadOnly { + /** + * Constructs a new HasOnlyReadOnly. + * @alias module:model/HasOnlyReadOnly + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.HasOnlyReadOnly = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a HasOnlyReadOnly from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/HasOnlyReadOnly} obj Optional instance to populate. + * @return {module:model/HasOnlyReadOnly} The populated HasOnlyReadOnly instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new HasOnlyReadOnly(); + + + - - /** - * The HasOnlyReadOnly model module. - * @module model/HasOnlyReadOnly - * @version 1.0.0 - */ - - /** - * Constructs a new HasOnlyReadOnly. - * @alias module:model/HasOnlyReadOnly - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a HasOnlyReadOnly from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/HasOnlyReadOnly} obj Optional instance to populate. - * @return {module:model/HasOnlyReadOnly} The populated HasOnlyReadOnly instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('bar')) { - obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); - } - if (data.hasOwnProperty('foo')) { - obj['foo'] = ApiClient.convertToType(data['foo'], 'String'); - } + if (data.hasOwnProperty('bar')) { + obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); + } + if (data.hasOwnProperty('foo')) { + obj['foo'] = ApiClient.convertToType(data['foo'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} bar - */ - exports.prototype['bar'] = undefined; - /** - * @member {String} foo - */ - exports.prototype['foo'] = undefined; + /** + * @member {String} bar + */ + bar = undefined; + /** + * @member {String} foo + */ + foo = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/List.js b/samples/client/petstore/javascript-promise-es6/src/model/List.js index b5db0490fe4..513acd45aff 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/List.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/List.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The List model module. +* @module model/List +* @version 1.0.0 +*/ +export default class List { + /** + * Constructs a new List. + * @alias module:model/List + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.List = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a List from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/List} obj Optional instance to populate. + * @return {module:model/List} The populated List instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new List(); + + + - - /** - * The List model module. - * @module model/List - * @version 1.0.0 - */ - - /** - * Constructs a new List. - * @alias module:model/List - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a List from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/List} obj Optional instance to populate. - * @return {module:model/List} The populated List instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('123-list')) { - obj['123-list'] = ApiClient.convertToType(data['123-list'], 'String'); - } + if (data.hasOwnProperty('123-list')) { + obj['123-list'] = ApiClient.convertToType(data['123-list'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} 123-list - */ - exports.prototype['123-list'] = undefined; + /** + * @member {String} 123-list + */ + 123-list = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/MapTest.js b/samples/client/petstore/javascript-promise-es6/src/model/MapTest.js index 59f089976c1..b7a60cd8d9d 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/MapTest.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/MapTest.js @@ -7,101 +7,101 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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.MapTest = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + +import ApiClient from '../ApiClient'; - /** - * The MapTest model module. - * @module model/MapTest - * @version 1.0.0 - */ - /** - * Constructs a new MapTest. - * @alias module:model/MapTest - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a MapTest from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/MapTest} obj Optional instance to populate. - * @return {module:model/MapTest} The populated MapTest instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('map_map_of_string')) { - obj['map_map_of_string'] = ApiClient.convertToType(data['map_map_of_string'], {'String': {'String': 'String'}}); - } - if (data.hasOwnProperty('map_of_enum_string')) { - obj['map_of_enum_string'] = ApiClient.convertToType(data['map_of_enum_string'], {'String': 'String'}); - } - } - return obj; - } - - /** - * @member {Object.>} map_map_of_string - */ - exports.prototype['map_map_of_string'] = undefined; - /** - * @member {Object.} map_of_enum_string - */ - exports.prototype['map_of_enum_string'] = undefined; - - - /** - * Allowed values for the inner property. - * @enum {String} - * @readonly - */ - exports.InnerEnum = { +/** +* The MapTest model module. +* @module model/MapTest +* @version 1.0.0 +*/ +export default class MapTest { /** - * value: "UPPER" - * @const - */ - "UPPER": "UPPER", + * Constructs a new MapTest. + * @alias module:model/MapTest + * @class + */ + + constructor() { + + + + + + + + + } + /** - * value: "lower" - * @const - */ - "lower": "lower" }; + * Constructs a MapTest from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/MapTest} obj Optional instance to populate. + * @return {module:model/MapTest} The populated MapTest instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new MapTest(); + + + + + + if (data.hasOwnProperty('map_map_of_string')) { + obj['map_map_of_string'] = ApiClient.convertToType(data['map_map_of_string'], {'String': {'String': 'String'}}); + } + if (data.hasOwnProperty('map_of_enum_string')) { + obj['map_of_enum_string'] = ApiClient.convertToType(data['map_of_enum_string'], {'String': 'String'}); + } + } + return obj; + } + + /** + * @member {Object.>} map_map_of_string + */ + map_map_of_string = undefined; + /** + * @member {Object.} map_of_enum_string + */ + map_of_enum_string = undefined; - return exports; -})); + + + + + /** + * Allowed values for the inner property. + * @enum {String} + * @readonly + */ + static InnerEnum = { + + /** + * value: "UPPER" + * @const + */ + "UPPER": "UPPER", + + /** + * value: "lower" + * @const + */ + "lower": "lower" + }; + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/MixedPropertiesAndAdditionalPropertiesClass.js b/samples/client/petstore/javascript-promise-es6/src/model/MixedPropertiesAndAdditionalPropertiesClass.js index 334b0773a04..6d912ceeb9b 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/MixedPropertiesAndAdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/MixedPropertiesAndAdditionalPropertiesClass.js @@ -7,92 +7,89 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; +import Animal from './Animal'; + + + + + +/** +* The MixedPropertiesAndAdditionalPropertiesClass model module. +* @module model/MixedPropertiesAndAdditionalPropertiesClass +* @version 1.0.0 +*/ +export default class MixedPropertiesAndAdditionalPropertiesClass { + /** + * Constructs a new MixedPropertiesAndAdditionalPropertiesClass. + * @alias module:model/MixedPropertiesAndAdditionalPropertiesClass + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.MixedPropertiesAndAdditionalPropertiesClass = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal); - } -}(this, function(ApiClient, Animal) { - 'use strict'; + /** + * Constructs a MixedPropertiesAndAdditionalPropertiesClass from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/MixedPropertiesAndAdditionalPropertiesClass} obj Optional instance to populate. + * @return {module:model/MixedPropertiesAndAdditionalPropertiesClass} The populated MixedPropertiesAndAdditionalPropertiesClass instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new MixedPropertiesAndAdditionalPropertiesClass(); + + + - - /** - * The MixedPropertiesAndAdditionalPropertiesClass model module. - * @module model/MixedPropertiesAndAdditionalPropertiesClass - * @version 1.0.0 - */ - - /** - * Constructs a new MixedPropertiesAndAdditionalPropertiesClass. - * @alias module:model/MixedPropertiesAndAdditionalPropertiesClass - * @class - */ - var exports = function() { - var _this = this; - - - - - }; - - /** - * Constructs a MixedPropertiesAndAdditionalPropertiesClass from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/MixedPropertiesAndAdditionalPropertiesClass} obj Optional instance to populate. - * @return {module:model/MixedPropertiesAndAdditionalPropertiesClass} The populated MixedPropertiesAndAdditionalPropertiesClass instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('uuid')) { - obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); - } - if (data.hasOwnProperty('dateTime')) { - obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); - } - if (data.hasOwnProperty('map')) { - obj['map'] = ApiClient.convertToType(data['map'], {'String': Animal}); - } + if (data.hasOwnProperty('uuid')) { + obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String'); + } + if (data.hasOwnProperty('dateTime')) { + obj['dateTime'] = ApiClient.convertToType(data['dateTime'], 'Date'); + } + if (data.hasOwnProperty('map')) { + obj['map'] = ApiClient.convertToType(data['map'], {'String': Animal}); + } + } + return obj; } - return obj; - } - /** - * @member {String} uuid - */ - exports.prototype['uuid'] = undefined; - /** - * @member {Date} dateTime - */ - exports.prototype['dateTime'] = undefined; - /** - * @member {Object.} map - */ - exports.prototype['map'] = undefined; + /** + * @member {String} uuid + */ + uuid = undefined; + /** + * @member {Date} dateTime + */ + dateTime = undefined; + /** + * @member {Object.} map + */ + map = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Model200Response.js b/samples/client/petstore/javascript-promise-es6/src/model/Model200Response.js index a10e470be5c..df4d957df7c 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Model200Response.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Model200Response.js @@ -7,85 +7,82 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Model200Response model module. +* @module model/Model200Response +* @version 1.0.0 +*/ +export default class Model200Response { + /** + * Constructs a new Model200Response. + * Model for testing model name starting with number + * @alias module:model/Model200Response + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Model200Response = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Model200Response from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Model200Response} obj Optional instance to populate. + * @return {module:model/Model200Response} The populated Model200Response instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Model200Response(); + + + - - /** - * The Model200Response model module. - * @module model/Model200Response - * @version 1.0.0 - */ - - /** - * Constructs a new Model200Response. - * Model for testing model name starting with number - * @alias module:model/Model200Response - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a Model200Response from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Model200Response} obj Optional instance to populate. - * @return {module:model/Model200Response} The populated Model200Response instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'Number'); - } - if (data.hasOwnProperty('class')) { - obj['class'] = ApiClient.convertToType(data['class'], 'String'); - } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'Number'); + } + if (data.hasOwnProperty('class')) { + obj['class'] = ApiClient.convertToType(data['class'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} name - */ - exports.prototype['name'] = undefined; - /** - * @member {String} class - */ - exports.prototype['class'] = undefined; + /** + * @member {Number} name + */ + name = undefined; + /** + * @member {String} class + */ + class = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/ModelReturn.js b/samples/client/petstore/javascript-promise-es6/src/model/ModelReturn.js index 07467bbaa63..88fd97ab85f 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/ModelReturn.js @@ -7,77 +7,75 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ModelReturn model module. +* @module model/ModelReturn +* @version 1.0.0 +*/ +export default class ModelReturn { + /** + * Constructs a new ModelReturn. + * Model for testing reserved words + * @alias module:model/ModelReturn + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ModelReturn = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ModelReturn from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ModelReturn} obj Optional instance to populate. + * @return {module:model/ModelReturn} The populated ModelReturn instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ModelReturn(); + + + - - /** - * The ModelReturn model module. - * @module model/ModelReturn - * @version 1.0.0 - */ - - /** - * Constructs a new ModelReturn. - * Model for testing reserved words - * @alias module:model/ModelReturn - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a ModelReturn from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/ModelReturn} obj Optional instance to populate. - * @return {module:model/ModelReturn} The populated ModelReturn instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('return')) { - obj['return'] = ApiClient.convertToType(data['return'], 'Number'); - } + if (data.hasOwnProperty('return')) { + obj['return'] = ApiClient.convertToType(data['return'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} return - */ - exports.prototype['return'] = undefined; + /** + * @member {Number} return + */ + return = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Name.js b/samples/client/petstore/javascript-promise-es6/src/model/Name.js index d79c05387fe..f355fbdd403 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Name.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Name.js @@ -7,102 +7,97 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Name model module. +* @module model/Name +* @version 1.0.0 +*/ +export default class Name { + /** + * Constructs a new Name. + * Model for testing model name same as property name + * @alias module:model/Name + * @class + * @param name {Number} + */ + + constructor(name) { + + + + + + this['name'] = name; + + } - root.SwaggerPetstore.Name = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Name from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Name} obj Optional instance to populate. + * @return {module:model/Name} The populated Name instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Name(); + + + - - /** - * The Name model module. - * @module model/Name - * @version 1.0.0 - */ - - /** - * Constructs a new Name. - * Model for testing model name same as property name - * @alias module:model/Name - * @class - * @param name {Number} - */ - var exports = function(name) { - var _this = this; - - _this['name'] = name; - - - - }; - - /** - * Constructs a Name from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Name} obj Optional instance to populate. - * @return {module:model/Name} The populated Name instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'Number'); - } - if (data.hasOwnProperty('snake_case')) { - obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Number'); - } - if (data.hasOwnProperty('property')) { - obj['property'] = ApiClient.convertToType(data['property'], 'String'); - } - if (data.hasOwnProperty('123Number')) { - obj['123Number'] = ApiClient.convertToType(data['123Number'], 'Number'); - } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'Number'); + } + if (data.hasOwnProperty('snake_case')) { + obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Number'); + } + if (data.hasOwnProperty('property')) { + obj['property'] = ApiClient.convertToType(data['property'], 'String'); + } + if (data.hasOwnProperty('123Number')) { + obj['123Number'] = ApiClient.convertToType(data['123Number'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} name - */ - exports.prototype['name'] = undefined; - /** - * @member {Number} snake_case - */ - exports.prototype['snake_case'] = undefined; - /** - * @member {String} property - */ - exports.prototype['property'] = undefined; - /** - * @member {Number} 123Number - */ - exports.prototype['123Number'] = undefined; + /** + * @member {Number} name + */ + name = undefined; + /** + * @member {Number} snake_case + */ + snake_case = undefined; + /** + * @member {String} property + */ + property = undefined; + /** + * @member {Number} 123Number + */ + 123Number = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/NumberOnly.js b/samples/client/petstore/javascript-promise-es6/src/model/NumberOnly.js index c5edb0b0a50..bee66870891 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/NumberOnly.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/NumberOnly.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The NumberOnly model module. +* @module model/NumberOnly +* @version 1.0.0 +*/ +export default class NumberOnly { + /** + * Constructs a new NumberOnly. + * @alias module:model/NumberOnly + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.NumberOnly = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a NumberOnly from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/NumberOnly} obj Optional instance to populate. + * @return {module:model/NumberOnly} The populated NumberOnly instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new NumberOnly(); + + + - - /** - * The NumberOnly model module. - * @module model/NumberOnly - * @version 1.0.0 - */ - - /** - * Constructs a new NumberOnly. - * @alias module:model/NumberOnly - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a NumberOnly from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/NumberOnly} obj Optional instance to populate. - * @return {module:model/NumberOnly} The populated NumberOnly instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('JustNumber')) { - obj['JustNumber'] = ApiClient.convertToType(data['JustNumber'], 'Number'); - } + if (data.hasOwnProperty('JustNumber')) { + obj['JustNumber'] = ApiClient.convertToType(data['JustNumber'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} JustNumber - */ - exports.prototype['JustNumber'] = undefined; + /** + * @member {Number} JustNumber + */ + JustNumber = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Order.js b/samples/client/petstore/javascript-promise-es6/src/model/Order.js index f4f9087001d..ff704900bbc 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Order.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Order.js @@ -7,140 +7,137 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Order model module. +* @module model/Order +* @version 1.0.0 +*/ +export default class Order { + /** + * Constructs a new Order. + * @alias module:model/Order + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Order = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Order from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Order} obj Optional instance to populate. + * @return {module:model/Order} The populated Order instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Order(); + + + - - /** - * The Order model module. - * @module model/Order - * @version 1.0.0 - */ - - /** - * Constructs a new Order. - * @alias module:model/Order - * @class - */ - var exports = function() { - var _this = this; - - - - - - - - }; - - /** - * Constructs a Order from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Order} obj Optional instance to populate. - * @return {module:model/Order} The populated Order 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('petId')) { - obj['petId'] = ApiClient.convertToType(data['petId'], 'Number'); - } - if (data.hasOwnProperty('quantity')) { - obj['quantity'] = ApiClient.convertToType(data['quantity'], 'Number'); - } - if (data.hasOwnProperty('shipDate')) { - obj['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date'); - } - if (data.hasOwnProperty('status')) { - obj['status'] = ApiClient.convertToType(data['status'], 'String'); - } - if (data.hasOwnProperty('complete')) { - obj['complete'] = ApiClient.convertToType(data['complete'], 'Boolean'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('petId')) { + obj['petId'] = ApiClient.convertToType(data['petId'], 'Number'); + } + if (data.hasOwnProperty('quantity')) { + obj['quantity'] = ApiClient.convertToType(data['quantity'], 'Number'); + } + if (data.hasOwnProperty('shipDate')) { + obj['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date'); + } + if (data.hasOwnProperty('status')) { + obj['status'] = ApiClient.convertToType(data['status'], 'String'); + } + if (data.hasOwnProperty('complete')) { + obj['complete'] = ApiClient.convertToType(data['complete'], 'Boolean'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {Number} petId - */ - exports.prototype['petId'] = undefined; - /** - * @member {Number} quantity - */ - exports.prototype['quantity'] = undefined; - /** - * @member {Date} shipDate - */ - exports.prototype['shipDate'] = undefined; - /** - * Order Status - * @member {module:model/Order.StatusEnum} status - */ - exports.prototype['status'] = undefined; - /** - * @member {Boolean} complete - * @default false - */ - exports.prototype['complete'] = false; - - - /** - * Allowed values for the status property. - * @enum {String} - * @readonly - */ - exports.StatusEnum = { /** - * value: "placed" - * @const - */ - "placed": "placed", + * @member {Number} id + */ + id = undefined; /** - * value: "approved" - * @const - */ - "approved": "approved", + * @member {Number} petId + */ + petId = undefined; /** - * value: "delivered" - * @const - */ - "delivered": "delivered" }; + * @member {Number} quantity + */ + quantity = undefined; + /** + * @member {Date} shipDate + */ + shipDate = undefined; + /** + * Order Status + * @member {module:model/Order.StatusEnum} status + */ + status = undefined; + /** + * @member {Boolean} complete + * @default false + */ + complete = false; - return exports; -})); + + + + + /** + * Allowed values for the status property. + * @enum {String} + * @readonly + */ + static StatusEnum = { + + /** + * value: "placed" + * @const + */ + "placed": "placed", + + /** + * value: "approved" + * @const + */ + "approved": "approved", + + /** + * value: "delivered" + * @const + */ + "delivered": "delivered" + }; + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/OuterBoolean.js b/samples/client/petstore/javascript-promise-es6/src/model/OuterBoolean.js index 80f1a64b99b..592a0b69864 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/OuterBoolean.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/OuterBoolean.js @@ -7,68 +7,67 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The OuterBoolean model module. +* @module model/OuterBoolean +* @version 1.0.0 +*/ +export default class OuterBoolean { + /** + * Constructs a new OuterBoolean. + * @alias module:model/OuterBoolean + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.OuterBoolean = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a OuterBoolean from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterBoolean} obj Optional instance to populate. + * @return {module:model/OuterBoolean} The populated OuterBoolean instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OuterBoolean(); + + + - - /** - * The OuterBoolean model module. - * @module model/OuterBoolean - * @version 1.0.0 - */ - - /** - * Constructs a new OuterBoolean. - * @alias module:model/OuterBoolean - * @class - */ - var exports = function() { - var _this = this; - - }; - - /** - * Constructs a OuterBoolean from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/OuterBoolean} obj Optional instance to populate. - * @return {module:model/OuterBoolean} The populated OuterBoolean instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - + } + return obj; } - return obj; - } - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/OuterComposite.js b/samples/client/petstore/javascript-promise-es6/src/model/OuterComposite.js index 2a40ec942b5..327e303467a 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/OuterComposite.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/OuterComposite.js @@ -7,92 +7,91 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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/OuterBoolean', '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('./OuterBoolean'), require('./OuterNumber'), require('./OuterString')); - } else { - // Browser globals (root is window) - if (!root.SwaggerPetstore) { - root.SwaggerPetstore = {}; + +import ApiClient from '../ApiClient'; +import OuterBoolean from './OuterBoolean'; +import OuterNumber from './OuterNumber'; +import OuterString from './OuterString'; + + + + + +/** +* The OuterComposite model module. +* @module model/OuterComposite +* @version 1.0.0 +*/ +export default class OuterComposite { + /** + * Constructs a new OuterComposite. + * @alias module:model/OuterComposite + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.OuterComposite = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.OuterBoolean, root.SwaggerPetstore.OuterNumber, root.SwaggerPetstore.OuterString); - } -}(this, function(ApiClient, OuterBoolean, OuterNumber, OuterString) { - 'use strict'; + /** + * Constructs a OuterComposite from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterComposite} obj Optional instance to populate. + * @return {module:model/OuterComposite} The populated OuterComposite instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OuterComposite(); + + + - - /** - * The OuterComposite model module. - * @module model/OuterComposite - * @version 1.0.0 - */ - - /** - * Constructs a new OuterComposite. - * @alias module:model/OuterComposite - * @class - */ - var exports = function() { - var _this = this; - - - - - }; - - /** - * Constructs a OuterComposite from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/OuterComposite} obj Optional instance to populate. - * @return {module:model/OuterComposite} The populated OuterComposite instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('my_number')) { - obj['my_number'] = OuterNumber.constructFromObject(data['my_number']); - } - if (data.hasOwnProperty('my_string')) { - obj['my_string'] = OuterString.constructFromObject(data['my_string']); - } - if (data.hasOwnProperty('my_boolean')) { - obj['my_boolean'] = OuterBoolean.constructFromObject(data['my_boolean']); - } + if (data.hasOwnProperty('my_number')) { + obj['my_number'] = OuterNumber.constructFromObject(data['my_number']); + } + if (data.hasOwnProperty('my_string')) { + obj['my_string'] = OuterString.constructFromObject(data['my_string']); + } + if (data.hasOwnProperty('my_boolean')) { + obj['my_boolean'] = OuterBoolean.constructFromObject(data['my_boolean']); + } + } + return obj; } - return obj; - } - /** - * @member {module:model/OuterNumber} my_number - */ - exports.prototype['my_number'] = undefined; - /** - * @member {module:model/OuterString} my_string - */ - exports.prototype['my_string'] = undefined; - /** - * @member {module:model/OuterBoolean} my_boolean - */ - exports.prototype['my_boolean'] = undefined; + /** + * @member {module:model/OuterNumber} my_number + */ + my_number = undefined; + /** + * @member {module:model/OuterString} my_string + */ + my_string = undefined; + /** + * @member {module:model/OuterBoolean} my_boolean + */ + my_boolean = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/OuterEnum.js b/samples/client/petstore/javascript-promise-es6/src/model/OuterEnum.js index 4ba975cf97a..bf264fd8f64 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/OuterEnum.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/OuterEnum.js @@ -7,63 +7,51 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + +/** +* Enum class OuterEnum. +* @enum {} +* @readonly +*/ +export default class OuterEnum { + + /** + * value: "placed" + * @const + */ + placed = "placed"; + + + /** + * value: "approved" + * @const + */ + approved = "approved"; + + + /** + * value: "delivered" + * @const + */ + delivered = "delivered"; + + + + /** + * Returns a OuterEnum enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/OuterEnum} The enum OuterEnum value. + */ + static constructFromObject(object) { + return object; } - root.SwaggerPetstore.OuterEnum = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; - - - /** - * Enum class OuterEnum. - * @enum {} - * @readonly - */ - var exports = { - /** - * value: "placed" - * @const - */ - "placed": "placed", - /** - * value: "approved" - * @const - */ - "approved": "approved", - /** - * value: "delivered" - * @const - */ - "delivered": "delivered" }; - - /** - * Returns a OuterEnum enum value from a Javascript object name. - * @param {Object} data The plain JavaScript object containing the name of the enum value. - * @return {module:model/OuterEnum} The enum OuterEnum value. - */ - exports.constructFromObject = function(object) { - return object; - } - - return exports; -})); +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/OuterNumber.js b/samples/client/petstore/javascript-promise-es6/src/model/OuterNumber.js index f3ab0768253..ff65b1588b7 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/OuterNumber.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/OuterNumber.js @@ -7,68 +7,67 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The OuterNumber model module. +* @module model/OuterNumber +* @version 1.0.0 +*/ +export default class OuterNumber { + /** + * Constructs a new OuterNumber. + * @alias module:model/OuterNumber + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.OuterNumber = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a OuterNumber from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterNumber} obj Optional instance to populate. + * @return {module:model/OuterNumber} The populated OuterNumber instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OuterNumber(); + + + - - /** - * The OuterNumber model module. - * @module model/OuterNumber - * @version 1.0.0 - */ - - /** - * Constructs a new OuterNumber. - * @alias module:model/OuterNumber - * @class - */ - var exports = function() { - var _this = this; - - }; - - /** - * Constructs a OuterNumber from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/OuterNumber} obj Optional instance to populate. - * @return {module:model/OuterNumber} The populated OuterNumber instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - + } + return obj; } - return obj; - } - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/OuterString.js b/samples/client/petstore/javascript-promise-es6/src/model/OuterString.js index 9edb9747a67..6921029ede1 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/OuterString.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/OuterString.js @@ -7,68 +7,67 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The OuterString model module. +* @module model/OuterString +* @version 1.0.0 +*/ +export default class OuterString { + /** + * Constructs a new OuterString. + * @alias module:model/OuterString + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.OuterString = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a OuterString from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterString} obj Optional instance to populate. + * @return {module:model/OuterString} The populated OuterString instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OuterString(); + + + - - /** - * The OuterString model module. - * @module model/OuterString - * @version 1.0.0 - */ - - /** - * Constructs a new OuterString. - * @alias module:model/OuterString - * @class - */ - var exports = function() { - var _this = this; - - }; - - /** - * Constructs a OuterString from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/OuterString} obj Optional instance to populate. - * @return {module:model/OuterString} The populated OuterString instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - + } + return obj; } - return obj; - } - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Pet.js b/samples/client/petstore/javascript-promise-es6/src/model/Pet.js index d5e8d5010ac..bb849152027 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Pet.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Pet.js @@ -7,141 +7,140 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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/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')); - } else { - // Browser globals (root is window) - if (!root.SwaggerPetstore) { - root.SwaggerPetstore = {}; + +import ApiClient from '../ApiClient'; +import Category from './Category'; +import Tag from './Tag'; + + + + + +/** +* The Pet model module. +* @module model/Pet +* @version 1.0.0 +*/ +export default class Pet { + /** + * Constructs a new Pet. + * @alias module:model/Pet + * @class + * @param name {String} + * @param photoUrls {Array.} + */ + + constructor(name, photoUrls) { + + + + + + this['name'] = name;this['photoUrls'] = photoUrls; + + } - root.SwaggerPetstore.Pet = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Category, root.SwaggerPetstore.Tag); - } -}(this, function(ApiClient, Category, Tag) { - 'use strict'; + /** + * Constructs a Pet from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Pet} obj Optional instance to populate. + * @return {module:model/Pet} The populated Pet instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Pet(); + + + - - /** - * The Pet model module. - * @module model/Pet - * @version 1.0.0 - */ - - /** - * Constructs a new Pet. - * @alias module:model/Pet - * @class - * @param name {String} - * @param photoUrls {Array.} - */ - var exports = function(name, photoUrls) { - var _this = this; - - - - _this['name'] = name; - _this['photoUrls'] = photoUrls; - - - }; - - /** - * Constructs a Pet from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Pet} obj Optional instance to populate. - * @return {module:model/Pet} The populated Pet 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('category')) { - obj['category'] = Category.constructFromObject(data['category']); - } - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'String'); - } - if (data.hasOwnProperty('photoUrls')) { - obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']); - } - if (data.hasOwnProperty('tags')) { - obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]); - } - if (data.hasOwnProperty('status')) { - obj['status'] = ApiClient.convertToType(data['status'], 'String'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('category')) { + obj['category'] = Category.constructFromObject(data['category']); + } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + if (data.hasOwnProperty('photoUrls')) { + obj['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']); + } + if (data.hasOwnProperty('tags')) { + obj['tags'] = ApiClient.convertToType(data['tags'], [Tag]); + } + if (data.hasOwnProperty('status')) { + obj['status'] = ApiClient.convertToType(data['status'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {module:model/Category} category - */ - exports.prototype['category'] = undefined; - /** - * @member {String} name - */ - exports.prototype['name'] = undefined; - /** - * @member {Array.} photoUrls - */ - exports.prototype['photoUrls'] = undefined; - /** - * @member {Array.} tags - */ - exports.prototype['tags'] = undefined; - /** - * pet status in the store - * @member {module:model/Pet.StatusEnum} status - */ - exports.prototype['status'] = undefined; - - - /** - * Allowed values for the status property. - * @enum {String} - * @readonly - */ - exports.StatusEnum = { /** - * value: "available" - * @const - */ - "available": "available", + * @member {Number} id + */ + id = undefined; /** - * value: "pending" - * @const - */ - "pending": "pending", + * @member {module:model/Category} category + */ + category = undefined; /** - * value: "sold" - * @const - */ - "sold": "sold" }; + * @member {String} name + */ + name = undefined; + /** + * @member {Array.} photoUrls + */ + photoUrls = undefined; + /** + * @member {Array.} tags + */ + tags = undefined; + /** + * pet status in the store + * @member {module:model/Pet.StatusEnum} status + */ + status = undefined; - return exports; -})); + + + + + /** + * Allowed values for the status property. + * @enum {String} + * @readonly + */ + static StatusEnum = { + + /** + * value: "available" + * @const + */ + "available": "available", + + /** + * value: "pending" + * @const + */ + "pending": "pending", + + /** + * value: "sold" + * @const + */ + "sold": "sold" + }; + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/ReadOnlyFirst.js b/samples/client/petstore/javascript-promise-es6/src/model/ReadOnlyFirst.js index 91612f15351..143b34f3eb1 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/ReadOnlyFirst.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/ReadOnlyFirst.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The ReadOnlyFirst model module. +* @module model/ReadOnlyFirst +* @version 1.0.0 +*/ +export default class ReadOnlyFirst { + /** + * Constructs a new ReadOnlyFirst. + * @alias module:model/ReadOnlyFirst + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.ReadOnlyFirst = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a ReadOnlyFirst from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ReadOnlyFirst} obj Optional instance to populate. + * @return {module:model/ReadOnlyFirst} The populated ReadOnlyFirst instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ReadOnlyFirst(); + + + - - /** - * The ReadOnlyFirst model module. - * @module model/ReadOnlyFirst - * @version 1.0.0 - */ - - /** - * Constructs a new ReadOnlyFirst. - * @alias module:model/ReadOnlyFirst - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a ReadOnlyFirst from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/ReadOnlyFirst} obj Optional instance to populate. - * @return {module:model/ReadOnlyFirst} The populated ReadOnlyFirst instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('bar')) { - obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); - } - if (data.hasOwnProperty('baz')) { - obj['baz'] = ApiClient.convertToType(data['baz'], 'String'); - } + if (data.hasOwnProperty('bar')) { + obj['bar'] = ApiClient.convertToType(data['bar'], 'String'); + } + if (data.hasOwnProperty('baz')) { + obj['baz'] = ApiClient.convertToType(data['baz'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {String} bar - */ - exports.prototype['bar'] = undefined; - /** - * @member {String} baz - */ - exports.prototype['baz'] = undefined; + /** + * @member {String} bar + */ + bar = undefined; + /** + * @member {String} baz + */ + baz = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/SpecialModelName.js b/samples/client/petstore/javascript-promise-es6/src/model/SpecialModelName.js index bb13c09d956..4e0dd379b19 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/SpecialModelName.js @@ -7,76 +7,74 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The SpecialModelName model module. +* @module model/SpecialModelName +* @version 1.0.0 +*/ +export default class SpecialModelName { + /** + * Constructs a new SpecialModelName. + * @alias module:model/SpecialModelName + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.SpecialModelName = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a SpecialModelName from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/SpecialModelName} obj Optional instance to populate. + * @return {module:model/SpecialModelName} The populated SpecialModelName instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new SpecialModelName(); + + + - - /** - * The SpecialModelName model module. - * @module model/SpecialModelName - * @version 1.0.0 - */ - - /** - * Constructs a new SpecialModelName. - * @alias module:model/SpecialModelName - * @class - */ - var exports = function() { - var _this = this; - - - }; - - /** - * Constructs a SpecialModelName from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/SpecialModelName} obj Optional instance to populate. - * @return {module:model/SpecialModelName} The populated SpecialModelName instance. - */ - exports.constructFromObject = function(data, obj) { - if (data) { - obj = obj || new exports(); - - if (data.hasOwnProperty('$special[property.name]')) { - obj['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Number'); - } + if (data.hasOwnProperty('$special[property.name]')) { + obj['$special[property.name]'] = ApiClient.convertToType(data['$special[property.name]'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} $special[property.name] - */ - exports.prototype['$special[property.name]'] = undefined; + /** + * @member {Number} $special[property.name] + */ + $special[property.name] = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/Tag.js b/samples/client/petstore/javascript-promise-es6/src/model/Tag.js index 1066827e11e..759b3fa04e3 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/Tag.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/Tag.js @@ -7,84 +7,81 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The Tag model module. +* @module model/Tag +* @version 1.0.0 +*/ +export default class Tag { + /** + * Constructs a new Tag. + * @alias module:model/Tag + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.Tag = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a Tag from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/Tag} obj Optional instance to populate. + * @return {module:model/Tag} The populated Tag instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Tag(); + + + - - /** - * The Tag model module. - * @module model/Tag - * @version 1.0.0 - */ - - /** - * Constructs a new Tag. - * @alias module:model/Tag - * @class - */ - var exports = function() { - var _this = this; - - - - }; - - /** - * Constructs a Tag from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/Tag} obj Optional instance to populate. - * @return {module:model/Tag} The populated Tag 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'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {String} name - */ - exports.prototype['name'] = undefined; + /** + * @member {Number} id + */ + id = undefined; + /** + * @member {String} name + */ + name = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/User.js b/samples/client/petstore/javascript-promise-es6/src/model/User.js index e96af875697..36311e75938 100644 --- a/samples/client/petstore/javascript-promise-es6/src/model/User.js +++ b/samples/client/petstore/javascript-promise-es6/src/model/User.js @@ -7,133 +7,124 @@ * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git - * - * Swagger Codegen version: 2.2.3-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 = {}; + +import ApiClient from '../ApiClient'; + + + + + +/** +* The User model module. +* @module model/User +* @version 1.0.0 +*/ +export default class User { + /** + * Constructs a new User. + * @alias module:model/User + * @class + */ + + constructor() { + + + + + + + + } - root.SwaggerPetstore.User = factory(root.SwaggerPetstore.ApiClient); - } -}(this, function(ApiClient) { - 'use strict'; + /** + * Constructs a User from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/User} obj Optional instance to populate. + * @return {module:model/User} The populated User instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new User(); + + + - - /** - * The User model module. - * @module model/User - * @version 1.0.0 - */ - - /** - * Constructs a new User. - * @alias module:model/User - * @class - */ - var exports = function() { - var _this = this; - - - - - - - - - - }; - - /** - * Constructs a User from a plain JavaScript object, optionally creating a new instance. - * Copies all relevant properties from data to obj if supplied or a new instance if not. - * @param {Object} data The plain JavaScript object bearing properties of interest. - * @param {module:model/User} obj Optional instance to populate. - * @return {module:model/User} The populated User 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('username')) { - obj['username'] = ApiClient.convertToType(data['username'], 'String'); - } - if (data.hasOwnProperty('firstName')) { - obj['firstName'] = ApiClient.convertToType(data['firstName'], 'String'); - } - if (data.hasOwnProperty('lastName')) { - obj['lastName'] = ApiClient.convertToType(data['lastName'], 'String'); - } - if (data.hasOwnProperty('email')) { - obj['email'] = ApiClient.convertToType(data['email'], 'String'); - } - if (data.hasOwnProperty('password')) { - obj['password'] = ApiClient.convertToType(data['password'], 'String'); - } - if (data.hasOwnProperty('phone')) { - obj['phone'] = ApiClient.convertToType(data['phone'], 'String'); - } - if (data.hasOwnProperty('userStatus')) { - obj['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Number'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); + } + if (data.hasOwnProperty('username')) { + obj['username'] = ApiClient.convertToType(data['username'], 'String'); + } + if (data.hasOwnProperty('firstName')) { + obj['firstName'] = ApiClient.convertToType(data['firstName'], 'String'); + } + if (data.hasOwnProperty('lastName')) { + obj['lastName'] = ApiClient.convertToType(data['lastName'], 'String'); + } + if (data.hasOwnProperty('email')) { + obj['email'] = ApiClient.convertToType(data['email'], 'String'); + } + if (data.hasOwnProperty('password')) { + obj['password'] = ApiClient.convertToType(data['password'], 'String'); + } + if (data.hasOwnProperty('phone')) { + obj['phone'] = ApiClient.convertToType(data['phone'], 'String'); + } + if (data.hasOwnProperty('userStatus')) { + obj['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Number'); + } + } + return obj; } - return obj; - } - /** - * @member {Number} id - */ - exports.prototype['id'] = undefined; - /** - * @member {String} username - */ - exports.prototype['username'] = undefined; - /** - * @member {String} firstName - */ - exports.prototype['firstName'] = undefined; - /** - * @member {String} lastName - */ - exports.prototype['lastName'] = undefined; - /** - * @member {String} email - */ - exports.prototype['email'] = undefined; - /** - * @member {String} password - */ - exports.prototype['password'] = undefined; - /** - * @member {String} phone - */ - exports.prototype['phone'] = undefined; - /** - * User Status - * @member {Number} userStatus - */ - exports.prototype['userStatus'] = undefined; + /** + * @member {Number} id + */ + id = undefined; + /** + * @member {String} username + */ + username = undefined; + /** + * @member {String} firstName + */ + firstName = undefined; + /** + * @member {String} lastName + */ + lastName = undefined; + /** + * @member {String} email + */ + email = undefined; + /** + * @member {String} password + */ + password = undefined; + /** + * @member {String} phone + */ + phone = undefined; + /** + * User Status + * @member {Number} userStatus + */ + userStatus = undefined; - return exports; -})); + + + + + +} diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index 05378564d17..6ad6f81b3f5 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -45,6 +45,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index 76e1384fdb1..fac8904e521 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -447,7 +447,7 @@ if (_this.enableCookies && typeof window === 'undefined'){ _this.agent.saveCookies(response); } - resolve({data, response}); + resolve({data: data, response: response}); } catch (err) { reject(err); } diff --git a/samples/client/petstore/javascript-promise/test/ApiClientTest.js b/samples/client/petstore/javascript-promise/test/ApiClientTest.js index ca736876440..b58a27a025b 100644 --- a/samples/client/petstore/javascript-promise/test/ApiClientTest.js +++ b/samples/client/petstore/javascript-promise/test/ApiClientTest.js @@ -10,7 +10,7 @@ describe('ApiClient', function() { describe('defaults', function() { it('should have correct default values with the default API client', function() { expect(apiClient).to.be.ok(); - expect(apiClient.basePath).to.be('http://petstore.swagger.io/v2'); + expect(apiClient.basePath).to.be('http://petstore.swagger.io:80/v2'); expect(apiClient.authentications).to.eql({ petstore_auth: {type: 'oauth2'}, http_basic_test: {type: 'basic'}, @@ -45,8 +45,8 @@ describe('ApiClient', function() { it('should have correct default values with new API client and can customize it', function() { var newClient = new SwaggerPetstore.ApiClient; - expect(newClient.basePath).to.be('http://petstore.swagger.io/v2'); - expect(newClient.buildUrl('/abc', {})).to.be('http://petstore.swagger.io/v2/abc'); + expect(newClient.basePath).to.be('http://petstore.swagger.io:80/v2'); + expect(newClient.buildUrl('/abc', {})).to.be('http://petstore.swagger.io:80/v2/abc'); newClient.basePath = 'http://example.com'; expect(newClient.basePath).to.be('http://example.com'); @@ -102,16 +102,16 @@ describe('ApiClient', function() { describe('#buildUrl', function() { it('should work without path parameters in the path', function() { expect(apiClient.buildUrl('/abc', {})).to - .be('http://petstore.swagger.io/v2/abc'); + .be('http://petstore.swagger.io:80/v2/abc'); expect(apiClient.buildUrl('/abc/def?ok', {id: 123})).to - .be('http://petstore.swagger.io/v2/abc/def?ok'); + .be('http://petstore.swagger.io:80/v2/abc/def?ok'); }); it('should work with path parameters in the path', function() { expect(apiClient.buildUrl('/{id}', {id: 123})).to - .be('http://petstore.swagger.io/v2/123'); + .be('http://petstore.swagger.io:80/v2/123'); expect(apiClient.buildUrl('/abc/{id}/{name}?ok', {id: 456, name: 'a b'})).to. - be('http://petstore.swagger.io/v2/abc/456/a%20b?ok'); + be('http://petstore.swagger.io:80/v2/abc/456/a%20b?ok'); }); }); diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 740edf8857d..a58e731b223 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -45,6 +45,24 @@ browserify main.js > bundle.js Then include *bundle.js* in the HTML pages. +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: diff --git a/samples/client/petstore/jaxrs-cxf-client/pom.xml b/samples/client/petstore/jaxrs-cxf-client/pom.xml index b1d74fe3c16..11737e1547a 100644 --- a/samples/client/petstore/jaxrs-cxf-client/pom.xml +++ b/samples/client/petstore/jaxrs-cxf-client/pom.xml @@ -191,7 +191,7 @@ 1.1.7 2.5 1.1.0.Final - 3.1.8 + 3.1.11 2.8.4 UTF-8 diff --git a/samples/client/petstore/jaxrs-cxf/pom.xml b/samples/client/petstore/jaxrs-cxf/pom.xml index 041815ff47c..a61e8918261 100644 --- a/samples/client/petstore/jaxrs-cxf/pom.xml +++ b/samples/client/petstore/jaxrs-cxf/pom.xml @@ -168,7 +168,7 @@ 4.12 1.1.7 2.5 - 3.1.6 + 3.1.11 2.8.4 UTF-8 diff --git a/samples/client/petstore/powershell/.swagger-codegen-ignore b/samples/client/petstore/powershell/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/client/petstore/powershell/.swagger-codegen-ignore @@ -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 diff --git a/samples/client/petstore/powershell/.swagger-codegen/VERSION b/samples/client/petstore/powershell/.swagger-codegen/VERSION new file mode 100644 index 00000000000..7fea99011a6 --- /dev/null +++ b/samples/client/petstore/powershell/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/powershell/Build.ps1 b/samples/client/petstore/powershell/Build.ps1 new file mode 100644 index 00000000000..dfeead2b172 --- /dev/null +++ b/samples/client/petstore/powershell/Build.ps1 @@ -0,0 +1,86 @@ +function Get-FunctionsToExport { + [CmdletBinding()] + Param ( + [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [Alias('FullName')] + $Path + ) + + Process { + $Token = $null + $ParserErr = $null + + $Ast = [System.Management.Automation.Language.Parser]::ParseFile( + $Path, + [ref]$Token, + [ref]$ParserErr + ) + + if ($ParserErr) { + throw $ParserErr + } else { + foreach ($name in 'Begin', 'Process', 'End') { + foreach ($Statement in $Ast."${name}Block".Statements) { + if ( + [String]::IsNullOrWhiteSpace($Statement.Name) -or + $Statement.Extent.ToString() -notmatch + ('function\W+{0}' -f $Statement.Name) + ) { + continue + } + + $Statement.Name + } + } + } + } +} + +$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path +$ClientPath = ("$ScriptDir\..\..\petstore\csharp\SwaggerClient" | Resolve-Path).ProviderPath +$FunctionPath = 'API', 'Model' | ForEach-Object {Join-Path "$ScriptDir\src\IO.Swagger\" $_} +$BinPath = "$ScriptDir\src\IO.Swagger\Bin" + +Start-Process -FilePath "$ClientPath\build.bat" -WorkingDirectory $ClientPath -Wait -NoNewWindow + +if (!(Test-Path "$ScriptDir\src\IO.Swagger\Bin" -PathType Container)) { + New-Item "$ScriptDir\src\IO.Swagger\Bin" -ItemType Directory > $null +} + +Copy-Item "$ClientPath\bin\*.dll" $BinPath + +$Manifest = @{ + Path = "$ScriptDir\src\IO.Swagger\IO.Swagger.psd1" + + Author = 'Swagger Codegen Team' + CompanyName = 'swagger.io' + Description = 'IO.Swagger - the PowerShell module for Swagger Petstore' + + RootModule = 'IO.Swagger.psm1' + Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module + + PowerShellVersion = '3.0' + + RequiredAssemblies = Get-ChildItem "$BinPath\*.dll" | ForEach-Object { + Join-Path $_.Directory.Name $_.Name + } + + FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport + + VariablesToExport = @() + AliasesToExport = @() + CmdletsToExport = @() + + # Should we use prefix to prevent command name collisions? + # https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/ + # + # Kirk Munro recommends against it: + # https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/#comment-20820 + # + # If not, we'd need to generate functions name with prefix. + # + # DefaultCommandPrefix = 'PetStore' +} + +New-ModuleManifest @Manifest diff --git a/samples/client/petstore/powershell/README.md b/samples/client/petstore/powershell/README.md new file mode 100644 index 00000000000..a1692f7982e --- /dev/null +++ b/samples/client/petstore/powershell/README.md @@ -0,0 +1,101 @@ +# IO.Swagger - the PowerShell module for the Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: 1.0.0 +- SDK version: +- Build date: 2017-06-09T17:28:25.415+04:00 +- Build package: io.swagger.codegen.languages.PowerShellClientCodegen + + +## Frameworks supported +- .NET 4.0 or later +- PowerShell 3.0 or later + + +## Dependencies +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later + +The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +``` +Install-Package RestSharp +Install-Package Newtonsoft.Json +``` + +NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) + + +## Installation +Run the following command to generate the DLL +- [Windows] `Build.ps1` + +Then import module from the .\src\IO.Swagger folder: +```powershell +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; +``` + + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + + +## Documentation for Models + + - [IO.Swagger\Model.ApiResponse](docs/ApiResponse.md) + - [IO.Swagger\Model.Category](docs/Category.md) + - [IO.Swagger\Model.Order](docs/Order.md) + - [IO.Swagger\Model.Pet](docs/Pet.md) + - [IO.Swagger\Model.Tag](docs/Tag.md) + - [IO.Swagger\Model.User](docs/User.md) + + + +## Documentation for Authorization + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### 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 + diff --git a/samples/client/petstore/powershell/docs/ApiResponse.md b/samples/client/petstore/powershell/docs/ApiResponse.md new file mode 100644 index 00000000000..e7c75f7167e --- /dev/null +++ b/samples/client/petstore/powershell/docs/ApiResponse.md @@ -0,0 +1,11 @@ +# IO.Swagger.IO.Swagger\Model.ApiResponse +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Int32** | | [optional] [default to null] +**type** | **String** | | [optional] [default to null] +**message** | **String** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/Category.md b/samples/client/petstore/powershell/docs/Category.md new file mode 100644 index 00000000000..5d513c3b8ec --- /dev/null +++ b/samples/client/petstore/powershell/docs/Category.md @@ -0,0 +1,10 @@ +# IO.Swagger.IO.Swagger\Model.Category +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/Order.md b/samples/client/petstore/powershell/docs/Order.md new file mode 100644 index 00000000000..468f34d4aca --- /dev/null +++ b/samples/client/petstore/powershell/docs/Order.md @@ -0,0 +1,14 @@ +# IO.Swagger.IO.Swagger\Model.Order +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] [default to null] +**petId** | **Int64** | | [optional] [default to null] +**quantity** | **Int32** | | [optional] [default to null] +**shipDate** | **System.DateTime** | | [optional] [default to null] +**status** | **String** | Order Status | [optional] [default to null] +**complete** | **Boolean** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/Pet.md b/samples/client/petstore/powershell/docs/Pet.md new file mode 100644 index 00000000000..08ddad43814 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Pet.md @@ -0,0 +1,14 @@ +# IO.Swagger.IO.Swagger\Model.Pet +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] [default to null] +**category** | [**IO.Swagger.Model.Category**](Category.md) | | [optional] [default to null] +**name** | **String** | | [default to null] +**photoUrls** | **String** | | [default to null] +**tags** | [**IO.Swagger.Model.Tag**](Tag.md) | | [optional] [default to null] +**status** | **String** | pet status in the store | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/PetApi.md b/samples/client/petstore/powershell/docs/PetApi.md new file mode 100644 index 00000000000..c95dad72b1d --- /dev/null +++ b/samples/client/petstore/powershell/docs/PetApi.md @@ -0,0 +1,536 @@ +# IO.Swagger.IO.Swagger\API.PetApi + +All URIs are relative to *http://petstore.swagger.io/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 + + + +# **AddPet** +> void AddPet (Pet body) + +Add a new pet to the store + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class AddPetExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var body = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **DeletePet** +> void DeletePet (Int64 petId, String apiKey) + +Deletes a pet + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class DeletePetExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // Int64 | Pet id to delete + var apiKey = apiKey_example; // String | (optional) + + try + { + // Deletes a pet + apiInstance.DeletePet(petId, apiKey); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FindPetsByStatus** +> IO.Swagger.Model.Pet FindPetsByStatus (String status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class FindPetsByStatusExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var status = new String(); // String | Status values that need to be considered for filter + + try + { + // Finds Pets by status + IO.Swagger.Model.Pet result = apiInstance.FindPetsByStatus(status); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**String**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**IO.Swagger.Model.Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FindPetsByTags** +> IO.Swagger.Model.Pet FindPetsByTags (String tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class FindPetsByTagsExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var tags = new String(); // String | Tags to filter by + + try + { + // Finds Pets by tags + IO.Swagger.Model.Pet result = apiInstance.FindPetsByTags(tags); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**String**](String.md)| Tags to filter by | + +### Return type + +[**IO.Swagger.Model.Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetPetById** +> IO.Swagger.Model.Pet GetPetById (Int64 petId) + +Find pet by ID + +Returns a single pet + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class GetPetByIdExample + { + public void main() + { + // Configure API key authorization: api_key + Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); + + var apiInstance = new PetApi(); + var petId = 789; // Int64 | ID of pet to return + + try + { + // Find pet by ID + IO.Swagger.Model.Pet result = apiInstance.GetPetById(petId); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64**| ID of pet to return | + +### Return type + +[**IO.Swagger.Model.Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UpdatePet** +> void UpdatePet (Pet body) + +Update an existing pet + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class UpdatePetExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var body = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + apiInstance.UpdatePet(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UpdatePetWithForm** +> void UpdatePetWithForm (Int64 petId, String name, String status) + +Updates a pet in the store with form data + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class UpdatePetWithFormExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // Int64 | ID of pet that needs to be updated + var name = name_example; // String | Updated name of the pet (optional) + var status = status_example; // String | Updated status of the pet (optional) + + try + { + // Updates a pet in the store with form data + apiInstance.UpdatePetWithForm(petId, name, status); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64**| 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 + +void (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 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UploadFile** +> IO.Swagger.Model.ApiResponse UploadFile (Int64 petId, String additionalMetadata, String file) + +uploads an image + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class UploadFileExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // Int64 | ID of pet to update + var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server (optional) + var file = new String(); // String | file to upload (optional) + + try + { + // uploads an image + IO.Swagger.Model.ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **String**| file to upload | [optional] + +### Return type + +[**IO.Swagger.Model.ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/StoreApi.md b/samples/client/petstore/powershell/docs/StoreApi.md new file mode 100644 index 00000000000..cd86bdfa903 --- /dev/null +++ b/samples/client/petstore/powershell/docs/StoreApi.md @@ -0,0 +1,256 @@ +# IO.Swagger.IO.Swagger\API.StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet + + + +# **DeleteOrder** +> void DeleteOrder (String 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 +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class DeleteOrderExample + { + public void main() + { + var apiInstance = new StoreApi(); + var orderId = orderId_example; // String | ID of the order that needs to be deleted + + try + { + // Delete purchase order by ID + apiInstance.DeleteOrder(orderId); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetInventory** +> {String, Int32} GetInventory () + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class GetInventoryExample + { + public void main() + { + // Configure API key authorization: api_key + Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); + + var apiInstance = new StoreApi(); + + try + { + // Returns pet inventories by status + {String, Int32} result = apiInstance.GetInventory(); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**{String, Int32}**](Map.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetOrderById** +> IO.Swagger.Model.Order GetOrderById (Int64 orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class GetOrderByIdExample + { + public void main() + { + var apiInstance = new StoreApi(); + var orderId = 789; // Int64 | ID of pet that needs to be fetched + + try + { + // Find purchase order by ID + IO.Swagger.Model.Order result = apiInstance.GetOrderById(orderId); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Int64**| ID of pet that needs to be fetched | + +### Return type + +[**IO.Swagger.Model.Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **PlaceOrder** +> IO.Swagger.Model.Order PlaceOrder (Order body) + +Place an order for a pet + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class PlaceOrderExample + { + public void main() + { + var apiInstance = new StoreApi(); + var body = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + IO.Swagger.Model.Order result = apiInstance.PlaceOrder(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**IO.Swagger.Model.Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/Tag.md b/samples/client/petstore/powershell/docs/Tag.md new file mode 100644 index 00000000000..f63e85100a6 --- /dev/null +++ b/samples/client/petstore/powershell/docs/Tag.md @@ -0,0 +1,10 @@ +# IO.Swagger.IO.Swagger\Model.Tag +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/User.md b/samples/client/petstore/powershell/docs/User.md new file mode 100644 index 00000000000..64762d009f5 --- /dev/null +++ b/samples/client/petstore/powershell/docs/User.md @@ -0,0 +1,16 @@ +# IO.Swagger.IO.Swagger\Model.User +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] [default to null] +**username** | **String** | | [optional] [default to null] +**firstName** | **String** | | [optional] [default to null] +**lastName** | **String** | | [optional] [default to null] +**email** | **String** | | [optional] [default to null] +**password** | **String** | | [optional] [default to null] +**phone** | **String** | | [optional] [default to null] +**userStatus** | **Int32** | User Status | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/UserApi.md b/samples/client/petstore/powershell/docs/UserApi.md new file mode 100644 index 00000000000..03eb1b3260b --- /dev/null +++ b/samples/client/petstore/powershell/docs/UserApi.md @@ -0,0 +1,498 @@ +# IO.Swagger.IO.Swagger\API.UserApi + +All URIs are relative to *http://petstore.swagger.io/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 + + + +# **CreateUser** +> void CreateUser (User body) + +Create user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class CreateUserExample + { + public void main() + { + var apiInstance = new UserApi(); + var body = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **CreateUsersWithArrayInput** +> void CreateUsersWithArrayInput (IO.Swagger.Model.User body) + +Creates list of users with given input array + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class CreateUsersWithArrayInputExample + { + public void main() + { + var apiInstance = new UserApi(); + var body = new IO.Swagger.Model.User(); // IO.Swagger.Model.User | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**IO.Swagger.Model.User**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **CreateUsersWithListInput** +> void CreateUsersWithListInput (IO.Swagger.Model.User body) + +Creates list of users with given input array + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class CreateUsersWithListInputExample + { + public void main() + { + var apiInstance = new UserApi(); + var body = new IO.Swagger.Model.User(); // IO.Swagger.Model.User | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**IO.Swagger.Model.User**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **DeleteUser** +> void DeleteUser (String username) + +Delete user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class DeleteUserExample + { + public void main() + { + var apiInstance = new UserApi(); + var username = username_example; // String | The name that needs to be deleted + + try + { + // Delete user + apiInstance.DeleteUser(username); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetUserByName** +> IO.Swagger.Model.User GetUserByName (String username) + +Get user by user name + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class GetUserByNameExample + { + public void main() + { + var apiInstance = new UserApi(); + var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + + try + { + // Get user by user name + IO.Swagger.Model.User result = apiInstance.GetUserByName(username); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**IO.Swagger.Model.User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **LoginUser** +> String LoginUser (String username, String password) + +Logs user into the system + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class LoginUserExample + { + public void main() + { + var apiInstance = new UserApi(); + var username = username_example; // String | The user name for login + var password = password_example; // String | The password for login in clear text + + try + { + // Logs user into the system + String result = apiInstance.LoginUser(username, password); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message ); + } + } + } +} +``` + +### 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 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **LogoutUser** +> void LogoutUser () + +Logs out current logged in user session + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class LogoutUserExample + { + public void main() + { + var apiInstance = new UserApi(); + + try + { + // Logs out current logged in user session + apiInstance.LogoutUser(); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UpdateUser** +> void UpdateUser (String username, User body) + +Updated user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.IO.Swagger\API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger\Model; + +namespace Example +{ + public class UpdateUserExample + { + public void main() + { + var apiInstance = new UserApi(); + var username = username_example; // String | name that need to be deleted + var body = new User(); // User | Updated user object + + try + { + // Updated user + apiInstance.UpdateUser(username, body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/src/IO.Swagger/API/PetApi.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/API/PetApi.ps1 new file mode 100644 index 00000000000..64f23ec9d6b --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/API/PetApi.ps1 @@ -0,0 +1,164 @@ +function Invoke-PetApiAddPet { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.Pet] + ${body} + ) + + Process { + 'Calling method: PetApi-AddPet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.AddPet( + ${body} + ) + } +} + +function Invoke-PetApiDeletePet { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${petId}, + [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${apiKey} + ) + + Process { + 'Calling method: PetApi-DeletePet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.DeletePet( + ${petId}, + ${apiKey} + ) + } +} + +function Invoke-PetApiFindPetsByStatus { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${status} + ) + + Process { + 'Calling method: PetApi-FindPetsByStatus' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.FindPetsByStatus( + ${status} + ) + } +} + +function Invoke-PetApiFindPetsByTags { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${tags} + ) + + Process { + 'Calling method: PetApi-FindPetsByTags' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.FindPetsByTags( + ${tags} + ) + } +} + +function Invoke-PetApiGetPetById { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${petId} + ) + + Process { + 'Calling method: PetApi-GetPetById' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.GetPetById( + ${petId} + ) + } +} + +function Invoke-PetApiUpdatePet { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.Pet] + ${body} + ) + + Process { + 'Calling method: PetApi-UpdatePet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UpdatePet( + ${body} + ) + } +} + +function Invoke-PetApiUpdatePetWithForm { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${petId}, + [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${name}, + [Parameter(Position = 3, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${status} + ) + + Process { + 'Calling method: PetApi-UpdatePetWithForm' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UpdatePetWithForm( + ${petId}, + ${name}, + ${status} + ) + } +} + +function Invoke-PetApiUploadFile { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${petId}, + [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${additionalMetadata}, + [Parameter(Position = 3, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [IO.Swagger.Model.String] + ${file} + ) + + Process { + 'Calling method: PetApi-UploadFile' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UploadFile( + ${petId}, + ${additionalMetadata}, + ${file} + ) + } +} + diff --git a/samples/client/petstore/powershell/src/IO.Swagger/API/StoreApi.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/API/StoreApi.ps1 new file mode 100644 index 00000000000..291e1491fd3 --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/API/StoreApi.ps1 @@ -0,0 +1,68 @@ +function Invoke-StoreApiDeleteOrder { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${orderId} + ) + + Process { + 'Calling method: StoreApi-DeleteOrder' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:StoreApi.DeleteOrder( + ${orderId} + ) + } +} + +function Invoke-StoreApiGetInventory { + [CmdletBinding()] + Param ( + ) + + Process { + 'Calling method: StoreApi-GetInventory' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:StoreApi.GetInventory( + ) + } +} + +function Invoke-StoreApiGetOrderById { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${orderId} + ) + + Process { + 'Calling method: StoreApi-GetOrderById' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:StoreApi.GetOrderById( + ${orderId} + ) + } +} + +function Invoke-StoreApiPlaceOrder { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.Order] + ${body} + ) + + Process { + 'Calling method: StoreApi-PlaceOrder' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:StoreApi.PlaceOrder( + ${body} + ) + } +} + diff --git a/samples/client/petstore/powershell/src/IO.Swagger/API/UserApi.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/API/UserApi.ps1 new file mode 100644 index 00000000000..8c46dad120d --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/API/UserApi.ps1 @@ -0,0 +1,148 @@ +function Invoke-UserApiCreateUser { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.User] + ${body} + ) + + Process { + 'Calling method: UserApi-CreateUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.CreateUser( + ${body} + ) + } +} + +function Invoke-UserApiCreateUsersWithArrayInput { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.User] + ${body} + ) + + Process { + 'Calling method: UserApi-CreateUsersWithArrayInput' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.CreateUsersWithArrayInput( + ${body} + ) + } +} + +function Invoke-UserApiCreateUsersWithListInput { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.User] + ${body} + ) + + Process { + 'Calling method: UserApi-CreateUsersWithListInput' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.CreateUsersWithListInput( + ${body} + ) + } +} + +function Invoke-UserApiDeleteUser { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${username} + ) + + Process { + 'Calling method: UserApi-DeleteUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.DeleteUser( + ${username} + ) + } +} + +function Invoke-UserApiGetUserByName { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${username} + ) + + Process { + 'Calling method: UserApi-GetUserByName' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.GetUserByName( + ${username} + ) + } +} + +function Invoke-UserApiLoginUser { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${username}, + [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${password} + ) + + Process { + 'Calling method: UserApi-LoginUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.LoginUser( + ${username}, + ${password} + ) + } +} + +function Invoke-UserApiLogoutUser { + [CmdletBinding()] + Param ( + ) + + Process { + 'Calling method: UserApi-LogoutUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.LogoutUser( + ) + } +} + +function Invoke-UserApiUpdateUser { + [CmdletBinding()] + Param ( + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${username}, + [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.User] + ${body} + ) + + Process { + 'Calling method: UserApi-UpdateUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.UpdateUser( + ${username}, + ${body} + ) + } +} + diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Bin/IO.Swagger.dll b/samples/client/petstore/powershell/src/IO.Swagger/Bin/IO.Swagger.dll new file mode 100644 index 00000000000..a76f2b990b0 Binary files /dev/null and b/samples/client/petstore/powershell/src/IO.Swagger/Bin/IO.Swagger.dll differ diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Bin/Newtonsoft.Json.dll b/samples/client/petstore/powershell/src/IO.Swagger/Bin/Newtonsoft.Json.dll new file mode 100644 index 00000000000..b7ef414f309 Binary files /dev/null and b/samples/client/petstore/powershell/src/IO.Swagger/Bin/Newtonsoft.Json.dll differ diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Bin/RestSharp.dll b/samples/client/petstore/powershell/src/IO.Swagger/Bin/RestSharp.dll new file mode 100644 index 00000000000..59d82f94198 Binary files /dev/null and b/samples/client/petstore/powershell/src/IO.Swagger/Bin/RestSharp.dll differ diff --git a/samples/client/petstore/powershell/src/IO.Swagger/IO.Swagger.psd1 b/samples/client/petstore/powershell/src/IO.Swagger/IO.Swagger.psd1 new file mode 100644 index 00000000000..49b6712c5e1 Binary files /dev/null and b/samples/client/petstore/powershell/src/IO.Swagger/IO.Swagger.psd1 differ diff --git a/samples/client/petstore/powershell/src/IO.Swagger/IO.Swagger.psm1 b/samples/client/petstore/powershell/src/IO.Swagger/IO.Swagger.psm1 new file mode 100644 index 00000000000..9b253e2fcee --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/IO.Swagger.psm1 @@ -0,0 +1,29 @@ +#region Import functions + +'API', 'Model', 'Private' | Get-ChildItem -Path { + Join-Path $PSScriptRoot $_ +} -Filter '*.ps1' | ForEach-Object { + Write-Verbose "Importing file: $($_.BaseName)" + try { + . $_.FullName + } catch { + Write-Verbose "Can't import function!" + } +} + +#endregion + + +#region Initialize APIs + +'Creating object: IO.Swagger.Api.PetApi' | Write-Verbose +$Script:PetApi= New-Object -TypeName IO.Swagger.Api.PetApi -ArgumentList @($null) + +'Creating object: IO.Swagger.Api.StoreApi' | Write-Verbose +$Script:StoreApi= New-Object -TypeName IO.Swagger.Api.StoreApi -ArgumentList @($null) + +'Creating object: IO.Swagger.Api.UserApi' | Write-Verbose +$Script:UserApi= New-Object -TypeName IO.Swagger.Api.UserApi -ArgumentList @($null) + + +#endregion diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Model/New-ApiResponse.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-ApiResponse.ps1 new file mode 100644 index 00000000000..f5fcdd09b71 --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-ApiResponse.ps1 @@ -0,0 +1,25 @@ +function New-ApiResponse { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${code}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${type}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${message} + ) + + Process { + 'Creating object: IO.Swagger.Model.ApiResponse' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.ApiResponse -ArgumentList @( + ${code}, + ${type}, + ${message} + ) + } +} diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Category.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Category.ps1 new file mode 100644 index 00000000000..9009a971945 --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Category.ps1 @@ -0,0 +1,21 @@ +function New-Category { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${name} + ) + + Process { + 'Creating object: IO.Swagger.Model.Category' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Category -ArgumentList @( + ${id}, + ${name} + ) + } +} diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Order.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Order.ps1 new file mode 100644 index 00000000000..199952c4e18 --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Order.ps1 @@ -0,0 +1,37 @@ +function New-Order { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${petId}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${quantity}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[System.DateTime]] + ${shipDate}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${status}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${complete} + ) + + Process { + 'Creating object: IO.Swagger.Model.Order' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Order -ArgumentList @( + ${id}, + ${petId}, + ${quantity}, + ${shipDate}, + ${status}, + ${complete} + ) + } +} diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Pet.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Pet.ps1 new file mode 100644 index 00000000000..5818fdaa591 --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Pet.ps1 @@ -0,0 +1,37 @@ +function New-Pet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[IO.Swagger.Model.Category]] + ${category}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${name}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [[String]] + ${photoUrls}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[IO.Swagger.Model.Tag]] + ${tags}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${status} + ) + + Process { + 'Creating object: IO.Swagger.Model.Pet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Pet -ArgumentList @( + ${id}, + ${category}, + ${name}, + ${photoUrls}, + ${tags}, + ${status} + ) + } +} diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Tag.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Tag.ps1 new file mode 100644 index 00000000000..2d333643afe --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-Tag.ps1 @@ -0,0 +1,21 @@ +function New-Tag { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${name} + ) + + Process { + 'Creating object: IO.Swagger.Model.Tag' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Tag -ArgumentList @( + ${id}, + ${name} + ) + } +} diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Model/New-User.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-User.ps1 new file mode 100644 index 00000000000..011ffdef5cb --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/Model/New-User.ps1 @@ -0,0 +1,45 @@ +function New-User { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${username}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${firstName}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${lastName}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${email}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${password}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${phone}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${userStatus} + ) + + Process { + 'Creating object: IO.Swagger.Model.User' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.User -ArgumentList @( + ${id}, + ${username}, + ${firstName}, + ${lastName}, + ${email}, + ${password}, + ${phone}, + ${userStatus} + ) + } +} diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Private/Get-CommonParameters.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/Private/Get-CommonParameters.ps1 new file mode 100644 index 00000000000..31a0a1ff3af --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/Private/Get-CommonParameters.ps1 @@ -0,0 +1,14 @@ +<# +.Synopsis + Helper function to get common parameters (Verbose, Debug, etc.) +.Example + Get-CommonParameters +#> +function Get-CommonParameters { + function tmp { + [CmdletBinding()] + Param () + } + + (Get-Command -Name tmp -CommandType Function).Parameters.Keys +} diff --git a/samples/client/petstore/powershell/src/IO.Swagger/Private/Out-DebugParameter.ps1 b/samples/client/petstore/powershell/src/IO.Swagger/Private/Out-DebugParameter.ps1 new file mode 100644 index 00000000000..ca18c391cc1 --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/Private/Out-DebugParameter.ps1 @@ -0,0 +1,37 @@ +<# +.Synopsis + Helper function to format debug parameter output. +.Example + $PSBoundParameters | Out-DebugParameter | Write-Debug +#> +function Out-DebugParameter { + [CmdletBinding()] + Param ( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [AllowEmptyCollection()] + $InputObject + ) + + Begin { + $CommonParameters = Get-CommonParameters + } + + Process { + $InputObject.GetEnumerator() | Where-Object { + $CommonParameters -notcontains $_.Key + } | Format-Table -AutoSize -Property ( + @{ + Name = 'Parameter' + Expression = {$_.Key} + }, + @{ + Name = 'Value' + Expression = {$_.Value} + } + ) | Out-String -Stream | ForEach-Object { + if ($_.Trim()) { + $_ + } + } + } +} diff --git a/samples/client/petstore/powershell/src/IO.Swagger/en-US/about_IO.Swagger.help.txt b/samples/client/petstore/powershell/src/IO.Swagger/en-US/about_IO.Swagger.help.txt new file mode 100644 index 00000000000..7aa65057cc2 --- /dev/null +++ b/samples/client/petstore/powershell/src/IO.Swagger/en-US/about_IO.Swagger.help.txt @@ -0,0 +1,20 @@ +PSTOPIC + about_IO.Swagger + +SHORT DESCRIPTION + IO.Swagger - the PowerShell module for the Swagger Petstore + +LONG DESCRIPTION + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + + - API version: 1.0.0 + - SDK version: + - Build date: 2017-06-09T17:28:25.415+04:00 + - Build package: io.swagger.codegen.languages.PowerShellClientCodegen + + Frameworks supported: + + * PowerShell 3.0+ + * .NET 4.0 or later diff --git a/samples/client/petstore/powershell_test/.swagger-codegen-ignore b/samples/client/petstore/powershell_test/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/client/petstore/powershell_test/.swagger-codegen-ignore @@ -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 diff --git a/samples/client/petstore/powershell_test/.swagger-codegen/VERSION b/samples/client/petstore/powershell_test/.swagger-codegen/VERSION new file mode 100644 index 00000000000..7fea99011a6 --- /dev/null +++ b/samples/client/petstore/powershell_test/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/powershell_test/Build.ps1 b/samples/client/petstore/powershell_test/Build.ps1 new file mode 100644 index 00000000000..93f9996115f --- /dev/null +++ b/samples/client/petstore/powershell_test/Build.ps1 @@ -0,0 +1,86 @@ +function Get-FunctionsToExport { + [CmdletBinding()] + Param ( + [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [Alias('FullName')] + $Path + ) + + Process { + $Token = $null + $ParserErr = $null + + $Ast = [System.Management.Automation.Language.Parser]::ParseFile( + $Path, + [ref]$Token, + [ref]$ParserErr + ) + + if ($ParserErr) { + throw $ParserErr + } else { + foreach ($name in 'Begin', 'Process', 'End') { + foreach ($Statement in $Ast."${name}Block".Statements) { + if ( + [String]::IsNullOrWhiteSpace($Statement.Name) -or + $Statement.Extent.ToString() -notmatch + ('function\W+{0}' -f $Statement.Name) + ) { + continue + } + + $Statement.Name + } + } + } + } +} + +$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path +$ClientPath = ("$ScriptDir\..\..\petstore\csharp\SwaggerClient" | Resolve-Path).ProviderPath +$FunctionPath = 'API', 'Model' | ForEach-Object {Join-Path "$ScriptDir\src\IO.Swagger\" $_} +$BinPath = "$ScriptDir\src\IO.Swagger\Bin" + +Start-Process -FilePath "$ClientPath\build.bat" -WorkingDirectory $ClientPath -Wait -NoNewWindow + +if (!(Test-Path "$ScriptDir\src\IO.Swagger\Bin" -PathType Container)) { + New-Item "$ScriptDir\src\IO.Swagger\Bin" -ItemType Directory > $null +} + +Copy-Item "$ClientPath\bin\*.dll" $BinPath + +$Manifest = @{ + Path = "$ScriptDir\src\IO.Swagger\IO.Swagger.psd1" + + Author = 'Swagger Codegen Team' + CompanyName = 'swagger.io' + Description = 'IO.Swagger - the PowerShell module for Swagger Petstore' + + RootModule = 'IO.Swagger.psm1' + Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module + + PowerShellVersion = '3.0' + + RequiredAssemblies = Get-ChildItem "$BinPath\*.dll" | ForEach-Object { + Join-Path $_.Directory.Name $_.Name + } + + FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport + + VariablesToExport = @() + AliasesToExport = @() + CmdletsToExport = @() + + # Should we use prefix to prevent command name collisions? + # https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/ + # + # Kirk Munro recommends against it: + # https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/#comment-20820 + # + # If not, we'd need to generate functions name with prefix. + # + # DefaultCommandPrefix = 'PetStore' +} + +New-ModuleManifest @Manifest diff --git a/samples/client/petstore/powershell_test/README.md b/samples/client/petstore/powershell_test/README.md new file mode 100644 index 00000000000..eed57643045 --- /dev/null +++ b/samples/client/petstore/powershell_test/README.md @@ -0,0 +1,31 @@ +# IO.Swagger - the PowerShell module for the Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: 1.0.0 +- SDK version: +- Build date: 2017-06-20T22:49:00.415+08:00 +- Build package: io.swagger.codegen.languages.PowerShellClientCodegen + + +## Frameworks supported +- PowerShell 3.0 or later + + +## Dependencies +- C# API client generated by Swagger Codegen AND should be located in $ScriptDir\..\..\petstore\csharp\SwaggerClient as stated in Build.ps1 + + +## Installation +Run the following command to generate the DLL +- [Windows] `Build.ps1` + +Then import module from the .\src\IO.Swagger folder: +```powershell +using IO.Swagger.IO.Swagger/API; +using IO.Swagger.Client; +using IO.Swagger.IO.Swagger/Model; +``` + diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/API/PetApi.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/API/PetApi.ps1 new file mode 100644 index 00000000000..76897d2b081 --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/API/PetApi.ps1 @@ -0,0 +1,164 @@ +function Invoke-PetApiAddPet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.Pet] + ${body} + ) + + Process { + 'Calling method: PetApi-AddPet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.AddPet( + ${body} + ) + } +} + +function Invoke-PetApiDeletePet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${petId}, + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${apiKey} + ) + + Process { + 'Calling method: PetApi-DeletePet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.DeletePet( + ${petId}, + ${apiKey} + ) + } +} + +function Invoke-PetApiFindPetsByStatus { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String[]] + ${status} + ) + + Process { + 'Calling method: PetApi-FindPetsByStatus' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.FindPetsByStatus( + ${status} + ) + } +} + +function Invoke-PetApiFindPetsByTags { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String[]] + ${tags} + ) + + Process { + 'Calling method: PetApi-FindPetsByTags' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.FindPetsByTags( + ${tags} + ) + } +} + +function Invoke-PetApiGetPetById { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${petId} + ) + + Process { + 'Calling method: PetApi-GetPetById' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.GetPetById( + ${petId} + ) + } +} + +function Invoke-PetApiUpdatePet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.Pet] + ${body} + ) + + Process { + 'Calling method: PetApi-UpdatePet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UpdatePet( + ${body} + ) + } +} + +function Invoke-PetApiUpdatePetWithForm { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${petId}, + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${name}, + [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${status} + ) + + Process { + 'Calling method: PetApi-UpdatePetWithForm' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UpdatePetWithForm( + ${petId}, + ${name}, + ${status} + ) + } +} + +function Invoke-PetApiUploadFile { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${petId}, + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${additionalMetadata}, + [Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [String] + ${file} + ) + + Process { + 'Calling method: PetApi-UploadFile' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UploadFile( + ${petId}, + ${additionalMetadata}, + ${file} + ) + } +} + diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/API/StoreApi.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/API/StoreApi.ps1 new file mode 100644 index 00000000000..e1959279f4c --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/API/StoreApi.ps1 @@ -0,0 +1,68 @@ +function Invoke-StoreApiDeleteOrder { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${orderId} + ) + + Process { + 'Calling method: StoreApi-DeleteOrder' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:StoreApi.DeleteOrder( + ${orderId} + ) + } +} + +function Invoke-StoreApiGetInventory { + [CmdletBinding()] + Param ( + ) + + Process { + 'Calling method: StoreApi-GetInventory' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:StoreApi.GetInventory( + ) + } +} + +function Invoke-StoreApiGetOrderById { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Int64] + ${orderId} + ) + + Process { + 'Calling method: StoreApi-GetOrderById' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:StoreApi.GetOrderById( + ${orderId} + ) + } +} + +function Invoke-StoreApiPlaceOrder { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.Order] + ${body} + ) + + Process { + 'Calling method: StoreApi-PlaceOrder' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:StoreApi.PlaceOrder( + ${body} + ) + } +} + diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/API/UserApi.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/API/UserApi.ps1 new file mode 100644 index 00000000000..dc47192292d --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/API/UserApi.ps1 @@ -0,0 +1,148 @@ +function Invoke-UserApiCreateUser { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.User] + ${body} + ) + + Process { + 'Calling method: UserApi-CreateUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.CreateUser( + ${body} + ) + } +} + +function Invoke-UserApiCreateUsersWithArrayInput { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.User[]] + ${body} + ) + + Process { + 'Calling method: UserApi-CreateUsersWithArrayInput' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.CreateUsersWithArrayInput( + ${body} + ) + } +} + +function Invoke-UserApiCreateUsersWithListInput { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.User[]] + ${body} + ) + + Process { + 'Calling method: UserApi-CreateUsersWithListInput' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.CreateUsersWithListInput( + ${body} + ) + } +} + +function Invoke-UserApiDeleteUser { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${username} + ) + + Process { + 'Calling method: UserApi-DeleteUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.DeleteUser( + ${username} + ) + } +} + +function Invoke-UserApiGetUserByName { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${username} + ) + + Process { + 'Calling method: UserApi-GetUserByName' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.GetUserByName( + ${username} + ) + } +} + +function Invoke-UserApiLoginUser { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${username}, + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${password} + ) + + Process { + 'Calling method: UserApi-LoginUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.LoginUser( + ${username}, + ${password} + ) + } +} + +function Invoke-UserApiLogoutUser { + [CmdletBinding()] + Param ( + ) + + Process { + 'Calling method: UserApi-LogoutUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.LogoutUser( + ) + } +} + +function Invoke-UserApiUpdateUser { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${username}, + [Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.User] + ${body} + ) + + Process { + 'Calling method: UserApi-UpdateUser' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:UserApi.UpdateUser( + ${username}, + ${body} + ) + } +} + diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/IO.Swagger.psm1 b/samples/client/petstore/powershell_test/src/IO.Swagger/IO.Swagger.psm1 new file mode 100644 index 00000000000..9b253e2fcee --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/IO.Swagger.psm1 @@ -0,0 +1,29 @@ +#region Import functions + +'API', 'Model', 'Private' | Get-ChildItem -Path { + Join-Path $PSScriptRoot $_ +} -Filter '*.ps1' | ForEach-Object { + Write-Verbose "Importing file: $($_.BaseName)" + try { + . $_.FullName + } catch { + Write-Verbose "Can't import function!" + } +} + +#endregion + + +#region Initialize APIs + +'Creating object: IO.Swagger.Api.PetApi' | Write-Verbose +$Script:PetApi= New-Object -TypeName IO.Swagger.Api.PetApi -ArgumentList @($null) + +'Creating object: IO.Swagger.Api.StoreApi' | Write-Verbose +$Script:StoreApi= New-Object -TypeName IO.Swagger.Api.StoreApi -ArgumentList @($null) + +'Creating object: IO.Swagger.Api.UserApi' | Write-Verbose +$Script:UserApi= New-Object -TypeName IO.Swagger.Api.UserApi -ArgumentList @($null) + + +#endregion diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-ApiResponse.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-ApiResponse.ps1 new file mode 100644 index 00000000000..f5fcdd09b71 --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-ApiResponse.ps1 @@ -0,0 +1,25 @@ +function New-ApiResponse { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${code}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${type}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${message} + ) + + Process { + 'Creating object: IO.Swagger.Model.ApiResponse' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.ApiResponse -ArgumentList @( + ${code}, + ${type}, + ${message} + ) + } +} diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Category.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Category.ps1 new file mode 100644 index 00000000000..9009a971945 --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Category.ps1 @@ -0,0 +1,21 @@ +function New-Category { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${name} + ) + + Process { + 'Creating object: IO.Swagger.Model.Category' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Category -ArgumentList @( + ${id}, + ${name} + ) + } +} diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Order.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Order.ps1 new file mode 100644 index 00000000000..199952c4e18 --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Order.ps1 @@ -0,0 +1,37 @@ +function New-Order { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${petId}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${quantity}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[System.DateTime]] + ${shipDate}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${status}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Boolean]] + ${complete} + ) + + Process { + 'Creating object: IO.Swagger.Model.Order' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Order -ArgumentList @( + ${id}, + ${petId}, + ${quantity}, + ${shipDate}, + ${status}, + ${complete} + ) + } +} diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Pet.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Pet.ps1 new file mode 100644 index 00000000000..1e434e8cada --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Pet.ps1 @@ -0,0 +1,37 @@ +function New-Pet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[IO.Swagger.Model.Category]] + ${category}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String] + ${name}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [String[]] + ${photoUrls}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[IO.Swagger.Model.Tag[]]] + ${tags}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${status} + ) + + Process { + 'Creating object: IO.Swagger.Model.Pet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Pet -ArgumentList @( + ${id}, + ${category}, + ${name}, + ${photoUrls}, + ${tags}, + ${status} + ) + } +} diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Tag.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Tag.ps1 new file mode 100644 index 00000000000..2d333643afe --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-Tag.ps1 @@ -0,0 +1,21 @@ +function New-Tag { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${name} + ) + + Process { + 'Creating object: IO.Swagger.Model.Tag' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Tag -ArgumentList @( + ${id}, + ${name} + ) + } +} diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-User.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-User.ps1 new file mode 100644 index 00000000000..011ffdef5cb --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/Model/New-User.ps1 @@ -0,0 +1,45 @@ +function New-User { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int64]] + ${id}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${username}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${firstName}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${lastName}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${email}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${password}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${phone}, + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[Int32]] + ${userStatus} + ) + + Process { + 'Creating object: IO.Swagger.Model.User' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.User -ArgumentList @( + ${id}, + ${username}, + ${firstName}, + ${lastName}, + ${email}, + ${password}, + ${phone}, + ${userStatus} + ) + } +} diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/Private/Get-CommonParameters.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/Private/Get-CommonParameters.ps1 new file mode 100644 index 00000000000..31a0a1ff3af --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/Private/Get-CommonParameters.ps1 @@ -0,0 +1,14 @@ +<# +.Synopsis + Helper function to get common parameters (Verbose, Debug, etc.) +.Example + Get-CommonParameters +#> +function Get-CommonParameters { + function tmp { + [CmdletBinding()] + Param () + } + + (Get-Command -Name tmp -CommandType Function).Parameters.Keys +} diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/Private/Out-DebugParameter.ps1 b/samples/client/petstore/powershell_test/src/IO.Swagger/Private/Out-DebugParameter.ps1 new file mode 100644 index 00000000000..ca18c391cc1 --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/Private/Out-DebugParameter.ps1 @@ -0,0 +1,37 @@ +<# +.Synopsis + Helper function to format debug parameter output. +.Example + $PSBoundParameters | Out-DebugParameter | Write-Debug +#> +function Out-DebugParameter { + [CmdletBinding()] + Param ( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [AllowEmptyCollection()] + $InputObject + ) + + Begin { + $CommonParameters = Get-CommonParameters + } + + Process { + $InputObject.GetEnumerator() | Where-Object { + $CommonParameters -notcontains $_.Key + } | Format-Table -AutoSize -Property ( + @{ + Name = 'Parameter' + Expression = {$_.Key} + }, + @{ + Name = 'Value' + Expression = {$_.Value} + } + ) | Out-String -Stream | ForEach-Object { + if ($_.Trim()) { + $_ + } + } + } +} diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/en-US/about_IO.Swagger.help.txt b/samples/client/petstore/powershell_test/src/IO.Swagger/en-US/about_IO.Swagger.help.txt new file mode 100644 index 00000000000..d598279543b --- /dev/null +++ b/samples/client/petstore/powershell_test/src/IO.Swagger/en-US/about_IO.Swagger.help.txt @@ -0,0 +1,20 @@ +PSTOPIC + about_IO.Swagger + +SHORT DESCRIPTION + IO.Swagger - the PowerShell module for the Swagger Petstore + +LONG DESCRIPTION + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + + - API version: 1.0.0 + - SDK version: + - Build date: 2017-06-20T22:49:00.415+08:00 + - Build package: io.swagger.codegen.languages.PowerShellClientCodegen + + Frameworks supported: + + * PowerShell 3.0+ + * .NET 4.0 or later diff --git a/samples/client/petstore/powershell_test/test/ApiResponseTest.ps1 b/samples/client/petstore/powershell_test/test/ApiResponseTest.ps1 new file mode 100644 index 00000000000..1fc8f6add42 --- /dev/null +++ b/samples/client/petstore/powershell_test/test/ApiResponseTest.ps1 @@ -0,0 +1,2 @@ +## TODO we need to update the template to test the model files + diff --git a/samples/client/petstore/powershell_test/test/CategoryTest.ps1 b/samples/client/petstore/powershell_test/test/CategoryTest.ps1 new file mode 100644 index 00000000000..1fc8f6add42 --- /dev/null +++ b/samples/client/petstore/powershell_test/test/CategoryTest.ps1 @@ -0,0 +1,2 @@ +## TODO we need to update the template to test the model files + diff --git a/samples/client/petstore/powershell_test/test/OrderTest.ps1 b/samples/client/petstore/powershell_test/test/OrderTest.ps1 new file mode 100644 index 00000000000..1fc8f6add42 --- /dev/null +++ b/samples/client/petstore/powershell_test/test/OrderTest.ps1 @@ -0,0 +1,2 @@ +## TODO we need to update the template to test the model files + diff --git a/samples/client/petstore/powershell_test/test/PetApiTest.ps1 b/samples/client/petstore/powershell_test/test/PetApiTest.ps1 new file mode 100644 index 00000000000..5b21efc1aa5 --- /dev/null +++ b/samples/client/petstore/powershell_test/test/PetApiTest.ps1 @@ -0,0 +1,69 @@ +# This file is auto-generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen) +# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function + +Describe 'IO.Swagger PetApi' { + Context 'PetApi' { + It 'Invoke-PetApiAddPet' { + $ret = Invoke-PetApiGetPetById -body "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'PetApi' { + It 'Invoke-PetApiDeletePet' { + $ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" -apiKey "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'PetApi' { + It 'Invoke-PetApiFindPetsByStatus' { + $ret = Invoke-PetApiGetPetById -status "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'PetApi' { + It 'Invoke-PetApiFindPetsByTags' { + $ret = Invoke-PetApiGetPetById -tags "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'PetApi' { + It 'Invoke-PetApiGetPetById' { + $ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'PetApi' { + It 'Invoke-PetApiUpdatePet' { + $ret = Invoke-PetApiGetPetById -body "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'PetApi' { + It 'Invoke-PetApiUpdatePetWithForm' { + $ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" -name "TEST_VALUE" -status "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'PetApi' { + It 'Invoke-PetApiUploadFile' { + $ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" -additionalMetadata "TEST_VALUE" -file "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + +} diff --git a/samples/client/petstore/powershell_test/test/PetTest.ps1 b/samples/client/petstore/powershell_test/test/PetTest.ps1 new file mode 100644 index 00000000000..1fc8f6add42 --- /dev/null +++ b/samples/client/petstore/powershell_test/test/PetTest.ps1 @@ -0,0 +1,2 @@ +## TODO we need to update the template to test the model files + diff --git a/samples/client/petstore/powershell_test/test/StoreApiTest.ps1 b/samples/client/petstore/powershell_test/test/StoreApiTest.ps1 new file mode 100644 index 00000000000..de02803fe95 --- /dev/null +++ b/samples/client/petstore/powershell_test/test/StoreApiTest.ps1 @@ -0,0 +1,37 @@ +# This file is auto-generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen) +# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function + +Describe 'IO.Swagger StoreApi' { + Context 'StoreApi' { + It 'Invoke-StoreApiDeleteOrder' { + $ret = Invoke-PetApiGetPetById -orderId "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'StoreApi' { + It 'Invoke-StoreApiGetInventory' { + $ret = Invoke-PetApiGetPetById + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'StoreApi' { + It 'Invoke-StoreApiGetOrderById' { + $ret = Invoke-PetApiGetPetById -orderId "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'StoreApi' { + It 'Invoke-StoreApiPlaceOrder' { + $ret = Invoke-PetApiGetPetById -body "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + +} diff --git a/samples/client/petstore/powershell_test/test/TagTest.ps1 b/samples/client/petstore/powershell_test/test/TagTest.ps1 new file mode 100644 index 00000000000..1fc8f6add42 --- /dev/null +++ b/samples/client/petstore/powershell_test/test/TagTest.ps1 @@ -0,0 +1,2 @@ +## TODO we need to update the template to test the model files + diff --git a/samples/client/petstore/powershell_test/test/UserApiTest.ps1 b/samples/client/petstore/powershell_test/test/UserApiTest.ps1 new file mode 100644 index 00000000000..ecc58b46c1c --- /dev/null +++ b/samples/client/petstore/powershell_test/test/UserApiTest.ps1 @@ -0,0 +1,69 @@ +# This file is auto-generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen) +# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function + +Describe 'IO.Swagger UserApi' { + Context 'UserApi' { + It 'Invoke-UserApiCreateUser' { + $ret = Invoke-PetApiGetPetById -body "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'UserApi' { + It 'Invoke-UserApiCreateUsersWithArrayInput' { + $ret = Invoke-PetApiGetPetById -body "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'UserApi' { + It 'Invoke-UserApiCreateUsersWithListInput' { + $ret = Invoke-PetApiGetPetById -body "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'UserApi' { + It 'Invoke-UserApiDeleteUser' { + $ret = Invoke-PetApiGetPetById -username "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'UserApi' { + It 'Invoke-UserApiGetUserByName' { + $ret = Invoke-PetApiGetPetById -username "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'UserApi' { + It 'Invoke-UserApiLoginUser' { + $ret = Invoke-PetApiGetPetById -username "TEST_VALUE" -password "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'UserApi' { + It 'Invoke-UserApiLogoutUser' { + $ret = Invoke-PetApiGetPetById + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + + Context 'UserApi' { + It 'Invoke-UserApiUpdateUser' { + $ret = Invoke-PetApiGetPetById -username "TEST_VALUE" -body "TEST_VALUE" + #$ret | Should BeOfType IO.Swagger.Model.ModelNameHere + #$ret.property | Should Be 0 + } + } + +} diff --git a/samples/client/petstore/powershell_test/test/UserTest.ps1 b/samples/client/petstore/powershell_test/test/UserTest.ps1 new file mode 100644 index 00000000000..1fc8f6add42 --- /dev/null +++ b/samples/client/petstore/powershell_test/test/UserTest.ps1 @@ -0,0 +1,2 @@ +## TODO we need to update the template to test the model files + diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py index 3ed3cf31849..c567f731294 100644 --- a/samples/client/petstore/python/petstore_api/rest.py +++ b/samples/client/petstore/python/petstore_api/rest.py @@ -215,7 +215,7 @@ class RESTClientObject(object): # log response body logger.debug("response body: %s", r.data) - if r.status not in range(200, 206): + if not 200 <= r.status <= 299: raise ApiException(http_resp=r) return r diff --git a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp index fa57cc9c8a9..01e05241bda 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGHttpRequest.cpp @@ -15,6 +15,7 @@ #include #include #include +#include namespace Swagger { @@ -292,8 +293,16 @@ void HttpRequestWorker::execute(HttpRequestInput *input) { manager->deleteResource(request); } else { - QBuffer buff(&request_content); - manager->sendCustomRequest(request, input->http_method.toLatin1(), &buff); +#if (QT_VERSION >= 0x050800) + manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); +#else + QBuffer *buffer = new QBuffer; + buffer->setData(request_content); + buffer->open(QIODevice::ReadOnly); + + QNetworkReply* reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); + buffer->setParent(reply); +#endif } } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Configuration.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Configuration.swift index bb8625ea831..c03a10b930c 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Configuration.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Configuration.swift @@ -12,4 +12,4 @@ open class Configuration { // You must set it prior to encoding any dates, and it will only be read once. open static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" -} +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular2/default/variables.ts b/samples/client/petstore/typescript-angular2/default/variables.ts index b734b2e5918..29b7e5b1d71 100644 --- a/samples/client/petstore/typescript-angular2/default/variables.ts +++ b/samples/client/petstore/typescript-angular2/default/variables.ts @@ -1,9 +1,9 @@ -import { InjectionToken } from '@angular/core'; +import { OpaqueToken } from '@angular/core'; -export const BASE_PATH = new InjectionToken('basePath'); +export const BASE_PATH = new OpaqueToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} \ No newline at end of file +} diff --git a/samples/client/petstore/typescript-angular2/npm/variables.ts b/samples/client/petstore/typescript-angular2/npm/variables.ts index b734b2e5918..29b7e5b1d71 100644 --- a/samples/client/petstore/typescript-angular2/npm/variables.ts +++ b/samples/client/petstore/typescript-angular2/npm/variables.ts @@ -1,9 +1,9 @@ -import { InjectionToken } from '@angular/core'; +import { OpaqueToken } from '@angular/core'; -export const BASE_PATH = new InjectionToken('basePath'); +export const BASE_PATH = new OpaqueToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} \ No newline at end of file +} diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/variables.ts b/samples/client/petstore/typescript-angular2/with-interfaces/variables.ts index b734b2e5918..29b7e5b1d71 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/variables.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/variables.ts @@ -1,9 +1,9 @@ -import { InjectionToken } from '@angular/core'; +import { OpaqueToken } from '@angular/core'; -export const BASE_PATH = new InjectionToken('basePath'); +export const BASE_PATH = new OpaqueToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} \ No newline at end of file +} diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/pom.xml b/samples/server/petstore/jaxrs-cxf-annotated-base-path/pom.xml index b12ecaa443f..307ee24ba70 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/pom.xml +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/pom.xml @@ -171,7 +171,7 @@ 4.12 1.1.7 2.5 - 3.1.8 + 3.1.11 UTF-8 diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/pom.xml b/samples/server/petstore/jaxrs-cxf-non-spring-app/pom.xml index d2fcf897e07..97d19784600 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/pom.xml +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/pom.xml @@ -171,7 +171,7 @@ 4.12 1.1.7 2.5 - 3.1.8 + 3.1.11 UTF-8 diff --git a/samples/server/petstore/jaxrs-cxf/pom.xml b/samples/server/petstore/jaxrs-cxf/pom.xml index 1410437f424..aad54511529 100644 --- a/samples/server/petstore/jaxrs-cxf/pom.xml +++ b/samples/server/petstore/jaxrs-cxf/pom.xml @@ -191,7 +191,7 @@ 1.1.7 2.5 1.1.0.Final - 3.1.8 + 3.1.11 2.8.4 UTF-8 diff --git a/samples/server/petstore/restbed/model/Pet.cpp b/samples/server/petstore/restbed/model/Pet.cpp index f047b8a883c..1889dc891a8 100644 --- a/samples/server/petstore/restbed/model/Pet.cpp +++ b/samples/server/petstore/restbed/model/Pet.cpp @@ -85,14 +85,22 @@ void Pet::setName(std::string value) { m_Name = value; } -std::vector& Pet::getPhotoUrls() +std::vector Pet::getPhotoUrls() const { return m_PhotoUrls; } -std::vector>& Pet::getTags() +void Pet::setPhotoUrls(std::vector value) +{ + m_PhotoUrls = value; +} +std::vector> Pet::getTags() const { return m_Tags; } +void Pet::setTags(std::vector> value) +{ + m_Tags = value; +} std::string Pet::getStatus() const { return m_Status; diff --git a/samples/server/petstore/restbed/model/Pet.h b/samples/server/petstore/restbed/model/Pet.h index 73234cfe145..88d223a4c3f 100644 --- a/samples/server/petstore/restbed/model/Pet.h +++ b/samples/server/petstore/restbed/model/Pet.h @@ -65,12 +65,14 @@ public: /// /// /// - std::vector& getPhotoUrls(); - /// + std::vector getPhotoUrls() const; + void setPhotoUrls(std::vector value); + /// /// /// - std::vector>& getTags(); - /// + std::vector> getTags() const; + void setTags(std::vector> value); + /// /// pet status in the store /// std::string getStatus() const;