I use a standard set of templates, changes are made in api-header.mustache and api-source.mustache. Their _old versions contain the originals. Additions are necessary for the header argument in the generated functions so that you can authenticate using cookies.
54 lines
1.5 KiB
Text
54 lines
1.5 KiB
Text
{{>licenseInfo}}
|
|
/*
|
|
* ApiConfiguration.h
|
|
*
|
|
* This class represents a single item of a multipart-formdata request.
|
|
*/
|
|
|
|
#ifndef {{apiHeaderGuardPrefix}}_ApiConfiguration_H_
|
|
#define {{apiHeaderGuardPrefix}}_ApiConfiguration_H_
|
|
|
|
{{{defaultInclude}}}
|
|
|
|
#include <cpprest/details/basic_types.h>
|
|
#include <cpprest/http_client.h>
|
|
|
|
#include <map>
|
|
|
|
{{#apiNamespaceDeclarations}}
|
|
namespace {{this}} {
|
|
{{/apiNamespaceDeclarations}}
|
|
|
|
class {{declspec}} ApiConfiguration
|
|
{
|
|
public:
|
|
ApiConfiguration();
|
|
virtual ~ApiConfiguration();
|
|
|
|
const web::http::client::http_client_config& getHttpConfig() const;
|
|
void setHttpConfig( web::http::client::http_client_config& value );
|
|
|
|
utility::string_t getBaseUrl() const;
|
|
void setBaseUrl( const utility::string_t value );
|
|
|
|
utility::string_t getUserAgent() const;
|
|
void setUserAgent( const utility::string_t value );
|
|
|
|
std::map<utility::string_t, utility::string_t>& getDefaultHeaders();
|
|
const std::map<utility::string_t, utility::string_t>& getDefaultHeaders() const;
|
|
|
|
utility::string_t getApiKey( const utility::string_t& prefix) const;
|
|
void setApiKey( const utility::string_t& prefix, const utility::string_t& apiKey );
|
|
|
|
protected:
|
|
utility::string_t m_BaseUrl;
|
|
std::map<utility::string_t, utility::string_t> m_DefaultHeaders;
|
|
std::map<utility::string_t, utility::string_t> m_ApiKeys;
|
|
web::http::client::http_client_config m_HttpConfig;
|
|
utility::string_t m_UserAgent;
|
|
};
|
|
|
|
{{#apiNamespaceDeclarations}}
|
|
}
|
|
{{/apiNamespaceDeclarations}}
|
|
#endif /* {{apiHeaderGuardPrefix}}_ApiConfiguration_H_ */
|