text: /**
   * Mojang Session API
   * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
   *
   * OpenAPI spec version: 2020-06-05
   *
   * NOTE: This class is auto generated by OpenAPI-Generator 3.3.4.
   * https://openapi-generator.tech
   * Do not edit the class manually.
   */
  
  
  #include "LoginApi.h"
  #include "IHttpBody.h"
  #include "JsonBody.h"
  #include "MultipartFormData.h"
  
  #include <unordered_set>
  
  #include <boost/algorithm/string/replace.hpp>
  
  namespace com {
  namespace github {
  namespace asyncmc {
  namespace mojang {
  namespace sessions {
  namespace cpp {
  namespace restsdk {
  namespace api {
  
  using namespace com::github::asyncmc::mojang::sessions::cpp::restsdk::model;
  
  LoginApi::LoginApi( std::shared_ptr<ApiClient> apiClient )
      : m_ApiClient(apiClient)
  {
  }
  
  LoginApi::~LoginApi()
  {
  }
  
  pplx::task<std::shared_ptr<PlayerProfile>> LoginApi::getPlayerProfile(utility::string_t strippedUuid, boost::optional<bool> _unsigned)
  {
  
  
      std::shared_ptr<ApiConfiguration> localVarApiConfiguration( m_ApiClient->getConfiguration() );
      utility::string_t localVarPath = utility::conversions::to_string_t("/session/minecraft/profile/{stripped_uuid}");
      boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("stripped_uuid") + utility::conversions::to_string_t("}"), ApiClient::parameterToString(strippedUuid));
  
      std::map<utility::string_t, utility::string_t> localVarQueryParams;
      std::map<utility::string_t, utility::string_t> localVarHeaderParams( localVarApiConfiguration->getDefaultHeaders() );
      std::map<utility::string_t, utility::string_t> localVarFormParams;
      std::map<utility::string_t, std::shared_ptr<HttpContent>> localVarFileParams;
  
      std::unordered_set<utility::string_t> localVarResponseHttpContentTypes;
      localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
  
      utility::string_t localVarResponseHttpContentType;
  
      // use JSON if possible
      if ( localVarResponseHttpContentTypes.size() == 0 )
      {
          localVarResponseHttpContentType = utility::conversions::to_string_t("application/json");
      }
      // JSON
      else if ( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarResponseHttpContentTypes.end() )
      {
          localVarResponseHttpContentType = utility::conversions::to_string_t("application/json");
      }
      // multipart formdata
      else if( localVarResponseHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarResponseHttpContentTypes.end() )
      {
          localVarResponseHttpContentType = utility::conversions::to_string_t("multipart/form-data");
      }
      else
      {
          throw ApiException(400, utility::conversions::to_string_t("LoginApi->getPlayerProfile does not produce any supported media type"));
      }
  
      localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
  
      std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
  
      if (_unsigned)
      {
          localVarQueryParams[utility::conversions::to_string_t("unsigned")] = ApiClient::parameterToString(*_unsigned);
      }
  
      std::shared_ptr<IHttpBody> localVarHttpBody;
      utility::string_t localVarRequestHttpContentType;
  
      // use JSON if possible
      if ( localVarConsumeHttpContentTypes.size() == 0 || localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("application/json")) != localVarConsumeHttpContentTypes.end() )
      {
          localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
      }
      // multipart formdata
      else if( localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t("multipart/form-data")) != localVarConsumeHttpContentTypes.end() )
      {
          localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
      }
      else
      {
          throw ApiException(415, utility::conversions::to_string_t("LoginApi->getPlayerProfile does not consume any supported media type"));
      }
  
  
      return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
      .then([=](web::http::http_response localVarResponse)
      {
          if (m_ApiClient->getResponseHeadersHandler())
          {
              m_ApiClient->getResponseHeadersHandler()(localVarResponse.headers());
          }
  
          // 1xx - informational : OK
          // 2xx - successful       : OK
          // 3xx - redirection   : OK
          // 4xx - client error  : not OK
          // 5xx - client error  : not OK
          if (localVarResponse.status_code() >= 400)
          {
              throw ApiException(localVarResponse.status_code()
                  , utility::conversions::to_string_t("error calling getPlayerProfile: ") + localVarResponse.reason_phrase()
                  , std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
          }
  
          // check response content type
          if(localVarResponse.headers().has(utility::conversions::to_string_t("Content-Type")))
          {
              utility::string_t localVarContentType = localVarResponse.headers()[utility::conversions::to_string_t("Content-Type")];
              if( localVarContentType.find(localVarResponseHttpContentType) == std::string::npos )
              {
                  throw ApiException(500
                      , utility::conversions::to_string_t("error calling getPlayerProfile: unexpected response type: ") + localVarContentType
                      , std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
              }
          }
  
          return localVarResponse.extract_string();
      })
      .then([=](utility::string_t localVarResponse)
      {
          std::shared_ptr<PlayerProfile> localVarResult(new PlayerProfile());
  
          if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
          {
              web::json::value localVarJson = web::json::value::parse(localVarResponse);
  
              localVarResult->fromJson(localVarJson);
          }
          // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
          // {
          // TODO multipart response parsing
          // }
          else
          {
              throw ApiException(500
                  , utility::conversions::to_string_t("error calling getPlayerProfile: unsupported response type"));
          }
  
          return localVarResult;
      });
  }
  
  }
  }
  }
  }
  }
  }
  }
  }
  
  