Skip to content

Commit

Permalink
[Typescript-Angular2] Fixes swagger-api#4703 (swagger-api#4704)
Browse files Browse the repository at this point in the history
* fix issue swagger-api#4703

* run petstore
  • Loading branch information
27leaves authored and wing328 committed Feb 4, 2017
1 parent 23aee52 commit 95a8192
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class {{classname}} {
'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}
{{/produces}}
];

{{#authMethods}}
// authentication ({{name}}) required
{{#isApiKey}}
Expand All @@ -137,7 +137,7 @@ export class {{classname}} {
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (this.configuration.apiKey) {
formParams.set('{{keyParamName}}', this.configuration.apiKey);
queryParameters.set('{{keyParamName}}', this.configuration.apiKey);
}

{{/isKeyInQuery}}
Expand Down Expand Up @@ -199,15 +199,15 @@ export class {{classname}} {
{{/hasFormParams}}
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

{{/operation}}
}
{{/operations}}
48 changes: 24 additions & 24 deletions samples/client/petstore/typescript-angular2/default/api/PetApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class PetApi {
'application/json',
'application/xml'
];

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand All @@ -213,15 +213,15 @@ export class PetApi {
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* Deletes a pet
*
Expand All @@ -248,7 +248,7 @@ export class PetApi {
'application/json',
'application/xml'
];

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand All @@ -263,15 +263,15 @@ export class PetApi {
headers: headers,
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
Expand All @@ -297,7 +297,7 @@ export class PetApi {
'application/json',
'application/xml'
];

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand All @@ -312,15 +312,15 @@ export class PetApi {
headers: headers,
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Expand All @@ -346,7 +346,7 @@ export class PetApi {
'application/json',
'application/xml'
];

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand All @@ -361,15 +361,15 @@ export class PetApi {
headers: headers,
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* Find pet by ID
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
Expand All @@ -393,7 +393,7 @@ export class PetApi {
'application/json',
'application/xml'
];

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand All @@ -413,15 +413,15 @@ export class PetApi {
headers: headers,
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* Update an existing pet
*
Expand All @@ -443,7 +443,7 @@ export class PetApi {
'application/json',
'application/xml'
];

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand All @@ -461,15 +461,15 @@ export class PetApi {
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* Updates a pet in the store with form data
*
Expand Down Expand Up @@ -498,7 +498,7 @@ export class PetApi {
'application/json',
'application/xml'
];

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand All @@ -524,15 +524,15 @@ export class PetApi {
body: formParams.toString(),
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* uploads an image
*
Expand Down Expand Up @@ -561,7 +561,7 @@ export class PetApi {
'application/json',
'application/xml'
];

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand All @@ -587,13 +587,13 @@ export class PetApi {
body: formParams.toString(),
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

}
24 changes: 12 additions & 12 deletions samples/client/petstore/typescript-angular2/default/api/StoreApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,21 @@ export class StoreApi {
'application/json',
'application/xml'
];

let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
headers: headers,
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
Expand All @@ -160,7 +160,7 @@ export class StoreApi {
'application/json',
'application/xml'
];

// authentication (api_key) required
if (this.configuration.apiKey) {
headers.set('api_key', this.configuration.apiKey);
Expand All @@ -171,15 +171,15 @@ export class StoreApi {
headers: headers,
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
Expand All @@ -203,21 +203,21 @@ export class StoreApi {
'application/json',
'application/xml'
];

let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

/**
* Place an order for a pet
*
Expand All @@ -237,7 +237,7 @@ export class StoreApi {
'application/json',
'application/xml'
];

headers.set('Content-Type', 'application/json');

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand All @@ -246,13 +246,13 @@ export class StoreApi {
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
search: queryParameters
});

// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
}

}
Loading

0 comments on commit 95a8192

Please sign in to comment.