annotate include/core/http.h @ 76:3364fadc8a36

*: format source code
author Paper <mrpapersonic@gmail.com>
date Wed, 04 Oct 2023 01:46:33 -0400
parents d3e9310598b1
children 6f7385bd334c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #ifndef __core__http_h
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #define __core__http_h
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3
76
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
4 #include <QThread>
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include <string>
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 #include <vector>
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 class QObject;
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 namespace HTTP {
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 class HttpGetThread : public QThread {
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 Q_OBJECT
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 public:
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 HttpGetThread(std::string url, std::vector<std::string> headers = {}, QObject* parent = nullptr);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 private:
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userdata);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 void run() override;
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 std::string _url;
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 std::vector<std::string> _headers;
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 signals:
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 void resultReady(const QByteArray& arr);
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26 };
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 /* Performs a basic (blocking) post request */
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29 std::string PerformBasicPostRequest(std::string url, std::string data, std::vector<std::string> headers = {});
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30
76
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
31 } // namespace HTTP
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 #endif // __core__http_h