Merge branch 'ts_angular2_typings' of https://github.com/wing328/swagger-codegen into wing328-ts_angular2_typings

This commit is contained in:
wing328 2017-07-02 22:01:10 +08:00
commit 15382f5b77
22 changed files with 329 additions and 181 deletions

View File

@ -28,9 +28,37 @@ _unPublished (not recommended):_
npm install PATH_TO_GENERATED_PACKAGE --save npm install PATH_TO_GENERATED_PACKAGE --save
``` ```
_using `npm link`:_
In PATH_TO_GENERATED_PACKAGE:
```
npm link
```
In your project:
```
npm link {{npmName}}@{{npmVersion}}
```
In your angular2 project: In your angular2 project:
TODO: paste example. ```
import { DefaultApi } from '{{npmName}}/api/api';
@NgModule({
imports: [],
declarations: [],
exports: [],
providers: [AppModule]
})
export class CoreModule {}
```
```
import { DefaultApi } from '{{npmName}}/api/api';
export class AppComponent {
constructor(private apiGateway: DefaultApi) { }
}
```
### Set service base path ### Set service base path
If different than the generated base path, during app bootstrap, you can provide the base path to your service. If different than the generated base path, during app bootstrap, you can provide the base path to your service.
@ -41,4 +69,30 @@ import { BASE_PATH } from './path-to-swagger-gen-service/index';
bootstrap(AppComponent, [ bootstrap(AppComponent, [
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' }, { provide: BASE_PATH, useValue: 'https://your-web-service.com' },
]); ]);
```
#### Using @angular/cli
First extend your `src/environments/*.ts` files by adding the corresponding base path:
```
export const environment = {
production: false,
API_BASE_PATH: 'http://127.0.0.1:8080'
};
```
In the src/app/app.module.ts:
```
import { BASE_PATH } from '{{npmName}}';
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent,
],
imports: [ ],
providers: [{ provide: BASE_PATH, useValue: useValue: environment.API_BASE_PATH }],
bootstrap: [AppComponent]
})
export class AppModule { }
``` ```

View File

@ -10,30 +10,29 @@
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
"build": "typings install && tsc --outDir dist/" "build": "tsc --outDir dist/",
"postinstall": "npm run build"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/core": "^2.0.0", "@angular/core": "^2.2.2",
"@angular/http": "^2.0.0", "@angular/http": "^2.2.2",
"@angular/common": "^2.0.0", "@angular/common": "^2.2.2",
"@angular/compiler": "^2.0.0", "@angular/compiler": "^2.2.2",
"core-js": "^2.4.0", "core-js": "^2.4.0",
"reflect-metadata": "^0.1.3", "reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12", "rxjs": "^5.1.0",
"zone.js": "^0.6.17" "zone.js": "^0.7.6"
}, },
"devDependencies": { "devDependencies": {
"@angular/core": "^2.0.0", "@angular/core": "^2.2.2",
"@angular/http": "^2.0.0", "@angular/http": "^2.2.2",
"@angular/common": "^2.0.0", "@angular/common": "^2.2.2",
"@angular/compiler": "^2.0.0", "@angular/compiler": "^2.2.2",
"@angular/platform-browser": "^2.0.0", "@angular/platform-browser": "^2.2.2",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3", "reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12", "rxjs": "5.1.0",
"zone.js": "^0.6.17", "zone.js": "^0.7.6",
"typescript": "^2.0.0", "typescript": "^2.1.5"
"typings": "^1.3.2"
}{{#npmRepository}},{{/npmRepository}} }{{#npmRepository}},{{/npmRepository}}
{{#npmRepository}} {{#npmRepository}}
"publishConfig":{ "publishConfig":{

View File

@ -5,23 +5,21 @@
"noImplicitAny": false, "noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true, "suppressImplicitAnyIndexErrors": true,
"target": "es5", "target": "es5",
"module": "commonjs", "module": "es6",
"moduleResolution": "node", "moduleResolution": "node",
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",
"noLib": false, "noLib": false,
"declaration": true "declaration": true,
"lib": [ "es6", "dom" ]
}, },
"exclude": [ "exclude": [
"node_modules", "node_modules",
"typings/main.d.ts",
"typings/main",
"dist" "dist"
], ],
"filesGlob": [ "filesGlob": [
"./model/*.ts", "./model/*.ts",
"./api/*.ts", "./api/*.ts"
"typings/browser.d.ts"
] ]
} }

View File

@ -221,7 +221,7 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/xml', 'application/xml',
'application/json' 'application/json'
]; ];
@ -267,7 +267,7 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/xml', 'application/xml',
'application/json' 'application/json'
]; ];
@ -313,7 +313,7 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/xml', 'application/xml',
'application/json' 'application/json'
]; ];
@ -359,7 +359,7 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/xml', 'application/xml',
'application/json' 'application/json'
]; ];
@ -403,7 +403,7 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/xml', 'application/xml',
'application/json' 'application/json'
]; ];
@ -458,7 +458,7 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/xml', 'application/xml',
'application/json' 'application/json'
]; ];
@ -497,7 +497,7 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/xml', 'application/xml',
'application/json' 'application/json'
]; ];
@ -546,7 +546,7 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/xml', 'application/xml',
'application/json' 'application/json'
]; ];

View File

@ -1,9 +1,9 @@
/** /**
* Swagger Petstore * Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* *
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com * Contact: apiteam@swagger.io
* *
* 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
@ -20,6 +20,7 @@ import { Response, ResponseContentType } from '@angular/http
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import '../rxjs-operators'; import '../rxjs-operators';
import { ApiResponse } from '../model/apiResponse';
import { Pet } from '../model/pet'; import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
@ -77,7 +78,7 @@ export class PetService {
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
*/ */
public addPet(body?: Pet, extraHttpRequestParams?: any): Observable<{}> { public addPet(body: Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.addPetWithHttpInfo(body, extraHttpRequestParams) return this.addPetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -110,7 +111,7 @@ export class PetService {
* Multiple status values can be provided with comma separated strings * Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter * @param status Status values that need to be considered for filter
*/ */
public findPetsByStatus(status?: Array<string>, extraHttpRequestParams?: any): Observable<Array<Pet>> { public findPetsByStatus(status: Array<string>, extraHttpRequestParams?: any): Observable<Array<Pet>> {
return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams) return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -126,7 +127,7 @@ export class PetService {
* 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.
* @param tags Tags to filter by * @param tags Tags to filter by
*/ */
public findPetsByTags(tags?: Array<string>, extraHttpRequestParams?: any): Observable<Array<Pet>> { public findPetsByTags(tags: Array<string>, extraHttpRequestParams?: any): Observable<Array<Pet>> {
return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams) return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -139,8 +140,8 @@ export class PetService {
/** /**
* 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 single pet
* @param petId ID of pet that needs to be fetched * @param petId ID of pet to return
*/ */
public getPetById(petId: number, extraHttpRequestParams?: any): Observable<Pet> { public getPetById(petId: number, extraHttpRequestParams?: any): Observable<Pet> {
return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams) return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams)
@ -158,7 +159,7 @@ export class PetService {
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
*/ */
public updatePet(body?: Pet, extraHttpRequestParams?: any): Observable<{}> { public updatePet(body: Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithHttpInfo(body, extraHttpRequestParams) return this.updatePetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -176,7 +177,7 @@ export class PetService {
* @param name Updated name of the pet * @param name Updated name of the pet
* @param status Updated status of the pet * @param status Updated status of the pet
*/ */
public updatePetWithForm(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> { public updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams) return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -194,7 +195,7 @@ export class PetService {
* @param additionalMetadata Additional data to pass to server * @param additionalMetadata Additional data to pass to server
* @param file file to upload * @param file file to upload
*/ */
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: any): Observable<{}> { public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: any): Observable<ApiResponse> {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams) return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -211,17 +212,21 @@ export class PetService {
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
*/ */
public addPetWithHttpInfo(body?: Pet, extraHttpRequestParams?: any): Observable<Response> { public addPetWithHttpInfo(body: Pet, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet'; const path = this.basePath + '/pet';
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
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling addPet.');
}
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
// authentication (petstore_auth) required // authentication (petstore_auth) required
@ -275,8 +280,8 @@ export class PetService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
// authentication (petstore_auth) required // authentication (petstore_auth) required
@ -308,23 +313,25 @@ export class PetService {
* Multiple status values can be provided with comma separated strings * Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter * @param status Status values that need to be considered for filter
*/ */
public findPetsByStatusWithHttpInfo(status?: Array<string>, extraHttpRequestParams?: any): Observable<Response> { public findPetsByStatusWithHttpInfo(status: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/findByStatus'; const path = this.basePath + '/pet/findByStatus';
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
// verify required parameter 'status' is not null or undefined
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}
if (status) { if (status) {
status.forEach((element) => { queryParameters.set('status', status.join(COLLECTION_FORMATS['csv']));
queryParameters.append('status', <any>element);
})
} }
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
// authentication (petstore_auth) required // authentication (petstore_auth) required
@ -356,23 +363,25 @@ export class PetService {
* 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.
* @param tags Tags to filter by * @param tags Tags to filter by
*/ */
public findPetsByTagsWithHttpInfo(tags?: Array<string>, extraHttpRequestParams?: any): Observable<Response> { public findPetsByTagsWithHttpInfo(tags: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/findByTags'; const path = this.basePath + '/pet/findByTags';
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
// verify required parameter 'tags' is not null or undefined
if (tags === null || tags === undefined) {
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
}
if (tags) { if (tags) {
tags.forEach((element) => { queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv']));
queryParameters.append('tags', <any>element);
})
} }
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
// authentication (petstore_auth) required // authentication (petstore_auth) required
@ -401,8 +410,8 @@ export class PetService {
/** /**
* 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 single pet
* @param petId ID of pet that needs to be fetched * @param petId ID of pet to return
*/ */
public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable<Response> { public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}' const path = this.basePath + '/pet/${petId}'
@ -418,8 +427,8 @@ export class PetService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
// authentication (api_key) required // authentication (api_key) required
@ -427,15 +436,6 @@ export class PetService {
headers.set('api_key', this.configuration.apiKeys["api_key"]); headers.set('api_key', this.configuration.apiKeys["api_key"]);
} }
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken);
}
let requestOptions: RequestOptionsArgs = new RequestOptions({ let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get, method: RequestMethod.Get,
@ -456,17 +456,21 @@ export class PetService {
* *
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
*/ */
public updatePetWithHttpInfo(body?: Pet, extraHttpRequestParams?: any): Observable<Response> { public updatePetWithHttpInfo(body: Pet, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet'; const path = this.basePath + '/pet';
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
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updatePet.');
}
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
// authentication (petstore_auth) required // authentication (petstore_auth) required
@ -503,7 +507,7 @@ export class PetService {
* @param name Updated name of the pet * @param name Updated name of the pet
* @param status Updated status of the pet * @param status Updated status of the pet
*/ */
public updatePetWithFormWithHttpInfo(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> { public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}' const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId)); .replace('${' + 'petId' + '}', String(petId));
@ -526,8 +530,8 @@ export class PetService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
// authentication (petstore_auth) required // authentication (petstore_auth) required
@ -594,8 +598,7 @@ export class PetService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json'
'application/xml'
]; ];
// authentication (petstore_auth) required // authentication (petstore_auth) required

View File

@ -1,9 +1,9 @@
/** /**
* Swagger Petstore * Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* *
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com * Contact: apiteam@swagger.io
* *
* 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
@ -108,7 +108,7 @@ export class StoreService {
* 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
* @param orderId ID of pet that needs to be fetched * @param orderId ID of pet that needs to be fetched
*/ */
public getOrderById(orderId: string, extraHttpRequestParams?: any): Observable<Order> { public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable<Order> {
return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams) return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -124,7 +124,7 @@ export class StoreService {
* *
* @param body order placed for purchasing the pet * @param body order placed for purchasing the pet
*/ */
public placeOrder(body?: Order, extraHttpRequestParams?: any): Observable<Order> { public placeOrder(body: Order, extraHttpRequestParams?: any): Observable<Order> {
return this.placeOrderWithHttpInfo(body, extraHttpRequestParams) return this.placeOrderWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -155,8 +155,8 @@ export class StoreService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
@ -187,8 +187,7 @@ export class StoreService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json'
'application/xml'
]; ];
// authentication (api_key) required // authentication (api_key) required
@ -216,7 +215,7 @@ export class StoreService {
* 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
* @param orderId ID of pet that needs to be fetched * @param orderId ID of pet that needs to be fetched
*/ */
public getOrderByIdWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable<Response> { public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order/${orderId}' const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId)); .replace('${' + 'orderId' + '}', String(orderId));
@ -230,8 +229,8 @@ export class StoreService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
@ -254,17 +253,21 @@ export class StoreService {
* *
* @param body order placed for purchasing the pet * @param body order placed for purchasing the pet
*/ */
public placeOrderWithHttpInfo(body?: Order, extraHttpRequestParams?: any): Observable<Response> { public placeOrderWithHttpInfo(body: Order, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order'; const path = this.basePath + '/store/order';
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
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
}
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];

View File

@ -1,9 +1,9 @@
/** /**
* Swagger Petstore * Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* *
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com * Contact: apiteam@swagger.io
* *
* 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
@ -77,7 +77,7 @@ export class UserService {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param body Created user object * @param body Created user object
*/ */
public createUser(body?: User, extraHttpRequestParams?: any): Observable<{}> { public createUser(body: User, extraHttpRequestParams?: any): Observable<{}> {
return this.createUserWithHttpInfo(body, extraHttpRequestParams) return this.createUserWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -93,7 +93,7 @@ export class UserService {
* *
* @param body List of user object * @param body List of user object
*/ */
public createUsersWithArrayInput(body?: Array<User>, extraHttpRequestParams?: any): Observable<{}> { public createUsersWithArrayInput(body: Array<User>, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams) return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -109,7 +109,7 @@ export class UserService {
* *
* @param body List of user object * @param body List of user object
*/ */
public createUsersWithListInput(body?: Array<User>, extraHttpRequestParams?: any): Observable<{}> { public createUsersWithListInput(body: Array<User>, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams) return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -158,7 +158,7 @@ export class UserService {
* @param username The user name for login * @param username The user name for login
* @param password The password for login in clear text * @param password The password for login in clear text
*/ */
public loginUser(username?: string, password?: string, extraHttpRequestParams?: any): Observable<string> { public loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable<string> {
return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams) return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -190,7 +190,7 @@ export class UserService {
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param body Updated user object
*/ */
public updateUser(username: string, body?: User, extraHttpRequestParams?: any): Observable<{}> { public updateUser(username: string, body: User, extraHttpRequestParams?: any): Observable<{}> {
return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams) return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams)
.map((response: Response) => { .map((response: Response) => {
if (response.status === 204) { if (response.status === 204) {
@ -207,17 +207,21 @@ export class UserService {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param body Created user object * @param body Created user object
*/ */
public createUserWithHttpInfo(body?: User, extraHttpRequestParams?: any): Observable<Response> { public createUserWithHttpInfo(body: User, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user'; const path = this.basePath + '/user';
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
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUser.');
}
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
@ -243,17 +247,21 @@ export class UserService {
* *
* @param body List of user object * @param body List of user object
*/ */
public createUsersWithArrayInputWithHttpInfo(body?: Array<User>, extraHttpRequestParams?: any): Observable<Response> { public createUsersWithArrayInputWithHttpInfo(body: Array<User>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/createWithArray'; const path = this.basePath + '/user/createWithArray';
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
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
}
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
@ -279,17 +287,21 @@ export class UserService {
* *
* @param body List of user object * @param body List of user object
*/ */
public createUsersWithListInputWithHttpInfo(body?: Array<User>, extraHttpRequestParams?: any): Observable<Response> { public createUsersWithListInputWithHttpInfo(body: Array<User>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/createWithList'; const path = this.basePath + '/user/createWithList';
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
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
}
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
@ -329,8 +341,8 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
@ -367,8 +379,8 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
@ -392,12 +404,20 @@ export class UserService {
* @param username The user name for login * @param username The user name for login
* @param password The password for login in clear text * @param password The password for login in clear text
*/ */
public loginUserWithHttpInfo(username?: string, password?: string, extraHttpRequestParams?: any): Observable<Response> { public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/login'; const path = this.basePath + '/user/login';
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
// verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling loginUser.');
}
// verify required parameter 'password' is not null or undefined
if (password === null || password === undefined) {
throw new Error('Required parameter password was null or undefined when calling loginUser.');
}
if (username !== undefined) { if (username !== undefined) {
queryParameters.set('username', <any>username); queryParameters.set('username', <any>username);
} }
@ -409,8 +429,8 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
@ -441,8 +461,8 @@ export class UserService {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];
@ -466,7 +486,7 @@ export class UserService {
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param body Updated user object
*/ */
public updateUserWithHttpInfo(username: string, body?: User, extraHttpRequestParams?: any): Observable<Response> { public updateUserWithHttpInfo(username: string, body: User, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}' const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username)); .replace('${' + 'username' + '}', String(username));
@ -477,11 +497,15 @@ export class UserService {
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.');
} }
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updateUser.');
}
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/xml',
'application/xml' 'application/json'
]; ];

View File

@ -1,9 +1,9 @@
/** /**
* Swagger Petstore * Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* *
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com * Contact: apiteam@swagger.io
* *
* 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
@ -12,6 +12,9 @@
/**
* A category for a pet
*/
export interface Category { export interface Category {
id?: number; id?: number;

View File

@ -1,3 +1,4 @@
export * from './apiResponse';
export * from './category'; export * from './category';
export * from './order'; export * from './order';
export * from './pet'; export * from './pet';

View File

@ -1,9 +1,9 @@
/** /**
* Swagger Petstore * Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* *
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com * Contact: apiteam@swagger.io
* *
* 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
@ -12,6 +12,9 @@
/**
* An order for a pets from the pet store
*/
export interface Order { export interface Order {
id?: number; id?: number;

View File

@ -1,9 +1,9 @@
/** /**
* Swagger Petstore * Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* *
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com * Contact: apiteam@swagger.io
* *
* 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
@ -14,6 +14,9 @@ import { Category } from './category';
import { Tag } from './tag'; import { Tag } from './tag';
/**
* A pet for sale in the pet store
*/
export interface Pet { export interface Pet {
id?: number; id?: number;

View File

@ -1,9 +1,9 @@
/** /**
* Swagger Petstore * Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* *
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com * Contact: apiteam@swagger.io
* *
* 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
@ -12,6 +12,9 @@
/**
* A tag for a pet
*/
export interface Tag { export interface Tag {
id?: number; id?: number;

View File

@ -1,9 +1,9 @@
/** /**
* Swagger Petstore * Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* *
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com * Contact: apiteam@swagger.io
* *
* 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
@ -12,6 +12,9 @@
/**
* A User who is purchasing from the pet store
*/
export interface User { export interface User {
id?: number; id?: number;

View File

@ -6,4 +6,4 @@ export const COLLECTION_FORMATS = {
'tsv': ' ', 'tsv': ' ',
'ssv': ' ', 'ssv': ' ',
'pipes': '|' 'pipes': '|'
} }

View File

@ -28,9 +28,37 @@ _unPublished (not recommended):_
npm install PATH_TO_GENERATED_PACKAGE --save npm install PATH_TO_GENERATED_PACKAGE --save
``` ```
_using `npm link`:_
In PATH_TO_GENERATED_PACKAGE:
```
npm link
```
In your project:
```
npm link @swagger/angular2-typescript-petstore@0.0.1
```
In your angular2 project: In your angular2 project:
TODO: paste example. ```
import { DefaultApi } from '@swagger/angular2-typescript-petstore/api/api';
@NgModule({
imports: [],
declarations: [],
exports: [],
providers: [AppModule]
})
export class CoreModule {}
```
```
import { DefaultApi } from '@swagger/angular2-typescript-petstore/api/api';
export class AppComponent {
constructor(private apiGateway: DefaultApi) { }
}
```
### Set service base path ### Set service base path
If different than the generated base path, during app bootstrap, you can provide the base path to your service. If different than the generated base path, during app bootstrap, you can provide the base path to your service.
@ -41,4 +69,30 @@ import { BASE_PATH } from './path-to-swagger-gen-service/index';
bootstrap(AppComponent, [ bootstrap(AppComponent, [
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' }, { provide: BASE_PATH, useValue: 'https://your-web-service.com' },
]); ]);
```
#### Using @angular/cli
First extend your `src/environments/*.ts` files by adding the corresponding base path:
```
export const environment = {
production: false,
API_BASE_PATH: 'http://127.0.0.1:8080'
};
```
In the src/app/app.module.ts:
```
import { BASE_PATH } from '@swagger/angular2-typescript-petstore';
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent,
],
imports: [ ],
providers: [{ provide: BASE_PATH, useValue: useValue: environment.API_BASE_PATH }],
bootstrap: [AppComponent]
})
export class AppModule { }
``` ```

View File

@ -10,30 +10,29 @@
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
"build": "typings install && tsc --outDir dist/" "build": "tsc --outDir dist/",
"postinstall": "npm run build"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/core": "^2.0.0", "@angular/core": "^2.2.2",
"@angular/http": "^2.0.0", "@angular/http": "^2.2.2",
"@angular/common": "^2.0.0", "@angular/common": "^2.2.2",
"@angular/compiler": "^2.0.0", "@angular/compiler": "^2.2.2",
"core-js": "^2.4.0", "core-js": "^2.4.0",
"reflect-metadata": "^0.1.3", "reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12", "rxjs": "^5.1.0",
"zone.js": "^0.6.17" "zone.js": "^0.7.6"
}, },
"devDependencies": { "devDependencies": {
"@angular/core": "^2.0.0", "@angular/core": "^2.2.2",
"@angular/http": "^2.0.0", "@angular/http": "^2.2.2",
"@angular/common": "^2.0.0", "@angular/common": "^2.2.2",
"@angular/compiler": "^2.0.0", "@angular/compiler": "^2.2.2",
"@angular/platform-browser": "^2.0.0", "@angular/platform-browser": "^2.2.2",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3", "reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12", "rxjs": "5.1.0",
"zone.js": "^0.6.17", "zone.js": "^0.7.6",
"typescript": "^2.0.0", "typescript": "^2.1.5"
"typings": "^1.3.2"
}, },
"publishConfig":{ "publishConfig":{
"registry":"https://skimdb.npmjs.com/registry" "registry":"https://skimdb.npmjs.com/registry"

View File

@ -5,23 +5,21 @@
"noImplicitAny": false, "noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true, "suppressImplicitAnyIndexErrors": true,
"target": "es5", "target": "es5",
"module": "commonjs", "module": "es6",
"moduleResolution": "node", "moduleResolution": "node",
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",
"noLib": false, "noLib": false,
"declaration": true "declaration": true,
"lib": [ "es6", "dom" ]
}, },
"exclude": [ "exclude": [
"node_modules", "node_modules",
"typings/main.d.ts",
"typings/main",
"dist" "dist"
], ],
"filesGlob": [ "filesGlob": [
"./model/*.ts", "./model/*.ts",
"./api/*.ts", "./api/*.ts"
"typings/browser.d.ts"
] ]
} }

View File

@ -1,4 +1,4 @@
import { InjectionToken<string> } from '@angular/core'; import { InjectionToken } from '@angular/core';
export const BASE_PATH = new InjectionToken<string>('basePath'); export const BASE_PATH = new InjectionToken<string>('basePath');
export const COLLECTION_FORMATS = { export const COLLECTION_FORMATS = {

View File

@ -188,13 +188,13 @@ export class PetApi implements PetApiInterface {
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',
'application/xml' 'application/xml'
]; ];
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -250,7 +250,7 @@ export class PetApi implements PetApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -299,7 +299,7 @@ export class PetApi implements PetApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -348,7 +348,7 @@ export class PetApi implements PetApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -396,7 +396,7 @@ export class PetApi implements PetApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -440,13 +440,13 @@ export class PetApi implements PetApiInterface {
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',
'application/xml' 'application/xml'
]; ];
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -502,7 +502,7 @@ export class PetApi implements PetApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -566,7 +566,7 @@ export class PetApi implements PetApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];

View File

@ -127,7 +127,7 @@ export class StoreApi implements StoreApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -160,7 +160,7 @@ export class StoreApi implements StoreApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -204,7 +204,7 @@ export class StoreApi implements StoreApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -238,7 +238,7 @@ export class StoreApi implements StoreApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];

View File

@ -188,7 +188,7 @@ export class UserApi implements UserApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -225,7 +225,7 @@ export class UserApi implements UserApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -262,7 +262,7 @@ export class UserApi implements UserApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -304,7 +304,7 @@ export class UserApi implements UserApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -343,7 +343,7 @@ export class UserApi implements UserApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -386,7 +386,7 @@ export class UserApi implements UserApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -419,7 +419,7 @@ export class UserApi implements UserApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];
@ -459,7 +459,7 @@ export class UserApi implements UserApiInterface {
// to determine the Accept header // to determine the Accept header
let produces: string[] = [ let produces: string[] = [
'application/json', 'application/json',
'application/xml' 'application/xml'
]; ];

View File

@ -1,4 +1,4 @@
import { InjectionToken<string> } from '@angular/core'; import { InjectionToken } from '@angular/core';
export const BASE_PATH = new InjectionToken<string>('basePath'); export const BASE_PATH = new InjectionToken<string>('basePath');
export const COLLECTION_FORMATS = { export const COLLECTION_FORMATS = {