@@ -109,6 +109,26 @@ -(NSNumber*) updatePetWithCompletionBlock: (SWGPet*) body
109
109
SWGApiClient* client = [SWGApiClient sharedClientFromPool: basePath];
110
110
111
111
112
+
113
+
114
+
115
+
116
+ // it's void
117
+ return [client stringWithCompletionBlock: requestUrl
118
+ method: @" PUT"
119
+ queryParams: queryParams
120
+ body: bodyDictionary
121
+ headerParams: headerParams
122
+ requestContentType: requestContentType
123
+ responseContentType: responseContentType
124
+ completionBlock: ^(NSString *data, NSError *error) {
125
+ if (error) {
126
+ completionBlock (error);
127
+ return ;
128
+ }
129
+ completionBlock (nil );
130
+ }];
131
+
112
132
113
133
}
114
134
@@ -170,6 +190,26 @@ -(NSNumber*) addPetWithCompletionBlock: (SWGPet*) body
170
190
SWGApiClient* client = [SWGApiClient sharedClientFromPool: basePath];
171
191
172
192
193
+
194
+
195
+
196
+
197
+ // it's void
198
+ return [client stringWithCompletionBlock: requestUrl
199
+ method: @" POST"
200
+ queryParams: queryParams
201
+ body: bodyDictionary
202
+ headerParams: headerParams
203
+ requestContentType: requestContentType
204
+ responseContentType: responseContentType
205
+ completionBlock: ^(NSString *data, NSError *error) {
206
+ if (error) {
207
+ completionBlock (error);
208
+ return ;
209
+ }
210
+ completionBlock (nil );
211
+ }];
212
+
173
213
174
214
}
175
215
@@ -199,18 +239,18 @@ -(NSNumber*) findPetsByStatusWithCompletionBlock: (NSArray*) status
199
239
id bodyDictionary = nil ;
200
240
201
241
202
- bodyDictionary = [[NSMutableArray alloc ] init ];
203
242
204
243
NSMutableDictionary * formParams = [[NSMutableDictionary alloc ]init];
205
244
206
245
207
- [bodyDictionary addObject: formParams];
208
246
209
247
210
248
211
249
212
250
SWGApiClient* client = [SWGApiClient sharedClientFromPool: basePath];
213
251
252
+
253
+ // response is in a container
214
254
// array container response type
215
255
return [client dictionary: requestUrl
216
256
method: @" GET"
@@ -225,8 +265,24 @@ -(NSNumber*) findPetsByStatusWithCompletionBlock: (NSArray*) status
225
265
return ;
226
266
}
227
267
268
+ if ([data isKindOfClass: [NSArray class ]]){
269
+ NSMutableArray * objs = [[NSMutableArray alloc ] initWithCapacity: [data count ]];
270
+ for (NSDictionary * dict in (NSArray *)data) {
271
+
272
+
273
+ SWGPet* d = [[SWGPet alloc ]initWithValues: dict];
274
+
275
+ [objs addObject: d];
276
+ }
277
+ completionBlock (objs, nil );
278
+ }
279
+
280
+
228
281
}];
229
282
283
+
284
+
285
+
230
286
231
287
}
232
288
@@ -256,18 +312,18 @@ -(NSNumber*) findPetsByTagsWithCompletionBlock: (NSArray*) tags
256
312
id bodyDictionary = nil ;
257
313
258
314
259
- bodyDictionary = [[NSMutableArray alloc ] init ];
260
315
261
316
NSMutableDictionary * formParams = [[NSMutableDictionary alloc ]init];
262
317
263
318
264
- [bodyDictionary addObject: formParams];
265
319
266
320
267
321
268
322
269
323
SWGApiClient* client = [SWGApiClient sharedClientFromPool: basePath];
270
324
325
+
326
+ // response is in a container
271
327
// array container response type
272
328
return [client dictionary: requestUrl
273
329
method: @" GET"
@@ -282,8 +338,24 @@ -(NSNumber*) findPetsByTagsWithCompletionBlock: (NSArray*) tags
282
338
return ;
283
339
}
284
340
341
+ if ([data isKindOfClass: [NSArray class ]]){
342
+ NSMutableArray * objs = [[NSMutableArray alloc ] initWithCapacity: [data count ]];
343
+ for (NSDictionary * dict in (NSArray *)data) {
344
+
345
+
346
+ SWGPet* d = [[SWGPet alloc ]initWithValues: dict];
347
+
348
+ [objs addObject: d];
349
+ }
350
+ completionBlock (objs, nil );
351
+ }
352
+
353
+
285
354
}];
286
355
356
+
357
+
358
+
287
359
288
360
}
289
361
@@ -312,21 +384,25 @@ -(NSNumber*) getPetByIdWithCompletionBlock: (NSNumber*) petId
312
384
id bodyDictionary = nil ;
313
385
314
386
315
- bodyDictionary = [[NSMutableArray alloc ] init ];
316
387
317
388
NSMutableDictionary * formParams = [[NSMutableDictionary alloc ]init];
318
389
319
390
320
- [bodyDictionary addObject: formParams];
321
391
322
392
323
393
324
394
325
395
SWGApiClient* client = [SWGApiClient sharedClientFromPool: basePath];
326
396
327
397
398
+
399
+
400
+ // non container response
401
+
328
402
403
+
329
404
405
+ // complex response
330
406
331
407
// comples response type
332
408
return [client dictionary: requestUrl
@@ -342,16 +418,17 @@ -(NSNumber*) getPetByIdWithCompletionBlock: (NSNumber*) petId
342
418
343
419
return ;
344
420
}
345
-
346
- SWGPet *result = nil ;
421
+ SWGPet* result = nil ;
347
422
if (data) {
348
- result = [[SWGPet alloc ]initWithValues: data];
423
+ result = [[SWGPet alloc ] initWithValues : data];
349
424
}
350
425
completionBlock (result , nil );
351
426
352
427
}];
353
428
354
429
430
+
431
+
355
432
}
356
433
357
434
-(NSNumber *) updatePetWithFormWithCompletionBlock : (NSString *) petId
@@ -381,23 +458,53 @@ -(NSNumber*) updatePetWithFormWithCompletionBlock: (NSString*) petId
381
458
id bodyDictionary = nil ;
382
459
383
460
384
- bodyDictionary = [[NSMutableArray alloc ] init ];
385
461
386
462
NSMutableDictionary * formParams = [[NSMutableDictionary alloc ]init];
387
463
388
464
465
+
389
466
formParams[@" name" ] = name;
390
467
468
+ if (bodyDictionary == nil ) {
469
+ bodyDictionary = [[NSMutableArray alloc ] init ];
470
+ }
471
+ [bodyDictionary addObject: formParams];
472
+
473
+
391
474
formParams[@" status" ] = status;
392
475
476
+ if (bodyDictionary == nil ) {
477
+ bodyDictionary = [[NSMutableArray alloc ] init ];
478
+ }
393
479
[bodyDictionary addObject: formParams];
394
480
481
+
395
482
396
483
397
484
398
485
SWGApiClient* client = [SWGApiClient sharedClientFromPool: basePath];
399
486
400
487
488
+
489
+
490
+
491
+
492
+ // it's void
493
+ return [client stringWithCompletionBlock: requestUrl
494
+ method: @" POST"
495
+ queryParams: queryParams
496
+ body: bodyDictionary
497
+ headerParams: headerParams
498
+ requestContentType: requestContentType
499
+ responseContentType: responseContentType
500
+ completionBlock: ^(NSString *data, NSError *error) {
501
+ if (error) {
502
+ completionBlock (error);
503
+ return ;
504
+ }
505
+ completionBlock (nil );
506
+ }];
507
+
401
508
402
509
}
403
510
@@ -429,19 +536,37 @@ -(NSNumber*) deletePetWithCompletionBlock: (NSString*) api_key
429
536
id bodyDictionary = nil ;
430
537
431
538
432
- bodyDictionary = [[NSMutableArray alloc ] init ];
433
539
434
540
NSMutableDictionary * formParams = [[NSMutableDictionary alloc ]init];
435
541
436
542
437
- [bodyDictionary addObject: formParams];
438
543
439
544
440
545
441
546
442
547
SWGApiClient* client = [SWGApiClient sharedClientFromPool: basePath];
443
548
444
549
550
+
551
+
552
+
553
+
554
+ // it's void
555
+ return [client stringWithCompletionBlock: requestUrl
556
+ method: @" DELETE"
557
+ queryParams: queryParams
558
+ body: bodyDictionary
559
+ headerParams: headerParams
560
+ requestContentType: requestContentType
561
+ responseContentType: responseContentType
562
+ completionBlock: ^(NSString *data, NSError *error) {
563
+ if (error) {
564
+ completionBlock (error);
565
+ return ;
566
+ }
567
+ completionBlock (nil );
568
+ }];
569
+
445
570
446
571
}
447
572
@@ -472,31 +597,44 @@ -(NSNumber*) uploadFileWithCompletionBlock: (NSNumber*) petId
472
597
id bodyDictionary = nil ;
473
598
474
599
475
- bodyDictionary = [[NSMutableArray alloc ] init ];
476
600
477
601
NSMutableDictionary * formParams = [[NSMutableDictionary alloc ]init];
478
602
479
603
604
+
480
605
formParams[@" additionalMetadata" ] = additionalMetadata;
481
606
607
+ if (bodyDictionary == nil ) {
608
+ bodyDictionary = [[NSMutableArray alloc ] init ];
609
+ }
610
+ [bodyDictionary addObject: formParams];
611
+
612
+
482
613
requestContentType = @" multipart/form-data" ;
614
+ if (bodyDictionary == nil ) {
615
+ bodyDictionary = [[NSMutableArray alloc ] init ];
616
+ }
483
617
[bodyDictionary addObject: file];
484
618
file.paramName = @" file" ;
485
619
620
+ if (bodyDictionary == nil ) {
621
+ bodyDictionary = [[NSMutableArray alloc ] init ];
622
+ }
486
623
[bodyDictionary addObject: formParams];
487
624
625
+
488
626
489
627
490
628
491
629
SWGApiClient* client = [SWGApiClient sharedClientFromPool: basePath];
492
630
493
631
632
+
494
633
495
- // primitive response type
496
-
634
+
497
635
498
- // no return base type
499
- return [client stringWithCompletionBlock: requestUrl
636
+ // it's void
637
+ return [client stringWithCompletionBlock: requestUrl
500
638
method: @" POST"
501
639
queryParams: queryParams
502
640
body: bodyDictionary
@@ -510,9 +648,7 @@ -(NSNumber*) uploadFileWithCompletionBlock: (NSNumber*) petId
510
648
}
511
649
completionBlock (nil );
512
650
}];
513
-
514
-
515
-
651
+
516
652
517
653
}
518
654
0 commit comments