@@ -294,6 +294,138 @@ pplx::task<void> PetApi::deletePet(int64_t petId, boost::optional<utility::strin
294294 return void ();
295295 });
296296}
297+ pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByColor (boost::optional<std::shared_ptr<Color>> color) const
298+ {
299+
300+
301+ std::shared_ptr<const ApiConfiguration> localVarApiConfiguration ( m_ApiClient->getConfiguration () );
302+ utility::string_t localVarPath = utility::conversions::to_string_t (" /pet/findByColor" );
303+
304+ std::map<utility::string_t , utility::string_t > localVarQueryParams;
305+ std::map<utility::string_t , utility::string_t > localVarHeaderParams ( localVarApiConfiguration->getDefaultHeaders () );
306+ std::map<utility::string_t , utility::string_t > localVarFormParams;
307+ std::map<utility::string_t , std::shared_ptr<HttpContent>> localVarFileParams;
308+
309+ std::unordered_set<utility::string_t > localVarResponseHttpContentTypes;
310+ localVarResponseHttpContentTypes.insert ( utility::conversions::to_string_t (" application/json" ) );
311+
312+ utility::string_t localVarResponseHttpContentType;
313+
314+ // use JSON if possible
315+ if ( localVarResponseHttpContentTypes.size () == 0 )
316+ {
317+ localVarResponseHttpContentType = utility::conversions::to_string_t (" application/json" );
318+ }
319+ // JSON
320+ else if ( localVarResponseHttpContentTypes.find (utility::conversions::to_string_t (" application/json" )) != localVarResponseHttpContentTypes.end () )
321+ {
322+ localVarResponseHttpContentType = utility::conversions::to_string_t (" application/json" );
323+ }
324+ // multipart formdata
325+ else if ( localVarResponseHttpContentTypes.find (utility::conversions::to_string_t (" multipart/form-data" )) != localVarResponseHttpContentTypes.end () )
326+ {
327+ localVarResponseHttpContentType = utility::conversions::to_string_t (" multipart/form-data" );
328+ }
329+ else
330+ {
331+ throw ApiException (400 , utility::conversions::to_string_t (" PetApi->findPetsByColor does not produce any supported media type" ));
332+ }
333+
334+ localVarHeaderParams[utility::conversions::to_string_t (" Accept" )] = localVarResponseHttpContentType;
335+
336+ std::unordered_set<utility::string_t > localVarConsumeHttpContentTypes;
337+
338+ if (color && *color != nullptr )
339+ {
340+ localVarQueryParams[utility::conversions::to_string_t (" color" )] = ApiClient::parameterToString (*color);
341+ }
342+
343+ std::shared_ptr<IHttpBody> localVarHttpBody;
344+ utility::string_t localVarRequestHttpContentType;
345+
346+ // use JSON if possible
347+ if ( localVarConsumeHttpContentTypes.size () == 0 || localVarConsumeHttpContentTypes.find (utility::conversions::to_string_t (" application/json" )) != localVarConsumeHttpContentTypes.end () )
348+ {
349+ localVarRequestHttpContentType = utility::conversions::to_string_t (" application/json" );
350+ }
351+ // multipart formdata
352+ else if ( localVarConsumeHttpContentTypes.find (utility::conversions::to_string_t (" multipart/form-data" )) != localVarConsumeHttpContentTypes.end () )
353+ {
354+ localVarRequestHttpContentType = utility::conversions::to_string_t (" multipart/form-data" );
355+ }
356+ else if (localVarConsumeHttpContentTypes.find (utility::conversions::to_string_t (" application/x-www-form-urlencoded" )) != localVarConsumeHttpContentTypes.end ())
357+ {
358+ localVarRequestHttpContentType = utility::conversions::to_string_t (" application/x-www-form-urlencoded" );
359+ }
360+ else
361+ {
362+ throw ApiException (415 , utility::conversions::to_string_t (" PetApi->findPetsByColor does not consume any supported media type" ));
363+ }
364+
365+ // authentication (petstore_auth) required
366+ // oauth2 authentication is added automatically as part of the http_client_config
367+
368+ return m_ApiClient->callApi (localVarPath, utility::conversions::to_string_t (" GET" ), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
369+ .then ([=, this ](web::http::http_response localVarResponse)
370+ {
371+ if (m_ApiClient->getResponseHandler ())
372+ {
373+ m_ApiClient->getResponseHandler ()(localVarResponse.status_code (), localVarResponse.headers ());
374+ }
375+
376+ // 1xx - informational : OK
377+ // 2xx - successful : OK
378+ // 3xx - redirection : OK
379+ // 4xx - client error : not OK
380+ // 5xx - client error : not OK
381+ if (localVarResponse.status_code () >= 400 )
382+ {
383+ throw ApiException (localVarResponse.status_code ()
384+ , utility::conversions::to_string_t (" error calling findPetsByColor: " ) + localVarResponse.reason_phrase ()
385+ , std::make_shared<std::stringstream>(localVarResponse.extract_utf8string (true ).get ()));
386+ }
387+
388+ // check response content type
389+ if (localVarResponse.headers ().has (utility::conversions::to_string_t (" Content-Type" )))
390+ {
391+ utility::string_t localVarContentType = localVarResponse.headers ()[utility::conversions::to_string_t (" Content-Type" )];
392+ if ( localVarContentType.find (localVarResponseHttpContentType) == std::string::npos )
393+ {
394+ throw ApiException (500
395+ , utility::conversions::to_string_t (" error calling findPetsByColor: unexpected response type: " ) + localVarContentType
396+ , std::make_shared<std::stringstream>(localVarResponse.extract_utf8string (true ).get ()));
397+ }
398+ }
399+
400+ return localVarResponse.extract_string ();
401+ })
402+ .then ([=, this ](utility::string_t localVarResponse)
403+ {
404+ std::vector<std::shared_ptr<Pet>> localVarResult;
405+
406+ if (localVarResponseHttpContentType == utility::conversions::to_string_t (" application/json" ))
407+ {
408+ web::json::value localVarJson = web::json::value::parse (localVarResponse);
409+ for ( auto & localVarItem : localVarJson.as_array () )
410+ {
411+ std::shared_ptr<Pet> localVarItemObj;
412+ ModelBase::fromJson (localVarItem, localVarItemObj);
413+ localVarResult.push_back (localVarItemObj);
414+ }
415+ }
416+ // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
417+ // {
418+ // TODO multipart response parsing
419+ // }
420+ else
421+ {
422+ throw ApiException (500
423+ , utility::conversions::to_string_t (" error calling findPetsByColor: unsupported response type" ));
424+ }
425+
426+ return localVarResult;
427+ });
428+ }
297429pplx::task<std::vector<std::shared_ptr<Pet>>> PetApi::findPetsByStatus (std::vector<utility::string_t > status) const
298430{
299431
0 commit comments