text: /**
   * Swagger Petstore
   * This is a sample server Petstore server.  You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).  For this sample, you can use the api key `special-key` to test the authorization filters.
   *
   * OpenAPI spec version: 1.0.0
   * Contact: apiteam@swagger.io
   *
   * NOTE: This class is auto generated by the swagger code generator program.
   * https://github.com/swagger-api/swagger-codegen.git
   * Do not edit the class manually.
   */
  #include "SwaggerPetApiOperations.h"
  
  #include "SwaggerModule.h"
  #include "SwaggerHelpers.h"
  
  #include "Dom/JsonObject.h"
  #include "Templates/SharedPointer.h"
  #include "HttpModule.h"
  #include "PlatformHttp.h"
  
  namespace Swagger 
  {
  
  FString SwaggerPetApi::AddPetRequest::ComputePath() const
  {
  	FString Path(TEXT("/pet"));
  	return Path;
  }
  
  void SwaggerPetApi::AddPetRequest::SetupHttpRequest(const TSharedRef<IHttpRequest>& HttpRequest) const
  {
  	static const TArray<FString> Consumes = { TEXT("application/json"), TEXT("application/xml") };
  	//static const TArray<FString> Produces = { TEXT("application/xml"), TEXT("application/json") };
  
  	HttpRequest->SetVerb(TEXT("POST"));
  
  	// Default to Json Body request
  	if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json")))
  	{
  		// Body parameters
  		FString JsonBody;
  		JsonWriter Writer = TJsonWriterFactory<>::Create(&JsonBody);
  
  		Writer->WriteObjectStart();
  		Writer->WriteIdentifierPrefix(TEXT("body")); WriteJsonValue(Writer, Body);
  		Writer->WriteObjectEnd();
  		Writer->Close();
  
  		HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8"));
  		HttpRequest->SetContentAsString(JsonBody);
  	}
  	else if (Consumes.Contains(TEXT("multipart/form-data")))
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Body parameter (body) was ignored, not supported in multipart form"));
  	}
  	else if (Consumes.Contains(TEXT("application/x-www-form-urlencoded")))
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Body parameter (body) was ignored, not supported in urlencoded requests"));
  	}
  	else
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Request ContentType not supported (%s)"), *FString::Join(Consumes, TEXT(",")));
  	}
  }
  
  void SwaggerPetApi::AddPetResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
  {
  	Response::SetHttpResponseCode(InHttpResponseCode);
  	switch ((int)InHttpResponseCode)
  	{
  	case 405:
  		SetResponseString(TEXT("Invalid input"));
  		break;
  	}
  }
  
  bool SwaggerPetApi::AddPetResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
  {
  	return true;
  }
  
  FString SwaggerPetApi::DeletePetRequest::ComputePath() const
  {
  	TMap<FString, FStringFormatArg> PathParams = { 
  	{ TEXT("petId"), ToStringFormatArg(PetId) } };
  
  	FString Path = FString::Format(TEXT("/pet/{petId}"), PathParams);
  	
  	return Path;
  }
  
  void SwaggerPetApi::DeletePetRequest::SetupHttpRequest(const TSharedRef<IHttpRequest>& HttpRequest) const
  {
  	static const TArray<FString> Consumes = {  };
  	//static const TArray<FString> Produces = { TEXT("application/xml"), TEXT("application/json") };
  
  	HttpRequest->SetVerb(TEXT("DELETE"));
  
  	// Header parameters
  	if (ApiKey.IsSet())
  	{
  		HttpRequest->SetHeader(TEXT("api_key"), ApiKey.GetValue());
  	}
  
  	// Default to Json Body request
  	if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json")))
  	{
  	}
  	else if (Consumes.Contains(TEXT("multipart/form-data")))
  	{
  	}
  	else if (Consumes.Contains(TEXT("application/x-www-form-urlencoded")))
  	{
  	}
  	else
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Request ContentType not supported (%s)"), *FString::Join(Consumes, TEXT(",")));
  	}
  }
  
  void SwaggerPetApi::DeletePetResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
  {
  	Response::SetHttpResponseCode(InHttpResponseCode);
  	switch ((int)InHttpResponseCode)
  	{
  	case 400:
  		SetResponseString(TEXT("Invalid pet value"));
  		break;
  	}
  }
  
  bool SwaggerPetApi::DeletePetResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
  {
  	return true;
  }
  
  inline FString ToString(const SwaggerPetApi::FindPetsByStatusRequest::StatusEnum& Value)
  {
  	switch (Value)
  	{
  	case SwaggerPetApi::FindPetsByStatusRequest::StatusEnum::Available:
  		return TEXT("available");
  	case SwaggerPetApi::FindPetsByStatusRequest::StatusEnum::Pending:
  		return TEXT("pending");
  	case SwaggerPetApi::FindPetsByStatusRequest::StatusEnum::Sold:
  		return TEXT("sold");
  	}
  
  	UE_LOG(LogSwagger, Error, TEXT("Invalid SwaggerPetApi::FindPetsByStatusRequest::StatusEnum Value (%d)"), (int)Value);	
  	return TEXT("");
  }
  
  inline FStringFormatArg ToStringFormatArg(const SwaggerPetApi::FindPetsByStatusRequest::StatusEnum& Value)
  {
  	return FStringFormatArg(ToString(Value));
  }
  
  inline void WriteJsonValue(JsonWriter& Writer, const SwaggerPetApi::FindPetsByStatusRequest::StatusEnum& Value)
  {
  	WriteJsonValue(Writer, ToString(Value));
  }
  
  inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, SwaggerPetApi::FindPetsByStatusRequest::StatusEnum& Value)
  {
  	FString TmpValue;
  	if (JsonValue->TryGetString(TmpValue))
  	{
  		static TMap<FString, SwaggerPetApi::FindPetsByStatusRequest::StatusEnum> StringToEnum = { 
  			{ TEXT("available"), SwaggerPetApi::FindPetsByStatusRequest::StatusEnum::Available },
  			{ TEXT("pending"), SwaggerPetApi::FindPetsByStatusRequest::StatusEnum::Pending },
  			{ TEXT("sold"), SwaggerPetApi::FindPetsByStatusRequest::StatusEnum::Sold }, };
  
  		const auto Found = StringToEnum.Find(TmpValue);
  		if(Found)
  		{
  			Value = *Found;
  			return true;
  		}
  	}
  	return false;
  }
  
  FString SwaggerPetApi::FindPetsByStatusRequest::ComputePath() const
  {
  	FString Path(TEXT("/pet/findByStatus"));
  	TArray<FString> QueryParams;
  	QueryParams.Add(FString(TEXT("status=")) + CollectionToUrlString_csv(Status, TEXT("status")));
  	Path += TCHAR('?');
  	Path += FString::Join(QueryParams, TEXT("&"));
  
  	return Path;
  }
  
  void SwaggerPetApi::FindPetsByStatusRequest::SetupHttpRequest(const TSharedRef<IHttpRequest>& HttpRequest) const
  {
  	static const TArray<FString> Consumes = {  };
  	//static const TArray<FString> Produces = { TEXT("application/xml"), TEXT("application/json") };
  
  	HttpRequest->SetVerb(TEXT("GET"));
  
  	// Default to Json Body request
  	if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json")))
  	{
  	}
  	else if (Consumes.Contains(TEXT("multipart/form-data")))
  	{
  	}
  	else if (Consumes.Contains(TEXT("application/x-www-form-urlencoded")))
  	{
  	}
  	else
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Request ContentType not supported (%s)"), *FString::Join(Consumes, TEXT(",")));
  	}
  }
  
  void SwaggerPetApi::FindPetsByStatusResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
  {
  	Response::SetHttpResponseCode(InHttpResponseCode);
  	switch ((int)InHttpResponseCode)
  	{
  	case 200:
  	default:
  		SetResponseString(TEXT("successful operation"));
  		break;
  	case 400:
  		SetResponseString(TEXT("Invalid status value"));
  		break;
  	}
  }
  
  bool SwaggerPetApi::FindPetsByStatusResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
  {
  	return TryGetJsonValue(JsonValue, Content);
  }
  
  FString SwaggerPetApi::FindPetsByTagsRequest::ComputePath() const
  {
  	FString Path(TEXT("/pet/findByTags"));
  	TArray<FString> QueryParams;
  	QueryParams.Add(FString(TEXT("tags=")) + CollectionToUrlString_csv(Tags, TEXT("tags")));
  	Path += TCHAR('?');
  	Path += FString::Join(QueryParams, TEXT("&"));
  
  	return Path;
  }
  
  void SwaggerPetApi::FindPetsByTagsRequest::SetupHttpRequest(const TSharedRef<IHttpRequest>& HttpRequest) const
  {
  	static const TArray<FString> Consumes = {  };
  	//static const TArray<FString> Produces = { TEXT("application/xml"), TEXT("application/json") };
  
  	HttpRequest->SetVerb(TEXT("GET"));
  
  	// Default to Json Body request
  	if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json")))
  	{
  	}
  	else if (Consumes.Contains(TEXT("multipart/form-data")))
  	{
  	}
  	else if (Consumes.Contains(TEXT("application/x-www-form-urlencoded")))
  	{
  	}
  	else
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Request ContentType not supported (%s)"), *FString::Join(Consumes, TEXT(",")));
  	}
  }
  
  void SwaggerPetApi::FindPetsByTagsResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
  {
  	Response::SetHttpResponseCode(InHttpResponseCode);
  	switch ((int)InHttpResponseCode)
  	{
  	case 200:
  	default:
  		SetResponseString(TEXT("successful operation"));
  		break;
  	case 400:
  		SetResponseString(TEXT("Invalid tag value"));
  		break;
  	}
  }
  
  bool SwaggerPetApi::FindPetsByTagsResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
  {
  	return TryGetJsonValue(JsonValue, Content);
  }
  
  FString SwaggerPetApi::GetPetByIdRequest::ComputePath() const
  {
  	TMap<FString, FStringFormatArg> PathParams = { 
  	{ TEXT("petId"), ToStringFormatArg(PetId) } };
  
  	FString Path = FString::Format(TEXT("/pet/{petId}"), PathParams);
  	
  	return Path;
  }
  
  void SwaggerPetApi::GetPetByIdRequest::SetupHttpRequest(const TSharedRef<IHttpRequest>& HttpRequest) const
  {
  	static const TArray<FString> Consumes = {  };
  	//static const TArray<FString> Produces = { TEXT("application/xml"), TEXT("application/json") };
  
  	HttpRequest->SetVerb(TEXT("GET"));
  
  	// Default to Json Body request
  	if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json")))
  	{
  	}
  	else if (Consumes.Contains(TEXT("multipart/form-data")))
  	{
  	}
  	else if (Consumes.Contains(TEXT("application/x-www-form-urlencoded")))
  	{
  	}
  	else
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Request ContentType not supported (%s)"), *FString::Join(Consumes, TEXT(",")));
  	}
  }
  
  void SwaggerPetApi::GetPetByIdResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
  {
  	Response::SetHttpResponseCode(InHttpResponseCode);
  	switch ((int)InHttpResponseCode)
  	{
  	case 200:
  	default:
  		SetResponseString(TEXT("successful operation"));
  		break;
  	case 400:
  		SetResponseString(TEXT("Invalid ID supplied"));
  		break;
  	case 404:
  		SetResponseString(TEXT("Pet not found"));
  		break;
  	}
  }
  
  bool SwaggerPetApi::GetPetByIdResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
  {
  	return TryGetJsonValue(JsonValue, Content);
  }
  
  FString SwaggerPetApi::UpdatePetRequest::ComputePath() const
  {
  	FString Path(TEXT("/pet"));
  	return Path;
  }
  
  void SwaggerPetApi::UpdatePetRequest::SetupHttpRequest(const TSharedRef<IHttpRequest>& HttpRequest) const
  {
  	static const TArray<FString> Consumes = { TEXT("application/json"), TEXT("application/xml") };
  	//static const TArray<FString> Produces = { TEXT("application/xml"), TEXT("application/json") };
  
  	HttpRequest->SetVerb(TEXT("PUT"));
  
  	// Default to Json Body request
  	if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json")))
  	{
  		// Body parameters
  		FString JsonBody;
  		JsonWriter Writer = TJsonWriterFactory<>::Create(&JsonBody);
  
  		Writer->WriteObjectStart();
  		Writer->WriteIdentifierPrefix(TEXT("body")); WriteJsonValue(Writer, Body);
  		Writer->WriteObjectEnd();
  		Writer->Close();
  
  		HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8"));
  		HttpRequest->SetContentAsString(JsonBody);
  	}
  	else if (Consumes.Contains(TEXT("multipart/form-data")))
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Body parameter (body) was ignored, not supported in multipart form"));
  	}
  	else if (Consumes.Contains(TEXT("application/x-www-form-urlencoded")))
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Body parameter (body) was ignored, not supported in urlencoded requests"));
  	}
  	else
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Request ContentType not supported (%s)"), *FString::Join(Consumes, TEXT(",")));
  	}
  }
  
  void SwaggerPetApi::UpdatePetResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
  {
  	Response::SetHttpResponseCode(InHttpResponseCode);
  	switch ((int)InHttpResponseCode)
  	{
  	case 400:
  		SetResponseString(TEXT("Invalid ID supplied"));
  		break;
  	case 404:
  		SetResponseString(TEXT("Pet not found"));
  		break;
  	case 405:
  		SetResponseString(TEXT("Validation exception"));
  		break;
  	}
  }
  
  bool SwaggerPetApi::UpdatePetResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
  {
  	return true;
  }
  
  FString SwaggerPetApi::UpdatePetWithFormRequest::ComputePath() const
  {
  	TMap<FString, FStringFormatArg> PathParams = { 
  	{ TEXT("petId"), ToStringFormatArg(PetId) } };
  
  	FString Path = FString::Format(TEXT("/pet/{petId}"), PathParams);
  	
  	return Path;
  }
  
  void SwaggerPetApi::UpdatePetWithFormRequest::SetupHttpRequest(const TSharedRef<IHttpRequest>& HttpRequest) const
  {
  	static const TArray<FString> Consumes = { TEXT("application/x-www-form-urlencoded") };
  	//static const TArray<FString> Produces = { TEXT("application/xml"), TEXT("application/json") };
  
  	HttpRequest->SetVerb(TEXT("POST"));
  
  	// Default to Json Body request
  	if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json")))
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Form parameter (name) was ignored, cannot be used in JsonBody"));
  		UE_LOG(LogSwagger, Error, TEXT("Form parameter (status) was ignored, cannot be used in JsonBody"));
  	}
  	else if (Consumes.Contains(TEXT("multipart/form-data")))
  	{
  		HttpMultipartFormData FormData;
  		if(Name.IsSet())
  		{
  			FormData.AddStringPart(TEXT("name"), *ToUrlString(Name.GetValue()));
  		}
  		if(Status.IsSet())
  		{
  			FormData.AddStringPart(TEXT("status"), *ToUrlString(Status.GetValue()));
  		}
  
  		FormData.SetupHttpRequest(HttpRequest);
  	}
  	else if (Consumes.Contains(TEXT("application/x-www-form-urlencoded")))
  	{
  		TArray<FString> FormParams;
  		if(Name.IsSet())
  		{
  			FormParams.Add(FString(TEXT("name=")) + ToUrlString(Name.GetValue()));
  		}
  		if(Status.IsSet())
  		{
  			FormParams.Add(FString(TEXT("status=")) + ToUrlString(Status.GetValue()));
  		}
  		
  		HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/x-www-form-urlencoded; charset=utf-8"));
  		HttpRequest->SetContentAsString(FString::Join(FormParams, TEXT("&")));
  	}
  	else
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Request ContentType not supported (%s)"), *FString::Join(Consumes, TEXT(",")));
  	}
  }
  
  void SwaggerPetApi::UpdatePetWithFormResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
  {
  	Response::SetHttpResponseCode(InHttpResponseCode);
  	switch ((int)InHttpResponseCode)
  	{
  	case 405:
  		SetResponseString(TEXT("Invalid input"));
  		break;
  	}
  }
  
  bool SwaggerPetApi::UpdatePetWithFormResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
  {
  	return true;
  }
  
  FString SwaggerPetApi::UploadFileRequest::ComputePath() const
  {
  	TMap<FString, FStringFormatArg> PathParams = { 
  	{ TEXT("petId"), ToStringFormatArg(PetId) } };
  
  	FString Path = FString::Format(TEXT("/pet/{petId}/uploadImage"), PathParams);
  	
  	return Path;
  }
  
  void SwaggerPetApi::UploadFileRequest::SetupHttpRequest(const TSharedRef<IHttpRequest>& HttpRequest) const
  {
  	static const TArray<FString> Consumes = { TEXT("multipart/form-data") };
  	//static const TArray<FString> Produces = { TEXT("application/json") };
  
  	HttpRequest->SetVerb(TEXT("POST"));
  
  	// Default to Json Body request
  	if (Consumes.Num() == 0 || Consumes.Contains(TEXT("application/json")))
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Form parameter (additionalMetadata) was ignored, cannot be used in JsonBody"));
  		UE_LOG(LogSwagger, Error, TEXT("Form parameter (file) was ignored, cannot be used in JsonBody"));
  	}
  	else if (Consumes.Contains(TEXT("multipart/form-data")))
  	{
  		HttpMultipartFormData FormData;
  		if(AdditionalMetadata.IsSet())
  		{
  			FormData.AddStringPart(TEXT("additionalMetadata"), *ToUrlString(AdditionalMetadata.GetValue()));
  		}
  		if(File.IsSet())
  		{
  			FormData.AddFilePart(TEXT("file"), File.GetValue());
  		}
  
  		FormData.SetupHttpRequest(HttpRequest);
  	}
  	else if (Consumes.Contains(TEXT("application/x-www-form-urlencoded")))
  	{
  		TArray<FString> FormParams;
  		if(AdditionalMetadata.IsSet())
  		{
  			FormParams.Add(FString(TEXT("additionalMetadata=")) + ToUrlString(AdditionalMetadata.GetValue()));
  		}
  		UE_LOG(LogSwagger, Error, TEXT("Form parameter (file) was ignored, Files are not supported in urlencoded requests"));
  		
  		HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/x-www-form-urlencoded; charset=utf-8"));
  		HttpRequest->SetContentAsString(FString::Join(FormParams, TEXT("&")));
  	}
  	else
  	{
  		UE_LOG(LogSwagger, Error, TEXT("Request ContentType not supported (%s)"), *FString::Join(Consumes, TEXT(",")));
  	}
  }
  
  void SwaggerPetApi::UploadFileResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
  {
  	Response::SetHttpResponseCode(InHttpResponseCode);
  	switch ((int)InHttpResponseCode)
  	{
  	case 200:
  	default:
  		SetResponseString(TEXT("successful operation"));
  		break;
  	}
  }
  
  bool SwaggerPetApi::UploadFileResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
  {
  	return TryGetJsonValue(JsonValue, Content);
  }
  
  }
  