[TypeScript][Angular2] better code indentation, update Petstore sample (#4990)

* fix query parameter indentation, update ts angular2 sample

* update ts angular2 sample
This commit is contained in:
wing328 2017-03-09 22:27:29 +08:00 committed by GitHub
parent cffaaa027a
commit bfb4390a1c
17 changed files with 226 additions and 311 deletions

View File

@ -1,3 +1,4 @@
wwwroot/*.js wwwroot/*.js
node_modules node_modules
typings typings
dist

View File

@ -8,18 +8,6 @@
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import { Inject, Injectable, Optional } from '@angular/core'; import { Inject, Injectable, Optional } from '@angular/core';
@ -31,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 */
@ -196,8 +184,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',
@ -212,23 +198,27 @@ 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'
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); ? this.configuration.accessToken()
: this.configuration.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,
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -248,7 +238,7 @@ 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));
// to determine the Content-Type header // to determine the Content-Type header
let consumes: string[] = [ let consumes: string[] = [
@ -262,21 +252,24 @@ 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'
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); ? this.configuration.accessToken()
: this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete, method: RequestMethod.Delete,
headers: headers, headers: headers,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -290,11 +283,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[] = [
]; ];
@ -307,21 +301,24 @@ 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'
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); ? this.configuration.accessToken()
: this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -335,11 +332,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[] = [
]; ];
@ -352,21 +350,24 @@ 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'
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); ? this.configuration.accessToken()
: this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken);
} }
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
headers: headers, headers: headers,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -385,8 +386,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[] = [
]; ];
@ -399,26 +398,29 @@ 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'
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); ? this.configuration.accessToken()
: this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken);
} }
// 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,
headers: headers, headers: headers,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -432,8 +434,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',
@ -448,23 +448,27 @@ 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'
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); ? this.configuration.accessToken()
: this.configuration.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,
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -487,8 +491,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'
@ -502,17 +504,19 @@ 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'
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); ? this.configuration.accessToken()
: this.configuration.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);
} }
@ -521,10 +525,14 @@ export class PetApi {
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
body: formParams.toString(), body: formParams.toString(),
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -547,8 +555,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'
@ -562,17 +568,19 @@ 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'
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken); ? this.configuration.accessToken()
: this.configuration.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);
} }
@ -581,10 +589,14 @@ export class PetApi {
method: RequestMethod.Post, method: RequestMethod.Post,
headers: headers, headers: headers,
body: formParams.toString(), body: formParams.toString(),
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }

View File

@ -8,18 +8,6 @@
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import { Inject, Injectable, Optional } from '@angular/core'; import { Inject, Injectable, Optional } from '@angular/core';
@ -31,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 */
@ -131,8 +119,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[] = [
]; ];
@ -143,17 +129,17 @@ 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,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -166,8 +152,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[] = [
]; ];
@ -179,21 +163,21 @@ 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,
headers: headers, headers: headers,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -212,8 +196,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[] = [
]; ];
@ -224,17 +206,17 @@ 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,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -248,8 +230,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[] = [
]; ];
@ -260,19 +240,20 @@ 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,
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }

View File

@ -8,18 +8,6 @@
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import { Inject, Injectable, Optional } from '@angular/core'; import { Inject, Injectable, Optional } from '@angular/core';
@ -31,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 */
@ -192,8 +180,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[] = [
]; ];
@ -204,19 +190,20 @@ 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,
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -230,8 +217,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[] = [
]; ];
@ -242,19 +227,20 @@ 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,
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -268,8 +254,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[] = [
]; ];
@ -280,19 +264,20 @@ 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,
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -311,8 +296,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[] = [
]; ];
@ -323,17 +306,17 @@ 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,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -352,8 +335,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[] = [
]; ];
@ -364,17 +345,17 @@ 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,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -392,11 +373,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[] = [
]; ];
@ -407,17 +388,17 @@ 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,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -430,8 +411,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[] = [
]; ];
@ -442,17 +421,17 @@ 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,
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(path, requestOptions); return this.http.request(path, requestOptions);
} }
@ -472,8 +451,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[] = [
]; ];
@ -484,19 +461,20 @@ 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,
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters, search: queryParameters
responseType: ResponseContentType.Json
}); });
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
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

@ -2,5 +2,5 @@ export class Configuration {
apiKey: string; apiKey: string;
username: string; username: string;
password: string; password: string;
accessToken: string; accessToken: string | (() => string);
} }

View File

@ -8,18 +8,6 @@
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import * as models from './models'; import * as models from './models';

View File

@ -8,18 +8,6 @@
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import * as models from './models'; import * as models from './models';

View File

@ -8,18 +8,6 @@
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import * as models from './models'; import * as models from './models';

View File

@ -8,18 +8,6 @@
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import * as models from './models'; import * as models from './models';

View File

@ -8,18 +8,6 @@
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
import * as models from './models'; import * as models from './models';

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,3 +1,4 @@
wwwroot/*.js wwwroot/*.js
node_modules node_modules
typings typings
dist

View File

@ -1,4 +1,4 @@
## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201702090204 ## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201703092202
### 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.201702090204 --save npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201703092202 --save
``` ```
_unPublished (not recommended):_ _unPublished (not recommended):_

View File

@ -371,20 +371,12 @@ 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
if (username !== undefined) { if (username !== undefined) {
if(username instanceof Date) {
queryParameters.set('username', <any>username.d.toISOString());
} else {
queryParameters.set('username', <any>username); queryParameters.set('username', <any>username);
} }
}
if (password !== undefined) { if (password !== undefined) {
if(password instanceof Date) {
queryParameters.set('password', <any>password.d.toISOString());
} else {
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[] = [

View File

@ -1,6 +1,6 @@
{ {
"name": "@swagger/angular2-typescript-petstore", "name": "@swagger/angular2-typescript-petstore",
"version": "0.0.1-SNAPSHOT.201702090204", "version": "0.0.1-SNAPSHOT.201703092202",
"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": [