mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 06:30:52 +00:00
Merge pull request #2676 from Vrolijkx/master
Typescript angular2 client can be published to npm
This commit is contained in:
commit
5602cb6db8
6
bin/typescript-angular2-petstore-with-npm.json
Executable file
6
bin/typescript-angular2-petstore-with-npm.json
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"npmName": "@swagger/angular2-typescript-petstore",
|
||||||
|
"npmVersion": "0.0.1",
|
||||||
|
"npmRepository" : "https://skimdb.npmjs.com/registry",
|
||||||
|
"snapshot" : true
|
||||||
|
}
|
31
bin/typescript-angular2-petstore-with-npm.sh
Executable file
31
bin/typescript-angular2-petstore-with-npm.sh
Executable file
@ -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.json -l typescript-angular2 -c bin/typescript-angular2-petstore-with-npm.json -o samples/client/petstore/typescript-angular2-with-npm"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
@ -1,15 +1,29 @@
|
|||||||
package io.swagger.codegen.languages;
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
import io.swagger.codegen.CodegenParameter;
|
import io.swagger.codegen.CodegenParameter;
|
||||||
import io.swagger.codegen.SupportingFile;
|
import io.swagger.codegen.SupportingFile;
|
||||||
import io.swagger.models.properties.ArrayProperty;
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.BooleanProperty;
|
||||||
import io.swagger.models.properties.FileProperty;
|
import io.swagger.models.properties.FileProperty;
|
||||||
import io.swagger.models.properties.MapProperty;
|
import io.swagger.models.properties.MapProperty;
|
||||||
import io.swagger.models.properties.Property;
|
import io.swagger.models.properties.Property;
|
||||||
|
|
||||||
public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCodegen {
|
public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||||
|
private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm");
|
||||||
|
|
||||||
|
public static final String NPM_NAME = "npmName";
|
||||||
|
public static final String NPM_VERSION = "npmVersion";
|
||||||
|
public static final String NPM_REPOSITORY = "npmRepository";
|
||||||
|
public static final String SNAPSHOT = "snapshot";
|
||||||
|
|
||||||
|
protected String npmName = null;
|
||||||
|
protected String npmVersion = "1.0.0";
|
||||||
|
protected String npmRepository = null;
|
||||||
|
|
||||||
public TypeScriptAngular2ClientCodegen() {
|
public TypeScriptAngular2ClientCodegen() {
|
||||||
super();
|
super();
|
||||||
@ -21,6 +35,12 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
|||||||
typeMapping.put("Date","Date");
|
typeMapping.put("Date","Date");
|
||||||
apiPackage = "api";
|
apiPackage = "api";
|
||||||
modelPackage = "model";
|
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_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
|
||||||
|
this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -36,8 +56,43 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
|||||||
@Override
|
@Override
|
||||||
public void processOpts() {
|
public void processOpts() {
|
||||||
super.processOpts();
|
super.processOpts();
|
||||||
supportingFiles.clear();
|
supportingFiles.add(new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts"));
|
||||||
supportingFiles.add(new SupportingFile("model.d.mustache", modelPackage().replace('.', File.separatorChar), "model.d.ts"));
|
supportingFiles.add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts"));
|
||||||
|
supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts"));
|
||||||
|
|
||||||
|
if(additionalProperties.containsKey(NPM_NAME)) {
|
||||||
|
addNpmPackageGeneration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addNpmPackageGeneration() {
|
||||||
|
if(additionalProperties.containsKey(NPM_NAME)) {
|
||||||
|
this.setNpmName(additionalProperties.get(NPM_NAME).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey(NPM_VERSION)) {
|
||||||
|
this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) {
|
||||||
|
this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date()));
|
||||||
|
}
|
||||||
|
additionalProperties.put(NPM_VERSION, npmVersion);
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey(NPM_REPOSITORY)) {
|
||||||
|
this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//Files for building our lib
|
||||||
|
supportingFiles.add(new SupportingFile("README.mustache", getIndexDirectory(), "README.md"));
|
||||||
|
supportingFiles.add(new SupportingFile("package.mustache", getIndexDirectory(), "package.json"));
|
||||||
|
supportingFiles.add(new SupportingFile("typings.mustache", getIndexDirectory(), "typings.json"));
|
||||||
|
supportingFiles.add(new SupportingFile("tsconfig.mustache", getIndexDirectory(), "tsconfig.json"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getIndexDirectory() {
|
||||||
|
String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.')));
|
||||||
|
return indexPackage.replace('.', File.separatorChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,7 +124,7 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
|||||||
if (languageSpecificPrimitives.contains(type))
|
if (languageSpecificPrimitives.contains(type))
|
||||||
return type;
|
return type;
|
||||||
} else
|
} else
|
||||||
type = "model." + swaggerType;
|
type = "models." + swaggerType;
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,4 +133,28 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
|||||||
super.postProcessParameter(parameter);
|
super.postProcessParameter(parameter);
|
||||||
parameter.dataType = addModelPrefix(parameter.dataType);
|
parameter.dataType = addModelPrefix(parameter.dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNpmName() {
|
||||||
|
return npmName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNpmName(String npmName) {
|
||||||
|
this.npmName = npmName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNpmVersion() {
|
||||||
|
return npmVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNpmVersion(String npmVersion) {
|
||||||
|
this.npmVersion = npmVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNpmRepository() {
|
||||||
|
return npmRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNpmRepository(String npmRepository) {
|
||||||
|
this.npmRepository = npmRepository;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
## {{npmName}}@{{npmVersion}}
|
||||||
|
|
||||||
|
### Building
|
||||||
|
|
||||||
|
To build an compile the typescript sources to javascript use:
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### publishing
|
||||||
|
|
||||||
|
First build the package than run ```npm publish```
|
||||||
|
|
||||||
|
### consuming
|
||||||
|
|
||||||
|
navigate to the folder of your consuming project and run one of next commando's.
|
||||||
|
|
||||||
|
_published:_
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install {{npmName}}@{{npmVersion}} --save
|
||||||
|
```
|
||||||
|
|
||||||
|
_unPublished (not recommended):_
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||||
|
```
|
||||||
|
|
||||||
|
In your angular2 project:
|
||||||
|
|
||||||
|
TODO: paste example.
|
@ -1,7 +1,7 @@
|
|||||||
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
||||||
import {Injectable} from 'angular2/core';
|
import {Injectable} from 'angular2/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import * as model from "../model/model.d.ts"
|
import * as models from '../model/models';
|
||||||
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ export class {{classname}} {
|
|||||||
{{/hasFormParams}}
|
{{/hasFormParams}}
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
{{#models}}
|
|
||||||
{{#model}}
|
|
||||||
export * from './{{{ classname }}}';
|
|
||||||
{{/model}}
|
|
||||||
{{/models}}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{{#apiInfo}}
|
{{#apiInfo}}
|
||||||
{{#apis}}
|
{{#apis}}
|
||||||
{{#operations}}
|
{{#operations}}
|
@ -0,0 +1,2 @@
|
|||||||
|
export * from './api/api';
|
||||||
|
export * from './model/models';
|
@ -1,14 +1,14 @@
|
|||||||
{{#models}}
|
{{#models}}
|
||||||
{{#model}}
|
{{#model}}
|
||||||
'use strict';
|
'use strict';
|
||||||
import * as model from "./model.d.ts"
|
import * as models from './models';
|
||||||
|
|
||||||
{{#description}}
|
{{#description}}
|
||||||
/**
|
/**
|
||||||
* {{{description}}}
|
* {{{description}}}
|
||||||
*/
|
*/
|
||||||
{{/description}}
|
{{/description}}
|
||||||
export interface {{classname}} {{#parent}}extends model.{{{parent}}} {{/parent}}{
|
export interface {{classname}} {{#parent}}extends models.{{{parent}}} {{/parent}}{
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
|
|
||||||
{{#description}}
|
{{#description}}
|
||||||
@ -16,7 +16,6 @@ export interface {{classname}} {{#parent}}extends model.{{{parent}}} {{/parent}}
|
|||||||
* {{{description}}}
|
* {{{description}}}
|
||||||
*/
|
*/
|
||||||
{{/description}}
|
{{/description}}
|
||||||
|
|
||||||
{{name}}?: {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
|
{{name}}?: {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
{{#models}}
|
||||||
|
{{#model}}
|
||||||
|
export * from './{{{ classname }}}';
|
||||||
|
{{/model}}
|
||||||
|
{{/models}}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "{{npmName}}",
|
||||||
|
"version": "{{npmVersion}}",
|
||||||
|
"description": "swagger client for {{npmName}}",
|
||||||
|
"keywords": [
|
||||||
|
"swagger-client"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"main": "./lib/index.js",
|
||||||
|
"typings": "./lib/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"build": "typings install && tsc"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"angular2": "^2.0.0-beta.15",
|
||||||
|
"rxjs": "^5.0.0-beta.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^1.8.10",
|
||||||
|
"typings": "^0.8.1",
|
||||||
|
"angular2": "^2.0.0-beta.15",
|
||||||
|
"es6-shim": "^0.35.0",
|
||||||
|
"es7-reflect-metadata": "^1.6.0",
|
||||||
|
"rxjs": "5.0.0-beta.2",
|
||||||
|
"zone.js": "^0.6.10"
|
||||||
|
}{{#npmRepository}},
|
||||||
|
"publishConfig":{
|
||||||
|
"registry":"{{npmRepository}}"
|
||||||
|
}
|
||||||
|
{{/npmRepository}}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
|
"target": "es5",
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"removeComments": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"outDir": "./lib",
|
||||||
|
"noLib": false,
|
||||||
|
"declaration": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"typings/main.d.ts",
|
||||||
|
"typings/main",
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"filesGlob": [
|
||||||
|
"./model/*.ts",
|
||||||
|
"./api/*.ts",
|
||||||
|
"typings/browser.d.ts"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"ambientDependencies": {
|
||||||
|
"core-js": "registry:dt/core-js#0.0.0+20160317120654"
|
||||||
|
}
|
||||||
|
}
|
@ -5,11 +5,15 @@ import com.google.common.collect.ImmutableMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import io.swagger.codegen.CodegenConstants;
|
import io.swagger.codegen.CodegenConstants;
|
||||||
|
import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen;
|
||||||
|
|
||||||
public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider {
|
public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider {
|
||||||
public static final String SORT_PARAMS_VALUE = "false";
|
public static final String SORT_PARAMS_VALUE = "false";
|
||||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||||
public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
|
public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
|
||||||
|
public static final String NMP_NAME = "npmName";
|
||||||
|
private static final String NMP_VERSION = "1.1.2";
|
||||||
|
private static final String NPM_REPOSITORY = "https://registry.npmjs.org";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLanguage() {
|
public String getLanguage() {
|
||||||
@ -22,6 +26,10 @@ public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider
|
|||||||
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||||
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE)
|
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE)
|
||||||
|
.put(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME)
|
||||||
|
.put(TypeScriptAngular2ClientCodegen.NPM_VERSION, NMP_VERSION)
|
||||||
|
.put(TypeScriptAngular2ClientCodegen.SNAPSHOT, Boolean.FALSE.toString())
|
||||||
|
.put(TypeScriptAngular2ClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,10 +119,10 @@ public class TypeScriptAngular2ModelTest {
|
|||||||
|
|
||||||
final CodegenProperty property1 = cm.vars.get(0);
|
final CodegenProperty property1 = cm.vars.get(0);
|
||||||
Assert.assertEquals(property1.baseName, "children");
|
Assert.assertEquals(property1.baseName, "children");
|
||||||
Assert.assertEquals(property1.datatype, "model.Children");
|
Assert.assertEquals(property1.datatype, "models.Children");
|
||||||
Assert.assertEquals(property1.name, "children");
|
Assert.assertEquals(property1.name, "children");
|
||||||
Assert.assertEquals(property1.defaultValue, "null");
|
Assert.assertEquals(property1.defaultValue, "null");
|
||||||
Assert.assertEquals(property1.baseType, "model.Children");
|
Assert.assertEquals(property1.baseType, "models.Children");
|
||||||
Assert.assertNull(property1.required);
|
Assert.assertNull(property1.required);
|
||||||
Assert.assertTrue(property1.isNotContainer);
|
Assert.assertTrue(property1.isNotContainer);
|
||||||
}
|
}
|
||||||
@ -143,8 +143,8 @@ public class TypeScriptAngular2ModelTest {
|
|||||||
|
|
||||||
final CodegenProperty property1 = cm.vars.get(0);
|
final CodegenProperty property1 = cm.vars.get(0);
|
||||||
Assert.assertEquals(property1.baseName, "children");
|
Assert.assertEquals(property1.baseName, "children");
|
||||||
Assert.assertEquals(property1.complexType, "model.Children");
|
Assert.assertEquals(property1.complexType, "models.Children");
|
||||||
Assert.assertEquals(property1.datatype, "Array<model.Children>");
|
Assert.assertEquals(property1.datatype, "Array<models.Children>");
|
||||||
Assert.assertEquals(property1.name, "children");
|
Assert.assertEquals(property1.name, "children");
|
||||||
Assert.assertEquals(property1.baseType, "Array");
|
Assert.assertEquals(property1.baseType, "Array");
|
||||||
Assert.assertNull(property1.required);
|
Assert.assertNull(property1.required);
|
||||||
@ -178,6 +178,6 @@ public class TypeScriptAngular2ModelTest {
|
|||||||
Assert.assertEquals(cm.description, "a map model");
|
Assert.assertEquals(cm.description, "a map model");
|
||||||
Assert.assertEquals(cm.vars.size(), 0);
|
Assert.assertEquals(cm.vars.size(), 0);
|
||||||
Assert.assertEquals(cm.imports.size(), 1);
|
Assert.assertEquals(cm.imports.size(), 1);
|
||||||
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("model.Children")).size(), 1);
|
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("models.Children")).size(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604211551
|
||||||
|
|
||||||
|
### Building
|
||||||
|
|
||||||
|
To build an compile the typescript sources to javascript use:
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### publishing
|
||||||
|
|
||||||
|
First build the package than run ```npm publish```
|
||||||
|
|
||||||
|
### consuming
|
||||||
|
|
||||||
|
navigate to the folder of your consuming project and run one of next commando's.
|
||||||
|
|
||||||
|
_published:_
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201604211551 --save
|
||||||
|
```
|
||||||
|
|
||||||
|
_unPublished (not recommended):_
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||||
|
```
|
||||||
|
|
||||||
|
In your angular2 project:
|
||||||
|
|
||||||
|
TODO: paste example.
|
@ -0,0 +1,236 @@
|
|||||||
|
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
||||||
|
import {Injectable} from 'angular2/core';
|
||||||
|
import {Observable} from 'rxjs/Observable';
|
||||||
|
import * as models from '../model/models';
|
||||||
|
|
||||||
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class PetApi {
|
||||||
|
protected basePath = 'http://petstore.swagger.io/v2';
|
||||||
|
public defaultHeaders : Headers = new Headers();
|
||||||
|
|
||||||
|
constructor(protected http: Http, basePath: string) {
|
||||||
|
if (basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<{}> {
|
||||||
|
const path = this.basePath + '/pet';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a pet
|
||||||
|
*
|
||||||
|
* @param petId Pet id to delete
|
||||||
|
* @param apiKey
|
||||||
|
*/
|
||||||
|
public deletePet (petId: number, apiKey?: string, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/pet/{petId}'
|
||||||
|
.replace('{' + 'petId' + '}', String(petId));
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
// verify required parameter 'petId' is set
|
||||||
|
if (!petId) {
|
||||||
|
throw new Error('Missing required parameter petId when calling deletePet');
|
||||||
|
}
|
||||||
|
headerParams.set('api_key', apiKey);
|
||||||
|
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by status
|
||||||
|
* Multiple status values can be provided with comma seperated strings
|
||||||
|
* @param status Status values that need to be considered for filter
|
||||||
|
*/
|
||||||
|
public findPetsByStatus (status?: models.Array<string>, extraHttpRequestParams?: any ) : Observable<Array<models.Pet>> {
|
||||||
|
const path = this.basePath + '/pet/findByStatus';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
if (status !== undefined) {
|
||||||
|
queryParameters['status'] = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by tags
|
||||||
|
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
* @param tags Tags to filter by
|
||||||
|
*/
|
||||||
|
public findPetsByTags (tags?: models.Array<string>, extraHttpRequestParams?: any ) : Observable<Array<models.Pet>> {
|
||||||
|
const path = this.basePath + '/pet/findByTags';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
if (tags !== undefined) {
|
||||||
|
queryParameters['tags'] = tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find pet by ID
|
||||||
|
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||||
|
* @param petId ID of pet that needs to be fetched
|
||||||
|
*/
|
||||||
|
public getPetById (petId: number, extraHttpRequestParams?: any ) : Observable<models.Pet> {
|
||||||
|
const path = this.basePath + '/pet/{petId}'
|
||||||
|
.replace('{' + 'petId' + '}', String(petId));
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
// verify required parameter 'petId' is set
|
||||||
|
if (!petId) {
|
||||||
|
throw new Error('Missing required parameter petId when calling getPetById');
|
||||||
|
}
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an existing pet
|
||||||
|
*
|
||||||
|
* @param body Pet object that needs to be added to the store
|
||||||
|
*/
|
||||||
|
public updatePet (body?: models.Pet, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/pet';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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: string, name?: string, status?: string, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/pet/{petId}'
|
||||||
|
.replace('{' + 'petId' + '}', String(petId));
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let formParams = new URLSearchParams();
|
||||||
|
|
||||||
|
// verify required parameter 'petId' is set
|
||||||
|
if (!petId) {
|
||||||
|
throw new Error('Missing required parameter petId when calling updatePetWithForm');
|
||||||
|
}
|
||||||
|
headerParams.set('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
|
|
||||||
|
formParams['name'] = name;
|
||||||
|
|
||||||
|
formParams['status'] = status;
|
||||||
|
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
requestOptions.body = formParams.toString();
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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?: models.any, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/pet/{petId}/uploadImage'
|
||||||
|
.replace('{' + 'petId' + '}', String(petId));
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let formParams = new URLSearchParams();
|
||||||
|
|
||||||
|
// verify required parameter 'petId' is set
|
||||||
|
if (!petId) {
|
||||||
|
throw new Error('Missing required parameter petId when calling uploadFile');
|
||||||
|
}
|
||||||
|
headerParams.set('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
|
|
||||||
|
formParams['additionalMetadata'] = additionalMetadata;
|
||||||
|
|
||||||
|
formParams['file'] = file;
|
||||||
|
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
requestOptions.body = formParams.toString();
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,111 @@
|
|||||||
|
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
||||||
|
import {Injectable} from 'angular2/core';
|
||||||
|
import {Observable} from 'rxjs/Observable';
|
||||||
|
import * as models from '../model/models';
|
||||||
|
|
||||||
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class StoreApi {
|
||||||
|
protected basePath = 'http://petstore.swagger.io/v2';
|
||||||
|
public defaultHeaders : Headers = new Headers();
|
||||||
|
|
||||||
|
constructor(protected http: Http, basePath: string) {
|
||||||
|
if (basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 deleteOrder (orderId: string, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/store/order/{orderId}'
|
||||||
|
.replace('{' + 'orderId' + '}', String(orderId));
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
// verify required parameter 'orderId' is set
|
||||||
|
if (!orderId) {
|
||||||
|
throw new Error('Missing required parameter orderId when calling deleteOrder');
|
||||||
|
}
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns pet inventories by status
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
*/
|
||||||
|
public getInventory (extraHttpRequestParams?: any ) : Observable<{ [key: string]: number; }> {
|
||||||
|
const path = this.basePath + '/store/inventory';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 getOrderById (orderId: string, extraHttpRequestParams?: any ) : Observable<models.Order> {
|
||||||
|
const path = this.basePath + '/store/order/{orderId}'
|
||||||
|
.replace('{' + 'orderId' + '}', String(orderId));
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
// verify required parameter 'orderId' is set
|
||||||
|
if (!orderId) {
|
||||||
|
throw new Error('Missing required parameter orderId when calling getOrderById');
|
||||||
|
}
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place an order for a pet
|
||||||
|
*
|
||||||
|
* @param body order placed for purchasing the pet
|
||||||
|
*/
|
||||||
|
public placeOrder (body?: models.Order, extraHttpRequestParams?: any ) : Observable<models.Order> {
|
||||||
|
const path = this.basePath + '/store/order';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,209 @@
|
|||||||
|
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
||||||
|
import {Injectable} from 'angular2/core';
|
||||||
|
import {Observable} from 'rxjs/Observable';
|
||||||
|
import * as models from '../model/models';
|
||||||
|
|
||||||
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class UserApi {
|
||||||
|
protected basePath = 'http://petstore.swagger.io/v2';
|
||||||
|
public defaultHeaders : Headers = new Headers();
|
||||||
|
|
||||||
|
constructor(protected http: Http, basePath: string) {
|
||||||
|
if (basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @param body Created user object
|
||||||
|
*/
|
||||||
|
public createUser (body?: models.User, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/user';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
* @param body List of user object
|
||||||
|
*/
|
||||||
|
public createUsersWithArrayInput (body?: models.Array<models.User>, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/user/createWithArray';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
* @param body List of user object
|
||||||
|
*/
|
||||||
|
public createUsersWithListInput (body?: models.Array<models.User>, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/user/createWithList';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @param username The name that needs to be deleted
|
||||||
|
*/
|
||||||
|
public deleteUser (username: string, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/user/{username}'
|
||||||
|
.replace('{' + 'username' + '}', String(username));
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
// verify required parameter 'username' is set
|
||||||
|
if (!username) {
|
||||||
|
throw new Error('Missing required parameter username when calling deleteUser');
|
||||||
|
}
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<models.User> {
|
||||||
|
const path = this.basePath + '/user/{username}'
|
||||||
|
.replace('{' + 'username' + '}', String(username));
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
// verify required parameter 'username' is set
|
||||||
|
if (!username) {
|
||||||
|
throw new Error('Missing required parameter username when calling getUserByName');
|
||||||
|
}
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<string> {
|
||||||
|
const path = this.basePath + '/user/login';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
if (username !== undefined) {
|
||||||
|
queryParameters['username'] = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (password !== undefined) {
|
||||||
|
queryParameters['password'] = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out current logged in user session
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public logoutUser (extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/user/logout';
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 updateUser (username: string, body?: models.User, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
|
const path = this.basePath + '/user/{username}'
|
||||||
|
.replace('{' + 'username' + '}', String(username));
|
||||||
|
|
||||||
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
|
let headerParams = this.defaultHeaders;
|
||||||
|
// verify required parameter 'username' is set
|
||||||
|
if (!username) {
|
||||||
|
throw new Error('Missing required parameter username when calling updateUser');
|
||||||
|
}
|
||||||
|
let requestOptions: RequestOptionsArgs = {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: headerParams,
|
||||||
|
search: queryParameters
|
||||||
|
};
|
||||||
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
|
return this.http.request(path, requestOptions)
|
||||||
|
.map((response: Response) => response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
export * from '../api/PetApi';
|
||||||
|
export * from '../api/StoreApi';
|
||||||
|
export * from '../api/UserApi';
|
||||||
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
|||||||
|
export * from './api/api';
|
||||||
|
export * from './model/models';
|
@ -0,0 +1,10 @@
|
|||||||
|
'use strict';
|
||||||
|
import * as models from './models';
|
||||||
|
|
||||||
|
export interface Category {
|
||||||
|
|
||||||
|
id?: number;
|
||||||
|
|
||||||
|
name?: string;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
'use strict';
|
||||||
|
import * as models from './models';
|
||||||
|
|
||||||
|
export interface Order {
|
||||||
|
|
||||||
|
id?: number;
|
||||||
|
|
||||||
|
petId?: number;
|
||||||
|
|
||||||
|
quantity?: number;
|
||||||
|
|
||||||
|
shipDate?: Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order Status
|
||||||
|
*/
|
||||||
|
status?: Order.StatusEnum;
|
||||||
|
|
||||||
|
complete?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace Order {
|
||||||
|
|
||||||
|
export enum StatusEnum {
|
||||||
|
placed = <any> 'placed',
|
||||||
|
approved = <any> 'approved',
|
||||||
|
delivered = <any> 'delivered',
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
'use strict';
|
||||||
|
import * as models from './models';
|
||||||
|
|
||||||
|
export interface Pet {
|
||||||
|
|
||||||
|
id?: number;
|
||||||
|
|
||||||
|
category?: models.Category;
|
||||||
|
|
||||||
|
name?: string;
|
||||||
|
|
||||||
|
photoUrls?: Array<string>;
|
||||||
|
|
||||||
|
tags?: Array<models.Tag>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pet status in the store
|
||||||
|
*/
|
||||||
|
status?: Pet.StatusEnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace Pet {
|
||||||
|
|
||||||
|
export enum StatusEnum {
|
||||||
|
available = <any> 'available',
|
||||||
|
pending = <any> 'pending',
|
||||||
|
sold = <any> 'sold',
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
'use strict';
|
||||||
|
import * as models from './models';
|
||||||
|
|
||||||
|
export interface Tag {
|
||||||
|
|
||||||
|
id?: number;
|
||||||
|
|
||||||
|
name?: string;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
import * as models from './models';
|
||||||
|
|
||||||
|
export interface User {
|
||||||
|
|
||||||
|
id?: number;
|
||||||
|
|
||||||
|
username?: string;
|
||||||
|
|
||||||
|
firstName?: string;
|
||||||
|
|
||||||
|
lastName?: string;
|
||||||
|
|
||||||
|
email?: string;
|
||||||
|
|
||||||
|
password?: string;
|
||||||
|
|
||||||
|
phone?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User Status
|
||||||
|
*/
|
||||||
|
userStatus?: number;
|
||||||
|
}
|
||||||
|
|
@ -6,8 +6,3 @@ export * from './User';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export * from '../api/PetApi';
|
|
||||||
export * from '../api/StoreApi';
|
|
||||||
export * from '../api/UserApi';
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "@swagger/angular2-typescript-petstore",
|
||||||
|
"version": "0.0.1-SNAPSHOT.201604211551",
|
||||||
|
"description": "swagger client for @swagger/angular2-typescript-petstore",
|
||||||
|
"keywords": [
|
||||||
|
"swagger-client"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"main": "./lib/index.js",
|
||||||
|
"typings": "./lib/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"build": "typings install && tsc"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"angular2": "^2.0.0-beta.15",
|
||||||
|
"rxjs": "^5.0.0-beta.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^1.8.10",
|
||||||
|
"typings": "^0.8.1",
|
||||||
|
"angular2": "^2.0.0-beta.15",
|
||||||
|
"es6-shim": "^0.35.0",
|
||||||
|
"es7-reflect-metadata": "^1.6.0",
|
||||||
|
"rxjs": "5.0.0-beta.2",
|
||||||
|
"zone.js": "^0.6.10"
|
||||||
|
},
|
||||||
|
"publishConfig":{
|
||||||
|
"registry":"https://skimdb.npmjs.com/registry"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
|
"target": "es5",
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"removeComments": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"outDir": "./lib",
|
||||||
|
"noLib": false,
|
||||||
|
"declaration": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"typings/main.d.ts",
|
||||||
|
"typings/main",
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"filesGlob": [
|
||||||
|
"./model/*.ts",
|
||||||
|
"./api/*.ts",
|
||||||
|
"typings/browser.d.ts"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"ambientDependencies": {
|
||||||
|
"core-js": "registry:dt/core-js#0.0.0+20160317120654"
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
||||||
import {Injectable} from 'angular2/core';
|
import {Injectable} from 'angular2/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import * as model from "../model/model.d.ts"
|
import * as models from '../model/models';
|
||||||
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ export class PetApi {
|
|||||||
*
|
*
|
||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
*/
|
*/
|
||||||
public addPet (body?: model.Pet, extraHttpRequestParams?: any ) : Observable<{}> {
|
public addPet (body?: models.Pet, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
const path = this.basePath + '/pet';
|
const path = this.basePath + '/pet';
|
||||||
|
|
||||||
let queryParameters: any = ""; // This should probably be an object in the future
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
@ -36,7 +36,7 @@ export class PetApi {
|
|||||||
requestOptions.body = JSON.stringify(body);
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +64,7 @@ export class PetApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +72,7 @@ export class PetApi {
|
|||||||
* Multiple status values can be provided with comma seperated strings
|
* Multiple status values can be provided with comma seperated strings
|
||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
*/
|
*/
|
||||||
public findPetsByStatus (status?: model.Array<string>, extraHttpRequestParams?: any ) : Observable<Array<model.Pet>> {
|
public findPetsByStatus (status?: models.Array<string>, extraHttpRequestParams?: any ) : Observable<Array<models.Pet>> {
|
||||||
const path = this.basePath + '/pet/findByStatus';
|
const path = this.basePath + '/pet/findByStatus';
|
||||||
|
|
||||||
let queryParameters: any = ""; // This should probably be an object in the future
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
@ -88,7 +88,7 @@ export class PetApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,7 +96,7 @@ export class PetApi {
|
|||||||
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
* @param tags Tags to filter by
|
* @param tags Tags to filter by
|
||||||
*/
|
*/
|
||||||
public findPetsByTags (tags?: model.Array<string>, extraHttpRequestParams?: any ) : Observable<Array<model.Pet>> {
|
public findPetsByTags (tags?: models.Array<string>, extraHttpRequestParams?: any ) : Observable<Array<models.Pet>> {
|
||||||
const path = this.basePath + '/pet/findByTags';
|
const path = this.basePath + '/pet/findByTags';
|
||||||
|
|
||||||
let queryParameters: any = ""; // This should probably be an object in the future
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
@ -112,7 +112,7 @@ export class PetApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,7 +120,7 @@ export class PetApi {
|
|||||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||||
* @param petId ID of pet that needs to be fetched
|
* @param petId ID of pet that needs to be fetched
|
||||||
*/
|
*/
|
||||||
public getPetById (petId: number, extraHttpRequestParams?: any ) : Observable<model.Pet> {
|
public getPetById (petId: number, extraHttpRequestParams?: any ) : Observable<models.Pet> {
|
||||||
const path = this.basePath + '/pet/{petId}'
|
const path = this.basePath + '/pet/{petId}'
|
||||||
.replace('{' + 'petId' + '}', String(petId));
|
.replace('{' + 'petId' + '}', String(petId));
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ export class PetApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +145,7 @@ export class PetApi {
|
|||||||
*
|
*
|
||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
*/
|
*/
|
||||||
public updatePet (body?: model.Pet, extraHttpRequestParams?: any ) : Observable<{}> {
|
public updatePet (body?: models.Pet, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
const path = this.basePath + '/pet';
|
const path = this.basePath + '/pet';
|
||||||
|
|
||||||
let queryParameters: any = ""; // This should probably be an object in the future
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
@ -158,7 +158,7 @@ export class PetApi {
|
|||||||
requestOptions.body = JSON.stringify(body);
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,7 +194,7 @@ export class PetApi {
|
|||||||
requestOptions.body = formParams.toString();
|
requestOptions.body = formParams.toString();
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +204,7 @@ export class PetApi {
|
|||||||
* @param additionalMetadata Additional data to pass to server
|
* @param additionalMetadata Additional data to pass to server
|
||||||
* @param file file to upload
|
* @param file file to upload
|
||||||
*/
|
*/
|
||||||
public uploadFile (petId: number, additionalMetadata?: string, file?: model.any, extraHttpRequestParams?: any ) : Observable<{}> {
|
public uploadFile (petId: number, additionalMetadata?: string, file?: models.any, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
const path = this.basePath + '/pet/{petId}/uploadImage'
|
const path = this.basePath + '/pet/{petId}/uploadImage'
|
||||||
.replace('{' + 'petId' + '}', String(petId));
|
.replace('{' + 'petId' + '}', String(petId));
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ export class PetApi {
|
|||||||
requestOptions.body = formParams.toString();
|
requestOptions.body = formParams.toString();
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
||||||
import {Injectable} from 'angular2/core';
|
import {Injectable} from 'angular2/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import * as model from "../model/model.d.ts"
|
import * as models from '../model/models';
|
||||||
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ export class StoreApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +59,7 @@ export class StoreApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +67,7 @@ export class StoreApi {
|
|||||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
* 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 orderId ID of pet that needs to be fetched
|
||||||
*/
|
*/
|
||||||
public getOrderById (orderId: string, extraHttpRequestParams?: any ) : Observable<model.Order> {
|
public getOrderById (orderId: string, extraHttpRequestParams?: any ) : Observable<models.Order> {
|
||||||
const path = this.basePath + '/store/order/{orderId}'
|
const path = this.basePath + '/store/order/{orderId}'
|
||||||
.replace('{' + 'orderId' + '}', String(orderId));
|
.replace('{' + 'orderId' + '}', String(orderId));
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ export class StoreApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,7 +92,7 @@ export class StoreApi {
|
|||||||
*
|
*
|
||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
*/
|
*/
|
||||||
public placeOrder (body?: model.Order, extraHttpRequestParams?: any ) : Observable<model.Order> {
|
public placeOrder (body?: models.Order, extraHttpRequestParams?: any ) : Observable<models.Order> {
|
||||||
const path = this.basePath + '/store/order';
|
const path = this.basePath + '/store/order';
|
||||||
|
|
||||||
let queryParameters: any = ""; // This should probably be an object in the future
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
@ -105,7 +105,7 @@ export class StoreApi {
|
|||||||
requestOptions.body = JSON.stringify(body);
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angular2/http';
|
||||||
import {Injectable} from 'angular2/core';
|
import {Injectable} from 'angular2/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import * as model from "../model/model.d.ts"
|
import * as models from '../model/models';
|
||||||
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ export class UserApi {
|
|||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
*/
|
*/
|
||||||
public createUser (body?: model.User, extraHttpRequestParams?: any ) : Observable<{}> {
|
public createUser (body?: models.User, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
const path = this.basePath + '/user';
|
const path = this.basePath + '/user';
|
||||||
|
|
||||||
let queryParameters: any = ""; // This should probably be an object in the future
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
@ -36,7 +36,7 @@ export class UserApi {
|
|||||||
requestOptions.body = JSON.stringify(body);
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,7 +44,7 @@ export class UserApi {
|
|||||||
*
|
*
|
||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
*/
|
*/
|
||||||
public createUsersWithArrayInput (body?: model.Array<model.User>, extraHttpRequestParams?: any ) : Observable<{}> {
|
public createUsersWithArrayInput (body?: models.Array<models.User>, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
const path = this.basePath + '/user/createWithArray';
|
const path = this.basePath + '/user/createWithArray';
|
||||||
|
|
||||||
let queryParameters: any = ""; // This should probably be an object in the future
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
@ -57,7 +57,7 @@ export class UserApi {
|
|||||||
requestOptions.body = JSON.stringify(body);
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,7 +65,7 @@ export class UserApi {
|
|||||||
*
|
*
|
||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
*/
|
*/
|
||||||
public createUsersWithListInput (body?: model.Array<model.User>, extraHttpRequestParams?: any ) : Observable<{}> {
|
public createUsersWithListInput (body?: models.Array<models.User>, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
const path = this.basePath + '/user/createWithList';
|
const path = this.basePath + '/user/createWithList';
|
||||||
|
|
||||||
let queryParameters: any = ""; // This should probably be an object in the future
|
let queryParameters: any = ""; // This should probably be an object in the future
|
||||||
@ -78,7 +78,7 @@ export class UserApi {
|
|||||||
requestOptions.body = JSON.stringify(body);
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,7 +103,7 @@ export class UserApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,7 +111,7 @@ export class UserApi {
|
|||||||
*
|
*
|
||||||
* @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?: any ) : Observable<model.User> {
|
public getUserByName (username: string, extraHttpRequestParams?: any ) : Observable<models.User> {
|
||||||
const path = this.basePath + '/user/{username}'
|
const path = this.basePath + '/user/{username}'
|
||||||
.replace('{' + 'username' + '}', String(username));
|
.replace('{' + 'username' + '}', String(username));
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ export class UserApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,7 +157,7 @@ export class UserApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,7 +176,7 @@ export class UserApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,7 +185,7 @@ export class UserApi {
|
|||||||
* @param username name that need to be deleted
|
* @param username name that need to be deleted
|
||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
*/
|
*/
|
||||||
public updateUser (username: string, body?: model.User, extraHttpRequestParams?: any ) : Observable<{}> {
|
public updateUser (username: string, body?: models.User, extraHttpRequestParams?: any ) : Observable<{}> {
|
||||||
const path = this.basePath + '/user/{username}'
|
const path = this.basePath + '/user/{username}'
|
||||||
.replace('{' + 'username' + '}', String(username));
|
.replace('{' + 'username' + '}', String(username));
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ export class UserApi {
|
|||||||
requestOptions.body = JSON.stringify(body);
|
requestOptions.body = JSON.stringify(body);
|
||||||
|
|
||||||
return this.http.request(path, requestOptions)
|
return this.http.request(path, requestOptions)
|
||||||
.map(response => response.json());
|
.map((response: Response) => response.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
5
samples/client/petstore/typescript-angular2/api/api.ts
Normal file
5
samples/client/petstore/typescript-angular2/api/api.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export * from '../api/PetApi';
|
||||||
|
export * from '../api/StoreApi';
|
||||||
|
export * from '../api/UserApi';
|
||||||
|
|
||||||
|
|
2
samples/client/petstore/typescript-angular2/index.ts
Normal file
2
samples/client/petstore/typescript-angular2/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './api/api';
|
||||||
|
export * from './model/models';
|
@ -1,12 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import * as model from "./model.d.ts"
|
import * as models from './models';
|
||||||
|
|
||||||
export interface Category {
|
export interface Category {
|
||||||
|
|
||||||
|
|
||||||
id?: number;
|
id?: number;
|
||||||
|
|
||||||
|
|
||||||
name?: string;
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,27 +1,21 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import * as model from "./model.d.ts"
|
import * as models from './models';
|
||||||
|
|
||||||
export interface Order {
|
export interface Order {
|
||||||
|
|
||||||
|
|
||||||
id?: number;
|
id?: number;
|
||||||
|
|
||||||
|
|
||||||
petId?: number;
|
petId?: number;
|
||||||
|
|
||||||
|
|
||||||
quantity?: number;
|
quantity?: number;
|
||||||
|
|
||||||
|
|
||||||
shipDate?: Date;
|
shipDate?: Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order Status
|
* Order Status
|
||||||
*/
|
*/
|
||||||
|
|
||||||
status?: Order.StatusEnum;
|
status?: Order.StatusEnum;
|
||||||
|
|
||||||
|
|
||||||
complete?: boolean;
|
complete?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,27 +1,21 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import * as model from "./model.d.ts"
|
import * as models from './models';
|
||||||
|
|
||||||
export interface Pet {
|
export interface Pet {
|
||||||
|
|
||||||
|
|
||||||
id?: number;
|
id?: number;
|
||||||
|
|
||||||
|
category?: models.Category;
|
||||||
category?: model.Category;
|
|
||||||
|
|
||||||
|
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
||||||
|
|
||||||
photoUrls?: Array<string>;
|
photoUrls?: Array<string>;
|
||||||
|
|
||||||
|
tags?: Array<models.Tag>;
|
||||||
tags?: Array<model.Tag>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pet status in the store
|
* pet status in the store
|
||||||
*/
|
*/
|
||||||
|
|
||||||
status?: Pet.StatusEnum;
|
status?: Pet.StatusEnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import * as model from "./model.d.ts"
|
import * as models from './models';
|
||||||
|
|
||||||
export interface Tag {
|
export interface Tag {
|
||||||
|
|
||||||
|
|
||||||
id?: number;
|
id?: number;
|
||||||
|
|
||||||
|
|
||||||
name?: string;
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,33 +1,25 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import * as model from "./model.d.ts"
|
import * as models from './models';
|
||||||
|
|
||||||
export interface User {
|
export interface User {
|
||||||
|
|
||||||
|
|
||||||
id?: number;
|
id?: number;
|
||||||
|
|
||||||
|
|
||||||
username?: string;
|
username?: string;
|
||||||
|
|
||||||
|
|
||||||
firstName?: string;
|
firstName?: string;
|
||||||
|
|
||||||
|
|
||||||
lastName?: string;
|
lastName?: string;
|
||||||
|
|
||||||
|
|
||||||
email?: string;
|
email?: string;
|
||||||
|
|
||||||
|
|
||||||
password?: string;
|
password?: string;
|
||||||
|
|
||||||
|
|
||||||
phone?: string;
|
phone?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User Status
|
* User Status
|
||||||
*/
|
*/
|
||||||
|
|
||||||
userStatus?: number;
|
userStatus?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
export * from './Category';
|
||||||
|
export * from './Order';
|
||||||
|
export * from './Pet';
|
||||||
|
export * from './Tag';
|
||||||
|
export * from './User';
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user