Object-oriented libraries for working with HTTP and REST API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
api/lib/api.hpp

47 lines
922 B

1 year ago
#ifndef _API_
#define _API_
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include "http.hpp"
1 year ago
using namespace std;
class http_request;
class http_response;
1 year ago
class defapi {
public:
vector<string> methods;
vector<string> paths;
1 year ago
vector<string> keys;
map<string, vector<string>> val_matrix;
defapi(const vector<string> _methods, const vector<string> _paths, const vector<string> _keys);
void necessary(const string _path, const vector<string> _keys);
1 year ago
};
class api {
public:
defapi* def;
1 year ago
string method;
string path;
map<string, string> params;
string url;
1 year ago
string body;
// odlazni api zahtjev
api(defapi* _def, const string _method, const string _path, const map<string, string> _params = {}, const string _body = {});
// dolazni api zahjtev
api(defapi* _def, const http_request _req);
// bool validate();
1 year ago
};
#endif