forked from loafle/openapi-generator-original
* Implement generating interfaces option for api resources, closes swagger-api/swagger-codegen#5453. This commit introduces another _system property_ for typescript-angular2, called `withInterfaces` that is default to `false`. You can activate this flag by: ``` java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ -i http://petstore.swagger.io/v2/swagger.json \ -l typescript-angular2 -o samples/server/petstore/springboot/typescript-angular2 \ -D withInterfaces=true ``` If set to `true`, generated api resource classes will be implemented with their interfaces in separate files. This change should not break and change the behaviour even though `withInterfaces` flag set to `true`. You are also welcome to create your own custom resource class by implementing those generated interfaces as they support defining new attributes with `[others: string]: any;` signature. * Fix unit test for typescript/angular2 client options for "withInterfaces" * Use double quote to follow coding standard * Respect interface naming convention for typescript/angular2 Create respectful interface names that ends with `Interface` suffix, instead of prefixing with `I` according to typescript naming convention. This is also consistent with their file names that also ends with `Interface.ts`. Also fixes the merge conflicts. * Have better explanation for the `withInterfaces` system config
This commit is contained in:
parent
ebcd8489bc
commit
e12b22d5ce
@ -34,3 +34,7 @@ java $JAVA_OPTS -jar $executable $ags
|
||||
echo "Typescript Petstore API client (npm setting)"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular2 -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular2/npm"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
echo "Typescript Petstore API client (with interfaces generated)"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-angular2 -o samples/client/petstore/typescript-angular2/with-interfaces -D withInterfaces=true"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
31
bin/typescript-angular2-petstore-interfaces.sh
Executable file
31
bin/typescript-angular2-petstore-interfaces.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 -o samples/client/petstore/typescript-angular2/with-interfaces -D withInterfaces=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
@ -28,6 +28,7 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
public static final String SNAPSHOT = "snapshot";
|
||||
public static final String USE_OPAQUE_TOKEN = "useOpaqueToken";
|
||||
public static final String INJECTION_TOKEN = "injectionToken";
|
||||
public static final String WITH_INTERFACES = "withInterfaces";
|
||||
|
||||
protected String npmName = null;
|
||||
protected String npmVersion = "1.0.0";
|
||||
@ -51,6 +52,7 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
|
||||
this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(USE_OPAQUE_TOKEN, "When setting this property to true, OpaqueToken is used instead of InjectionToken", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,6 +90,13 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
this.setOpaqueToken();
|
||||
}
|
||||
additionalProperties.put(INJECTION_TOKEN, this.injectionToken);
|
||||
|
||||
if(additionalProperties.containsKey(WITH_INTERFACES)) {
|
||||
boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString());
|
||||
if (withInterfaces) {
|
||||
apiTemplateFiles.put("apiInterface.mustache", "Interface.ts");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addNpmPackageGeneration() {
|
||||
|
@ -10,6 +10,9 @@ import 'rxjs/add/operator/map';
|
||||
import * as models from '../model/models';
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
{{#withInterfaces}}
|
||||
import { {{classname}}Interface } from './{{classname}}Interface';
|
||||
{{/withInterfaces}}
|
||||
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
@ -21,7 +24,13 @@ import { Configuration } from '../configurat
|
||||
*/
|
||||
{{/description}}
|
||||
@Injectable()
|
||||
{{#withInterfaces}}
|
||||
export class {{classname}} implements {{classname}}Interface {
|
||||
{{/withInterfaces}}
|
||||
{{^withInterfaces}}
|
||||
export class {{classname}} {
|
||||
{{/withInterfaces}}
|
||||
|
||||
protected basePath = '{{{basePath}}}';
|
||||
public defaultHeaders: Headers = new Headers();
|
||||
public configuration: Configuration = new Configuration();
|
||||
|
@ -0,0 +1,31 @@
|
||||
{{>licenseInfo}}
|
||||
import { Headers } from '@angular/http';
|
||||
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import * as models from '../model/models';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
{{#operations}}
|
||||
|
||||
{{#description}}
|
||||
/**
|
||||
* {{&description}}
|
||||
*/
|
||||
{{/description}}
|
||||
export interface {{classname}}Interface {
|
||||
defaultHeaders: Headers;
|
||||
configuration: Configuration;
|
||||
[others: string]: any;
|
||||
|
||||
{{#operation}}
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
{{#allParams}}* @param {{paramName}} {{description}}
|
||||
{{/allParams}}*/
|
||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any): Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}>;
|
||||
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
@ -33,6 +33,7 @@ public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider
|
||||
.put(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME)
|
||||
.put(TypeScriptAngular2ClientCodegen.NPM_VERSION, NMP_VERSION)
|
||||
.put(TypeScriptAngular2ClientCodegen.SNAPSHOT, Boolean.FALSE.toString())
|
||||
.put(TypeScriptAngular2ClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString())
|
||||
.put(TypeScriptAngular2ClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY)
|
||||
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
|
||||
.put(TypeScriptAngular2ClientCodegen.USE_OPAQUE_TOKEN, Boolean.FALSE.toString())
|
||||
|
4
samples/client/petstore/typescript-angular2/with-interfaces/.gitignore
vendored
Normal file
4
samples/client/petstore/typescript-angular2/with-interfaces/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
@ -0,0 +1,23 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
@ -0,0 +1,605 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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 { 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';
|
||||
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 findPetsByStatus(status?: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
|
||||
return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return response.json() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 findPetsByTags(tags?: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
|
||||
return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return 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> {
|
||||
return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return 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<{}> {
|
||||
return this.updatePetWithHttpInfo(body, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return 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<{}> {
|
||||
return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return 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?: 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<Response> {
|
||||
const path = this.basePath + '/pet';
|
||||
|
||||
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[] = [
|
||||
'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 = (<any>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<Response> {
|
||||
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.');
|
||||
}
|
||||
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 = (<any>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<string>, extraHttpRequestParams?: any): Observable<Response> {
|
||||
const path = this.basePath + '/pet/findByStatus';
|
||||
|
||||
let queryParameters = new URLSearchParams();
|
||||
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
|
||||
if (status) {
|
||||
status.forEach((element) => {
|
||||
queryParameters.append('status', <any>element);
|
||||
})
|
||||
}
|
||||
|
||||
// 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 = (<any>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<string>, extraHttpRequestParams?: any): Observable<Response> {
|
||||
const path = this.basePath + '/pet/findByTags';
|
||||
|
||||
let queryParameters = new URLSearchParams();
|
||||
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
|
||||
if (tags) {
|
||||
tags.forEach((element) => {
|
||||
queryParameters.append('tags', <any>element);
|
||||
})
|
||||
}
|
||||
|
||||
// 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 = (<any>Object).assign(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable<Response> {
|
||||
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);
|
||||
}
|
||||
|
||||
// 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 = (<any>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<Response> {
|
||||
const path = this.basePath + '/pet';
|
||||
|
||||
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[] = [
|
||||
'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 = (<any>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: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> {
|
||||
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', <any>name);
|
||||
}
|
||||
|
||||
if (status !== undefined) {
|
||||
formParams.set('status', <any>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 = (<any>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<Response> {
|
||||
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', <any>additionalMetadata);
|
||||
}
|
||||
|
||||
if (file !== undefined) {
|
||||
formParams.set('file', <any>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 = (<any>Object).assign(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>>;
|
||||
|
||||
/**
|
||||
* 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<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
getPetById(petId: number, extraHttpRequestParams?: any): Observable<models.Pet>;
|
||||
|
||||
/**
|
||||
* 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: string, 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<{}>;
|
||||
|
||||
}
|
@ -0,0 +1,262 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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 { 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';
|
||||
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<{}> {
|
||||
return this.deleteOrderWithHttpInfo(orderId, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return response.json() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
*/
|
||||
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() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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> {
|
||||
return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return 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> {
|
||||
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<Response> {
|
||||
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 = (<any>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<Response> {
|
||||
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 = (<any>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: string, extraHttpRequestParams?: any): Observable<Response> {
|
||||
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 = (<any>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<Response> {
|
||||
const path = this.basePath + '/store/order';
|
||||
|
||||
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'
|
||||
];
|
||||
|
||||
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 = (<any>Object).assign(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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: string, extraHttpRequestParams?: any): Observable<models.Order>;
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param body order placed for purchasing the pet
|
||||
*/
|
||||
placeOrder(body?: models.Order, extraHttpRequestParams?: any): Observable<models.Order>;
|
||||
|
||||
}
|
@ -0,0 +1,483 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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 { 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';
|
||||
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<{}> {
|
||||
return this.createUserWithHttpInfo(body, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return response.json() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param body List of user object
|
||||
*/
|
||||
public createUsersWithArrayInput(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
|
||||
return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return response.json() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param body List of user object
|
||||
*/
|
||||
public createUsersWithListInput(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
|
||||
return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return 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<{}> {
|
||||
return this.deleteUserWithHttpInfo(username, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return 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> {
|
||||
return this.getUserByNameWithHttpInfo(username, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return 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> {
|
||||
return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams)
|
||||
.map((response: Response) => {
|
||||
if (response.status === 204) {
|
||||
return undefined;
|
||||
} else {
|
||||
return response.json() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() || {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<{}> {
|
||||
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<Response> {
|
||||
const path = this.basePath + '/user';
|
||||
|
||||
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'
|
||||
];
|
||||
|
||||
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 = (<any>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<models.User>, extraHttpRequestParams?: any): Observable<Response> {
|
||||
const path = this.basePath + '/user/createWithArray';
|
||||
|
||||
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'
|
||||
];
|
||||
|
||||
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 = (<any>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<models.User>, extraHttpRequestParams?: any): Observable<Response> {
|
||||
const path = this.basePath + '/user/createWithList';
|
||||
|
||||
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'
|
||||
];
|
||||
|
||||
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 = (<any>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<Response> {
|
||||
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 = (<any>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<Response> {
|
||||
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 = (<any>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<Response> {
|
||||
const path = this.basePath + '/user/login';
|
||||
|
||||
let queryParameters = new URLSearchParams();
|
||||
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
|
||||
if (username !== undefined) {
|
||||
queryParameters.set('username', <any>username);
|
||||
}
|
||||
|
||||
if (password !== undefined) {
|
||||
queryParameters.set('password', <any>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 = (<any>Object).assign(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
*/
|
||||
public logoutUserWithHttpInfo(extraHttpRequestParams?: any): Observable<Response> {
|
||||
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 = (<any>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<Response> {
|
||||
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.');
|
||||
}
|
||||
// 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 = (<any>Object).assign(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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<models.User>, extraHttpRequestParams?: any): Observable<{}>;
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param body List of user object
|
||||
*/
|
||||
createUsersWithListInput(body?: Array<models.User>, 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<models.User>;
|
||||
|
||||
/**
|
||||
* 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<string>;
|
||||
|
||||
/**
|
||||
* 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<{}>;
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
export * from './PetApi';
|
||||
import { PetApi } from './PetApi';
|
||||
export * from './StoreApi';
|
||||
import { StoreApi } from './StoreApi';
|
||||
export * from './UserApi';
|
||||
import { UserApi } from './UserApi';
|
||||
export const APIS = [PetApi, StoreApi, UserApi];
|
@ -0,0 +1,7 @@
|
||||
export class Configuration {
|
||||
apiKey: string;
|
||||
username: string;
|
||||
password: string;
|
||||
accessToken: string | (() => string);
|
||||
withCredentials: boolean;
|
||||
}
|
@ -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 crediential in your environment."
|
||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
@ -0,0 +1,4 @@
|
||||
export * from './api/api';
|
||||
export * from './model/models';
|
||||
export * from './variables';
|
||||
export * from './configuration';
|
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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 * as models from './models';
|
||||
|
||||
export interface Category {
|
||||
id?: number;
|
||||
|
||||
name?: string;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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 * 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,38 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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 * 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,20 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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 * as models from './models';
|
||||
|
||||
export interface Tag {
|
||||
id?: number;
|
||||
|
||||
name?: string;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
*
|
||||
* 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 * 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;
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
export * from './Category';
|
||||
export * from './Order';
|
||||
export * from './Pet';
|
||||
export * from './Tag';
|
||||
export * from './User';
|
@ -0,0 +1,9 @@
|
||||
import { OpaqueToken } from '@angular/core';
|
||||
|
||||
export const BASE_PATH = new OpaqueToken('basePath');
|
||||
export const COLLECTION_FORMATS = {
|
||||
'csv': ',',
|
||||
'tsv': ' ',
|
||||
'ssv': ' ',
|
||||
'pipes': '|'
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user