@@ -215,6 +215,79 @@ public function deletePetAction(Request $request, $petId)
215
215
}
216
216
}
217
217
218
+ /**
219
+ * Operation downloadFile
220
+ *
221
+ * downloads an image
222
+ *
223
+ * @param Request $request The Symfony request to handle.
224
+ * @return Response The Symfony response.
225
+ */
226
+ public function downloadFileAction (Request $ request , $ petId )
227
+ {
228
+ // Figure out what data format to return to the client
229
+ $ produces = ['image/png ' ];
230
+ // Figure out what the client accepts
231
+ $ clientAccepts = $ request ->headers ->has ('Accept ' )?$ request ->headers ->get ('Accept ' ):'*/* ' ;
232
+ $ responseFormat = $ this ->getOutputFormat ($ clientAccepts , $ produces );
233
+ if ($ responseFormat === null ) {
234
+ return new Response ('' , 406 );
235
+ }
236
+
237
+ // Handle authentication
238
+
239
+ // Read out all input parameter values into variables
240
+
241
+ // Use the default value if no value was provided
242
+
243
+ // Deserialize the input values that needs it
244
+ try {
245
+ $ petId = $ this ->deserialize ($ petId , 'int ' , 'string ' );
246
+ } catch (SerializerRuntimeException $ exception ) {
247
+ return $ this ->createBadRequestResponse ($ exception ->getMessage ());
248
+ }
249
+
250
+ // Validate the input values
251
+ $ asserts = [];
252
+ $ asserts [] = new Assert \NotNull ();
253
+ $ asserts [] = new Assert \Type ("int " );
254
+ $ response = $ this ->validate ($ petId , $ asserts );
255
+ if ($ response instanceof Response) {
256
+ return $ response ;
257
+ }
258
+
259
+
260
+ try {
261
+ $ handler = $ this ->getApiHandler ();
262
+
263
+
264
+ // Make the call to the business logic
265
+ $ responseCode = 200 ;
266
+ $ responseHeaders = [];
267
+
268
+ $ result = $ handler ->downloadFile ($ petId , $ responseCode , $ responseHeaders );
269
+
270
+ $ message = match ($ responseCode ) {
271
+ 200 => 'successful operation ' ,
272
+ default => '' ,
273
+ };
274
+
275
+ return new Response (
276
+ $ result !== null ?$ this ->serialize ($ result , $ responseFormat ):'' ,
277
+ $ responseCode ,
278
+ array_merge (
279
+ $ responseHeaders ,
280
+ [
281
+ 'Content-Type ' => $ responseFormat ,
282
+ 'X-OpenAPI-Message ' => $ message
283
+ ]
284
+ )
285
+ );
286
+ } catch (\Throwable $ fallthrough ) {
287
+ return $ this ->createErrorResponse (new HttpException (500 , 'An unsuspected error occurred. ' , $ fallthrough ));
288
+ }
289
+ }
290
+
218
291
/**
219
292
* Operation findPetsByStatus
220
293
*
@@ -465,6 +538,152 @@ public function getPetByIdAction(Request $request, $petId)
465
538
}
466
539
}
467
540
541
+ /**
542
+ * Operation petAge
543
+ *
544
+ * Get the age of the pet
545
+ *
546
+ * @param Request $request The Symfony request to handle.
547
+ * @return Response The Symfony response.
548
+ */
549
+ public function petAgeAction (Request $ request , $ petId )
550
+ {
551
+ // Figure out what data format to return to the client
552
+ $ produces = ['text/plain ' ];
553
+ // Figure out what the client accepts
554
+ $ clientAccepts = $ request ->headers ->has ('Accept ' )?$ request ->headers ->get ('Accept ' ):'*/* ' ;
555
+ $ responseFormat = $ this ->getOutputFormat ($ clientAccepts , $ produces );
556
+ if ($ responseFormat === null ) {
557
+ return new Response ('' , 406 );
558
+ }
559
+
560
+ // Handle authentication
561
+
562
+ // Read out all input parameter values into variables
563
+
564
+ // Use the default value if no value was provided
565
+
566
+ // Deserialize the input values that needs it
567
+ try {
568
+ $ petId = $ this ->deserialize ($ petId , 'int ' , 'string ' );
569
+ } catch (SerializerRuntimeException $ exception ) {
570
+ return $ this ->createBadRequestResponse ($ exception ->getMessage ());
571
+ }
572
+
573
+ // Validate the input values
574
+ $ asserts = [];
575
+ $ asserts [] = new Assert \NotNull ();
576
+ $ asserts [] = new Assert \Type ("int " );
577
+ $ response = $ this ->validate ($ petId , $ asserts );
578
+ if ($ response instanceof Response) {
579
+ return $ response ;
580
+ }
581
+
582
+
583
+ try {
584
+ $ handler = $ this ->getApiHandler ();
585
+
586
+
587
+ // Make the call to the business logic
588
+ $ responseCode = 200 ;
589
+ $ responseHeaders = [];
590
+
591
+ $ result = $ handler ->petAge ($ petId , $ responseCode , $ responseHeaders );
592
+
593
+ $ message = match ($ responseCode ) {
594
+ 200 => 'successful operation ' ,
595
+ default => '' ,
596
+ };
597
+
598
+ return new Response (
599
+ $ result !== null ?$ this ->serialize ($ result , $ responseFormat ):'' ,
600
+ $ responseCode ,
601
+ array_merge (
602
+ $ responseHeaders ,
603
+ [
604
+ 'Content-Type ' => $ responseFormat ,
605
+ 'X-OpenAPI-Message ' => $ message
606
+ ]
607
+ )
608
+ );
609
+ } catch (\Throwable $ fallthrough ) {
610
+ return $ this ->createErrorResponse (new HttpException (500 , 'An unsuspected error occurred. ' , $ fallthrough ));
611
+ }
612
+ }
613
+
614
+ /**
615
+ * Operation petAvailableForSale
616
+ *
617
+ * Whether the pet can currently be bought
618
+ *
619
+ * @param Request $request The Symfony request to handle.
620
+ * @return Response The Symfony response.
621
+ */
622
+ public function petAvailableForSaleAction (Request $ request , $ petId )
623
+ {
624
+ // Figure out what data format to return to the client
625
+ $ produces = ['text/plain ' ];
626
+ // Figure out what the client accepts
627
+ $ clientAccepts = $ request ->headers ->has ('Accept ' )?$ request ->headers ->get ('Accept ' ):'*/* ' ;
628
+ $ responseFormat = $ this ->getOutputFormat ($ clientAccepts , $ produces );
629
+ if ($ responseFormat === null ) {
630
+ return new Response ('' , 406 );
631
+ }
632
+
633
+ // Handle authentication
634
+
635
+ // Read out all input parameter values into variables
636
+
637
+ // Use the default value if no value was provided
638
+
639
+ // Deserialize the input values that needs it
640
+ try {
641
+ $ petId = $ this ->deserialize ($ petId , 'int ' , 'string ' );
642
+ } catch (SerializerRuntimeException $ exception ) {
643
+ return $ this ->createBadRequestResponse ($ exception ->getMessage ());
644
+ }
645
+
646
+ // Validate the input values
647
+ $ asserts = [];
648
+ $ asserts [] = new Assert \NotNull ();
649
+ $ asserts [] = new Assert \Type ("int " );
650
+ $ response = $ this ->validate ($ petId , $ asserts );
651
+ if ($ response instanceof Response) {
652
+ return $ response ;
653
+ }
654
+
655
+
656
+ try {
657
+ $ handler = $ this ->getApiHandler ();
658
+
659
+
660
+ // Make the call to the business logic
661
+ $ responseCode = 200 ;
662
+ $ responseHeaders = [];
663
+
664
+ $ result = $ handler ->petAvailableForSale ($ petId , $ responseCode , $ responseHeaders );
665
+
666
+ $ message = match ($ responseCode ) {
667
+ 200 => 'successful operation ' ,
668
+ default => '' ,
669
+ };
670
+
671
+ return new Response (
672
+ $ result !== null ?$ this ->serialize ($ result , $ responseFormat ):'' ,
673
+ $ responseCode ,
674
+ array_merge (
675
+ $ responseHeaders ,
676
+ [
677
+ 'Content-Type ' => $ responseFormat ,
678
+ 'X-OpenAPI-Message ' => $ message
679
+ ]
680
+ )
681
+ );
682
+ } catch (\Throwable $ fallthrough ) {
683
+ return $ this ->createErrorResponse (new HttpException (500 , 'An unsuspected error occurred. ' , $ fallthrough ));
684
+ }
685
+ }
686
+
468
687
/**
469
688
* Operation updatePet
470
689
*
0 commit comments