-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBackend_API.h
59 lines (50 loc) · 1.92 KB
/
Backend_API.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef BACKEND_API_H
#define BACKEND_API_H
#include <cstdio>
#include <curl/curl.h>
#include <jsoncpp/json/json.h>
#include <exception>
// #include <iostream>
#include <string>
#include <cstring>
#include <wx/base64.h>
class Backend_API{
public:
Backend_API(std::string backend_addr="https://tg-backend-2.azurewebsites.net") : addr{backend_addr}
{
curl_global_init(CURL_GLOBAL_ALL);
}
~Backend_API(){
curl_global_cleanup();
}
Json::Value sign_up(std::string email, std::string passwd, std::string repeat_passwd);
Json::Value login(std::string email, std::string passwd, std::string code);
Json::Value get_clients_list();
Json::Value delete_client(std::string token, std::string client_id);
Json::Value post_offer(std::string token,
std::string name,
std::string v_descr,
std::string beg_y,
std::string end_y,
std::string doors_num,
std::string seat_num,
std::string boot_cap,
std::string len,
std::string width,
std::string height,
std::string wheel_b,
std::string back_wheel,
std::string fron_wheel,
std::string gearbox,
std::string drive,
std::string client_id_json,
std::string price,
std::string offer_descr,
std::string email,
std::string phone_num);
private:
Json::Value str2json(std::string strJson);
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp);
const std::string addr;
};
#endif