@@ -123,39 +123,39 @@ SWGPetApi::findPetsByStatus(QList<QString*>* status) {
123
123
124
124
125
125
126
- if (status->size () > 0 ) {
127
- if (QString (" multi" ).indexOf (" multi" ) == 0 ) {
126
+ if (status->size () > 0 ) {
127
+ if (QString (" multi" ).indexOf (" multi" ) == 0 ) {
128
128
foreach (QString* t, *status) {
129
- if (fullPath.indexOf (" ?" ) > 0 )
129
+ if (fullPath.indexOf (" ?" ) > 0 )
130
130
fullPath.append (" &" );
131
131
else
132
132
fullPath.append (" ?" );
133
133
fullPath.append (" status=" ).append (stringValue (t));
134
134
}
135
135
}
136
136
else if (QString (" multi" ).indexOf (" ssv" ) == 0 ) {
137
- if (fullPath.indexOf (" ?" ) > 0 )
137
+ if (fullPath.indexOf (" ?" ) > 0 )
138
138
fullPath.append (" &" );
139
139
else
140
140
fullPath.append (" ?" );
141
141
fullPath.append (" status=" );
142
142
qint32 count = 0 ;
143
143
foreach (QString* t, *status) {
144
- if (count > 0 ) {
144
+ if (count > 0 ) {
145
145
fullPath.append (" " );
146
146
}
147
147
fullPath.append (stringValue (t));
148
148
}
149
149
}
150
150
else if (QString (" multi" ).indexOf (" tsv" ) == 0 ) {
151
- if (fullPath.indexOf (" ?" ) > 0 )
151
+ if (fullPath.indexOf (" ?" ) > 0 )
152
152
fullPath.append (" &" );
153
153
else
154
154
fullPath.append (" ?" );
155
155
fullPath.append (" status=" );
156
156
qint32 count = 0 ;
157
157
foreach (QString* t, *status) {
158
- if (count > 0 ) {
158
+ if (count > 0 ) {
159
159
fullPath.append (" \t " );
160
160
}
161
161
fullPath.append (stringValue (t));
@@ -228,39 +228,39 @@ SWGPetApi::findPetsByTags(QList<QString*>* tags) {
228
228
229
229
230
230
231
- if (tags->size () > 0 ) {
232
- if (QString (" multi" ).indexOf (" multi" ) == 0 ) {
231
+ if (tags->size () > 0 ) {
232
+ if (QString (" multi" ).indexOf (" multi" ) == 0 ) {
233
233
foreach (QString* t, *tags) {
234
- if (fullPath.indexOf (" ?" ) > 0 )
234
+ if (fullPath.indexOf (" ?" ) > 0 )
235
235
fullPath.append (" &" );
236
236
else
237
237
fullPath.append (" ?" );
238
238
fullPath.append (" tags=" ).append (stringValue (t));
239
239
}
240
240
}
241
241
else if (QString (" multi" ).indexOf (" ssv" ) == 0 ) {
242
- if (fullPath.indexOf (" ?" ) > 0 )
242
+ if (fullPath.indexOf (" ?" ) > 0 )
243
243
fullPath.append (" &" );
244
244
else
245
245
fullPath.append (" ?" );
246
246
fullPath.append (" tags=" );
247
247
qint32 count = 0 ;
248
248
foreach (QString* t, *tags) {
249
- if (count > 0 ) {
249
+ if (count > 0 ) {
250
250
fullPath.append (" " );
251
251
}
252
252
fullPath.append (stringValue (t));
253
253
}
254
254
}
255
255
else if (QString (" multi" ).indexOf (" tsv" ) == 0 ) {
256
- if (fullPath.indexOf (" ?" ) > 0 )
256
+ if (fullPath.indexOf (" ?" ) > 0 )
257
257
fullPath.append (" &" );
258
258
else
259
259
fullPath.append (" ?" );
260
260
fullPath.append (" tags=" );
261
261
qint32 count = 0 ;
262
262
foreach (QString* t, *tags) {
263
- if (count > 0 ) {
263
+ if (count > 0 ) {
264
264
fullPath.append (" \t " );
265
265
}
266
266
fullPath.append (stringValue (t));
@@ -391,12 +391,10 @@ SWGPetApi::updatePetWithForm(QString* petId, QString* name, QString* status) {
391
391
HttpRequestWorker *worker = new HttpRequestWorker ();
392
392
HttpRequestInput input (fullPath, " POST" );
393
393
394
-
395
- if (name != NULL ) {
394
+ if (name != NULL ) {
396
395
input.add_var (" name" , *name);
397
396
}
398
-
399
- if (status != NULL ) {
397
+ if (status != NULL ) {
400
398
input.add_var (" status" , *status);
401
399
}
402
400
@@ -493,10 +491,12 @@ SWGPetApi::uploadFile(qint64 petId, QString* additionalMetadata, SWGHttpRequestI
493
491
HttpRequestWorker *worker = new HttpRequestWorker ();
494
492
HttpRequestInput input (fullPath, " POST" );
495
493
496
-
497
- if (additionalMetadata != NULL ) {
494
+ if (additionalMetadata != NULL ) {
498
495
input.add_var (" additionalMetadata" , *additionalMetadata);
499
496
}
497
+ if (file != NULL ) {
498
+ input.add_file (" file" , *file.local_filename , *file.request_filename , *file.mime_type );
499
+ }
500
500
501
501
502
502
@@ -528,4 +528,107 @@ SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) {
528
528
529
529
emit uploadFileSignal ();
530
530
}
531
+ void
532
+ SWGPetApi::getPetByIdWithByteArray (qint64 petId) {
533
+ QString fullPath;
534
+ fullPath.append (this ->host ).append (this ->basePath ).append (" /pet/{petId}?testing_byte_array=true" );
535
+
536
+
537
+ QString petIdPathParam (" {" ); petIdPathParam.append (" petId" ).append (" }" );
538
+ fullPath.replace (petIdPathParam, stringValue (petId));
539
+
540
+
541
+
542
+
543
+ HttpRequestWorker *worker = new HttpRequestWorker ();
544
+ HttpRequestInput input (fullPath, " GET" );
545
+
546
+
547
+
548
+
549
+
550
+
551
+
552
+ connect (worker,
553
+ &HttpRequestWorker::on_execution_finished,
554
+ this ,
555
+ &SWGPetApi::getPetByIdWithByteArrayCallback);
556
+
557
+ worker->execute (&input);
558
+ }
559
+
560
+ void
561
+ SWGPetApi::getPetByIdWithByteArrayCallback (HttpRequestWorker * worker) {
562
+ QString msg;
563
+ if (worker->error_type == QNetworkReply::NoError) {
564
+ msg = QString (" Success! %1 bytes" ).arg (worker->response .length ());
565
+ }
566
+ else {
567
+ msg = " Error: " + worker->error_str ;
568
+ }
569
+
570
+
571
+
572
+
573
+
574
+
575
+ QString json (worker->response );
576
+ QString* output = static_cast <QString*>(create (json, QString (" QString" )));
577
+
578
+
579
+
580
+
581
+ worker->deleteLater ();
582
+
583
+ emit getPetByIdWithByteArraySignal (output);
584
+
585
+ }
586
+ void
587
+ SWGPetApi::addPetUsingByteArray (QString* body) {
588
+ QString fullPath;
589
+ fullPath.append (this ->host ).append (this ->basePath ).append (" /pet?testing_byte_array=true" );
590
+
591
+
592
+
593
+
594
+
595
+ HttpRequestWorker *worker = new HttpRequestWorker ();
596
+ HttpRequestInput input (fullPath, " POST" );
597
+
598
+
599
+
600
+
601
+
602
+
603
+ QString output = body.asJson ();
604
+ input.request_body .append (output);
605
+
606
+
607
+
608
+
609
+ connect (worker,
610
+ &HttpRequestWorker::on_execution_finished,
611
+ this ,
612
+ &SWGPetApi::addPetUsingByteArrayCallback);
613
+
614
+ worker->execute (&input);
615
+ }
616
+
617
+ void
618
+ SWGPetApi::addPetUsingByteArrayCallback (HttpRequestWorker * worker) {
619
+ QString msg;
620
+ if (worker->error_type == QNetworkReply::NoError) {
621
+ msg = QString (" Success! %1 bytes" ).arg (worker->response .length ());
622
+ }
623
+ else {
624
+ msg = " Error: " + worker->error_str ;
625
+ }
626
+
627
+
628
+
629
+ worker->deleteLater ();
630
+
631
+
632
+ emit addPetUsingByteArraySignal ();
633
+ }
531
634
} /* namespace Swagger */
0 commit comments