http class. Do not use this directly.
More...
#include <mastodon-cpp.hpp>
http class. Do not use this directly.
- Since
- before 0.11.0
◆ http()
API::http::http |
( |
const API & |
api, |
|
|
const string & |
instance, |
|
|
const string & |
access_token |
|
) |
| |
|
explicit |
Constructs new http object.
- Parameters
-
API | Parent object. |
instance | Instance domain name |
access_token | Access token |
- Since
- before 0.11.0
37 , _access_token(access_token)
38 , _cancel_stream(
false)
◆ cancel_stream()
void API::http::cancel_stream |
( |
| ) |
|
Cancels the stream. Use only with streams.
Cancels the stream next time data comes in. Can take a few seconds. This works only with streams, because only streams have an own http object.
- Since
- 0.12.2
254 _cancel_stream =
true;
255 _streamthread.join();
◆ get_mutex()
std::mutex & API::http::get_mutex |
( |
| ) |
|
Gets the mutex guarding the string that is written to.
The mutex guards the function that writes to the string you specified in get_stream().
- Returns
- A reference of the mutex.
- Since
- 0.12.3
◆ request()
return_call API::http::request |
( |
const http_method & |
meth, |
|
|
const string & |
path, |
|
|
const curlpp::Forms & |
formdata |
|
) |
| |
HTTP Request.
- Parameters
-
meth | A method defined in http::method. |
path | The API call as string. |
formdata | The form data for PATCH and POST requests. |
- Since
- 0.100.0
57 return request_common(meth, path, formdata, answer);
◆ request_stream()
void API::http::request_stream |
( |
const string & |
path, |
|
|
string & |
stream |
|
) |
| |
HTTP Request for streams.
- Parameters
-
path | The API call as string. |
stream | The stream of data that is returned. |
- Since
- 0.100.0
63 _streamthread = std::thread(
66 ret = request_common(http_method::GET_STREAM, path,
67 curlpp::Forms(), stream);
68 ttdebug <<
"Remaining content of the stream: " << stream <<
'\n';
72 stream +=
"event: ERROR\ndata: {\"error_code\":" 73 + std::to_string(ret.
error_code) +
",\"http_error\":" Return type for API calls.
Definition: return_types.hpp:92
uint8_t error_code
Error code.
Definition: return_types.hpp:41
uint16_t http_error_code
HTTP error code.
Definition: return_types.hpp:55
The documentation for this class was generated from the following files: