mirror of
https://github.com/hanzo-cpp/sdk.git
synced 2026-11-20 19:55:32 +00:00
The projection was 113 commits behind the document it claims to describe, and `generate.py --all --check` reported every one of the thirteen clients DRIFTED — the same +19 models in each, because they all fell behind the same emission. Regenerated in place from hanzo-inc/cloud openapi.yaml at 939b09d4 (sha256 087024f6…), which is the only description of this API that cannot name a route the binary does not serve. `--check` is clean across all thirteen after. .spec-lock moved with the code. The generator READS that file and never writes it — hanzoai/ci`s lane does — so a hand run leaves every lock naming the previous document. A lock that disagrees with the tree beside it is worse than no lock: the next `--check` without `--spec` fetches what production serves, compares it to a digest that was already wrong, and reports drift that is really staleness.
112 lines
3.4 KiB
C++
112 lines
3.4 KiB
C++
/**
|
|
* Hanzo Cloud API
|
|
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
*
|
|
* The version of the OpenAPI document: v1
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI-Generator 7.14.0.
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
/*
|
|
* ApiClient.h
|
|
*
|
|
* This is an API client responsible for stating the HTTP calls
|
|
*/
|
|
|
|
#ifndef HANZO_API_ApiClient_H_
|
|
#define HANZO_API_ApiClient_H_
|
|
|
|
|
|
#include "hanzo/ApiConfiguration.h"
|
|
#include "hanzo/ApiException.h"
|
|
#include "hanzo/IHttpBody.h"
|
|
#include "hanzo/HttpContent.h"
|
|
#include "hanzo/ModelBase.h"
|
|
#if defined (_WIN32) || defined (_WIN64)
|
|
#undef U
|
|
#endif
|
|
|
|
#include <cpprest/details/basic_types.h>
|
|
#include <cpprest/http_client.h>
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <functional>
|
|
|
|
namespace hanzo {
|
|
namespace api {
|
|
|
|
using namespace hanzo::model;
|
|
|
|
class ApiClient
|
|
{
|
|
public:
|
|
ApiClient( std::shared_ptr<const ApiConfiguration> configuration = nullptr );
|
|
virtual ~ApiClient();
|
|
|
|
typedef std::function<void(web::http::status_code, const web::http::http_headers&)> ResponseHandlerType;
|
|
|
|
const ResponseHandlerType& getResponseHandler() const;
|
|
void setResponseHandler(const ResponseHandlerType& responseHandler);
|
|
|
|
std::shared_ptr<const ApiConfiguration> getConfiguration() const;
|
|
void setConfiguration(std::shared_ptr<const ApiConfiguration> configuration);
|
|
|
|
static utility::string_t parameterToString(utility::string_t value);
|
|
static utility::string_t parameterToString(int32_t value);
|
|
static utility::string_t parameterToString(int64_t value);
|
|
static utility::string_t parameterToString(float value);
|
|
static utility::string_t parameterToString(double value);
|
|
static utility::string_t parameterToString(const utility::datetime &value);
|
|
static utility::string_t parameterToString(bool value);
|
|
static utility::string_t parameterToString(const ModelBase& value);
|
|
template<class T>
|
|
static utility::string_t parameterToString(const std::vector<T>& value);
|
|
template<class T>
|
|
static utility::string_t parameterToString(const std::shared_ptr<T>& value);
|
|
|
|
pplx::task<web::http::http_response> callApi(
|
|
const utility::string_t& path,
|
|
const utility::string_t& method,
|
|
const std::map<utility::string_t, utility::string_t>& queryParams,
|
|
const std::shared_ptr<IHttpBody> postBody,
|
|
const std::map<utility::string_t, utility::string_t>& headerParams,
|
|
const std::map<utility::string_t, utility::string_t>& formParams,
|
|
const std::map<utility::string_t, std::shared_ptr<HttpContent>>& fileParams,
|
|
const utility::string_t& contentType
|
|
) const;
|
|
|
|
protected:
|
|
|
|
ResponseHandlerType m_ResponseHandler;
|
|
std::shared_ptr<const ApiConfiguration> m_Configuration;
|
|
};
|
|
|
|
template<class T>
|
|
utility::string_t ApiClient::parameterToString(const std::vector<T>& value)
|
|
{
|
|
utility::stringstream_t ss;
|
|
|
|
for( size_t i = 0; i < value.size(); i++)
|
|
{
|
|
if( i > 0) ss << utility::conversions::to_string_t(", ");
|
|
ss << ApiClient::parameterToString(value[i]);
|
|
}
|
|
|
|
return ss.str();
|
|
}
|
|
|
|
template<class T>
|
|
utility::string_t ApiClient::parameterToString(const std::shared_ptr<T>& value)
|
|
{
|
|
return parameterToString(*value.get());
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
#endif /* HANZO_API_ApiClient_H_ */
|