Files
sdk-cpp/src/api/TribufuGeneratedApi.cpp

11219 lines
587 KiB
C++

/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI-Generator 7.12.0.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "tribufu++/api/TribufuGeneratedApi.h"
#include "tribufu++/IHttpBody.h"
#include "tribufu++/JsonBody.h"
#include "tribufu++/MultipartFormData.h"
#include <boost/algorithm/string/replace.hpp>
#include <unordered_set>
namespace tribufu
{
namespace api
{
using namespace tribufu::models;
TribufuGeneratedApi::TribufuGeneratedApi(std::shared_ptr<const ApiClient> apiClient) : m_ApiClient(apiClient)
{
}
TribufuGeneratedApi::~TribufuGeneratedApi()
{
}
pplx::task<void> TribufuGeneratedApi::authorize(
boost::optional<std::shared_ptr<AuthorizeRequest>> authorizeRequest) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/authorize");
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;
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(
"TribufuGeneratedApi->authorize does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (authorizeRequest)
localVarJson = ModelBase::toJson(*authorizeRequest);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (authorizeRequest && (*authorizeRequest).get())
{
(*authorizeRequest)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("authorizeRequest"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->authorize does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 authorize: ") +
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 authorize: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<void> TribufuGeneratedApi::changeEmail(utility::string_t id,
boost::optional<std::shared_ptr<AnyType>> body) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/email");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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;
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(
"TribufuGeneratedApi->changeEmail does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
localVarJson = ModelBase::toJson(body.get());
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get()));
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->changeEmail does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 changeEmail: ") +
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 changeEmail: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<void> TribufuGeneratedApi::changePassword(utility::string_t id,
boost::optional<std::shared_ptr<AnyType>> body) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/password");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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;
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(
"TribufuGeneratedApi->changePassword does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
localVarJson = ModelBase::toJson(body.get());
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get()));
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->changePassword does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 changePassword: ") +
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 changePassword: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<void> TribufuGeneratedApi::claimGameServer(utility::string_t id,
boost::optional<std::shared_ptr<AnyType>> body) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/{id}/claim");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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;
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(
"TribufuGeneratedApi->claimGameServer does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
localVarJson = ModelBase::toJson(body.get());
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get()));
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->claimGameServer does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 claimGameServer: ") +
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 claimGameServer: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<std::shared_ptr<CryptoViewModel>> TribufuGeneratedApi::convertBase64(
boost::optional<std::shared_ptr<CryptoViewModel>> cryptoViewModel) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/base64");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->convertBase64 does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (cryptoViewModel)
localVarJson = ModelBase::toJson(*cryptoViewModel);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (cryptoViewModel && (*cryptoViewModel).get())
{
(*cryptoViewModel)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("cryptoViewModel"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->convertBase64 does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 convertBase64: ") +
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 convertBase64: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<CryptoViewModel> localVarResult(new CryptoViewModel());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 convertBase64: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<void> TribufuGeneratedApi::createGameServer(boost::optional<std::shared_ptr<AnyType>> body) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers");
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;
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(
"TribufuGeneratedApi->createGameServer does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
localVarJson = ModelBase::toJson(body.get());
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get()));
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->createGameServer does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 createGameServer: ") +
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 createGameServer: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<void> TribufuGeneratedApi::createGameServerCluster(
boost::optional<std::shared_ptr<AnyType>> body) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters");
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;
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(
"TribufuGeneratedApi->createGameServerCluster does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
localVarJson = ModelBase::toJson(body.get());
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get()));
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->createGameServerCluster does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 createGameServerCluster: ") +
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 createGameServerCluster: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<void> TribufuGeneratedApi::createGroup(boost::optional<std::shared_ptr<AnyType>> body) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups");
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;
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(
"TribufuGeneratedApi->createGroup does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
localVarJson = ModelBase::toJson(body.get());
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get()));
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->createGroup does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 createGroup: ") +
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 createGroup: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<std::shared_ptr<TokenResponse>> TribufuGeneratedApi::createToken(
boost::optional<std::shared_ptr<TokenRequest>> tokenRequest) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/token");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->createToken does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(
utility::conversions::to_string_t("application/x-www-form-urlencoded"));
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");
web::json::value localVarJson;
if (tokenRequest)
localVarJson = ModelBase::toJson(*tokenRequest);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (tokenRequest && (*tokenRequest).get())
{
(*tokenRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("tokenRequest"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->createToken does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 createToken: ") +
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 createToken: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<TokenResponse> localVarResult(new TokenResponse());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 createToken: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<void> TribufuGeneratedApi::deleteGameServer(utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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;
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(
"TribufuGeneratedApi->deleteGameServer does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->deleteGameServer does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 deleteGameServer: ") +
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 deleteGameServer: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<void> TribufuGeneratedApi::deleteGameServerCluster(utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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;
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(
"TribufuGeneratedApi->deleteGameServerCluster does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->deleteGameServerCluster does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 deleteGameServerCluster: ") +
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 deleteGameServerCluster: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<void> TribufuGeneratedApi::deleteGroup(utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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;
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(
"TribufuGeneratedApi->deleteGroup does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->deleteGroup does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("DELETE"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 deleteGroup: ") +
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 deleteGroup: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<std::vector<utility::string_t>> TribufuGeneratedApi::generateFlakeId(
boost::optional<int32_t> amount) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/flake");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->generateFlakeId does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (amount)
{
localVarQueryParams[utility::conversions::to_string_t("amount")] =
ApiClient::parameterToString(*amount);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->generateFlakeId does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 generateFlakeId: ") +
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 generateFlakeId: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<utility::string_t> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
utility::string_t localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 generateFlakeId: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<utility::string_t>> TribufuGeneratedApi::generateFlakeIdFromTimestamp(
utility::string_t timestamp, boost::optional<int32_t> amount) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/flake/{timestamp}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("timestamp") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(timestamp)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->generateFlakeIdFromTimestamp does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (amount)
{
localVarQueryParams[utility::conversions::to_string_t("amount")] =
ApiClient::parameterToString(*amount);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->generateFlakeIdFromTimestamp does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 generateFlakeIdFromTimestamp: ") +
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 generateFlakeIdFromTimestamp: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<utility::string_t> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
utility::string_t localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 generateFlakeIdFromTimestamp: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<HashViewModel>> TribufuGeneratedApi::generatePassword(
boost::optional<int32_t> length, boost::optional<bool> symbols) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/password");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->generatePassword does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (length)
{
localVarQueryParams[utility::conversions::to_string_t("length")] =
ApiClient::parameterToString(*length);
}
if (symbols)
{
localVarQueryParams[utility::conversions::to_string_t("symbols")] =
ApiClient::parameterToString(*symbols);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->generatePassword does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 generatePassword: ") +
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 generatePassword: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<HashViewModel> localVarResult(new HashViewModel());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 generatePassword: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<utility::string_t>> TribufuGeneratedApi::generateUuid(
boost::optional<int32_t> version, boost::optional<int32_t> amount) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/uuid");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->generateUuid does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (version)
{
localVarQueryParams[utility::conversions::to_string_t("version")] =
ApiClient::parameterToString(*version);
}
if (amount)
{
localVarQueryParams[utility::conversions::to_string_t("amount")] =
ApiClient::parameterToString(*amount);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->generateUuid does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 generateUuid: ") +
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 generateUuid: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<utility::string_t> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
utility::string_t localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 generateUuid: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<void> TribufuGeneratedApi::getClientInfo() const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/clientinfo");
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;
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(
"TribufuGeneratedApi->getClientInfo does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getClientInfo does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getClientInfo: ") +
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 getClientInfo: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<std::vector<std::shared_ptr<IpAddress>>> TribufuGeneratedApi::getCurrentIpAddress() const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/geoip");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getCurrentIpAddress does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getCurrentIpAddress does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getCurrentIpAddress: ") +
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 getCurrentIpAddress: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<IpAddress>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<IpAddress> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getCurrentIpAddress: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<Game>> TribufuGeneratedApi::getGameById(utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameById does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameById does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameById: ") +
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 getGameById: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Game> localVarResult(new Game());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getGameById: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<GameServerCluster>>> TribufuGeneratedApi::getGameClustersByGameId(
utility::string_t id, boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games/{id}/clusters");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameClustersByGameId does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameClustersByGameId does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameClustersByGameId: ") +
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 getGameClustersByGameId: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<GameServerCluster>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<GameServerCluster> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGameClustersByGameId: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<AnyType>>> TribufuGeneratedApi::getGameItems(
utility::string_t id, boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games/{id}/items");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameItems does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameItems does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameItems: ") +
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 getGameItems: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<AnyType>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<AnyType> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGameItems: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<GameServer>> TribufuGeneratedApi::getGameServerByAddressAndQueryPort(
utility::string_t address, int32_t port) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/address/{address}:{port}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("address") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(address)));
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("port") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(port)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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("TribufuGeneratedApi->getGameServerByAddressAndQueryPort "
"does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t("TribufuGeneratedApi->getGameServerByAddressAndQueryPort "
"does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameServerByAddressAndQueryPort: ") +
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 getGameServerByAddressAndQueryPort: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<GameServer> localVarResult(new GameServer());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getGameServerByAddressAndQueryPort: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<GameServer>> TribufuGeneratedApi::getGameServerById(utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameServerById does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameServerById does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameServerById: ") +
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 getGameServerById: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<GameServer> localVarResult(new GameServer());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getGameServerById: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<GameServerCluster>> TribufuGeneratedApi::getGameServerClusterById(
utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameServerClusterById does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameServerClusterById does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameServerClusterById: ") +
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 getGameServerClusterById: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<GameServerCluster> localVarResult(new GameServerCluster());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getGameServerClusterById: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<GameServerCluster>>> TribufuGeneratedApi::getGameServerClusters(
boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameServerClusters does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameServerClusters does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameServerClusters: ") +
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 getGameServerClusters: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<GameServerCluster>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<GameServerCluster> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGameServerClusters: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<GameServer>>> TribufuGeneratedApi::getGameServers(
boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameServers does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameServers does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameServers: ") +
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 getGameServers: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<GameServer>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<GameServer> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGameServers: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<GameServer>>> TribufuGeneratedApi::getGameServersByCountry(
utility::string_t country, boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/country/{country}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("country") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(country)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameServersByCountry does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameServersByCountry does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameServersByCountry: ") +
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 getGameServersByCountry: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<GameServer>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<GameServer> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGameServersByCountry: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<GameServer>>> TribufuGeneratedApi::getGameServersByGameId(
utility::string_t id, boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games/{id}/servers");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameServersByGameId does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameServersByGameId does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameServersByGameId: ") +
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 getGameServersByGameId: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<GameServer>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<GameServer> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGameServersByGameId: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::map<utility::string_t, int32_t>> TribufuGeneratedApi::getGameServersCountries() const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/countries");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameServersCountries does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameServersCountries does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameServersCountries: ") +
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 getGameServersCountries: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::map<utility::string_t, int32_t> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_object())
{
int32_t localVarItemObj;
ModelBase::fromJson(localVarItem.second, localVarItemObj);
localVarResult[localVarItem.first] = localVarItemObj;
}
}
// 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 getGameServersCountries: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<ServerMetrics>> TribufuGeneratedApi::getGameServersMetrics() const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/metrics");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGameServersMetrics does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGameServersMetrics does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGameServersMetrics: ") +
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 getGameServersMetrics: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<ServerMetrics> localVarResult(new ServerMetrics());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getGameServersMetrics: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<Game>>> TribufuGeneratedApi::getGames() const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/games");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGames does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGames does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGames: ") +
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 getGames: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<Game>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<Game> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGames: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<Group>> TribufuGeneratedApi::getGroupById(utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGroupById does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getGroupById does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGroupById: ") +
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 getGroupById: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Group> localVarResult(new Group());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getGroupById: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<Group>> TribufuGeneratedApi::getGroupByTag(utility::string_t tag) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/tag/{tag}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("tag") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(tag)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGroupByTag does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getGroupByTag does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGroupByTag: ") +
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 getGroupByTag: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Group> localVarResult(new Group());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getGroupByTag: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<Group>> TribufuGeneratedApi::getGroupByUuid(utility::string_t uuid) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/uuid/{uuid}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("uuid") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(uuid)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGroupByUuid does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGroupByUuid does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGroupByUuid: ") +
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 getGroupByUuid: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Group> localVarResult(new Group());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getGroupByUuid: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<GroupGame>>> TribufuGeneratedApi::getGroupGames(
utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}/games");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGroupGames does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getGroupGames does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGroupGames: ") +
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 getGroupGames: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<GroupGame>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<GroupGame> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGroupGames: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<GroupMember>>> TribufuGeneratedApi::getGroupMembers(
utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}/members");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGroupMembers does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getGroupMembers does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGroupMembers: ") +
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 getGroupMembers: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<GroupMember>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<GroupMember> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGroupMembers: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<Group>>> TribufuGeneratedApi::getGroups(
boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getGroups does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getGroups does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getGroups: ") +
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 getGroups: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<Group>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<Group> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getGroups: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<IpAddress>> TribufuGeneratedApi::getIpAddress(utility::string_t address) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/geoip/addresses/{address}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("address") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(address)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getIpAddress does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getIpAddress does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getIpAddress: ") +
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 getIpAddress: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<IpAddress> localVarResult(new IpAddress());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getIpAddress: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<IpAddress>>> TribufuGeneratedApi::getIpAddresses(
boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/geoip/addresses");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getIpAddresses does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getIpAddresses does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getIpAddresses: ") +
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 getIpAddresses: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<IpAddress>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<IpAddress> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getIpAddresses: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<LeaderboardItem>>> TribufuGeneratedApi::getLeaderboard(
boost::optional<std::shared_ptr<LeaderboardOrder>> order) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/leaderboard");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getLeaderboard does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (order && *order != nullptr)
{
localVarQueryParams[utility::conversions::to_string_t("Order")] = ApiClient::parameterToString(*order);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getLeaderboard does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getLeaderboard: ") +
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 getLeaderboard: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<LeaderboardItem>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<LeaderboardItem> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getLeaderboard: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<UserInfo>> TribufuGeneratedApi::getMe() const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/me");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getMe does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getMe does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getMe: ") +
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 getMe: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<UserInfo> localVarResult(new UserInfo());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getMe: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<Package>> TribufuGeneratedApi::getPackageById(utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/packages/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getPackageById does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getPackageById does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getPackageById: ") +
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 getPackageById: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Package> localVarResult(new Package());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getPackageById: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<Package>>> TribufuGeneratedApi::getPackages(
boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/packages");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getPackages does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getPackages does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getPackages: ") +
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 getPackages: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<Package>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<Package> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getPackages: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<void> TribufuGeneratedApi::getPublicKeys() const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/jwks");
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;
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(
"TribufuGeneratedApi->getPublicKeys does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getPublicKeys does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getPublicKeys: ") +
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 getPublicKeys: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<std::shared_ptr<Subscription>> TribufuGeneratedApi::getSubscriptionById(utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/subscriptions/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getSubscriptionById does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getSubscriptionById does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getSubscriptionById: ") +
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 getSubscriptionById: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Subscription> localVarResult(new Subscription());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getSubscriptionById: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<Subscription>>> TribufuGeneratedApi::getSubscriptions(
boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/subscriptions");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getSubscriptions does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getSubscriptions does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getSubscriptions: ") +
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 getSubscriptions: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<Subscription>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<Subscription> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getSubscriptions: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<Account>>> TribufuGeneratedApi::getUserAccounts(
utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/accounts");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserAccounts does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserAccounts does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserAccounts: ") +
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 getUserAccounts: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<Account>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<Account> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getUserAccounts: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<Profile>> TribufuGeneratedApi::getUserById(utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserById does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserById does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserById: ") +
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 getUserById: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Profile> localVarResult(new Profile());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getUserById: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<Profile>> TribufuGeneratedApi::getUserByName(utility::string_t name) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/name/{name}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("name") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(name)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserByName does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserByName does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserByName: ") +
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 getUserByName: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Profile> localVarResult(new Profile());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getUserByName: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<Profile>> TribufuGeneratedApi::getUserByUuid(utility::string_t uuid) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/uuid/{uuid}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("uuid") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(uuid)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserByUuid does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserByUuid does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserByUuid: ") +
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 getUserByUuid: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Profile> localVarResult(new Profile());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getUserByUuid: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<AnyType>>> TribufuGeneratedApi::getUserFriends(
utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/friends");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserFriends does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserFriends does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserFriends: ") +
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 getUserFriends: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<AnyType>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<AnyType> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getUserFriends: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<ProfileGame>>> TribufuGeneratedApi::getUserGames(
utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/games");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserGames does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserGames does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserGames: ") +
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 getUserGames: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<ProfileGame>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<ProfileGame> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getUserGames: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<ProfileGroup>>> TribufuGeneratedApi::getUserGroups(
utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/groups");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserGroups does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserGroups does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserGroups: ") +
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 getUserGroups: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<ProfileGroup>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<ProfileGroup> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getUserGroups: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<UserInfo>> TribufuGeneratedApi::getUserInfo() const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/userinfo");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserInfo does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserInfo does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserInfo: ") +
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 getUserInfo: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<UserInfo> localVarResult(new UserInfo());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 getUserInfo: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<AnyType>>> TribufuGeneratedApi::getUserPunishments(
utility::string_t id) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/punishments");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserPunishments does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserPunishments does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserPunishments: ") +
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 getUserPunishments: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<AnyType>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<AnyType> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getUserPunishments: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<GameServer>>> TribufuGeneratedApi::getUserServers(
utility::string_t id, boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/servers");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUserServers does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getUserServers does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUserServers: ") +
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 getUserServers: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<GameServer>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<GameServer> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getUserServers: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::vector<std::shared_ptr<Profile>>> TribufuGeneratedApi::getUsers(
boost::optional<int32_t> page, boost::optional<int32_t> limit) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->getUsers does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
if (page)
{
localVarQueryParams[utility::conversions::to_string_t("page")] = ApiClient::parameterToString(*page);
}
if (limit)
{
localVarQueryParams[utility::conversions::to_string_t("limit")] = ApiClient::parameterToString(*limit);
}
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415, utility::conversions::to_string_t(
"TribufuGeneratedApi->getUsers does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("GET"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 getUsers: ") +
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 getUsers: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<Profile>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<Profile> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 getUsers: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<HashViewModel>> TribufuGeneratedApi::hashArgon2(
boost::optional<std::shared_ptr<HashViewModel>> hashViewModel) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/argon2");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->hashArgon2 does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (hashViewModel)
localVarJson = ModelBase::toJson(*hashViewModel);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (hashViewModel && (*hashViewModel).get())
{
(*hashViewModel)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->hashArgon2 does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 hashArgon2: ") +
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 hashArgon2: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<HashViewModel> localVarResult(new HashViewModel());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 hashArgon2: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<HashViewModel>> TribufuGeneratedApi::hashBcrypt(
boost::optional<std::shared_ptr<HashViewModel>> hashViewModel) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/bcrypt");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->hashBcrypt does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (hashViewModel)
localVarJson = ModelBase::toJson(*hashViewModel);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (hashViewModel && (*hashViewModel).get())
{
(*hashViewModel)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->hashBcrypt does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 hashBcrypt: ") +
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 hashBcrypt: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<HashViewModel> localVarResult(new HashViewModel());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 hashBcrypt: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<HashViewModel>> TribufuGeneratedApi::hashMd5(
boost::optional<std::shared_ptr<HashViewModel>> hashViewModel) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/md5");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->hashMd5 does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (hashViewModel)
localVarJson = ModelBase::toJson(*hashViewModel);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (hashViewModel && (*hashViewModel).get())
{
(*hashViewModel)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415, utility::conversions::to_string_t(
"TribufuGeneratedApi->hashMd5 does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 hashMd5: ") +
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 hashMd5: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<HashViewModel> localVarResult(new HashViewModel());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 hashMd5: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<HashViewModel>> TribufuGeneratedApi::hashSha256(
boost::optional<std::shared_ptr<HashViewModel>> hashViewModel) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/utils/sha256");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->hashSha256 does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (hashViewModel)
localVarJson = ModelBase::toJson(*hashViewModel);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (hashViewModel && (*hashViewModel).get())
{
(*hashViewModel)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("hashViewModel"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->hashSha256 does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 hashSha256: ") +
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 hashSha256: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<HashViewModel> localVarResult(new HashViewModel());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 hashSha256: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<void> TribufuGeneratedApi::introspectToken(
boost::optional<std::shared_ptr<IntrospectRequest>> introspectRequest) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/introspect");
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;
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(
"TribufuGeneratedApi->introspectToken does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(
utility::conversions::to_string_t("application/x-www-form-urlencoded"));
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");
web::json::value localVarJson;
if (introspectRequest)
localVarJson = ModelBase::toJson(*introspectRequest);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (introspectRequest && (*introspectRequest).get())
{
(*introspectRequest)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("introspectRequest"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->introspectToken does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 introspectToken: ") +
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 introspectToken: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<std::shared_ptr<LoginResponse>> TribufuGeneratedApi::login(
boost::optional<std::shared_ptr<LoginRequest>> loginRequest) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/login");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->login does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (loginRequest)
localVarJson = ModelBase::toJson(*loginRequest);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (loginRequest && (*loginRequest).get())
{
(*loginRequest)->toMultipart(localVarMultipart, utility::conversions::to_string_t("loginRequest"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415, utility::conversions::to_string_t(
"TribufuGeneratedApi->login does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 login: ") +
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 login: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<LoginResponse> localVarResult(new LoginResponse());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 login: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<void> TribufuGeneratedApi::logout() const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/logout");
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;
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(
"TribufuGeneratedApi->logout does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
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 if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415, utility::conversions::to_string_t(
"TribufuGeneratedApi->logout does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 logout: ") +
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 logout: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<std::shared_ptr<LoginResponse>> TribufuGeneratedApi::r_register(
boost::optional<std::shared_ptr<RegisterRequest>> registerRequest) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/register");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->r_register does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (registerRequest)
localVarJson = ModelBase::toJson(*registerRequest);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (registerRequest && (*registerRequest).get())
{
(*registerRequest)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("registerRequest"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->r_register does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 r_register: ") +
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 r_register: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<LoginResponse> localVarResult(new LoginResponse());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 r_register: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<std::shared_ptr<LoginResponse>> TribufuGeneratedApi::refresh(
boost::optional<std::shared_ptr<RefreshRequest>> refreshRequest) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/refresh");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->refresh does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (refreshRequest)
localVarJson = ModelBase::toJson(*refreshRequest);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (refreshRequest && (*refreshRequest).get())
{
(*refreshRequest)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("refreshRequest"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415, utility::conversions::to_string_t(
"TribufuGeneratedApi->refresh does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 refresh: ") +
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 refresh: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<LoginResponse> localVarResult(new LoginResponse());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 refresh: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<void> TribufuGeneratedApi::revokeToken(
boost::optional<std::shared_ptr<RevokeRequest>> revokeRequest) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/oauth2/revoke");
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;
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(
"TribufuGeneratedApi->revokeToken does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(
utility::conversions::to_string_t("application/x-www-form-urlencoded"));
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");
web::json::value localVarJson;
if (revokeRequest)
localVarJson = ModelBase::toJson(*revokeRequest);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (revokeRequest && (*revokeRequest).get())
{
(*revokeRequest)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("revokeRequest"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->revokeToken does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 revokeToken: ") +
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 revokeToken: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<std::vector<std::shared_ptr<AnyType>>> TribufuGeneratedApi::search(
boost::optional<std::shared_ptr<SearchRequest>> searchRequest) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/search");
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->search does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (searchRequest)
localVarJson = ModelBase::toJson(*searchRequest);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (searchRequest && (*searchRequest).get())
{
(*searchRequest)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("searchRequest"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415, utility::conversions::to_string_t(
"TribufuGeneratedApi->search does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams,
localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 search: ") +
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 search: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::vector<std::shared_ptr<AnyType>> localVarResult;
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
for (auto &localVarItem : localVarJson.as_array())
{
std::shared_ptr<AnyType> localVarItemObj;
ModelBase::fromJson(localVarItem, localVarItemObj);
localVarResult.push_back(localVarItemObj);
}
}
// 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 search: unsupported response type"));
}
return localVarResult;
});
}
pplx::task<void> TribufuGeneratedApi::updateGameServer(utility::string_t id,
boost::optional<std::shared_ptr<AnyType>> body) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/servers/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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;
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(
"TribufuGeneratedApi->updateGameServer does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
localVarJson = ModelBase::toJson(body.get());
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get()));
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->updateGameServer does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 updateGameServer: ") +
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 updateGameServer: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<void> TribufuGeneratedApi::updateGameServerCluster(
utility::string_t id, boost::optional<std::shared_ptr<AnyType>> body) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/clusters/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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;
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(
"TribufuGeneratedApi->updateGameServerCluster does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
localVarJson = ModelBase::toJson(body.get());
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get()));
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->updateGameServerCluster does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 updateGameServerCluster: ") +
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 updateGameServerCluster: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<void> TribufuGeneratedApi::updateGroup(utility::string_t id,
boost::optional<std::shared_ptr<AnyType>> body) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/groups/{id}");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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;
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(
"TribufuGeneratedApi->updateGroup does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
localVarJson = ModelBase::toJson(body.get());
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), body.get()));
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(415,
utility::conversions::to_string_t(
"TribufuGeneratedApi->updateGroup does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 updateGroup: ") +
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 updateGroup: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) { return void(); });
}
pplx::task<std::shared_ptr<Profile>> TribufuGeneratedApi::updateUserProfile(
utility::string_t id, boost::optional<std::shared_ptr<UpdateProfile>> updateProfile) const
{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration(m_ApiClient->getConfiguration());
utility::string_t localVarPath = utility::conversions::to_string_t("/v1/users/{id}/profile");
boost::replace_all(localVarPath,
utility::conversions::to_string_t("{") + utility::conversions::to_string_t("id") +
utility::conversions::to_string_t("}"),
web::uri::encode_uri(ApiClient::parameterToString(id)));
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("text/plain"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarResponseHttpContentTypes.insert(utility::conversions::to_string_t("text/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(
"TribufuGeneratedApi->updateUserProfile does not produce any supported media type"));
}
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set<utility::string_t> localVarConsumeHttpContentTypes;
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json-patch+json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("text/json"));
localVarConsumeHttpContentTypes.insert(utility::conversions::to_string_t("application/*+json"));
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");
web::json::value localVarJson;
if (updateProfile)
localVarJson = ModelBase::toJson(*updateProfile);
localVarHttpBody = std::shared_ptr<IHttpBody>(new JsonBody(localVarJson));
}
// 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");
std::shared_ptr<MultipartFormData> localVarMultipart(new MultipartFormData);
if (updateProfile && (*updateProfile).get())
{
(*updateProfile)
->toMultipart(localVarMultipart, utility::conversions::to_string_t("updateProfile"));
}
localVarHttpBody = localVarMultipart;
localVarRequestHttpContentType +=
utility::conversions::to_string_t("; boundary=") + localVarMultipart->getBoundary();
}
else if (localVarConsumeHttpContentTypes.find(utility::conversions::to_string_t(
"application/x-www-form-urlencoded")) != localVarConsumeHttpContentTypes.end())
{
localVarRequestHttpContentType = utility::conversions::to_string_t("application/x-www-form-urlencoded");
}
else
{
throw ApiException(
415, utility::conversions::to_string_t(
"TribufuGeneratedApi->updateUserProfile does not consume any supported media type"));
}
// authentication (ApiKey) required
{
utility::string_t localVarApiKey =
localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("Authorization"));
if (localVarApiKey.size() > 0)
{
localVarHeaderParams[utility::conversions::to_string_t("Authorization")] = localVarApiKey;
}
}
return m_ApiClient
->callApi(localVarPath, utility::conversions::to_string_t("PUT"), localVarQueryParams, localVarHttpBody,
localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=, this](web::http::http_response localVarResponse) {
if (m_ApiClient->getResponseHandler())
{
m_ApiClient->getResponseHandler()(localVarResponse.status_code(), 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 updateUserProfile: ") +
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 updateUserProfile: unexpected response type: ") +
localVarContentType,
std::make_shared<std::stringstream>(localVarResponse.extract_utf8string(true).get()));
}
}
return localVarResponse.extract_string();
})
.then([=, this](utility::string_t localVarResponse) {
std::shared_ptr<Profile> localVarResult(new Profile());
if (localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
{
web::json::value localVarJson = web::json::value::parse(localVarResponse);
ModelBase::fromJson(localVarJson, localVarResult);
}
// 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 updateUserProfile: unsupported response type"));
}
return localVarResult;
});
}
}
}