JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
API.h
Go to the documentation of this file.
1 //
2 // Created by Nico on 23/08/2019.
3 //
4 
5 #ifndef JODA_API_H
6 #define JODA_API_H
7 
8 #include <httplib.h>
11 
15 class API {
16  public:
20  static constexpr size_t VERSION = 2;
21 
25  static constexpr auto prefix = "/v2";
26 
32  static void registerEndpoint(const std::string &prefix,
33  httplib::Server &server);
34 };
35 
40  public:
41  JodaAPIVersionException() : JodaAPIException("Missing 'API' parameter") {}
42 
43  explicit JodaAPIVersionException(unsigned int got)
44  : JodaAPIException("Expected version " + std::to_string(API::VERSION) +
45  " but got " + std::to_string(got)) {}
46 
47  explicit JodaAPIVersionException(const std::string &what)
48  : JodaAPIException("'API' parameter invalid: " + what) {}
49 };
50 
51 } // namespace joda::network::apiv2
52 #endif // JODA_API_H
Definition: JodaServer.h:18
Definition: API.h:15
static constexpr size_t VERSION
Definition: API.h:20
static void registerEndpoint(const std::string &prefix, httplib::Server &server)
Definition: API.cpp:12
static constexpr auto prefix
Definition: API.h:25
JodaAPIVersionException(unsigned int got)
Definition: API.h:43
JodaAPIVersionException(const std::string &what)
Definition: API.h:47
Definition: API.h:10