TypeScript client API: Add public getter/setter for base path (#5270)

This commit is contained in:
Granjow 2017-04-01 10:33:29 +02:00 committed by wing328
parent e96db74918
commit 64c7e23a04
3 changed files with 67 additions and 11 deletions

View File

@ -116,7 +116,7 @@ export enum {{classname}}ApiKeys {
} }
export class {{classname}} { export class {{classname}} {
protected basePath = defaultBasePath; protected _basePath = defaultBasePath;
protected defaultHeaders : any = {}; protected defaultHeaders : any = {};
protected _useQuerystring : boolean = false; protected _useQuerystring : boolean = false;
@ -163,6 +163,14 @@ export class {{classname}} {
this._useQuerystring = value; this._useQuerystring = value;
} }
set basePath(basePath: string) {
this._basePath = basePath;
}
get basePath() {
return this._basePath;
}
public setApiKey(key: {{classname}}ApiKeys, value: string) { public setApiKey(key: {{classname}}ApiKeys, value: string) {
this.authentications[{{classname}}ApiKeys[key]].apiKey = value; this.authentications[{{classname}}ApiKeys[key]].apiKey = value;
} }

View File

@ -140,7 +140,7 @@ export enum PetApiApiKeys {
} }
export class PetApi { export class PetApi {
protected basePath = defaultBasePath; protected _basePath = defaultBasePath;
protected defaultHeaders : any = {}; protected defaultHeaders : any = {};
protected _useQuerystring : boolean = false; protected _useQuerystring : boolean = false;
@ -167,6 +167,14 @@ export class PetApi {
this._useQuerystring = value; this._useQuerystring = value;
} }
set basePath(basePath: string) {
this._basePath = basePath;
}
get basePath() {
return this._basePath;
}
public setApiKey(key: PetApiApiKeys, value: string) { public setApiKey(key: PetApiApiKeys, value: string) {
this.authentications[PetApiApiKeys[key]].apiKey = value; this.authentications[PetApiApiKeys[key]].apiKey = value;
} }
@ -413,10 +421,10 @@ export class PetApi {
json: true, json: true,
}; };
this.authentications.petstore_auth.applyToRequest(requestOptions);
this.authentications.api_key.applyToRequest(requestOptions); this.authentications.api_key.applyToRequest(requestOptions);
this.authentications.petstore_auth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions); this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) { if (Object.keys(formParams).length) {
@ -624,7 +632,7 @@ export enum StoreApiApiKeys {
} }
export class StoreApi { export class StoreApi {
protected basePath = defaultBasePath; protected _basePath = defaultBasePath;
protected defaultHeaders : any = {}; protected defaultHeaders : any = {};
protected _useQuerystring : boolean = false; protected _useQuerystring : boolean = false;
@ -651,6 +659,14 @@ export class StoreApi {
this._useQuerystring = value; this._useQuerystring = value;
} }
set basePath(basePath: string) {
this._basePath = basePath;
}
get basePath() {
return this._basePath;
}
public setApiKey(key: StoreApiApiKeys, value: string) { public setApiKey(key: StoreApiApiKeys, value: string) {
this.authentications[StoreApiApiKeys[key]].apiKey = value; this.authentications[StoreApiApiKeys[key]].apiKey = value;
} }
@ -862,7 +878,7 @@ export enum UserApiApiKeys {
} }
export class UserApi { export class UserApi {
protected basePath = defaultBasePath; protected _basePath = defaultBasePath;
protected defaultHeaders : any = {}; protected defaultHeaders : any = {};
protected _useQuerystring : boolean = false; protected _useQuerystring : boolean = false;
@ -889,6 +905,14 @@ export class UserApi {
this._useQuerystring = value; this._useQuerystring = value;
} }
set basePath(basePath: string) {
this._basePath = basePath;
}
get basePath() {
return this._basePath;
}
public setApiKey(key: UserApiApiKeys, value: string) { public setApiKey(key: UserApiApiKeys, value: string) {
this.authentications[UserApiApiKeys[key]].apiKey = value; this.authentications[UserApiApiKeys[key]].apiKey = value;
} }

View File

@ -140,7 +140,7 @@ export enum PetApiApiKeys {
} }
export class PetApi { export class PetApi {
protected basePath = defaultBasePath; protected _basePath = defaultBasePath;
protected defaultHeaders : any = {}; protected defaultHeaders : any = {};
protected _useQuerystring : boolean = false; protected _useQuerystring : boolean = false;
@ -167,6 +167,14 @@ export class PetApi {
this._useQuerystring = value; this._useQuerystring = value;
} }
set basePath(basePath: string) {
this._basePath = basePath;
}
get basePath() {
return this._basePath;
}
public setApiKey(key: PetApiApiKeys, value: string) { public setApiKey(key: PetApiApiKeys, value: string) {
this.authentications[PetApiApiKeys[key]].apiKey = value; this.authentications[PetApiApiKeys[key]].apiKey = value;
} }
@ -413,10 +421,10 @@ export class PetApi {
json: true, json: true,
}; };
this.authentications.petstore_auth.applyToRequest(requestOptions);
this.authentications.api_key.applyToRequest(requestOptions); this.authentications.api_key.applyToRequest(requestOptions);
this.authentications.petstore_auth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions); this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) { if (Object.keys(formParams).length) {
@ -624,7 +632,7 @@ export enum StoreApiApiKeys {
} }
export class StoreApi { export class StoreApi {
protected basePath = defaultBasePath; protected _basePath = defaultBasePath;
protected defaultHeaders : any = {}; protected defaultHeaders : any = {};
protected _useQuerystring : boolean = false; protected _useQuerystring : boolean = false;
@ -651,6 +659,14 @@ export class StoreApi {
this._useQuerystring = value; this._useQuerystring = value;
} }
set basePath(basePath: string) {
this._basePath = basePath;
}
get basePath() {
return this._basePath;
}
public setApiKey(key: StoreApiApiKeys, value: string) { public setApiKey(key: StoreApiApiKeys, value: string) {
this.authentications[StoreApiApiKeys[key]].apiKey = value; this.authentications[StoreApiApiKeys[key]].apiKey = value;
} }
@ -862,7 +878,7 @@ export enum UserApiApiKeys {
} }
export class UserApi { export class UserApi {
protected basePath = defaultBasePath; protected _basePath = defaultBasePath;
protected defaultHeaders : any = {}; protected defaultHeaders : any = {};
protected _useQuerystring : boolean = false; protected _useQuerystring : boolean = false;
@ -889,6 +905,14 @@ export class UserApi {
this._useQuerystring = value; this._useQuerystring = value;
} }
set basePath(basePath: string) {
this._basePath = basePath;
}
get basePath() {
return this._basePath;
}
public setApiKey(key: UserApiApiKeys, value: string) { public setApiKey(key: UserApiApiKeys, value: string) {
this.authentications[UserApiApiKeys[key]].apiKey = value; this.authentications[UserApiApiKeys[key]].apiKey = value;
} }