1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 16:57:16 +01:00
SqMod/vendor/CPR/include/cpr/session.h

153 lines
4.9 KiB
C
Raw Normal View History

2021-03-26 23:18:51 +01:00
#ifndef CPR_SESSION_H
#define CPR_SESSION_H
#include <cstdint>
#include <fstream>
#include <memory>
#include "cpr/auth.h"
#include "cpr/bearer.h"
#include "cpr/body.h"
#include "cpr/callback.h"
#include "cpr/connect_timeout.h"
#include "cpr/cookies.h"
#include "cpr/cprtypes.h"
#include "cpr/curlholder.h"
#include "cpr/digest.h"
2021-08-22 19:28:37 +02:00
#include "cpr/interface.h"
2021-03-26 23:18:51 +01:00
#include "cpr/limit_rate.h"
#include "cpr/low_speed.h"
#include "cpr/multipart.h"
#include "cpr/ntlm.h"
#include "cpr/parameters.h"
#include "cpr/payload.h"
#include "cpr/proxies.h"
2021-07-02 16:44:48 +02:00
#include "cpr/proxyauth.h"
2021-08-22 19:28:37 +02:00
#include "cpr/redirect.h"
2021-03-26 23:18:51 +01:00
#include "cpr/response.h"
#include "cpr/ssl_options.h"
#include "cpr/timeout.h"
#include "cpr/unix_socket.h"
#include "cpr/user_agent.h"
#include "cpr/verbose.h"
namespace cpr {
class Session {
public:
Session();
2021-07-02 16:44:48 +02:00
Session(Session&& old) noexcept;
2021-03-26 23:18:51 +01:00
Session(const Session& other) = delete;
~Session();
2021-07-02 16:44:48 +02:00
Session& operator=(Session&& old) noexcept;
2021-03-26 23:18:51 +01:00
Session& operator=(const Session& other) = delete;
void SetUrl(const Url& url);
void SetParameters(const Parameters& parameters);
void SetParameters(Parameters&& parameters);
void SetHeader(const Header& header);
void UpdateHeader(const Header& header);
void SetTimeout(const Timeout& timeout);
void SetConnectTimeout(const ConnectTimeout& timeout);
void SetAuth(const Authentication& auth);
void SetDigest(const Digest& auth);
void SetUserAgent(const UserAgent& ua);
void SetPayload(Payload&& payload);
void SetPayload(const Payload& payload);
void SetProxies(Proxies&& proxies);
void SetProxies(const Proxies& proxies);
2021-07-02 16:44:48 +02:00
void SetProxyAuth(ProxyAuthentication&& proxy_auth);
void SetProxyAuth(const ProxyAuthentication& proxy_auth);
2021-03-26 23:18:51 +01:00
void SetMultipart(Multipart&& multipart);
void SetMultipart(const Multipart& multipart);
void SetNTLM(const NTLM& auth);
2021-08-22 19:28:37 +02:00
void SetRedirect(const Redirect& redirect);
2021-03-26 23:18:51 +01:00
void SetCookies(const Cookies& cookies);
void SetBody(Body&& body);
void SetBody(const Body& body);
void SetLowSpeed(const LowSpeed& low_speed);
void SetVerifySsl(const VerifySsl& verify);
void SetUnixSocket(const UnixSocket& unix_socket);
void SetSslOptions(const SslOptions& options);
void SetReadCallback(const ReadCallback& read);
void SetHeaderCallback(const HeaderCallback& header);
void SetWriteCallback(const WriteCallback& write);
void SetProgressCallback(const ProgressCallback& progress);
void SetDebugCallback(const DebugCallback& debug);
void SetVerbose(const Verbose& verbose);
2021-08-22 19:28:37 +02:00
void SetInterface(const Interface& iface);
2021-03-26 23:18:51 +01:00
// Used in templated functions
void SetOption(const Url& url);
void SetOption(const Parameters& parameters);
void SetOption(Parameters&& parameters);
void SetOption(const Header& header);
void SetOption(const Timeout& timeout);
void SetOption(const ConnectTimeout& timeout);
void SetOption(const Authentication& auth);
// Only supported with libcurl >= 7.61.0.
// As an alternative use SetHeader and add the token manually.
#if LIBCURL_VERSION_NUM >= 0x073D00
void SetOption(const Bearer& auth);
#endif
void SetOption(const Digest& auth);
void SetOption(const UserAgent& ua);
void SetOption(Payload&& payload);
void SetOption(const Payload& payload);
void SetOption(const LimitRate& limit_rate);
void SetOption(Proxies&& proxies);
void SetOption(const Proxies& proxies);
2021-07-02 16:44:48 +02:00
void SetOption(ProxyAuthentication&& proxy_auth);
void SetOption(const ProxyAuthentication& proxy_auth);
2021-03-26 23:18:51 +01:00
void SetOption(Multipart&& multipart);
void SetOption(const Multipart& multipart);
void SetOption(const NTLM& auth);
2021-08-22 19:28:37 +02:00
void SetOption(const Redirect& redirect);
2021-03-26 23:18:51 +01:00
void SetOption(const Cookies& cookies);
void SetOption(Body&& body);
void SetOption(const Body& body);
void SetOption(const ReadCallback& read);
void SetOption(const HeaderCallback& header);
void SetOption(const WriteCallback& write);
void SetOption(const ProgressCallback& progress);
void SetOption(const DebugCallback& debug);
void SetOption(const LowSpeed& low_speed);
void SetOption(const VerifySsl& verify);
void SetOption(const Verbose& verbose);
void SetOption(const UnixSocket& unix_socket);
void SetOption(const SslOptions& options);
2021-08-22 19:28:37 +02:00
void SetOption(const Interface& iface);
2021-03-26 23:18:51 +01:00
2021-08-22 19:28:37 +02:00
cpr_off_t GetDownloadFileLength();
2021-03-26 23:18:51 +01:00
Response Delete();
Response Download(const WriteCallback& write);
Response Download(std::ofstream& file);
Response Get();
Response Head();
Response Options();
Response Patch();
Response Post();
Response Put();
std::shared_ptr<CurlHolder> GetCurlHolder();
2021-07-02 16:44:48 +02:00
void PrepareDelete();
void PrepareGet();
void PrepareHead();
void PrepareOptions();
void PreparePatch();
void PreparePost();
void PreparePut();
Response Complete(CURLcode curl_error);
protected:
2021-03-26 23:18:51 +01:00
class Impl;
std::unique_ptr<Impl> pimpl_;
};
} // namespace cpr
#endif