diff --git a/bin/typescript-angular-petstore-all.sh b/bin/typescript-angular-petstore-all.sh
index c3cdf8ba34f..bc2529582bb 100755
--- a/bin/typescript-angular-petstore-all.sh
+++ b/bin/typescript-angular-petstore-all.sh
@@ -46,3 +46,7 @@ java $JAVA_OPTS -jar $executable $ags
echo "Typescript Petstore API client (v4.3 { Adding HttpClientModule over HttpModule })"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular-v4.3/npm --additional-properties ngVersion=4.3"
java $JAVA_OPTS -jar $executable $ags
+
+echo "Typescript Petstore API client (v5 { Uses latest version of ng-packagr })"
+ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular-v5/npm --additional-properties ngVersion=5"
+java $JAVA_OPTS -jar $executable $ags
\ No newline at end of file
diff --git a/bin/typescript-angular-v5-petstore-with-npm.1.sh b/bin/typescript-angular-v5-petstore-with-npm.1.sh
new file mode 100644
index 00000000000..de072d6fdaa
--- /dev/null
+++ b/bin/typescript-angular-v5-petstore-with-npm.1.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 -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular-v5/npm --additional-properties ngVersion=5"
+
+java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/windows/typescript-angular-petstore-all.bat b/bin/windows/typescript-angular-petstore-all.bat
index dff81b05a62..c82663797a6 100644
--- a/bin/windows/typescript-angular-petstore-all.bat
+++ b/bin/windows/typescript-angular-petstore-all.bat
@@ -3,5 +3,6 @@ call .\bin\windows\typescript-angular-v2-interfaces.bat
call .\bin\windows\typescript-angular-v2.bat
call .\bin\windows\typescript-angular-v4-with-npm.bat
call .\bin\windows\typescript-angular-v4.3-with-npm.bat
+call .\bin\windows\typescript-angular-v5-with-npm.bat
diff --git a/bin/windows/typescript-angular-v5-with-npm.bat b/bin/windows/typescript-angular-v5-with-npm.bat
new file mode 100644
index 00000000000..014ec35c1eb
--- /dev/null
+++ b/bin/windows/typescript-angular-v5-with-npm.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
+set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -c bin\typescript-petstore-npm.json -l typescript-angular -o samples\client\petstore\typescript-angular-v5\npm --additional-properties ngVersion=5
+
+java %JAVA_OPTS% -jar %executable% %ags%
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java
index 526fe1e2a94..d5f49bab516 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java
@@ -49,8 +49,9 @@ public TypeScriptAngularClientCodegen() {
apiPackage = "api";
modelPackage = "model";
- this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package"));
- this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package"));
+ this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package." +
+ " Required to generate a full angular package"));
+ this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package. Default is '1.0.0'"));
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,
@@ -78,7 +79,7 @@ public String getName() {
@Override
public String getHelp() {
- return "Generates a TypeScript Angular (2.x or 4.x) client library.";
+ return "Generates a TypeScript Angular (2.x - 5.x) client library.";
}
@Override
@@ -97,8 +98,18 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("README.mustache", getIndexDirectory(), "README.md"));
+ // determine NG version
+ SemVer ngVersion;
+ if (additionalProperties.containsKey(NG_VERSION)) {
+ ngVersion = new SemVer(additionalProperties.get(NG_VERSION).toString());
+ } else {
+ ngVersion = new SemVer("4.3.0");
+ LOGGER.info("generating code for Angular {} ...", ngVersion);
+ LOGGER.info(" (you can select the angular version by setting the additionalProperty ngVersion)");
+ }
+
if (additionalProperties.containsKey(NPM_NAME)) {
- addNpmPackageGeneration();
+ addNpmPackageGeneration(ngVersion);
}
if (additionalProperties.containsKey(WITH_INTERFACES)) {
@@ -112,15 +123,6 @@ public void processOpts() {
taggedUnions = Boolean.parseBoolean(additionalProperties.get(TAGGED_UNIONS).toString());
}
- // determine NG version
- SemVer ngVersion;
- if (additionalProperties.containsKey(NG_VERSION)) {
- ngVersion = new SemVer(additionalProperties.get(NG_VERSION).toString());
- } else {
- ngVersion = new SemVer("4.3.0");
- LOGGER.info("generating code for Angular {} ...", ngVersion);
- LOGGER.info(" (you can select the angular version by setting the additionalProperty ngVersion)");
- }
additionalProperties.put(NG_VERSION, ngVersion);
additionalProperties.put("injectionToken", ngVersion.atLeast("4.0.0") ? "InjectionToken" : "OpaqueToken");
additionalProperties.put("injectionTokenTyped", ngVersion.atLeast("4.0.0"));
@@ -130,7 +132,8 @@ public void processOpts() {
}
}
- private void addNpmPackageGeneration() {
+ private void addNpmPackageGeneration(SemVer ngVersion) {
+
if (additionalProperties.containsKey(NPM_NAME)) {
this.setNpmName(additionalProperties.get(NPM_NAME).toString());
}
@@ -149,6 +152,20 @@ private void addNpmPackageGeneration() {
this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString());
}
+ // for Angular 2 AOT support we will use good-old ngc,
+ // Angular Package format wasn't invented at this time and building was much more easier
+ if (!ngVersion.atLeast("4.0.0")) {
+ LOGGER.warn("Please update your legacy Angular " + ngVersion + " project to benefit from 'Angular Package Format' support.");
+ additionalProperties.put("useNgPackagr", false);
+ } else {
+ additionalProperties.put("useNgPackagr", true);
+ supportingFiles.add(new SupportingFile("ng-package.mustache", getIndexDirectory(), "ng-package.json"));
+ }
+
+ // Libraries generated with v1.x of ng-packagr will ship with AoT metadata in v3, which is intended for Angular v4.
+ // Libraries generated with v2.x of ng-packagr will ship with AoT metadata in v4, which is intended for Angular v5 (and Angular v6).
+ additionalProperties.put("useOldNgPackagr", !ngVersion.atLeast("5.0.0"));
+
//Files for building our lib
supportingFiles.add(new SupportingFile("package.mustache", getIndexDirectory(), "package.json"));
supportingFiles.add(new SupportingFile("typings.mustache", getIndexDirectory(), "typings.json"));
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/README.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/README.mustache
index 4025896cafa..7f7acecf7fe 100644
--- a/modules/swagger-codegen/src/main/resources/typescript-angular/README.mustache
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/README.mustache
@@ -2,7 +2,7 @@
### Building
-To build an compile the typescript sources to javascript use:
+To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
@@ -10,11 +10,16 @@ npm run build
### publishing
+{{#useNgPackagr}}
+First build the package than run ```npm publish dist``` (don't forget to specify the `dist` folder!)
+{{/useNgPackagr}}
+{{^useNgPackagr}}
First build the package than run ```npm publish```
+{{/useNgPackagr}}
### consuming
-navigate to the folder of your consuming project and run one of next commando's.
+Navigate to the folder of your consuming project and run one of next commands.
_published:_
@@ -22,24 +27,41 @@ _published:_
npm install {{npmName}}@{{npmVersion}} --save
```
-_unPublished (not recommended):_
+_without publishing (not recommended):_
```
+{{#useNgPackagr}}
+npm install PATH_TO_GENERATED_PACKAGE/dist --save
+{{/useNgPackagr}}
+{{^useNgPackagr}}
npm install PATH_TO_GENERATED_PACKAGE --save
+{{/useNgPackagr}}
```
_using `npm link`:_
+{{#useNgPackagr}}
+In PATH_TO_GENERATED_PACKAGE/dist:
+{{/useNgPackagr}}
+{{^useNgPackagr}}
In PATH_TO_GENERATED_PACKAGE:
+{{/useNgPackagr}}
```
npm link
```
In your project:
```
-npm link {{npmName}}@{{npmVersion}}
+npm link {{npmName}}
```
+__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
+Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
+Published packages are not effected by this issue.
+
+
+#### General usage
+
In your Angular project:
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache
index 2ee1824f5f7..82e8458f39e 100644
--- a/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache
@@ -28,8 +28,8 @@ export class Configuration {
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} contentTypes - the array of content types that are available for selection
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param contentTypes - the array of content types that are available for selection
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
@@ -47,8 +47,8 @@ export class Configuration {
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} accepts - the array of content types that are available for selection.
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param accepts - the array of content types that are available for selection.
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
@@ -69,8 +69,8 @@ export class Configuration {
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
- * @param {string} mime - MIME (Multipurpose Internet Mail Extensions)
- * @return {boolean} True if the given MIME is JSON, false otherwise.
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/ng-package.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/ng-package.mustache
new file mode 100644
index 00000000000..3b17900dc9c
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/ng-package.mustache
@@ -0,0 +1,6 @@
+{
+ "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
+ "lib": {
+ "entryFile": "index.ts"
+ }
+}
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/package.mustache
index 2c9810e8559..afc69fb7146 100644
--- a/modules/swagger-codegen/src/main/resources/typescript-angular/package.mustache
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/package.mustache
@@ -7,12 +7,20 @@
"swagger-client"
],
"license": "Unlicense",
+ {{#useNgPackagr}}
+ "scripts": {
+ "build": "ng-packagr -p ng-package.json"
+ },
+ {{/useNgPackagr}}
+ {{^useNgPackagr}}
"main": "dist/index.js",
+ "module": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
- "build": "tsc --outDir dist/",
+ "build": "ngc",
"postinstall": "npm run build"
},
+ {{/useNgPackagr}}
"peerDependencies": {
"@angular/core": "^{{ngVersion}}",
"@angular/http": "^{{ngVersion}}",
@@ -24,11 +32,13 @@
"zone.js": "^0.7.6"
},
"devDependencies": {
+ "@angular/compiler-cli": "^{{ngVersion}}",
"@angular/core": "^{{ngVersion}}",
"@angular/http": "^{{ngVersion}}",
"@angular/common": "^{{ngVersion}}",
"@angular/compiler": "^{{ngVersion}}",
- "@angular/platform-browser": "^{{ngVersion}}",
+ "@angular/platform-browser": "^{{ngVersion}}",{{#useNgPackagr}}
+ "ng-packagr": {{#useOldNgPackagr}}"^1.6.0"{{/useOldNgPackagr}}{{^useOldNgPackagr}}"^2.4.1"{{/useOldNgPackagr}},{{/useNgPackagr}}
"reflect-metadata": "^0.1.3",
"rxjs": "^5.4.0",
"zone.js": "^0.7.6",
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/tsconfig.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/tsconfig.mustache
index 3ed5f2c0b10..930d4036184 100644
--- a/modules/swagger-codegen/src/main/resources/typescript-angular/tsconfig.mustache
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/tsconfig.mustache
@@ -21,5 +21,9 @@
"filesGlob": [
"./model/*.ts",
"./api/*.ts"
- ]
+ ]{{^useNgPackagr}},
+ "angularCompilerOptions": {
+ "genDir": "dist",
+ "skipTemplateCodegen": true
+ }{{/useNgPackagr}}
}
diff --git a/samples/client/petstore/typescript-angular-v2/default/LICENSE b/samples/client/petstore/typescript-angular-v2/default/LICENSE
deleted file mode 100644
index 8dada3edaf5..00000000000
--- a/samples/client/petstore/typescript-angular-v2/default/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/samples/client/petstore/typescript-angular-v2/default/README.md b/samples/client/petstore/typescript-angular-v2/default/README.md
index d1eaaa92928..851ec448b23 100644
--- a/samples/client/petstore/typescript-angular-v2/default/README.md
+++ b/samples/client/petstore/typescript-angular-v2/default/README.md
@@ -2,7 +2,7 @@
### Building
-To build an compile the typescript sources to javascript use:
+To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
@@ -14,7 +14,7 @@ First build the package than run ```npm publish```
### consuming
-navigate to the folder of your consuming project and run one of next commando's.
+Navigate to the folder of your consuming project and run one of next commands.
_published:_
@@ -22,7 +22,7 @@ _published:_
npm install @ --save
```
-_unPublished (not recommended):_
+_without publishing (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
@@ -37,9 +37,16 @@ npm link
In your project:
```
-npm link @
+npm link
```
+__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
+Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
+Published packages are not effected by this issue.
+
+
+#### General usage
+
In your Angular project:
diff --git a/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts
index fe2b4f7b6e7..4c2f8f1af08 100644
--- a/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts
@@ -124,7 +124,7 @@ export class UserService {
/**
*
* @summary Get user by user name
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable {
return this.getUserByNameWithHttpInfo(username, extraHttpRequestParams)
@@ -365,7 +365,7 @@ export class UserService {
/**
* Get user by user name
*
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable {
diff --git a/samples/client/petstore/typescript-angular-v2/default/configuration.ts b/samples/client/petstore/typescript-angular-v2/default/configuration.ts
index 2ee1824f5f7..82e8458f39e 100644
--- a/samples/client/petstore/typescript-angular-v2/default/configuration.ts
+++ b/samples/client/petstore/typescript-angular-v2/default/configuration.ts
@@ -28,8 +28,8 @@ export class Configuration {
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} contentTypes - the array of content types that are available for selection
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param contentTypes - the array of content types that are available for selection
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
@@ -47,8 +47,8 @@ export class Configuration {
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} accepts - the array of content types that are available for selection.
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param accepts - the array of content types that are available for selection.
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
@@ -69,8 +69,8 @@ export class Configuration {
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
- * @param {string} mime - MIME (Multipurpose Internet Mail Extensions)
- * @return {boolean} True if the given MIME is JSON, false otherwise.
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
diff --git a/samples/client/petstore/typescript-angular-v2/npm/README.md b/samples/client/petstore/typescript-angular-v2/npm/README.md
index 507613134c5..1d02eea3ae8 100644
--- a/samples/client/petstore/typescript-angular-v2/npm/README.md
+++ b/samples/client/petstore/typescript-angular-v2/npm/README.md
@@ -2,7 +2,7 @@
### Building
-To build an compile the typescript sources to javascript use:
+To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
@@ -14,7 +14,7 @@ First build the package than run ```npm publish```
### consuming
-navigate to the folder of your consuming project and run one of next commando's.
+Navigate to the folder of your consuming project and run one of next commands.
_published:_
@@ -22,7 +22,7 @@ _published:_
npm install @swagger/angular2-typescript-petstore@0.0.1 --save
```
-_unPublished (not recommended):_
+_without publishing (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
@@ -37,9 +37,16 @@ npm link
In your project:
```
-npm link @swagger/angular2-typescript-petstore@0.0.1
+npm link @swagger/angular2-typescript-petstore
```
+__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
+Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
+Published packages are not effected by this issue.
+
+
+#### General usage
+
In your Angular project:
diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts
index fe2b4f7b6e7..4c2f8f1af08 100644
--- a/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts
@@ -124,7 +124,7 @@ export class UserService {
/**
*
* @summary Get user by user name
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable {
return this.getUserByNameWithHttpInfo(username, extraHttpRequestParams)
@@ -365,7 +365,7 @@ export class UserService {
/**
* Get user by user name
*
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable {
diff --git a/samples/client/petstore/typescript-angular-v2/npm/configuration.ts b/samples/client/petstore/typescript-angular-v2/npm/configuration.ts
index 2ee1824f5f7..82e8458f39e 100644
--- a/samples/client/petstore/typescript-angular-v2/npm/configuration.ts
+++ b/samples/client/petstore/typescript-angular-v2/npm/configuration.ts
@@ -28,8 +28,8 @@ export class Configuration {
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} contentTypes - the array of content types that are available for selection
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param contentTypes - the array of content types that are available for selection
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
@@ -47,8 +47,8 @@ export class Configuration {
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} accepts - the array of content types that are available for selection.
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param accepts - the array of content types that are available for selection.
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
@@ -69,8 +69,8 @@ export class Configuration {
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
- * @param {string} mime - MIME (Multipurpose Internet Mail Extensions)
- * @return {boolean} True if the given MIME is JSON, false otherwise.
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
diff --git a/samples/client/petstore/typescript-angular-v2/npm/package-lock.json b/samples/client/petstore/typescript-angular-v2/npm/package-lock.json
deleted file mode 100644
index e75509b0294..00000000000
--- a/samples/client/petstore/typescript-angular-v2/npm/package-lock.json
+++ /dev/null
@@ -1,67 +0,0 @@
-{
- "name": "@swagger/angular2-typescript-petstore",
- "version": "0.0.1",
- "lockfileVersion": 1,
- "dependencies": {
- "@angular/common": {
- "version": "2.4.10",
- "resolved": "https://registry.npmjs.org/@angular/common/-/common-2.4.10.tgz",
- "integrity": "sha1-o6aC0iKPow7CPdDrV8joh/uiaZc=",
- "dev": true
- },
- "@angular/compiler": {
- "version": "2.4.10",
- "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-2.4.10.tgz",
- "integrity": "sha1-9R/TSCCyoCx8th+89JhzxYBW+ww=",
- "dev": true
- },
- "@angular/core": {
- "version": "2.4.10",
- "resolved": "https://registry.npmjs.org/@angular/core/-/core-2.4.10.tgz",
- "integrity": "sha1-C4MgplBlll2ZhkWx9c0892m0Qeo=",
- "dev": true
- },
- "@angular/http": {
- "version": "2.4.10",
- "resolved": "https://registry.npmjs.org/@angular/http/-/http-2.4.10.tgz",
- "integrity": "sha1-/2vq3ls5yYnr8jk8SbNO69Q+lVU=",
- "dev": true
- },
- "@angular/platform-browser": {
- "version": "2.4.10",
- "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-2.4.10.tgz",
- "integrity": "sha1-y/JWCBSPtP/vlsxQBbpdez4JOQY=",
- "dev": true
- },
- "reflect-metadata": {
- "version": "0.1.10",
- "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.10.tgz",
- "integrity": "sha1-tPg3BEFqytiZiMmxVjXUfgO5NEo=",
- "dev": true
- },
- "rxjs": {
- "version": "5.4.2",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.2.tgz",
- "integrity": "sha1-KjI2/L8D31e64G/Wly/ZnlwI/Pc=",
- "dev": true
- },
- "symbol-observable": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz",
- "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=",
- "dev": true
- },
- "typescript": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.1.tgz",
- "integrity": "sha1-w8yxbdqgsjFN4DHn5v7onlujRrw=",
- "dev": true
- },
- "zone.js": {
- "version": "0.7.8",
- "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.7.8.tgz",
- "integrity": "sha1-Tz/og01EWX8mOQU6D6Q43zT//e0=",
- "dev": true
- }
- }
-}
diff --git a/samples/client/petstore/typescript-angular-v2/npm/package.json b/samples/client/petstore/typescript-angular-v2/npm/package.json
index 0e363919a9b..3991f96afcd 100644
--- a/samples/client/petstore/typescript-angular-v2/npm/package.json
+++ b/samples/client/petstore/typescript-angular-v2/npm/package.json
@@ -8,9 +8,10 @@
],
"license": "Unlicense",
"main": "dist/index.js",
+ "module": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
- "build": "tsc --outDir dist/",
+ "build": "ngc",
"postinstall": "npm run build"
},
"peerDependencies": {
@@ -24,6 +25,7 @@
"zone.js": "^0.7.6"
},
"devDependencies": {
+ "@angular/compiler-cli": "^2.0.0",
"@angular/core": "^2.0.0",
"@angular/http": "^2.0.0",
"@angular/common": "^2.0.0",
diff --git a/samples/client/petstore/typescript-angular-v2/npm/tsconfig.json b/samples/client/petstore/typescript-angular-v2/npm/tsconfig.json
index 498ee01e9dd..3983fa8d99c 100644
--- a/samples/client/petstore/typescript-angular-v2/npm/tsconfig.json
+++ b/samples/client/petstore/typescript-angular-v2/npm/tsconfig.json
@@ -21,5 +21,9 @@
"filesGlob": [
"./model/*.ts",
"./api/*.ts"
- ]
+ ],
+ "angularCompilerOptions": {
+ "genDir": "dist",
+ "skipTemplateCodegen": true
+ }
}
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/README.md b/samples/client/petstore/typescript-angular-v2/with-interfaces/README.md
index d1eaaa92928..851ec448b23 100644
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/README.md
+++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/README.md
@@ -2,7 +2,7 @@
### Building
-To build an compile the typescript sources to javascript use:
+To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
@@ -14,7 +14,7 @@ First build the package than run ```npm publish```
### consuming
-navigate to the folder of your consuming project and run one of next commando's.
+Navigate to the folder of your consuming project and run one of next commands.
_published:_
@@ -22,7 +22,7 @@ _published:_
npm install @ --save
```
-_unPublished (not recommended):_
+_without publishing (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
@@ -37,9 +37,16 @@ npm link
In your project:
```
-npm link @
+npm link
```
+__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
+Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
+Published packages are not effected by this issue.
+
+
+#### General usage
+
In your Angular project:
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApi.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApi.ts
deleted file mode 100644
index 0d1c1439c34..00000000000
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApi.ts
+++ /dev/null
@@ -1,610 +0,0 @@
-/**
- * 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.
- *
- * OpenAPI spec version: 1.0.0
- * Contact: apiteam@swagger.io
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git
- * Do not edit the class manually.
- */
-
-/* tslint:disable:no-unused-variable member-ordering */
-
-import { Inject, Injectable, Optional } from '@angular/core';
-import { Http, Headers, URLSearchParams } from '@angular/http';
-import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http';
-import { Response, ResponseContentType } from '@angular/http';
-
-import { Observable } from 'rxjs/Observable';
-import 'rxjs/add/operator/map';
-
-import * as models from '../model/models';
-import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
-import { Configuration } from '../configuration';
-import { PetApiInterface } from './PetApiInterface';
-
-
-@Injectable()
-export class PetApi implements PetApiInterface {
-
- protected basePath = 'http://petstore.swagger.io/v2';
- public defaultHeaders: Headers = new Headers();
- public configuration: Configuration = new Configuration();
-
- constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
- if (basePath) {
- this.basePath = basePath;
- }
- if (configuration) {
- this.configuration = configuration;
- }
- }
-
- /**
- *
- * @summary Add a new pet to the store
- * @param body Pet object that needs to be added to the store
- */
- public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
- return this.addPetWithHttpInfo(body, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary Deletes a pet
- * @param petId Pet id to delete
- * @param apiKey
- */
- public deletePet(petId: number, apiKey?: string, extraHttpRequestParams?: any): Observable<{}> {
- return this.deletePetWithHttpInfo(petId, apiKey, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- * Multiple status values can be provided with comma separated strings
- * @summary Finds Pets by status
- * @param status Status values that need to be considered for filter
- */
- public findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable> {
- return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
- * @summary Finds Pets by tags
- * @param tags Tags to filter by
- */
- public findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable> {
- return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- * Returns a single pet
- * @summary Find pet by ID
- * @param petId ID of pet to return
- */
- public getPetById(petId: number, extraHttpRequestParams?: any): Observable {
- return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary Update an existing pet
- * @param body Pet object that needs to be added to the store
- */
- public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
- return this.updatePetWithHttpInfo(body, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary Updates a pet in the store with form data
- * @param petId ID of pet that needs to be updated
- * @param name Updated name of the pet
- * @param status Updated status of the pet
- */
- public updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> {
- return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary uploads an image
- * @param petId ID of pet to update
- * @param additionalMetadata Additional data to pass to server
- * @param file file to upload
- */
- public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable {
- return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
-
- /**
- * Add a new pet to the store
- *
- * @param body Pet object that needs to be added to the store
- */
- public addPetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/pet';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling addPet.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // authentication (petstore_auth) required
- // oauth required
- if (this.configuration.accessToken) {
- let accessToken = typeof this.configuration.accessToken === 'function'
- ? this.configuration.accessToken()
- : this.configuration.accessToken;
- headers.set('Authorization', 'Bearer ' + accessToken);
- }
-
- headers.set('Content-Type', 'application/json');
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Post,
- headers: headers,
- body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Deletes a pet
- *
- * @param petId Pet id to delete
- * @param apiKey
- */
- public deletePetWithHttpInfo(petId: number, apiKey?: string, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/pet/${petId}'
- .replace('${' + 'petId' + '}', String(petId));
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'petId' is not null or undefined
- if (petId === null || petId === undefined) {
- throw new Error('Required parameter petId was null or undefined when calling deletePet.');
- }
- if (apiKey !== undefined && apiKey !== null) {
- headers.set('api_key', String(apiKey));
- }
-
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // authentication (petstore_auth) required
- // oauth required
- if (this.configuration.accessToken) {
- let accessToken = typeof this.configuration.accessToken === 'function'
- ? this.configuration.accessToken()
- : this.configuration.accessToken;
- headers.set('Authorization', 'Bearer ' + accessToken);
- }
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Delete,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Finds Pets by status
- * Multiple status values can be provided with comma separated strings
- * @param status Status values that need to be considered for filter
- */
- public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/pet/findByStatus';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'status' is not null or undefined
- if (status === null || status === undefined) {
- throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
- }
- if (status) {
- queryParameters.set('status', status.join(COLLECTION_FORMATS['csv']));
- }
-
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // authentication (petstore_auth) required
- // oauth required
- if (this.configuration.accessToken) {
- let accessToken = typeof this.configuration.accessToken === 'function'
- ? this.configuration.accessToken()
- : this.configuration.accessToken;
- headers.set('Authorization', 'Bearer ' + accessToken);
- }
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Get,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Finds Pets by tags
- * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
- * @param tags Tags to filter by
- */
- public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/pet/findByTags';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'tags' is not null or undefined
- if (tags === null || tags === undefined) {
- throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
- }
- if (tags) {
- queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv']));
- }
-
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // authentication (petstore_auth) required
- // oauth required
- if (this.configuration.accessToken) {
- let accessToken = typeof this.configuration.accessToken === 'function'
- ? this.configuration.accessToken()
- : this.configuration.accessToken;
- headers.set('Authorization', 'Bearer ' + accessToken);
- }
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Get,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Find pet by ID
- * Returns a single pet
- * @param petId ID of pet to return
- */
- public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/pet/${petId}'
- .replace('${' + 'petId' + '}', String(petId));
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'petId' is not null or undefined
- if (petId === null || petId === undefined) {
- throw new Error('Required parameter petId was null or undefined when calling getPetById.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // authentication (api_key) required
- if (this.configuration.apiKey) {
- headers.set('api_key', this.configuration.apiKey);
- }
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Get,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Update an existing pet
- *
- * @param body Pet object that needs to be added to the store
- */
- public updatePetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/pet';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling updatePet.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // authentication (petstore_auth) required
- // oauth required
- if (this.configuration.accessToken) {
- let accessToken = typeof this.configuration.accessToken === 'function'
- ? this.configuration.accessToken()
- : this.configuration.accessToken;
- headers.set('Authorization', 'Bearer ' + accessToken);
- }
-
- headers.set('Content-Type', 'application/json');
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Put,
- headers: headers,
- body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Updates a pet in the store with form data
- *
- * @param petId ID of pet that needs to be updated
- * @param name Updated name of the pet
- * @param status Updated status of the pet
- */
- public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/pet/${petId}'
- .replace('${' + 'petId' + '}', String(petId));
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- let formParams = new URLSearchParams();
-
- // verify required parameter 'petId' is not null or undefined
- if (petId === null || petId === undefined) {
- throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- 'application/x-www-form-urlencoded'
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // authentication (petstore_auth) required
- // oauth required
- if (this.configuration.accessToken) {
- let accessToken = typeof this.configuration.accessToken === 'function'
- ? this.configuration.accessToken()
- : this.configuration.accessToken;
- headers.set('Authorization', 'Bearer ' + accessToken);
- }
-
- headers.set('Content-Type', 'application/x-www-form-urlencoded');
-
- if (name !== undefined) {
- formParams.set('name', name);
- }
-
- if (status !== undefined) {
- formParams.set('status', status);
- }
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Post,
- headers: headers,
- body: formParams.toString(),
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * uploads an image
- *
- * @param petId ID of pet to update
- * @param additionalMetadata Additional data to pass to server
- * @param file file to upload
- */
- public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/pet/${petId}/uploadImage'
- .replace('${' + 'petId' + '}', String(petId));
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- let formParams = new URLSearchParams();
-
- // verify required parameter 'petId' is not null or undefined
- if (petId === null || petId === undefined) {
- throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- 'multipart/form-data'
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // authentication (petstore_auth) required
- // oauth required
- if (this.configuration.accessToken) {
- let accessToken = typeof this.configuration.accessToken === 'function'
- ? this.configuration.accessToken()
- : this.configuration.accessToken;
- headers.set('Authorization', 'Bearer ' + accessToken);
- }
-
- headers.set('Content-Type', 'application/x-www-form-urlencoded');
-
- if (additionalMetadata !== undefined) {
- formParams.set('additionalMetadata', additionalMetadata);
- }
-
- if (file !== undefined) {
- formParams.set('file', file);
- }
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Post,
- headers: headers,
- body: formParams.toString(),
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
-}
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApiInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApiInterface.ts
deleted file mode 100644
index 3f7c04d27db..00000000000
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/PetApiInterface.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * 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.
- *
- * OpenAPI spec version: 1.0.0
- * Contact: apiteam@swagger.io
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git
- * Do not edit the class manually.
- */
-
-import { Headers } from '@angular/http';
-
-import { Observable } from 'rxjs/Observable';
-
-import * as models from '../model/models';
-import { Configuration } from '../configuration';
-
-
-export interface PetApiInterface {
- defaultHeaders: Headers;
- configuration: Configuration;
- [others: string]: any;
-
- /**
- * Add a new pet to the store
- *
- * @param body Pet object that needs to be added to the store
- */
- addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * Deletes a pet
- *
- * @param petId Pet id to delete
- * @param apiKey
- */
- deletePet(petId: number, apiKey?: string, extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * Finds Pets by status
- * Multiple status values can be provided with comma separated strings
- * @param status Status values that need to be considered for filter
- */
- findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable>;
-
- /**
- * Finds Pets by tags
- * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
- * @param tags Tags to filter by
- */
- findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable>;
-
- /**
- * Find pet by ID
- * Returns a single pet
- * @param petId ID of pet to return
- */
- getPetById(petId: number, extraHttpRequestParams?: any): Observable;
-
- /**
- * Update an existing pet
- *
- * @param body Pet object that needs to be added to the store
- */
- updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * Updates a pet in the store with form data
- *
- * @param petId ID of pet that needs to be updated
- * @param name Updated name of the pet
- * @param status Updated status of the pet
- */
- updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * uploads an image
- *
- * @param petId ID of pet to update
- * @param additionalMetadata Additional data to pass to server
- * @param file file to upload
- */
- uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable;
-
-}
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApi.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApi.ts
deleted file mode 100644
index 137c9b76625..00000000000
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApi.ts
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * 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.
- *
- * OpenAPI spec version: 1.0.0
- * Contact: apiteam@swagger.io
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git
- * Do not edit the class manually.
- */
-
-/* tslint:disable:no-unused-variable member-ordering */
-
-import { Inject, Injectable, Optional } from '@angular/core';
-import { Http, Headers, URLSearchParams } from '@angular/http';
-import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http';
-import { Response, ResponseContentType } from '@angular/http';
-
-import { Observable } from 'rxjs/Observable';
-import 'rxjs/add/operator/map';
-
-import * as models from '../model/models';
-import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
-import { Configuration } from '../configuration';
-import { StoreApiInterface } from './StoreApiInterface';
-
-
-@Injectable()
-export class StoreApi implements StoreApiInterface {
-
- protected basePath = 'http://petstore.swagger.io/v2';
- public defaultHeaders: Headers = new Headers();
- public configuration: Configuration = new Configuration();
-
- constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
- if (basePath) {
- this.basePath = basePath;
- }
- if (configuration) {
- this.configuration = configuration;
- }
- }
-
- /**
- * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
- * @summary Delete purchase order by ID
- * @param orderId ID of the order that needs to be deleted
- */
- public deleteOrder(orderId: string, extraHttpRequestParams?: any): Observable<{}> {
- return this.deleteOrderWithHttpInfo(orderId, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- * Returns a map of status codes to quantities
- * @summary Returns pet inventories by status
- */
- public getInventory(extraHttpRequestParams?: any): Observable<{ [key: string]: number; }> {
- return this.getInventoryWithHttpInfo(extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
- * @summary Find purchase order by ID
- * @param orderId ID of pet that needs to be fetched
- */
- public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable {
- return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary Place an order for a pet
- * @param body order placed for purchasing the pet
- */
- public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable {
- return this.placeOrderWithHttpInfo(body, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
-
- /**
- * Delete purchase order by ID
- * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
- * @param orderId ID of the order that needs to be deleted
- */
- public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/store/order/${orderId}'
- .replace('${' + 'orderId' + '}', String(orderId));
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'orderId' is not null or undefined
- if (orderId === null || orderId === undefined) {
- throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Delete,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Returns pet inventories by status
- * Returns a map of status codes to quantities
- */
- public getInventoryWithHttpInfo(extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/store/inventory';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- // authentication (api_key) required
- if (this.configuration.apiKey) {
- headers.set('api_key', this.configuration.apiKey);
- }
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Get,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Find purchase order by ID
- * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
- * @param orderId ID of pet that needs to be fetched
- */
- public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/store/order/${orderId}'
- .replace('${' + 'orderId' + '}', String(orderId));
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'orderId' is not null or undefined
- if (orderId === null || orderId === undefined) {
- throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Get,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Place an order for a pet
- *
- * @param body order placed for purchasing the pet
- */
- public placeOrderWithHttpInfo(body: models.Order, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/store/order';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling placeOrder.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- headers.set('Content-Type', 'application/json');
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Post,
- headers: headers,
- body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
-}
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApiInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApiInterface.ts
deleted file mode 100644
index ca2476d8210..00000000000
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/StoreApiInterface.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.
- *
- * OpenAPI spec version: 1.0.0
- * Contact: apiteam@swagger.io
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git
- * Do not edit the class manually.
- */
-
-import { Headers } from '@angular/http';
-
-import { Observable } from 'rxjs/Observable';
-
-import * as models from '../model/models';
-import { Configuration } from '../configuration';
-
-
-export interface StoreApiInterface {
- defaultHeaders: Headers;
- configuration: Configuration;
- [others: string]: any;
-
- /**
- * Delete purchase order by ID
- * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
- * @param orderId ID of the order that needs to be deleted
- */
- deleteOrder(orderId: string, extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * Returns pet inventories by status
- * Returns a map of status codes to quantities
- */
- getInventory(extraHttpRequestParams?: any): Observable<{ [key: string]: number; }>;
-
- /**
- * Find purchase order by ID
- * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
- * @param orderId ID of pet that needs to be fetched
- */
- getOrderById(orderId: number, extraHttpRequestParams?: any): Observable;
-
- /**
- * Place an order for a pet
- *
- * @param body order placed for purchasing the pet
- */
- placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable;
-
-}
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApi.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApi.ts
deleted file mode 100644
index 1fb4f6c6f4d..00000000000
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApi.ts
+++ /dev/null
@@ -1,507 +0,0 @@
-/**
- * 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.
- *
- * OpenAPI spec version: 1.0.0
- * Contact: apiteam@swagger.io
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git
- * Do not edit the class manually.
- */
-
-/* tslint:disable:no-unused-variable member-ordering */
-
-import { Inject, Injectable, Optional } from '@angular/core';
-import { Http, Headers, URLSearchParams } from '@angular/http';
-import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http';
-import { Response, ResponseContentType } from '@angular/http';
-
-import { Observable } from 'rxjs/Observable';
-import 'rxjs/add/operator/map';
-
-import * as models from '../model/models';
-import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
-import { Configuration } from '../configuration';
-import { UserApiInterface } from './UserApiInterface';
-
-
-@Injectable()
-export class UserApi implements UserApiInterface {
-
- protected basePath = 'http://petstore.swagger.io/v2';
- public defaultHeaders: Headers = new Headers();
- public configuration: Configuration = new Configuration();
-
- constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
- if (basePath) {
- this.basePath = basePath;
- }
- if (configuration) {
- this.configuration = configuration;
- }
- }
-
- /**
- * This can only be done by the logged in user.
- * @summary Create user
- * @param body Created user object
- */
- public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> {
- return this.createUserWithHttpInfo(body, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary Creates list of users with given input array
- * @param body List of user object
- */
- public createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}> {
- return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary Creates list of users with given input array
- * @param body List of user object
- */
- public createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}> {
- return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- * This can only be done by the logged in user.
- * @summary Delete user
- * @param username The name that needs to be deleted
- */
- public deleteUser(username: string, extraHttpRequestParams?: any): Observable<{}> {
- return this.deleteUserWithHttpInfo(username, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary Get user by user name
- * @param username The name that needs to be fetched. Use user1 for testing.
- */
- public getUserByName(username: string, extraHttpRequestParams?: any): Observable {
- return this.getUserByNameWithHttpInfo(username, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary Logs user into the system
- * @param username The user name for login
- * @param password The password for login in clear text
- */
- public loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable {
- return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- *
- * @summary Logs out current logged in user session
- */
- public logoutUser(extraHttpRequestParams?: any): Observable<{}> {
- return this.logoutUserWithHttpInfo(extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
- /**
- * This can only be done by the logged in user.
- * @summary Updated user
- * @param username name that need to be deleted
- * @param body Updated user object
- */
- public updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}> {
- return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams)
- .map((response: Response) => {
- if (response.status === 204) {
- return undefined;
- } else {
- return response.json() || {};
- }
- });
- }
-
-
- /**
- * Create user
- * This can only be done by the logged in user.
- * @param body Created user object
- */
- public createUserWithHttpInfo(body: models.User, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/user';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling createUser.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- headers.set('Content-Type', 'application/json');
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Post,
- headers: headers,
- body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Creates list of users with given input array
- *
- * @param body List of user object
- */
- public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/user/createWithArray';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- headers.set('Content-Type', 'application/json');
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Post,
- headers: headers,
- body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Creates list of users with given input array
- *
- * @param body List of user object
- */
- public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/user/createWithList';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- headers.set('Content-Type', 'application/json');
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Post,
- headers: headers,
- body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Delete user
- * This can only be done by the logged in user.
- * @param username The name that needs to be deleted
- */
- public deleteUserWithHttpInfo(username: string, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/user/${username}'
- .replace('${' + 'username' + '}', String(username));
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'username' is not null or undefined
- if (username === null || username === undefined) {
- throw new Error('Required parameter username was null or undefined when calling deleteUser.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Delete,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Get user by user name
- *
- * @param username The name that needs to be fetched. Use user1 for testing.
- */
- public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/user/${username}'
- .replace('${' + 'username' + '}', String(username));
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'username' is not null or undefined
- if (username === null || username === undefined) {
- throw new Error('Required parameter username was null or undefined when calling getUserByName.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Get,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Logs user into the system
- *
- * @param username The user name for login
- * @param password The password for login in clear text
- */
- public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/user/login';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'username' is not null or undefined
- if (username === null || username === undefined) {
- throw new Error('Required parameter username was null or undefined when calling loginUser.');
- }
- // verify required parameter 'password' is not null or undefined
- if (password === null || password === undefined) {
- throw new Error('Required parameter password was null or undefined when calling loginUser.');
- }
- if (username !== undefined) {
- queryParameters.set('username', username);
- }
-
- if (password !== undefined) {
- queryParameters.set('password', password);
- }
-
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Get,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Logs out current logged in user session
- *
- */
- public logoutUserWithHttpInfo(extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/user/logout';
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Get,
- headers: headers,
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
- /**
- * Updated user
- * This can only be done by the logged in user.
- * @param username name that need to be deleted
- * @param body Updated user object
- */
- public updateUserWithHttpInfo(username: string, body: models.User, extraHttpRequestParams?: any): Observable {
- const path = this.basePath + '/user/${username}'
- .replace('${' + 'username' + '}', String(username));
-
- let queryParameters = new URLSearchParams();
- let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
- // verify required parameter 'username' is not null or undefined
- if (username === null || username === undefined) {
- throw new Error('Required parameter username was null or undefined when calling updateUser.');
- }
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling updateUser.');
- }
- // to determine the Content-Type header
- let consumes: string[] = [
- ];
-
- // to determine the Accept header
- let produces: string[] = [
- 'application/json',
- 'application/xml'
- ];
-
- headers.set('Content-Type', 'application/json');
-
- let requestOptions: RequestOptionsArgs = new RequestOptions({
- method: RequestMethod.Put,
- headers: headers,
- body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
- search: queryParameters,
- withCredentials:this.configuration.withCredentials
- });
- // https://github.com/swagger-api/swagger-codegen/issues/4037
- if (extraHttpRequestParams) {
- requestOptions = (Object).assign(requestOptions, extraHttpRequestParams);
- }
-
- return this.http.request(path, requestOptions);
- }
-
-}
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApiInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApiInterface.ts
deleted file mode 100644
index 067befa18e7..00000000000
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/UserApiInterface.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * 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.
- *
- * OpenAPI spec version: 1.0.0
- * Contact: apiteam@swagger.io
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git
- * Do not edit the class manually.
- */
-
-import { Headers } from '@angular/http';
-
-import { Observable } from 'rxjs/Observable';
-
-import * as models from '../model/models';
-import { Configuration } from '../configuration';
-
-
-export interface UserApiInterface {
- defaultHeaders: Headers;
- configuration: Configuration;
- [others: string]: any;
-
- /**
- * Create user
- * This can only be done by the logged in user.
- * @param body Created user object
- */
- createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * Creates list of users with given input array
- *
- * @param body List of user object
- */
- createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * Creates list of users with given input array
- *
- * @param body List of user object
- */
- createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * Delete user
- * This can only be done by the logged in user.
- * @param username The name that needs to be deleted
- */
- deleteUser(username: string, extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * Get user by user name
- *
- * @param username The name that needs to be fetched. Use user1 for testing.
- */
- getUserByName(username: string, extraHttpRequestParams?: any): Observable;
-
- /**
- * Logs user into the system
- *
- * @param username The user name for login
- * @param password The password for login in clear text
- */
- loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable;
-
- /**
- * Logs out current logged in user session
- *
- */
- logoutUser(extraHttpRequestParams?: any): Observable<{}>;
-
- /**
- * Updated user
- * This can only be done by the logged in user.
- * @param username name that need to be deleted
- * @param body Updated user object
- */
- updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}>;
-
-}
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts
index ccbb653e9ef..c581358c7c4 100644
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts
@@ -125,7 +125,7 @@ export class UserService implements UserServiceInterface {
/**
*
* @summary Get user by user name
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable {
return this.getUserByNameWithHttpInfo(username, extraHttpRequestParams)
@@ -366,7 +366,7 @@ export class UserService implements UserServiceInterface {
/**
* Get user by user name
*
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable {
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.serviceInterface.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.serviceInterface.ts
index f68e221df9a..24a7c857b69 100644
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.serviceInterface.ts
+++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.serviceInterface.ts
@@ -53,7 +53,7 @@ export interface UserServiceInterface {
/**
* Get user by user name
*
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
getUserByName(username: string, extraHttpRequestParams?: any): Observable;
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts
index 2ee1824f5f7..82e8458f39e 100644
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts
+++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts
@@ -28,8 +28,8 @@ export class Configuration {
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} contentTypes - the array of content types that are available for selection
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param contentTypes - the array of content types that are available for selection
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
@@ -47,8 +47,8 @@ export class Configuration {
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} accepts - the array of content types that are available for selection.
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param accepts - the array of content types that are available for selection.
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
@@ -69,8 +69,8 @@ export class Configuration {
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
- * @param {string} mime - MIME (Multipurpose Internet Mail Extensions)
- * @return {boolean} True if the given MIME is JSON, false otherwise.
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/README.md b/samples/client/petstore/typescript-angular-v4.3/npm/README.md
index 211bb2292fb..b5a6ac2a8b8 100644
--- a/samples/client/petstore/typescript-angular-v4.3/npm/README.md
+++ b/samples/client/petstore/typescript-angular-v4.3/npm/README.md
@@ -2,7 +2,7 @@
### Building
-To build an compile the typescript sources to javascript use:
+To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
@@ -10,11 +10,11 @@ npm run build
### publishing
-First build the package than run ```npm publish```
+First build the package than run ```npm publish dist``` (don't forget to specify the `dist` folder!)
### consuming
-navigate to the folder of your consuming project and run one of next commando's.
+Navigate to the folder of your consuming project and run one of next commands.
_published:_
@@ -22,24 +22,31 @@ _published:_
npm install @swagger/angular2-typescript-petstore@0.0.1 --save
```
-_unPublished (not recommended):_
+_without publishing (not recommended):_
```
-npm install PATH_TO_GENERATED_PACKAGE --save
+npm install PATH_TO_GENERATED_PACKAGE/dist --save
```
_using `npm link`:_
-In PATH_TO_GENERATED_PACKAGE:
+In PATH_TO_GENERATED_PACKAGE/dist:
```
npm link
```
In your project:
```
-npm link @swagger/angular2-typescript-petstore@0.0.1
+npm link @swagger/angular2-typescript-petstore
```
+__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
+Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
+Published packages are not effected by this issue.
+
+
+#### General usage
+
In your Angular project:
diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts
index edc7a4b4298..f37fdc3baac 100644
--- a/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts
@@ -238,7 +238,7 @@ export class UserService {
/**
* Get user by user name
*
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts b/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts
index 2ee1824f5f7..82e8458f39e 100644
--- a/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts
+++ b/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts
@@ -28,8 +28,8 @@ export class Configuration {
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} contentTypes - the array of content types that are available for selection
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param contentTypes - the array of content types that are available for selection
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
@@ -47,8 +47,8 @@ export class Configuration {
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} accepts - the array of content types that are available for selection.
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param accepts - the array of content types that are available for selection.
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
@@ -69,8 +69,8 @@ export class Configuration {
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
- * @param {string} mime - MIME (Multipurpose Internet Mail Extensions)
- * @return {boolean} True if the given MIME is JSON, false otherwise.
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/ng-package.json b/samples/client/petstore/typescript-angular-v4.3/npm/ng-package.json
new file mode 100644
index 00000000000..3b17900dc9c
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v4.3/npm/ng-package.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
+ "lib": {
+ "entryFile": "index.ts"
+ }
+}
diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/package-lock.json b/samples/client/petstore/typescript-angular-v4.3/npm/package-lock.json
deleted file mode 100644
index a7f42957533..00000000000
--- a/samples/client/petstore/typescript-angular-v4.3/npm/package-lock.json
+++ /dev/null
@@ -1,73 +0,0 @@
-{
- "name": "@swagger/angular2-typescript-petstore",
- "version": "0.0.1",
- "lockfileVersion": 1,
- "dependencies": {
- "@angular/common": {
- "version": "4.4.6",
- "resolved": "https://registry.npmjs.org/@angular/common/-/common-4.4.6.tgz",
- "integrity": "sha1-S4FCByTggooOg5uVpV6xp+g5GPI=",
- "dev": true
- },
- "@angular/compiler": {
- "version": "4.4.6",
- "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-4.4.6.tgz",
- "integrity": "sha1-LuH68lt1fh0SiXkHS+f65SmzvCA=",
- "dev": true
- },
- "@angular/core": {
- "version": "4.4.6",
- "resolved": "https://registry.npmjs.org/@angular/core/-/core-4.4.6.tgz",
- "integrity": "sha1-EwMf0Q3P5DiHVBmzjyESCVi8I1Q=",
- "dev": true
- },
- "@angular/http": {
- "version": "4.4.6",
- "resolved": "https://registry.npmjs.org/@angular/http/-/http-4.4.6.tgz",
- "integrity": "sha1-CvaAxnEL3AJtlA4iXP0PalwAXQw=",
- "dev": true
- },
- "@angular/platform-browser": {
- "version": "4.4.6",
- "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-4.4.6.tgz",
- "integrity": "sha1-qYOcVH4bZU+h0kqJeAyLpquNzOA=",
- "dev": true
- },
- "reflect-metadata": {
- "version": "0.1.10",
- "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.10.tgz",
- "integrity": "sha1-tPg3BEFqytiZiMmxVjXUfgO5NEo=",
- "dev": true
- },
- "rxjs": {
- "version": "5.5.2",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.2.tgz",
- "integrity": "sha512-oRYoIKWBU3Ic37fLA5VJu31VqQO4bWubRntcHSJ+cwaDQBwdnZ9x4zmhJfm/nFQ2E82/I4loSioHnACamrKGgA==",
- "dev": true
- },
- "symbol-observable": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz",
- "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=",
- "dev": true
- },
- "tslib": {
- "version": "1.8.0",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz",
- "integrity": "sha512-ymKWWZJST0/CkgduC2qkzjMOWr4bouhuURNXCn/inEX0L57BnRG6FhX76o7FOnsjHazCjfU2LKeSrlS2sIKQJg==",
- "dev": true
- },
- "typescript": {
- "version": "2.5.3",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz",
- "integrity": "sha512-ptLSQs2S4QuS6/OD1eAKG+S5G8QQtrU5RT32JULdZQtM1L3WTi34Wsu48Yndzi8xsObRAB9RPt/KhA9wlpEF6w==",
- "dev": true
- },
- "zone.js": {
- "version": "0.7.8",
- "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.7.8.tgz",
- "integrity": "sha1-Tz/og01EWX8mOQU6D6Q43zT//e0=",
- "dev": true
- }
- }
-}
diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/package.json b/samples/client/petstore/typescript-angular-v4.3/npm/package.json
index 05887c323e6..35ab96a80f5 100644
--- a/samples/client/petstore/typescript-angular-v4.3/npm/package.json
+++ b/samples/client/petstore/typescript-angular-v4.3/npm/package.json
@@ -7,11 +7,8 @@
"swagger-client"
],
"license": "Unlicense",
- "main": "dist/index.js",
- "typings": "dist/index.d.ts",
"scripts": {
- "build": "tsc --outDir dist/",
- "postinstall": "npm run build"
+ "build": "ng-packagr -p ng-package.json"
},
"peerDependencies": {
"@angular/core": "^4.3.0",
@@ -24,11 +21,13 @@
"zone.js": "^0.7.6"
},
"devDependencies": {
+ "@angular/compiler-cli": "^4.3.0",
"@angular/core": "^4.3.0",
"@angular/http": "^4.3.0",
"@angular/common": "^4.3.0",
"@angular/compiler": "^4.3.0",
"@angular/platform-browser": "^4.3.0",
+ "ng-packagr": "^1.6.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.4.0",
"zone.js": "^0.7.6",
diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/rxjs-operators.ts b/samples/client/petstore/typescript-angular-v4.3/npm/rxjs-operators.ts
deleted file mode 100644
index 5659cd0694f..00000000000
--- a/samples/client/petstore/typescript-angular-v4.3/npm/rxjs-operators.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
-
-// See node_module/rxjs/Rxjs.js
-// Import just the rxjs statics and operators we need for THIS app.
-
-// Statics
-import 'rxjs/add/observable/throw';
-
-// Operators
-import 'rxjs/add/operator/catch';
-import 'rxjs/add/operator/map';
diff --git a/samples/client/petstore/typescript-angular-v4/npm/README.md b/samples/client/petstore/typescript-angular-v4/npm/README.md
index 507613134c5..73c64dbafca 100644
--- a/samples/client/petstore/typescript-angular-v4/npm/README.md
+++ b/samples/client/petstore/typescript-angular-v4/npm/README.md
@@ -2,7 +2,7 @@
### Building
-To build an compile the typescript sources to javascript use:
+To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
@@ -10,11 +10,11 @@ npm run build
### publishing
-First build the package than run ```npm publish```
+First build the package than run ```npm publish dist``` (don't forget to specify the `dist` folder!)
### consuming
-navigate to the folder of your consuming project and run one of next commando's.
+Navigate to the folder of your consuming project and run one of next commands.
_published:_
@@ -22,24 +22,31 @@ _published:_
npm install @swagger/angular2-typescript-petstore@0.0.1 --save
```
-_unPublished (not recommended):_
+_without publishing (not recommended):_
```
-npm install PATH_TO_GENERATED_PACKAGE --save
+npm install PATH_TO_GENERATED_PACKAGE/dist --save
```
_using `npm link`:_
-In PATH_TO_GENERATED_PACKAGE:
+In PATH_TO_GENERATED_PACKAGE/dist:
```
npm link
```
In your project:
```
-npm link @swagger/angular2-typescript-petstore@0.0.1
+npm link @swagger/angular2-typescript-petstore
```
+__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
+Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
+Published packages are not effected by this issue.
+
+
+#### General usage
+
In your Angular project:
diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts
index fe2b4f7b6e7..4c2f8f1af08 100644
--- a/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts
@@ -124,7 +124,7 @@ export class UserService {
/**
*
* @summary Get user by user name
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable {
return this.getUserByNameWithHttpInfo(username, extraHttpRequestParams)
@@ -365,7 +365,7 @@ export class UserService {
/**
* Get user by user name
*
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable {
diff --git a/samples/client/petstore/typescript-angular-v4/npm/configuration.ts b/samples/client/petstore/typescript-angular-v4/npm/configuration.ts
index 2ee1824f5f7..82e8458f39e 100644
--- a/samples/client/petstore/typescript-angular-v4/npm/configuration.ts
+++ b/samples/client/petstore/typescript-angular-v4/npm/configuration.ts
@@ -28,8 +28,8 @@ export class Configuration {
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} contentTypes - the array of content types that are available for selection
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param contentTypes - the array of content types that are available for selection
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
@@ -47,8 +47,8 @@ export class Configuration {
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
- * @param {string[]} accepts - the array of content types that are available for selection.
- * @returns {string} the selected content-type or undefined if no selection could be made.
+ * @param accepts - the array of content types that are available for selection.
+ * @returns the selected content-type or undefined if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
@@ -69,8 +69,8 @@ export class Configuration {
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
- * @param {string} mime - MIME (Multipurpose Internet Mail Extensions)
- * @return {boolean} True if the given MIME is JSON, false otherwise.
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
diff --git a/samples/client/petstore/typescript-angular-v4/npm/ng-package.json b/samples/client/petstore/typescript-angular-v4/npm/ng-package.json
new file mode 100644
index 00000000000..3b17900dc9c
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v4/npm/ng-package.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
+ "lib": {
+ "entryFile": "index.ts"
+ }
+}
diff --git a/samples/client/petstore/typescript-angular-v4/npm/package-lock.json b/samples/client/petstore/typescript-angular-v4/npm/package-lock.json
deleted file mode 100644
index 270b88ce43f..00000000000
--- a/samples/client/petstore/typescript-angular-v4/npm/package-lock.json
+++ /dev/null
@@ -1,73 +0,0 @@
-{
- "name": "@swagger/angular2-typescript-petstore",
- "version": "0.0.1",
- "lockfileVersion": 1,
- "dependencies": {
- "@angular/common": {
- "version": "4.2.6",
- "resolved": "https://registry.npmjs.org/@angular/common/-/common-4.2.6.tgz",
- "integrity": "sha1-IQrOS9JON1+LQbpS/rNLGKiH1do=",
- "dev": true
- },
- "@angular/compiler": {
- "version": "4.2.6",
- "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-4.2.6.tgz",
- "integrity": "sha1-ZndW1JXKDUXSBhJooQ1Sr4Ofr/Q=",
- "dev": true
- },
- "@angular/core": {
- "version": "4.2.6",
- "resolved": "https://registry.npmjs.org/@angular/core/-/core-4.2.6.tgz",
- "integrity": "sha1-DByP8BV/B29KfAtyHKFCPxu+Fk4=",
- "dev": true
- },
- "@angular/http": {
- "version": "4.2.6",
- "resolved": "https://registry.npmjs.org/@angular/http/-/http-4.2.6.tgz",
- "integrity": "sha1-SZ4roLvB89cbdt6+wDTJWMrxE04=",
- "dev": true
- },
- "@angular/platform-browser": {
- "version": "4.2.6",
- "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-4.2.6.tgz",
- "integrity": "sha1-oTH/WSIl/mSWvKLJr/YSpNvd9Dc=",
- "dev": true
- },
- "reflect-metadata": {
- "version": "0.1.10",
- "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.10.tgz",
- "integrity": "sha1-tPg3BEFqytiZiMmxVjXUfgO5NEo=",
- "dev": true
- },
- "rxjs": {
- "version": "5.4.2",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.2.tgz",
- "integrity": "sha1-KjI2/L8D31e64G/Wly/ZnlwI/Pc=",
- "dev": true
- },
- "symbol-observable": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz",
- "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=",
- "dev": true
- },
- "tslib": {
- "version": "1.7.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz",
- "integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw=",
- "dev": true
- },
- "typescript": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.1.tgz",
- "integrity": "sha1-w8yxbdqgsjFN4DHn5v7onlujRrw=",
- "dev": true
- },
- "zone.js": {
- "version": "0.7.8",
- "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.7.8.tgz",
- "integrity": "sha1-Tz/og01EWX8mOQU6D6Q43zT//e0=",
- "dev": true
- }
- }
-}
diff --git a/samples/client/petstore/typescript-angular-v4/npm/package.json b/samples/client/petstore/typescript-angular-v4/npm/package.json
index b33b2586f0f..2d510066d95 100644
--- a/samples/client/petstore/typescript-angular-v4/npm/package.json
+++ b/samples/client/petstore/typescript-angular-v4/npm/package.json
@@ -7,11 +7,8 @@
"swagger-client"
],
"license": "Unlicense",
- "main": "dist/index.js",
- "typings": "dist/index.d.ts",
"scripts": {
- "build": "tsc --outDir dist/",
- "postinstall": "npm run build"
+ "build": "ng-packagr -p ng-package.json"
},
"peerDependencies": {
"@angular/core": "^4.0.0",
@@ -24,11 +21,13 @@
"zone.js": "^0.7.6"
},
"devDependencies": {
+ "@angular/compiler-cli": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
+ "ng-packagr": "^1.6.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.4.0",
"zone.js": "^0.7.6",
diff --git a/samples/client/petstore/typescript-angular-v5/npm/.gitignore b/samples/client/petstore/typescript-angular-v5/npm/.gitignore
new file mode 100644
index 00000000000..149b5765472
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/.gitignore
@@ -0,0 +1,4 @@
+wwwroot/*.js
+node_modules
+typings
+dist
diff --git a/samples/client/petstore/typescript-angular-v5/npm/.swagger-codegen-ignore b/samples/client/petstore/typescript-angular-v5/npm/.swagger-codegen-ignore
new file mode 100644
index 00000000000..c5fa491b4c5
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/.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/typescript-angular-v5/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v5/npm/.swagger-codegen/VERSION
new file mode 100644
index 00000000000..855ff9501eb
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/.swagger-codegen/VERSION
@@ -0,0 +1 @@
+2.4.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/typescript-angular-v5/npm/README.md b/samples/client/petstore/typescript-angular-v5/npm/README.md
new file mode 100644
index 00000000000..b5a6ac2a8b8
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/README.md
@@ -0,0 +1,178 @@
+## @swagger/angular2-typescript-petstore@0.0.1
+
+### Building
+
+To install the required dependencies and to build the typescript sources run:
+```
+npm install
+npm run build
+```
+
+### publishing
+
+First build the package than run ```npm publish dist``` (don't forget to specify the `dist` folder!)
+
+### consuming
+
+Navigate to the folder of your consuming project and run one of next commands.
+
+_published:_
+
+```
+npm install @swagger/angular2-typescript-petstore@0.0.1 --save
+```
+
+_without publishing (not recommended):_
+
+```
+npm install PATH_TO_GENERATED_PACKAGE/dist --save
+```
+
+_using `npm link`:_
+
+In PATH_TO_GENERATED_PACKAGE/dist:
+```
+npm link
+```
+
+In your project:
+```
+npm link @swagger/angular2-typescript-petstore
+```
+
+__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
+Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
+Published packages are not effected by this issue.
+
+
+#### General usage
+
+In your Angular project:
+
+
+```
+// without configuring providers
+import { ApiModule } from '@swagger/angular2-typescript-petstore';
+import { HttpClientModule } from '@angular/common/http';
+
+
+@NgModule({
+ imports: [
+ ApiModule,
+ // make sure to import the HttpClientModule in the AppModule only,
+ // see https://github.com/angular/angular/issues/20575
+ HttpClientModule
+ ],
+ declarations: [ AppComponent ],
+ providers: [],
+ bootstrap: [ AppComponent ]
+})
+export class AppModule {}
+```
+
+```
+// configuring providers
+import { ApiModule, Configuration, ConfigurationParameters } from '@swagger/angular2-typescript-petstore';
+
+export function apiConfigFactory (): Configuration => {
+ const params: ConfigurationParameters = {
+ // set configuration parameters here.
+ }
+ return new Configuration(params);
+}
+
+@NgModule({
+ imports: [ ApiModule.forRoot(apiConfigFactory) ],
+ declarations: [ AppComponent ],
+ providers: [],
+ bootstrap: [ AppComponent ]
+})
+export class AppModule {}
+```
+
+```
+import { DefaultApi } from '@swagger/angular2-typescript-petstore';
+
+export class AppComponent {
+ constructor(private apiGateway: DefaultApi) { }
+}
+```
+
+Note: The ApiModule is restricted to being instantiated once app wide.
+This is to ensure that all services are treated as singletons.
+
+#### Using multiple swagger files / APIs / ApiModules
+In order to use multiple `ApiModules` generated from different swagger files,
+you can create an alias name when importing the modules
+in order to avoid naming conflicts:
+```
+import { ApiModule } from 'my-api-path';
+import { ApiModule as OtherApiModule } from 'my-other-api-path';
+import { HttpClientModule } from '@angular/common/http';
+
+
+@NgModule({
+ imports: [
+ ApiModule,
+ OtherApiModule,
+ // make sure to import the HttpClientModule in the AppModule only,
+ // see https://github.com/angular/angular/issues/20575
+ HttpClientModule
+ ]
+})
+export class AppModule {
+
+}
+```
+
+
+### Set service base path
+If different than the generated base path, during app bootstrap, you can provide the base path to your service.
+
+```
+import { BASE_PATH } from '@swagger/angular2-typescript-petstore';
+
+bootstrap(AppComponent, [
+ { provide: BASE_PATH, useValue: 'https://your-web-service.com' },
+]);
+```
+or
+
+```
+import { BASE_PATH } from '@swagger/angular2-typescript-petstore';
+
+@NgModule({
+ imports: [],
+ declarations: [ AppComponent ],
+ providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
+ bootstrap: [ AppComponent ]
+})
+export class AppModule {}
+```
+
+
+#### Using @angular/cli
+First extend your `src/environments/*.ts` files by adding the corresponding base path:
+
+```
+export const environment = {
+ production: false,
+ API_BASE_PATH: 'http://127.0.0.1:8080'
+};
+```
+
+In the src/app/app.module.ts:
+```
+import { BASE_PATH } from '@swagger/angular2-typescript-petstore';
+import { environment } from '../environments/environment';
+
+@NgModule({
+ declarations: [
+ AppComponent
+ ],
+ imports: [ ],
+ providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
+ bootstrap: [ AppComponent ]
+})
+export class AppModule { }
+```
\ No newline at end of file
diff --git a/samples/client/petstore/typescript-angular-v5/npm/api.module.ts b/samples/client/petstore/typescript-angular-v5/npm/api.module.ts
new file mode 100644
index 00000000000..72f2a15ddcb
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/api.module.ts
@@ -0,0 +1,37 @@
+import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
+import { Configuration } from './configuration';
+import { HttpClient } from '@angular/common/http';
+
+
+import { PetService } from './api/pet.service';
+import { StoreService } from './api/store.service';
+import { UserService } from './api/user.service';
+
+@NgModule({
+ imports: [],
+ declarations: [],
+ exports: [],
+ providers: [
+ PetService,
+ StoreService,
+ UserService ]
+})
+export class ApiModule {
+ public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
+ return {
+ ngModule: ApiModule,
+ providers: [ { provide: Configuration, useFactory: configurationFactory } ]
+ }
+ }
+
+ constructor( @Optional() @SkipSelf() parentModule: ApiModule,
+ @Optional() http: HttpClient) {
+ if (parentModule) {
+ throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
+ }
+ if (!http) {
+ throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
+ 'See also https://github.com/angular/angular/issues/20575');
+ }
+ }
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/api/api.ts b/samples/client/petstore/typescript-angular-v5/npm/api/api.ts
new file mode 100644
index 00000000000..8e44b64083d
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/api/api.ts
@@ -0,0 +1,7 @@
+export * from './pet.service';
+import { PetService } from './pet.service';
+export * from './store.service';
+import { StoreService } from './store.service';
+export * from './user.service';
+import { UserService } from './user.service';
+export const APIS = [PetService, StoreService, UserService];
diff --git a/samples/client/petstore/typescript-angular-v5/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v5/npm/api/pet.service.ts
new file mode 100644
index 00000000000..5dc987751bc
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/api/pet.service.ts
@@ -0,0 +1,525 @@
+/**
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+/* tslint:disable:no-unused-variable member-ordering */
+
+import { Inject, Injectable, Optional } from '@angular/core';
+import { HttpClient, HttpHeaders, HttpParams,
+ HttpResponse, HttpEvent } from '@angular/common/http';
+import { CustomHttpUrlEncodingCodec } from '../encoder';
+
+import { Observable } from 'rxjs/Observable';
+
+import { ApiResponse } from '../model/apiResponse';
+import { Pet } from '../model/pet';
+
+import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
+import { Configuration } from '../configuration';
+
+
+@Injectable()
+export class PetService {
+
+ protected basePath = 'http://petstore.swagger.io/v2';
+ public defaultHeaders = new HttpHeaders();
+ public configuration = new Configuration();
+
+ constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
+ if (basePath) {
+ this.basePath = basePath;
+ }
+ if (configuration) {
+ this.configuration = configuration;
+ this.basePath = basePath || configuration.basePath || this.basePath;
+ }
+ }
+
+ /**
+ * @param consumes string[] mime-types
+ * @return true: consumes contains 'multipart/form-data', false: otherwise
+ */
+ private canConsumeForm(consumes: string[]): boolean {
+ const form = 'multipart/form-data';
+ for (let consume of consumes) {
+ if (form === consume) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Add a new pet to the store
+ *
+ * @param body Pet object that needs to be added to the store
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public addPet(body: Pet, observe?: 'body', reportProgress?: boolean): Observable;
+ public addPet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable>;
+ public addPet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable>;
+ public addPet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling addPet.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // authentication (petstore_auth) required
+ if (this.configuration.accessToken) {
+ let accessToken = typeof this.configuration.accessToken === 'function'
+ ? this.configuration.accessToken()
+ : this.configuration.accessToken;
+ headers = headers.set('Authorization', 'Bearer ' + accessToken);
+ }
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ 'application/json',
+ 'application/xml'
+ ];
+ let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes);
+ if (httpContentTypeSelected != undefined) {
+ headers = headers.set("Content-Type", httpContentTypeSelected);
+ }
+
+ return this.httpClient.post(`${this.basePath}/pet`,
+ body,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Deletes a pet
+ *
+ * @param petId Pet id to delete
+ * @param apiKey
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public deletePet(petId: number, apiKey?: string, observe?: 'body', reportProgress?: boolean): Observable;
+ public deletePet(petId: number, apiKey?: string, observe?: 'response', reportProgress?: boolean): Observable>;
+ public deletePet(petId: number, apiKey?: string, observe?: 'events', reportProgress?: boolean): Observable>;
+ public deletePet(petId: number, apiKey?: string, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (petId === null || petId === undefined) {
+ throw new Error('Required parameter petId was null or undefined when calling deletePet.');
+ }
+
+ let headers = this.defaultHeaders;
+ if (apiKey !== undefined && apiKey !== null) {
+ headers = headers.set('api_key', String(apiKey));
+ }
+
+ // authentication (petstore_auth) required
+ if (this.configuration.accessToken) {
+ let accessToken = typeof this.configuration.accessToken === 'function'
+ ? this.configuration.accessToken()
+ : this.configuration.accessToken;
+ headers = headers.set('Authorization', 'Bearer ' + accessToken);
+ }
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.delete(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Finds Pets by status
+ * Multiple status values can be provided with comma separated strings
+ * @param status Status values that need to be considered for filter
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'body', reportProgress?: boolean): Observable>;
+ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'response', reportProgress?: boolean): Observable>>;
+ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'events', reportProgress?: boolean): Observable>>;
+ public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (status === null || status === undefined) {
+ throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
+ }
+
+ let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
+ if (status) {
+ queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv']));
+ }
+
+ let headers = this.defaultHeaders;
+
+ // authentication (petstore_auth) required
+ if (this.configuration.accessToken) {
+ let accessToken = typeof this.configuration.accessToken === 'function'
+ ? this.configuration.accessToken()
+ : this.configuration.accessToken;
+ headers = headers.set('Authorization', 'Bearer ' + accessToken);
+ }
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.get>(`${this.basePath}/pet/findByStatus`,
+ {
+ params: queryParameters,
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Finds Pets by tags
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ * @param tags Tags to filter by
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public findPetsByTags(tags: Array, observe?: 'body', reportProgress?: boolean): Observable>;
+ public findPetsByTags(tags: Array, observe?: 'response', reportProgress?: boolean): Observable>>;
+ public findPetsByTags(tags: Array, observe?: 'events', reportProgress?: boolean): Observable>>;
+ public findPetsByTags(tags: Array, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (tags === null || tags === undefined) {
+ throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
+ }
+
+ let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
+ if (tags) {
+ queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv']));
+ }
+
+ let headers = this.defaultHeaders;
+
+ // authentication (petstore_auth) required
+ if (this.configuration.accessToken) {
+ let accessToken = typeof this.configuration.accessToken === 'function'
+ ? this.configuration.accessToken()
+ : this.configuration.accessToken;
+ headers = headers.set('Authorization', 'Bearer ' + accessToken);
+ }
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.get>(`${this.basePath}/pet/findByTags`,
+ {
+ params: queryParameters,
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Find pet by ID
+ * Returns a single pet
+ * @param petId ID of pet to return
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public getPetById(petId: number, observe?: 'body', reportProgress?: boolean): Observable;
+ public getPetById(petId: number, observe?: 'response', reportProgress?: boolean): Observable>;
+ public getPetById(petId: number, observe?: 'events', reportProgress?: boolean): Observable>;
+ public getPetById(petId: number, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (petId === null || petId === undefined) {
+ throw new Error('Required parameter petId was null or undefined when calling getPetById.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // authentication (api_key) required
+ if (this.configuration.apiKeys["api_key"]) {
+ headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
+ }
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Update an existing pet
+ *
+ * @param body Pet object that needs to be added to the store
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public updatePet(body: Pet, observe?: 'body', reportProgress?: boolean): Observable;
+ public updatePet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable>;
+ public updatePet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable>;
+ public updatePet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling updatePet.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // authentication (petstore_auth) required
+ if (this.configuration.accessToken) {
+ let accessToken = typeof this.configuration.accessToken === 'function'
+ ? this.configuration.accessToken()
+ : this.configuration.accessToken;
+ headers = headers.set('Authorization', 'Bearer ' + accessToken);
+ }
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ 'application/json',
+ 'application/xml'
+ ];
+ let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes);
+ if (httpContentTypeSelected != undefined) {
+ headers = headers.set("Content-Type", httpContentTypeSelected);
+ }
+
+ return this.httpClient.put(`${this.basePath}/pet`,
+ body,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Updates a pet in the store with form data
+ *
+ * @param petId ID of pet that needs to be updated
+ * @param name Updated name of the pet
+ * @param status Updated status of the pet
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'body', reportProgress?: boolean): Observable;
+ public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'response', reportProgress?: boolean): Observable>;
+ public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'events', reportProgress?: boolean): Observable>;
+ public updatePetWithForm(petId: number, name?: string, status?: string, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (petId === null || petId === undefined) {
+ throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // authentication (petstore_auth) required
+ if (this.configuration.accessToken) {
+ let accessToken = typeof this.configuration.accessToken === 'function'
+ ? this.configuration.accessToken()
+ : this.configuration.accessToken;
+ headers = headers.set('Authorization', 'Bearer ' + accessToken);
+ }
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ 'application/x-www-form-urlencoded'
+ ];
+
+ const canConsumeForm = this.canConsumeForm(consumes);
+
+ let formParams: { append(param: string, value: any): void; };
+ let useForm = false;
+ let convertFormParamsToString = false;
+ if (useForm) {
+ formParams = new FormData();
+ } else {
+ formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
+ }
+
+ if (name !== undefined) {
+ formParams = formParams.append('name', name) || formParams;
+ }
+ if (status !== undefined) {
+ formParams = formParams.append('status', status) || formParams;
+ }
+
+ return this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
+ convertFormParamsToString ? formParams.toString() : formParams,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * uploads an image
+ *
+ * @param petId ID of pet to update
+ * @param additionalMetadata Additional data to pass to server
+ * @param file file to upload
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'body', reportProgress?: boolean): Observable;
+ public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'response', reportProgress?: boolean): Observable>;
+ public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'events', reportProgress?: boolean): Observable>;
+ public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (petId === null || petId === undefined) {
+ throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // authentication (petstore_auth) required
+ if (this.configuration.accessToken) {
+ let accessToken = typeof this.configuration.accessToken === 'function'
+ ? this.configuration.accessToken()
+ : this.configuration.accessToken;
+ headers = headers.set('Authorization', 'Bearer ' + accessToken);
+ }
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ 'multipart/form-data'
+ ];
+
+ const canConsumeForm = this.canConsumeForm(consumes);
+
+ let formParams: { append(param: string, value: any): void; };
+ let useForm = false;
+ let convertFormParamsToString = false;
+ // use FormData to transmit files using content-type "multipart/form-data"
+ // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
+ useForm = canConsumeForm;
+ if (useForm) {
+ formParams = new FormData();
+ } else {
+ formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
+ }
+
+ if (additionalMetadata !== undefined) {
+ formParams = formParams.append('additionalMetadata', additionalMetadata) || formParams;
+ }
+ if (file !== undefined) {
+ formParams = formParams.append('file', file) || formParams;
+ }
+
+ return this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
+ convertFormParamsToString ? formParams.toString() : formParams,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v5/npm/api/store.service.ts
new file mode 100644
index 00000000000..7c5364e471c
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/api/store.service.ts
@@ -0,0 +1,228 @@
+/**
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+/* tslint:disable:no-unused-variable member-ordering */
+
+import { Inject, Injectable, Optional } from '@angular/core';
+import { HttpClient, HttpHeaders, HttpParams,
+ HttpResponse, HttpEvent } from '@angular/common/http';
+import { CustomHttpUrlEncodingCodec } from '../encoder';
+
+import { Observable } from 'rxjs/Observable';
+
+import { Order } from '../model/order';
+
+import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
+import { Configuration } from '../configuration';
+
+
+@Injectable()
+export class StoreService {
+
+ protected basePath = 'http://petstore.swagger.io/v2';
+ public defaultHeaders = new HttpHeaders();
+ public configuration = new Configuration();
+
+ constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
+ if (basePath) {
+ this.basePath = basePath;
+ }
+ if (configuration) {
+ this.configuration = configuration;
+ this.basePath = basePath || configuration.basePath || this.basePath;
+ }
+ }
+
+ /**
+ * @param consumes string[] mime-types
+ * @return true: consumes contains 'multipart/form-data', false: otherwise
+ */
+ private canConsumeForm(consumes: string[]): boolean {
+ const form = 'multipart/form-data';
+ for (let consume of consumes) {
+ if (form === consume) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Delete purchase order by ID
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * @param orderId ID of the order that needs to be deleted
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public deleteOrder(orderId: string, observe?: 'body', reportProgress?: boolean): Observable;
+ public deleteOrder(orderId: string, observe?: 'response', reportProgress?: boolean): Observable>;
+ public deleteOrder(orderId: string, observe?: 'events', reportProgress?: boolean): Observable>;
+ public deleteOrder(orderId: string, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (orderId === null || orderId === undefined) {
+ throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.delete(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Returns pet inventories by status
+ * Returns a map of status codes to quantities
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public getInventory(observe?: 'body', reportProgress?: boolean): Observable<{ [key: string]: number; }>;
+ public getInventory(observe?: 'response', reportProgress?: boolean): Observable>;
+ public getInventory(observe?: 'events', reportProgress?: boolean): Observable>;
+ public getInventory(observe: any = 'body', reportProgress: boolean = false ): Observable {
+
+ let headers = this.defaultHeaders;
+
+ // authentication (api_key) required
+ if (this.configuration.apiKeys["api_key"]) {
+ headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
+ }
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Find purchase order by ID
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ * @param orderId ID of pet that needs to be fetched
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public getOrderById(orderId: number, observe?: 'body', reportProgress?: boolean): Observable;
+ public getOrderById(orderId: number, observe?: 'response', reportProgress?: boolean): Observable>;
+ public getOrderById(orderId: number, observe?: 'events', reportProgress?: boolean): Observable>;
+ public getOrderById(orderId: number, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (orderId === null || orderId === undefined) {
+ throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.get(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Place an order for a pet
+ *
+ * @param body order placed for purchasing the pet
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public placeOrder(body: Order, observe?: 'body', reportProgress?: boolean): Observable;
+ public placeOrder(body: Order, observe?: 'response', reportProgress?: boolean): Observable>;
+ public placeOrder(body: Order, observe?: 'events', reportProgress?: boolean): Observable>;
+ public placeOrder(body: Order, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling placeOrder.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+ let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes);
+ if (httpContentTypeSelected != undefined) {
+ headers = headers.set("Content-Type", httpContentTypeSelected);
+ }
+
+ return this.httpClient.post(`${this.basePath}/store/order`,
+ body,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v5/npm/api/user.service.ts
new file mode 100644
index 00000000000..f37fdc3baac
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/api/user.service.ts
@@ -0,0 +1,420 @@
+/**
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+/* tslint:disable:no-unused-variable member-ordering */
+
+import { Inject, Injectable, Optional } from '@angular/core';
+import { HttpClient, HttpHeaders, HttpParams,
+ HttpResponse, HttpEvent } from '@angular/common/http';
+import { CustomHttpUrlEncodingCodec } from '../encoder';
+
+import { Observable } from 'rxjs/Observable';
+
+import { User } from '../model/user';
+
+import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
+import { Configuration } from '../configuration';
+
+
+@Injectable()
+export class UserService {
+
+ protected basePath = 'http://petstore.swagger.io/v2';
+ public defaultHeaders = new HttpHeaders();
+ public configuration = new Configuration();
+
+ constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
+ if (basePath) {
+ this.basePath = basePath;
+ }
+ if (configuration) {
+ this.configuration = configuration;
+ this.basePath = basePath || configuration.basePath || this.basePath;
+ }
+ }
+
+ /**
+ * @param consumes string[] mime-types
+ * @return true: consumes contains 'multipart/form-data', false: otherwise
+ */
+ private canConsumeForm(consumes: string[]): boolean {
+ const form = 'multipart/form-data';
+ for (let consume of consumes) {
+ if (form === consume) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Create user
+ * This can only be done by the logged in user.
+ * @param body Created user object
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public createUser(body: User, observe?: 'body', reportProgress?: boolean): Observable;
+ public createUser(body: User, observe?: 'response', reportProgress?: boolean): Observable>;
+ public createUser(body: User, observe?: 'events', reportProgress?: boolean): Observable>;
+ public createUser(body: User, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling createUser.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+ let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes);
+ if (httpContentTypeSelected != undefined) {
+ headers = headers.set("Content-Type", httpContentTypeSelected);
+ }
+
+ return this.httpClient.post(`${this.basePath}/user`,
+ body,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Creates list of users with given input array
+ *
+ * @param body List of user object
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public createUsersWithArrayInput(body: Array, observe?: 'body', reportProgress?: boolean): Observable;
+ public createUsersWithArrayInput(body: Array, observe?: 'response', reportProgress?: boolean): Observable>;
+ public createUsersWithArrayInput(body: Array, observe?: 'events', reportProgress?: boolean): Observable>;
+ public createUsersWithArrayInput(body: Array, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+ let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes);
+ if (httpContentTypeSelected != undefined) {
+ headers = headers.set("Content-Type", httpContentTypeSelected);
+ }
+
+ return this.httpClient.post(`${this.basePath}/user/createWithArray`,
+ body,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Creates list of users with given input array
+ *
+ * @param body List of user object
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public createUsersWithListInput(body: Array, observe?: 'body', reportProgress?: boolean): Observable;
+ public createUsersWithListInput(body: Array, observe?: 'response', reportProgress?: boolean): Observable>;
+ public createUsersWithListInput(body: Array, observe?: 'events', reportProgress?: boolean): Observable>;
+ public createUsersWithListInput(body: Array, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+ let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes);
+ if (httpContentTypeSelected != undefined) {
+ headers = headers.set("Content-Type", httpContentTypeSelected);
+ }
+
+ return this.httpClient.post(`${this.basePath}/user/createWithList`,
+ body,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Delete user
+ * This can only be done by the logged in user.
+ * @param username The name that needs to be deleted
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public deleteUser(username: string, observe?: 'body', reportProgress?: boolean): Observable;
+ public deleteUser(username: string, observe?: 'response', reportProgress?: boolean): Observable>;
+ public deleteUser(username: string, observe?: 'events', reportProgress?: boolean): Observable>;
+ public deleteUser(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (username === null || username === undefined) {
+ throw new Error('Required parameter username was null or undefined when calling deleteUser.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.delete(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Get user by user name
+ *
+ * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public getUserByName(username: string, observe?: 'body', reportProgress?: boolean): Observable;
+ public getUserByName(username: string, observe?: 'response', reportProgress?: boolean): Observable>;
+ public getUserByName(username: string, observe?: 'events', reportProgress?: boolean): Observable>;
+ public getUserByName(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (username === null || username === undefined) {
+ throw new Error('Required parameter username was null or undefined when calling getUserByName.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.get(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Logs user into the system
+ *
+ * @param username The user name for login
+ * @param password The password for login in clear text
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public loginUser(username: string, password: string, observe?: 'body', reportProgress?: boolean): Observable;
+ public loginUser(username: string, password: string, observe?: 'response', reportProgress?: boolean): Observable>;
+ public loginUser(username: string, password: string, observe?: 'events', reportProgress?: boolean): Observable>;
+ public loginUser(username: string, password: string, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (username === null || username === undefined) {
+ throw new Error('Required parameter username was null or undefined when calling loginUser.');
+ }
+ if (password === null || password === undefined) {
+ throw new Error('Required parameter password was null or undefined when calling loginUser.');
+ }
+
+ let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
+ if (username !== undefined) {
+ queryParameters = queryParameters.set('username', username);
+ }
+ if (password !== undefined) {
+ queryParameters = queryParameters.set('password', password);
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.get(`${this.basePath}/user/login`,
+ {
+ params: queryParameters,
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Logs out current logged in user session
+ *
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public logoutUser(observe?: 'body', reportProgress?: boolean): Observable;
+ public logoutUser(observe?: 'response', reportProgress?: boolean): Observable>;
+ public logoutUser(observe?: 'events', reportProgress?: boolean): Observable>;
+ public logoutUser(observe: any = 'body', reportProgress: boolean = false ): Observable {
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+
+ return this.httpClient.get(`${this.basePath}/user/logout`,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+ /**
+ * Updated user
+ * This can only be done by the logged in user.
+ * @param username name that need to be deleted
+ * @param body Updated user object
+ * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
+ * @param reportProgress flag to report request and response progress.
+ */
+ public updateUser(username: string, body: User, observe?: 'body', reportProgress?: boolean): Observable;
+ public updateUser(username: string, body: User, observe?: 'response', reportProgress?: boolean): Observable>;
+ public updateUser(username: string, body: User, observe?: 'events', reportProgress?: boolean): Observable>;
+ public updateUser(username: string, body: User, observe: any = 'body', reportProgress: boolean = false ): Observable {
+ if (username === null || username === undefined) {
+ throw new Error('Required parameter username was null or undefined when calling updateUser.');
+ }
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling updateUser.');
+ }
+
+ let headers = this.defaultHeaders;
+
+ // to determine the Accept header
+ let httpHeaderAccepts: string[] = [
+ 'application/xml',
+ 'application/json'
+ ];
+ let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
+ if (httpHeaderAcceptSelected != undefined) {
+ headers = headers.set("Accept", httpHeaderAcceptSelected);
+ }
+
+ // to determine the Content-Type header
+ let consumes: string[] = [
+ ];
+ let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes);
+ if (httpContentTypeSelected != undefined) {
+ headers = headers.set("Content-Type", httpContentTypeSelected);
+ }
+
+ return this.httpClient.put(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
+ body,
+ {
+ withCredentials: this.configuration.withCredentials,
+ headers: headers,
+ observe: observe,
+ reportProgress: reportProgress
+ }
+ );
+ }
+
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/configuration.ts b/samples/client/petstore/typescript-angular-v5/npm/configuration.ts
new file mode 100644
index 00000000000..82e8458f39e
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/configuration.ts
@@ -0,0 +1,79 @@
+export interface ConfigurationParameters {
+ apiKeys?: {[ key: string ]: string};
+ username?: string;
+ password?: string;
+ accessToken?: string | (() => string);
+ basePath?: string;
+ withCredentials?: boolean;
+}
+
+export class Configuration {
+ apiKeys?: {[ key: string ]: string};
+ username?: string;
+ password?: string;
+ accessToken?: string | (() => string);
+ basePath?: string;
+ withCredentials?: boolean;
+
+ constructor(configurationParameters: ConfigurationParameters = {}) {
+ this.apiKeys = configurationParameters.apiKeys;
+ this.username = configurationParameters.username;
+ this.password = configurationParameters.password;
+ this.accessToken = configurationParameters.accessToken;
+ this.basePath = configurationParameters.basePath;
+ this.withCredentials = configurationParameters.withCredentials;
+ }
+
+ /**
+ * Select the correct content-type to use for a request.
+ * Uses {@link Configuration#isJsonMime} to determine the correct content-type.
+ * If no content type is found return the first found type if the contentTypes is not empty
+ * @param contentTypes - the array of content types that are available for selection
+ * @returns the selected content-type or undefined if no selection could be made.
+ */
+ public selectHeaderContentType (contentTypes: string[]): string | undefined {
+ if (contentTypes.length == 0) {
+ return undefined;
+ }
+
+ let type = contentTypes.find(x => this.isJsonMime(x));
+ if (type === undefined) {
+ return contentTypes[0];
+ }
+ return type;
+ }
+
+ /**
+ * Select the correct accept content-type to use for a request.
+ * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
+ * If no content type is found return the first found type if the contentTypes is not empty
+ * @param accepts - the array of content types that are available for selection.
+ * @returns the selected content-type or undefined if no selection could be made.
+ */
+ public selectHeaderAccept(accepts: string[]): string | undefined {
+ if (accepts.length == 0) {
+ return undefined;
+ }
+
+ let type = accepts.find(x => this.isJsonMime(x));
+ if (type === undefined) {
+ return accepts[0];
+ }
+ return type;
+ }
+
+ /**
+ * Check if the given MIME is a JSON MIME.
+ * JSON MIME examples:
+ * application/json
+ * application/json; charset=UTF8
+ * APPLICATION/JSON
+ * application/vnd.company+json
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
+ */
+ public isJsonMime(mime: string): boolean {
+ const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
+ return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
+ }
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/encoder.ts b/samples/client/petstore/typescript-angular-v5/npm/encoder.ts
new file mode 100644
index 00000000000..f1c6b78c9c8
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/encoder.ts
@@ -0,0 +1,18 @@
+ import { HttpUrlEncodingCodec } from '@angular/common/http';
+
+/**
+* CustomHttpUrlEncodingCodec
+* Fix plus sign (+) not encoding, so sent as blank space
+* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318
+*/
+export class CustomHttpUrlEncodingCodec extends HttpUrlEncodingCodec {
+ encodeKey(k: string): string {
+ k = super.encodeKey(k);
+ return k.replace(/\+/gi, '%2B');
+ }
+ encodeValue(v: string): string {
+ v = super.encodeValue(v);
+ return v.replace(/\+/gi, '%2B');
+ }
+}
+
diff --git a/samples/client/petstore/typescript-angular-v5/npm/git_push.sh b/samples/client/petstore/typescript-angular-v5/npm/git_push.sh
new file mode 100644
index 00000000000..ae01b182ae9
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/git_push.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="GIT_USER_ID"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="GIT_REPO_ID"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=`git remote`
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
+
diff --git a/samples/client/petstore/typescript-angular-v5/npm/index.ts b/samples/client/petstore/typescript-angular-v5/npm/index.ts
new file mode 100644
index 00000000000..c312b70fa3e
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/index.ts
@@ -0,0 +1,5 @@
+export * from './api/api';
+export * from './model/models';
+export * from './variables';
+export * from './configuration';
+export * from './api.module';
\ No newline at end of file
diff --git a/samples/client/petstore/typescript-angular-v5/npm/model/apiResponse.ts b/samples/client/petstore/typescript-angular-v5/npm/model/apiResponse.ts
new file mode 100644
index 00000000000..af5590c3d85
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/model/apiResponse.ts
@@ -0,0 +1,21 @@
+/**
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+
+
+/**
+ * Describes the result of uploading an image resource
+ */
+export interface ApiResponse {
+ code?: number;
+ type?: string;
+ message?: string;
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/model/category.ts b/samples/client/petstore/typescript-angular-v5/npm/model/category.ts
new file mode 100644
index 00000000000..093bd438a38
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/model/category.ts
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+
+
+/**
+ * A category for a pet
+ */
+export interface Category {
+ id?: number;
+ name?: string;
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/model/models.ts b/samples/client/petstore/typescript-angular-v5/npm/model/models.ts
new file mode 100644
index 00000000000..8607c5dabd0
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/model/models.ts
@@ -0,0 +1,6 @@
+export * from './apiResponse';
+export * from './category';
+export * from './order';
+export * from './pet';
+export * from './tag';
+export * from './user';
diff --git a/samples/client/petstore/typescript-angular-v5/npm/model/order.ts b/samples/client/petstore/typescript-angular-v5/npm/model/order.ts
new file mode 100644
index 00000000000..6a1e1fd6bcf
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/model/order.ts
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+
+
+/**
+ * An order for a pets from the pet store
+ */
+export interface Order {
+ id?: number;
+ petId?: number;
+ quantity?: number;
+ shipDate?: Date;
+ /**
+ * Order Status
+ */
+ status?: Order.StatusEnum;
+ complete?: boolean;
+}
+export namespace Order {
+ export type StatusEnum = 'placed' | 'approved' | 'delivered';
+ export const StatusEnum = {
+ Placed: 'placed' as StatusEnum,
+ Approved: 'approved' as StatusEnum,
+ Delivered: 'delivered' as StatusEnum
+ }
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/model/pet.ts b/samples/client/petstore/typescript-angular-v5/npm/model/pet.ts
new file mode 100644
index 00000000000..b8b659008af
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/model/pet.ts
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+import { Category } from './category';
+import { Tag } from './tag';
+
+
+/**
+ * A pet for sale in the pet store
+ */
+export interface Pet {
+ id?: number;
+ category?: Category;
+ name: string;
+ photoUrls: Array;
+ tags?: Array;
+ /**
+ * pet status in the store
+ */
+ status?: Pet.StatusEnum;
+}
+export namespace Pet {
+ export type StatusEnum = 'available' | 'pending' | 'sold';
+ export const StatusEnum = {
+ Available: 'available' as StatusEnum,
+ Pending: 'pending' as StatusEnum,
+ Sold: 'sold' as StatusEnum
+ }
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/model/tag.ts b/samples/client/petstore/typescript-angular-v5/npm/model/tag.ts
new file mode 100644
index 00000000000..e35232df691
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/model/tag.ts
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+
+
+/**
+ * A tag for a pet
+ */
+export interface Tag {
+ id?: number;
+ name?: string;
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/model/user.ts b/samples/client/petstore/typescript-angular-v5/npm/model/user.ts
new file mode 100644
index 00000000000..e8788de129c
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/model/user.ts
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+
+
+/**
+ * A User who is purchasing from the pet store
+ */
+export interface User {
+ id?: number;
+ username?: string;
+ firstName?: string;
+ lastName?: string;
+ email?: string;
+ password?: string;
+ phone?: string;
+ /**
+ * User Status
+ */
+ userStatus?: number;
+}
diff --git a/samples/client/petstore/typescript-angular-v5/npm/ng-package.json b/samples/client/petstore/typescript-angular-v5/npm/ng-package.json
new file mode 100644
index 00000000000..3b17900dc9c
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/ng-package.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
+ "lib": {
+ "entryFile": "index.ts"
+ }
+}
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/package.json b/samples/client/petstore/typescript-angular-v5/npm/package.json
similarity index 59%
rename from samples/client/petstore/typescript-angular-v2/with-interfaces/package.json
rename to samples/client/petstore/typescript-angular-v5/npm/package.json
index 0e363919a9b..5542cda49cb 100644
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/package.json
+++ b/samples/client/petstore/typescript-angular-v5/npm/package.json
@@ -7,28 +7,27 @@
"swagger-client"
],
"license": "Unlicense",
- "main": "dist/index.js",
- "typings": "dist/index.d.ts",
"scripts": {
- "build": "tsc --outDir dist/",
- "postinstall": "npm run build"
+ "build": "ng-packagr -p ng-package.json"
},
"peerDependencies": {
- "@angular/core": "^2.0.0",
- "@angular/http": "^2.0.0",
- "@angular/common": "^2.0.0",
- "@angular/compiler": "^2.0.0",
+ "@angular/core": "^5.0.0",
+ "@angular/http": "^5.0.0",
+ "@angular/common": "^5.0.0",
+ "@angular/compiler": "^5.0.0",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.4.0",
"zone.js": "^0.7.6"
},
"devDependencies": {
- "@angular/core": "^2.0.0",
- "@angular/http": "^2.0.0",
- "@angular/common": "^2.0.0",
- "@angular/compiler": "^2.0.0",
- "@angular/platform-browser": "^2.0.0",
+ "@angular/compiler-cli": "^5.0.0",
+ "@angular/core": "^5.0.0",
+ "@angular/http": "^5.0.0",
+ "@angular/common": "^5.0.0",
+ "@angular/compiler": "^5.0.0",
+ "@angular/platform-browser": "^5.0.0",
+ "ng-packagr": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.4.0",
"zone.js": "^0.7.6",
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/tsconfig.json b/samples/client/petstore/typescript-angular-v5/npm/tsconfig.json
similarity index 94%
rename from samples/client/petstore/typescript-angular-v2/with-interfaces/tsconfig.json
rename to samples/client/petstore/typescript-angular-v5/npm/tsconfig.json
index a6e9096bbf7..498ee01e9dd 100644
--- a/samples/client/petstore/typescript-angular-v2/with-interfaces/tsconfig.json
+++ b/samples/client/petstore/typescript-angular-v5/npm/tsconfig.json
@@ -5,7 +5,7 @@
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"target": "es5",
- "module": "es6",
+ "module": "commonjs",
"moduleResolution": "node",
"removeComments": true,
"sourceMap": true,
diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/typings.json b/samples/client/petstore/typescript-angular-v5/npm/typings.json
similarity index 100%
rename from samples/client/petstore/typescript-angular-v2/with-interfaces/typings.json
rename to samples/client/petstore/typescript-angular-v5/npm/typings.json
diff --git a/samples/client/petstore/typescript-angular-v5/npm/variables.ts b/samples/client/petstore/typescript-angular-v5/npm/variables.ts
new file mode 100644
index 00000000000..6fe58549f39
--- /dev/null
+++ b/samples/client/petstore/typescript-angular-v5/npm/variables.ts
@@ -0,0 +1,9 @@
+import { InjectionToken } from '@angular/core';
+
+export const BASE_PATH = new InjectionToken('basePath');
+export const COLLECTION_FORMATS = {
+ 'csv': ',',
+ 'tsv': ' ',
+ 'ssv': ' ',
+ 'pipes': '|'
+}