Issue 4531 (#4539)

* ISSUE-4531
Arrays are now serialized according to the different collection formats. All api classes are also exported in a const array to make handling of large api libraries easier.

* Added petstore samples

* Fixed indentations and coding style
This commit is contained in:
Richard Naeve 2017-01-13 16:41:54 +01:00 committed by wing328
parent d40f7a41b6
commit 2e7e25801d
15 changed files with 194 additions and 328 deletions

View File

@ -8,7 +8,7 @@ import { Observable } from 'rxjs/Observab
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import * as models from '../model/models'; import * as models from '../model/models';
import { BASE_PATH } from '../variables'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration'; import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */ /* tslint:disable:no-unused-variable member-ordering */
@ -93,15 +93,36 @@ export class {{classname}} {
{{/required}} {{/required}}
{{/allParams}} {{/allParams}}
{{#queryParams}} {{#queryParams}}
{{#isListContainer}}
if ({{paramName}}) {
{{#isCollectionFormatMulti}}
{{paramName}}.forEach((element) => {
queryParameters.append('{{baseName}}', <any>element);
})
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
queryParameters.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']));
{{/isCollectionFormatMulti}}
}
{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined) { if ({{paramName}} !== undefined) {
queryParameters.set('{{baseName}}', <any>{{paramName}}); queryParameters.set('{{baseName}}', <any>{{paramName}});
} }
{{/isListContainer}}
{{/queryParams}} {{/queryParams}}
{{#headerParams}} {{#headerParams}}
{{#isListContainer}}
if ({{paramName}}) {
headers.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']));
}
{{/isListContainer}}
{{^isListContainer}}
headers.set('{{baseName}}', String({{paramName}})); headers.set('{{baseName}}', String({{paramName}}));
{{/headerParams}} {{/isListContainer}}
{{/headerParams}}
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
{{#consumes}} {{#consumes}}
@ -120,51 +141,64 @@ export class {{classname}} {
// authentication ({{name}}) required // authentication ({{name}}) required
{{#isApiKey}} {{#isApiKey}}
{{#isKeyInHeader}} {{#isKeyInHeader}}
if (this.configuration.apiKey) if (this.configuration.apiKey) {
{
headers.set('{{keyParamName}}', this.configuration.apiKey); headers.set('{{keyParamName}}', this.configuration.apiKey);
} }
{{/isKeyInHeader}} {{/isKeyInHeader}}
{{#isKeyInQuery}} {{#isKeyInQuery}}
if (this.configuration.apiKey) if (this.configuration.apiKey) {
{
formParams.set('{{keyParamName}}', this.configuration.apiKey); formParams.set('{{keyParamName}}', this.configuration.apiKey);
} }
{{/isKeyInQuery}} {{/isKeyInQuery}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}} {{#isBasic}}
// http basic authentication required // http basic authentication required
if (this.configuration.username || this.configuration.password) if (this.configuration.username || this.configuration.password) {
{
headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password)); headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
} }
{{/isBasic}} {{/isBasic}}
{{#isOAuth}} {{#isOAuth}}
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
{{/isOAuth}} {{/isOAuth}}
{{/authMethods}} {{/authMethods}}
{{#hasFormParams}} {{#hasFormParams}}
headers.set('Content-Type', 'application/x-www-form-urlencoded'); headers.set('Content-Type', 'application/x-www-form-urlencoded');
{{/hasFormParams}}
{{/hasFormParams}}
{{#bodyParam}} {{#bodyParam}}
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
{{/bodyParam}} {{/bodyParam}}
{{#formParams}} {{#formParams}}
if ({{paramName}} !== undefined) { {{#isListContainer}}
formParams.set('{{baseName}}', <any>{{paramName}}); if ({{paramName}}) {
{{#isCollectionFormatMulti}}
{{paramName}}.forEach((element) => {
formParams.append('{{baseName}}', <any>element);
})
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
formParams.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']));
{{/isCollectionFormatMulti}}
} }
{{/formParams}} {{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined) {
formParams.set('{{baseName}}', <any>{{paramName}});
}
{{/isListContainer}}
{{/formParams}}
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: {{httpMethod}}, method: {{httpMethod}},
headers: headers, headers: headers,
@ -184,7 +218,7 @@ export class {{classname}} {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
{{/operation}} {{/operation}}
} }
{{/operations}} {{/operations}}

View File

@ -2,6 +2,8 @@
{{#apis}} {{#apis}}
{{#operations}} {{#operations}}
export * from './{{ classname }}'; export * from './{{ classname }}';
import { {{ classname }} } from './{{ classname }}';
{{/operations}} {{/operations}}
{{/apis}} {{/apis}}
export const APIS = [ {{#apis}}{{#operations}}{{ classname }}, {{/operations}}{{/apis}}];
{{/apiInfo}} {{/apiInfo}}

View File

@ -1,3 +1,9 @@
import { OpaqueToken } from '@angular/core'; import { OpaqueToken } from '@angular/core';
export const BASE_PATH = new OpaqueToken('basePath'); export const BASE_PATH = new OpaqueToken('basePath');
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}

View File

@ -19,7 +19,7 @@ import { Observable } from 'rxjs/Observab
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import * as models from '../model/models'; import * as models from '../model/models';
import { BASE_PATH } from '../variables'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration'; import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */ /* tslint:disable:no-unused-variable member-ordering */
@ -199,8 +199,6 @@ export class PetApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
'application/json', 'application/json',
@ -215,18 +213,15 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -241,7 +236,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Deletes a pet * Deletes a pet
* *
@ -257,7 +252,6 @@ export class PetApi {
if (petId === null || petId === undefined) { if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.'); throw new Error('Required parameter petId was null or undefined when calling deletePet.');
} }
headers.set('api_key', String(apiKey)); headers.set('api_key', String(apiKey));
// to determine the Content-Type header // to determine the Content-Type header
@ -272,16 +266,12 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete, method: RequestMethod.Delete,
@ -296,7 +286,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Finds Pets by status * Finds Pets by status
* Multiple status values can be provided with comma separated strings * Multiple status values can be provided with comma separated strings
@ -307,11 +297,12 @@ export class PetApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
if (status !== undefined) { if (status) {
queryParameters.set('status', <any>status); status.forEach((element) => {
queryParameters.append('status', <any>element);
})
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -324,16 +315,12 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
@ -348,7 +335,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Finds Pets by tags * Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -359,11 +346,12 @@ export class PetApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
if (tags !== undefined) { if (tags) {
queryParameters.set('tags', <any>tags); tags.forEach((element) => {
queryParameters.append('tags', <any>element);
})
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -376,16 +364,12 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
@ -400,7 +384,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Find pet by ID * Find pet by ID
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions * Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
@ -415,8 +399,6 @@ export class PetApi {
if (petId === null || petId === undefined) { if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling getPetById.'); throw new Error('Required parameter petId was null or undefined when calling getPetById.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -427,23 +409,19 @@ export class PetApi {
'application/xml' 'application/xml'
]; ];
// authentication (api_key) required
if (this.configuration.apiKey) {
headers.set('api_key', this.configuration.apiKey);
}
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
// authentication (api_key) required
if (this.configuration.apiKey)
{
headers.set('api_key', this.configuration.apiKey);
}
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
@ -458,7 +436,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Update an existing pet * Update an existing pet
* *
@ -469,8 +447,6 @@ export class PetApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
'application/json', 'application/json',
@ -485,18 +461,15 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Put, method: RequestMethod.Put,
headers: headers, headers: headers,
@ -511,7 +484,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Updates a pet in the store with form data * Updates a pet in the store with form data
* *
@ -530,8 +503,6 @@ export class PetApi {
if (petId === null || petId === undefined) { if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
'application/x-www-form-urlencoded' 'application/x-www-form-urlencoded'
@ -545,22 +516,21 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
headers.set('Content-Type', 'application/x-www-form-urlencoded'); headers.set('Content-Type', 'application/x-www-form-urlencoded');
if (name !== undefined) { if (name !== undefined) {
formParams.set('name', <any>name); formParams.set('name', <any>name);
} }
if (status !== undefined) { if (status !== undefined) {
formParams.set('status', <any>status); formParams.set('status', <any>status);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
@ -577,7 +547,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* uploads an image * uploads an image
* *
@ -596,8 +566,6 @@ export class PetApi {
if (petId === null || petId === undefined) { if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
'multipart/form-data' 'multipart/form-data'
@ -611,22 +579,21 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
headers.set('Content-Type', 'application/x-www-form-urlencoded'); headers.set('Content-Type', 'application/x-www-form-urlencoded');
if (additionalMetadata !== undefined) { if (additionalMetadata !== undefined) {
formParams.set('additionalMetadata', <any>additionalMetadata); formParams.set('additionalMetadata', <any>additionalMetadata);
} }
if (file !== undefined) { if (file !== undefined) {
formParams.set('file', <any>file); formParams.set('file', <any>file);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
@ -643,5 +610,5 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
} }

View File

@ -19,7 +19,7 @@ import { Observable } from 'rxjs/Observab
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import * as models from '../model/models'; import * as models from '../model/models';
import { BASE_PATH } from '../variables'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration'; import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */ /* tslint:disable:no-unused-variable member-ordering */
@ -133,8 +133,6 @@ export class StoreApi {
if (orderId === null || orderId === undefined) { if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -145,10 +143,6 @@ export class StoreApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete, method: RequestMethod.Delete,
headers: headers, headers: headers,
@ -162,7 +156,7 @@ export class StoreApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Returns pet inventories by status * Returns pet inventories by status
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
@ -172,8 +166,6 @@ export class StoreApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -185,13 +177,9 @@ export class StoreApi {
]; ];
// authentication (api_key) required // authentication (api_key) required
if (this.configuration.apiKey) if (this.configuration.apiKey) {
{
headers.set('api_key', this.configuration.apiKey); headers.set('api_key', this.configuration.apiKey);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
@ -206,7 +194,7 @@ export class StoreApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Find purchase order by ID * Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -221,8 +209,6 @@ export class StoreApi {
if (orderId === null || orderId === undefined) { if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -233,10 +219,6 @@ export class StoreApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
@ -250,7 +232,7 @@ export class StoreApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Place an order for a pet * Place an order for a pet
* *
@ -261,8 +243,6 @@ export class StoreApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -273,11 +253,8 @@ export class StoreApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -292,5 +269,5 @@ export class StoreApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
} }

View File

@ -19,7 +19,7 @@ import { Observable } from 'rxjs/Observab
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import * as models from '../model/models'; import * as models from '../model/models';
import { BASE_PATH } from '../variables'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration'; import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */ /* tslint:disable:no-unused-variable member-ordering */
@ -195,8 +195,6 @@ export class UserApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -207,11 +205,8 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -226,7 +221,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
@ -237,8 +232,6 @@ export class UserApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -249,11 +242,8 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -268,7 +258,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
@ -279,8 +269,6 @@ export class UserApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -291,11 +279,8 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -310,7 +295,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Delete user * Delete user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -325,8 +310,6 @@ export class UserApi {
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling deleteUser.'); throw new Error('Required parameter username was null or undefined when calling deleteUser.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -337,10 +320,6 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete, method: RequestMethod.Delete,
headers: headers, headers: headers,
@ -354,7 +333,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Get user by user name * Get user by user name
* *
@ -369,8 +348,6 @@ export class UserApi {
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling getUserByName.'); throw new Error('Required parameter username was null or undefined when calling getUserByName.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -381,10 +358,6 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
@ -398,7 +371,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Logs user into the system * Logs user into the system
* *
@ -413,11 +386,11 @@ export class UserApi {
if (username !== undefined) { if (username !== undefined) {
queryParameters.set('username', <any>username); queryParameters.set('username', <any>username);
} }
if (password !== undefined) { if (password !== undefined) {
queryParameters.set('password', <any>password); queryParameters.set('password', <any>password);
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -428,10 +401,6 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
@ -445,7 +414,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Logs out current logged in user session * Logs out current logged in user session
* *
@ -455,8 +424,6 @@ export class UserApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -467,10 +434,6 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
@ -484,7 +447,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Updated user * Updated user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -500,8 +463,6 @@ export class UserApi {
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.'); throw new Error('Required parameter username was null or undefined when calling updateUser.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -512,11 +473,8 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Put, method: RequestMethod.Put,
headers: headers, headers: headers,
@ -531,5 +489,5 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
} }

View File

@ -1,3 +1,7 @@
export * from './PetApi'; export * from './PetApi';
import { PetApi } from './PetApi';
export * from './StoreApi'; export * from './StoreApi';
import { StoreApi } from './StoreApi';
export * from './UserApi'; export * from './UserApi';
import { UserApi } from './UserApi';
export const APIS = [ PetApi, StoreApi, UserApi, ];

View File

@ -1,3 +1,9 @@
import { OpaqueToken } from '@angular/core'; import { OpaqueToken } from '@angular/core';
export const BASE_PATH = new OpaqueToken('basePath'); export const BASE_PATH = new OpaqueToken('basePath');
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}

View File

@ -1,4 +1,4 @@
## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201612150011 ## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201701111439
### Building ### Building
@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's.
_published:_ _published:_
``` ```
npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201612150011 --save npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201701111439 --save
``` ```
_unPublished (not recommended):_ _unPublished (not recommended):_

View File

@ -19,7 +19,7 @@ import { Observable } from 'rxjs/Observab
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import * as models from '../model/models'; import * as models from '../model/models';
import { BASE_PATH } from '../variables'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration'; import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */ /* tslint:disable:no-unused-variable member-ordering */
@ -199,8 +199,6 @@ export class PetApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
'application/json', 'application/json',
@ -215,18 +213,15 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -241,7 +236,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Deletes a pet * Deletes a pet
* *
@ -257,7 +252,6 @@ export class PetApi {
if (petId === null || petId === undefined) { if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.'); throw new Error('Required parameter petId was null or undefined when calling deletePet.');
} }
headers.set('api_key', String(apiKey)); headers.set('api_key', String(apiKey));
// to determine the Content-Type header // to determine the Content-Type header
@ -272,16 +266,12 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete, method: RequestMethod.Delete,
@ -296,7 +286,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Finds Pets by status * Finds Pets by status
* Multiple status values can be provided with comma separated strings * Multiple status values can be provided with comma separated strings
@ -307,11 +297,12 @@ export class PetApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
if (status !== undefined) { if (status) {
queryParameters.set('status', <any>status); status.forEach((element) => {
queryParameters.append('status', <any>element);
})
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -324,16 +315,12 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
@ -348,7 +335,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Finds Pets by tags * Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -359,11 +346,12 @@ export class PetApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
if (tags !== undefined) { if (tags) {
queryParameters.set('tags', <any>tags); tags.forEach((element) => {
queryParameters.append('tags', <any>element);
})
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -376,16 +364,12 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
@ -400,7 +384,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Find pet by ID * Find pet by ID
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions * Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
@ -415,8 +399,6 @@ export class PetApi {
if (petId === null || petId === undefined) { if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling getPetById.'); throw new Error('Required parameter petId was null or undefined when calling getPetById.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -427,23 +409,19 @@ export class PetApi {
'application/xml' 'application/xml'
]; ];
// authentication (api_key) required
if (this.configuration.apiKey) {
headers.set('api_key', this.configuration.apiKey);
}
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
// authentication (api_key) required
if (this.configuration.apiKey)
{
headers.set('api_key', this.configuration.apiKey);
}
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
@ -458,7 +436,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Update an existing pet * Update an existing pet
* *
@ -469,8 +447,6 @@ export class PetApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
'application/json', 'application/json',
@ -485,18 +461,15 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Put, method: RequestMethod.Put,
headers: headers, headers: headers,
@ -511,7 +484,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Updates a pet in the store with form data * Updates a pet in the store with form data
* *
@ -530,8 +503,6 @@ export class PetApi {
if (petId === null || petId === undefined) { if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
'application/x-www-form-urlencoded' 'application/x-www-form-urlencoded'
@ -545,22 +516,21 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
headers.set('Content-Type', 'application/x-www-form-urlencoded'); headers.set('Content-Type', 'application/x-www-form-urlencoded');
if (name !== undefined) { if (name !== undefined) {
formParams.set('name', <any>name); formParams.set('name', <any>name);
} }
if (status !== undefined) { if (status !== undefined) {
formParams.set('status', <any>status); formParams.set('status', <any>status);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
@ -577,7 +547,7 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* uploads an image * uploads an image
* *
@ -596,8 +566,6 @@ export class PetApi {
if (petId === null || petId === undefined) { if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
'multipart/form-data' 'multipart/form-data'
@ -611,22 +579,21 @@ export class PetApi {
// authentication (petstore_auth) required // authentication (petstore_auth) required
// oauth required // oauth required
if (this.configuration.accessToken) if (this.configuration.accessToken) {
{
let accessToken = typeof this.configuration.accessToken === 'function' let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken); headers.set('Authorization', 'Bearer ' + accessToken);
} }
headers.set('Content-Type', 'application/x-www-form-urlencoded'); headers.set('Content-Type', 'application/x-www-form-urlencoded');
if (additionalMetadata !== undefined) { if (additionalMetadata !== undefined) {
formParams.set('additionalMetadata', <any>additionalMetadata); formParams.set('additionalMetadata', <any>additionalMetadata);
} }
if (file !== undefined) { if (file !== undefined) {
formParams.set('file', <any>file); formParams.set('file', <any>file);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
@ -643,5 +610,5 @@ export class PetApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
} }

View File

@ -19,7 +19,7 @@ import { Observable } from 'rxjs/Observab
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import * as models from '../model/models'; import * as models from '../model/models';
import { BASE_PATH } from '../variables'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration'; import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */ /* tslint:disable:no-unused-variable member-ordering */
@ -133,8 +133,6 @@ export class StoreApi {
if (orderId === null || orderId === undefined) { if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -145,10 +143,6 @@ export class StoreApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete, method: RequestMethod.Delete,
headers: headers, headers: headers,
@ -162,7 +156,7 @@ export class StoreApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Returns pet inventories by status * Returns pet inventories by status
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
@ -172,8 +166,6 @@ export class StoreApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -185,13 +177,9 @@ export class StoreApi {
]; ];
// authentication (api_key) required // authentication (api_key) required
if (this.configuration.apiKey) if (this.configuration.apiKey) {
{
headers.set('api_key', this.configuration.apiKey); headers.set('api_key', this.configuration.apiKey);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
@ -206,7 +194,7 @@ export class StoreApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Find purchase order by ID * Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -221,8 +209,6 @@ export class StoreApi {
if (orderId === null || orderId === undefined) { if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -233,10 +219,6 @@ export class StoreApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
@ -250,7 +232,7 @@ export class StoreApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Place an order for a pet * Place an order for a pet
* *
@ -261,8 +243,6 @@ export class StoreApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -273,11 +253,8 @@ export class StoreApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -292,5 +269,5 @@ export class StoreApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
} }

View File

@ -19,7 +19,7 @@ import { Observable } from 'rxjs/Observab
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import * as models from '../model/models'; import * as models from '../model/models';
import { BASE_PATH } from '../variables'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration'; import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */ /* tslint:disable:no-unused-variable member-ordering */
@ -195,8 +195,6 @@ export class UserApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -207,11 +205,8 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -226,7 +221,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
@ -237,8 +232,6 @@ export class UserApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -249,11 +242,8 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -268,7 +258,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
@ -279,8 +269,6 @@ export class UserApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -291,11 +279,8 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
@ -310,7 +295,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Delete user * Delete user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -325,8 +310,6 @@ export class UserApi {
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling deleteUser.'); throw new Error('Required parameter username was null or undefined when calling deleteUser.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -337,10 +320,6 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete, method: RequestMethod.Delete,
headers: headers, headers: headers,
@ -354,7 +333,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Get user by user name * Get user by user name
* *
@ -369,8 +348,6 @@ export class UserApi {
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling getUserByName.'); throw new Error('Required parameter username was null or undefined when calling getUserByName.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -381,10 +358,6 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
@ -398,7 +371,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Logs user into the system * Logs user into the system
* *
@ -413,11 +386,11 @@ export class UserApi {
if (username !== undefined) { if (username !== undefined) {
queryParameters.set('username', <any>username); queryParameters.set('username', <any>username);
} }
if (password !== undefined) { if (password !== undefined) {
queryParameters.set('password', <any>password); queryParameters.set('password', <any>password);
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -428,10 +401,6 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
@ -445,7 +414,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Logs out current logged in user session * Logs out current logged in user session
* *
@ -455,8 +424,6 @@ export class UserApi {
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -467,10 +434,6 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
@ -484,7 +447,7 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
/** /**
* Updated user * Updated user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -500,8 +463,6 @@ export class UserApi {
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.'); throw new Error('Required parameter username was null or undefined when calling updateUser.');
} }
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
]; ];
@ -512,11 +473,8 @@ export class UserApi {
'application/xml' 'application/xml'
]; ];
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Put, method: RequestMethod.Put,
headers: headers, headers: headers,
@ -531,5 +489,5 @@ export class UserApi {
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
} }

View File

@ -1,3 +1,7 @@
export * from './PetApi'; export * from './PetApi';
import { PetApi } from './PetApi';
export * from './StoreApi'; export * from './StoreApi';
import { StoreApi } from './StoreApi';
export * from './UserApi'; export * from './UserApi';
import { UserApi } from './UserApi';
export const APIS = [ PetApi, StoreApi, UserApi, ];

View File

@ -1,6 +1,6 @@
{ {
"name": "@swagger/angular2-typescript-petstore", "name": "@swagger/angular2-typescript-petstore",
"version": "0.0.1-SNAPSHOT.201612150011", "version": "0.0.1-SNAPSHOT.201701111439",
"description": "swagger client for @swagger/angular2-typescript-petstore", "description": "swagger client for @swagger/angular2-typescript-petstore",
"author": "Swagger Codegen Contributors", "author": "Swagger Codegen Contributors",
"keywords": [ "keywords": [

View File

@ -1,3 +1,9 @@
import { OpaqueToken } from '@angular/core'; import { OpaqueToken } from '@angular/core';
export const BASE_PATH = new OpaqueToken('basePath'); export const BASE_PATH = new OpaqueToken('basePath');
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}