Add Opeiontal decorator to basePath

This commit is contained in:
Takuro Wada 2016-05-04 18:25:29 +09:00
parent 949da93a05
commit 366c7d6917
9 changed files with 38 additions and 38 deletions

View File

@ -1,5 +1,5 @@
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http';
import {Injectable} from '@angular/core';
import {Injectable, Optional} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import * as models from '../model/models';
@ -18,10 +18,10 @@ export class {{classname}} {
protected basePath = '{{basePath}}';
public defaultHeaders : Headers = new Headers();
constructor(protected http: Http) {}
setBasePath(basePath: string) {
this.basePath = basePath;
constructor(protected http: Http, @Optional() basePath: string) {
if (basePath) {
this.basePath = basePath;
}
}
{{#operation}}

View File

@ -1,5 +1,5 @@
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http';
import {Injectable} from '@angular/core';
import {Injectable, Optional} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import * as models from '../model/models';
@ -12,10 +12,10 @@ export class PetApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders : Headers = new Headers();
constructor(protected http: Http) {}
setBasePath(basePath: string) {
this.basePath = basePath;
constructor(protected http: Http, @Optional() basePath: string) {
if (basePath) {
this.basePath = basePath;
}
}
/**

View File

@ -1,5 +1,5 @@
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http';
import {Injectable} from '@angular/core';
import {Injectable, Optional} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import * as models from '../model/models';
@ -12,10 +12,10 @@ export class StoreApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders : Headers = new Headers();
constructor(protected http: Http) {}
setBasePath(basePath: string) {
this.basePath = basePath;
constructor(protected http: Http, @Optional() basePath: string) {
if (basePath) {
this.basePath = basePath;
}
}
/**

View File

@ -1,5 +1,5 @@
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http';
import {Injectable} from '@angular/core';
import {Injectable, Optional} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import * as models from '../model/models';
@ -12,10 +12,10 @@ export class UserApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders : Headers = new Headers();
constructor(protected http: Http) {}
setBasePath(basePath: string) {
this.basePath = basePath;
constructor(protected http: Http, @Optional() basePath: string) {
if (basePath) {
this.basePath = basePath;
}
}
/**

View File

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

View File

@ -1,5 +1,5 @@
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http';
import {Injectable} from '@angular/core';
import {Injectable, Optional} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import * as models from '../model/models';
@ -12,10 +12,10 @@ export class PetApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders : Headers = new Headers();
constructor(protected http: Http) {}
setBasePath(basePath: string) {
this.basePath = basePath;
constructor(protected http: Http, @Optional() basePath: string) {
if (basePath) {
this.basePath = basePath;
}
}
/**

View File

@ -1,5 +1,5 @@
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http';
import {Injectable} from '@angular/core';
import {Injectable, Optional} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import * as models from '../model/models';
@ -12,10 +12,10 @@ export class StoreApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders : Headers = new Headers();
constructor(protected http: Http) {}
setBasePath(basePath: string) {
this.basePath = basePath;
constructor(protected http: Http, @Optional() basePath: string) {
if (basePath) {
this.basePath = basePath;
}
}
/**

View File

@ -1,5 +1,5 @@
import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http';
import {Injectable} from '@angular/core';
import {Injectable, Optional} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import * as models from '../model/models';
@ -12,10 +12,10 @@ export class UserApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders : Headers = new Headers();
constructor(protected http: Http) {}
setBasePath(basePath: string) {
this.basePath = basePath;
constructor(protected http: Http, @Optional() basePath: string) {
if (basePath) {
this.basePath = basePath;
}
}
/**

View File

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