66 lines
1.3 KiB
C++
66 lines
1.3 KiB
C++
|
#pragma once
|
||
|
|
||
|
#include "ping.hpp"
|
||
|
#include <string>
|
||
|
#include <utility>
|
||
|
#include <memory>
|
||
|
|
||
|
namespace restc_cpp {
|
||
|
class RestClient;
|
||
|
} //namespace restc_cpp
|
||
|
|
||
|
namespace oro {
|
||
|
|
||
|
struct Header {
|
||
|
//Date: Fri, 19 Jun 2020 22:33:43 GMT
|
||
|
Timestamp date;
|
||
|
|
||
|
//Content-Type: application/json
|
||
|
//Content-Length: 89
|
||
|
//Connection: keep-alive
|
||
|
//Set-Cookie: __cfduid=dccdd965b47650be8b0107bb1292154981592606023; expires=Sun, 19-Jul-20 22:33:43 GMT; path=/; domain=.originsro.org; HttpOnly; SameSite=Lax
|
||
|
|
||
|
//X-RateLimit-Limit: 2
|
||
|
int rate_limit;
|
||
|
|
||
|
//X-RateLimit-Remaining: 0
|
||
|
int rate_limit_remaining;
|
||
|
|
||
|
//X-RateLimit-Reset: 1592606027
|
||
|
unsigned long rate_limit_reset;
|
||
|
|
||
|
//Retry-After: 3
|
||
|
unsigned long retry_after;
|
||
|
|
||
|
//CF-Cache-Status: DYNAMIC
|
||
|
//cf-request-id: 03705077e200000091668c6200000001
|
||
|
//Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
|
||
|
//Server: cloudflare
|
||
|
std::string server;
|
||
|
|
||
|
//CF-RAY: 5a60b69fdc270091-LHR
|
||
|
|
||
|
|
||
|
};
|
||
|
|
||
|
class Api {
|
||
|
public:
|
||
|
Api (
|
||
|
std::string&& root_address,
|
||
|
std::string&& client_name,
|
||
|
std::string&& client_purpose
|
||
|
);
|
||
|
~Api() noexcept;
|
||
|
|
||
|
std::pair<Header, Ping> ping();
|
||
|
|
||
|
private:
|
||
|
std::string m_prefix;
|
||
|
std::string m_client_name;
|
||
|
std::string m_client_purpose;
|
||
|
|
||
|
std::unique_ptr<restc_cpp::RestClient> m_client;
|
||
|
};
|
||
|
|
||
|
} //namespace oro
|