Skip to content

Commit 7d6f92f

Browse files
committed
updated typescript angular samples
1 parent 0f445a8 commit 7d6f92f

File tree

32 files changed

+427
-101
lines changed

32 files changed

+427
-101
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
wwwroot/*.js
2+
node
3+
node_modules
4+
typings
5+
dist
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.0-SNAPSHOT
1+
3.0.25-SNAPSHOT

samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts

Lines changed: 101 additions & 32 deletions
Large diffs are not rendered by default.

samples/client/petstore/typescript-angular-v2/default/api/store.service.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
* NOTE: This class is auto generated by the swagger code generator program.
99
* https://github.com/swagger-api/swagger-codegen.git
1010
* Do not edit the class manually.
11-
*/
12-
/* tslint:disable:no-unused-variable member-ordering */
11+
*//* tslint:disable:no-unused-variable member-ordering */
1312

1413
import { Inject, Injectable, Optional } from '@angular/core';
1514
import { Http, Headers, URLSearchParams } from '@angular/http';
@@ -62,7 +61,7 @@ export class StoreService {
6261
* @summary Delete purchase order by ID
6362
* @param orderId ID of the order that needs to be deleted
6463
*/
65-
public deleteOrder(orderId: stringextraHttpRequestParams?: RequestOptionsArgs): Observable<{}> {
64+
public deleteOrder(orderId: string, extraHttpRequestParams?: RequestOptionsArgs): Observable<{}> {
6665
return this.deleteOrderWithHttpInfo(orderId, extraHttpRequestParams)
6766
.map((response: Response) => {
6867
if (response.status === 204) {
@@ -93,7 +92,7 @@ export class StoreService {
9392
* @summary Find purchase order by ID
9493
* @param orderId ID of pet that needs to be fetched
9594
*/
96-
public getOrderById(orderId: numberextraHttpRequestParams?: RequestOptionsArgs): Observable<Order> {
95+
public getOrderById(orderId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable<Order> {
9796
return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams)
9897
.map((response: Response) => {
9998
if (response.status === 204) {
@@ -109,7 +108,7 @@ export class StoreService {
109108
* @summary Place an order for a pet
110109
* @param body order placed for purchasing the pet
111110
*/
112-
public placeOrder(body: OrderextraHttpRequestParams?: RequestOptionsArgs): Observable<Order> {
111+
public placeOrder(body: Order, extraHttpRequestParams?: RequestOptionsArgs): Observable<Order> {
113112
return this.placeOrderWithHttpInfo(body, extraHttpRequestParams)
114113
.map((response: Response) => {
115114
if (response.status === 204) {
@@ -128,6 +127,7 @@ export class StoreService {
128127
129128
*/
130129
public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
130+
131131
if (orderId === null || orderId === undefined) {
132132
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
133133
}
@@ -147,9 +147,9 @@ export class StoreService {
147147
];
148148

149149
let requestOptions: RequestOptionsArgs = new RequestOptions({
150-
method: RequestMethod.Delete,
150+
method: 'RequestMethod.Delete',
151151
headers: headers,
152-
withCredentials:this.configuration.withCredentials
152+
withCredentials: this.configuration.withCredentials
153153
});
154154
// https://github.com/swagger-api/swagger-codegen/issues/4037
155155
if (extraHttpRequestParams) {
@@ -169,6 +169,10 @@ export class StoreService {
169169
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
170170

171171
// authentication (api_key) required
172+
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
173+
headers.set('api_key', this.configuration.apiKeys["api_key"]);
174+
}
175+
172176
// to determine the Accept header
173177
let httpHeaderAccepts: string[] = [
174178
'application/json'
@@ -183,9 +187,9 @@ export class StoreService {
183187
];
184188

185189
let requestOptions: RequestOptionsArgs = new RequestOptions({
186-
method: RequestMethod.Get,
190+
method: 'RequestMethod.Get',
187191
headers: headers,
188-
withCredentials:this.configuration.withCredentials
192+
withCredentials: this.configuration.withCredentials
189193
});
190194
// https://github.com/swagger-api/swagger-codegen/issues/4037
191195
if (extraHttpRequestParams) {
@@ -202,6 +206,7 @@ export class StoreService {
202206
203207
*/
204208
public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
209+
205210
if (orderId === null || orderId === undefined) {
206211
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
207212
}
@@ -223,9 +228,9 @@ export class StoreService {
223228
];
224229

225230
let requestOptions: RequestOptionsArgs = new RequestOptions({
226-
method: RequestMethod.Get,
231+
method: 'RequestMethod.Get',
227232
headers: headers,
228-
withCredentials:this.configuration.withCredentials
233+
withCredentials: this.configuration.withCredentials
229234
});
230235
// https://github.com/swagger-api/swagger-codegen/issues/4037
231236
if (extraHttpRequestParams) {
@@ -242,6 +247,7 @@ export class StoreService {
242247
243248
*/
244249
public placeOrderWithHttpInfo(body: Order, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
250+
245251
if (body === null || body === undefined) {
246252
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
247253
}
@@ -260,18 +266,18 @@ export class StoreService {
260266

261267
// to determine the Content-Type header
262268
const consumes: string[] = [
263-
'*/*'
269+
'application/json'
264270
];
265271
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
266272
if (httpContentTypeSelected != undefined) {
267273
headers.set('Content-Type', httpContentTypeSelected);
268274
}
269275

270276
let requestOptions: RequestOptionsArgs = new RequestOptions({
271-
method: RequestMethod.Post,
277+
method: 'RequestMethod.Post',
272278
headers: headers,
273279
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
274-
withCredentials:this.configuration.withCredentials
280+
withCredentials: this.configuration.withCredentials
275281
});
276282
// https://github.com/swagger-api/swagger-codegen/issues/4037
277283
if (extraHttpRequestParams) {
@@ -281,3 +287,4 @@ export class StoreService {
281287
return this.http.request(`${this.basePath}/store/order`, requestOptions);
282288
}
283289

290+
}

0 commit comments

Comments
 (0)