mastodonpp  0.0.0
Public Member Functions | Public Attributes | Friends | List of all members
mastodonpp::answer Struct Reference

Return type for Requests. More...

#include <return_types.hpp>

Public Member Functions

 operator bool () const
 Returns true if error_code is 0, false otherwise. More...
 
 operator string_view () const
 Returns body as std::string_view. More...
 

Public Attributes

uint8_t error_code
 Error code. More...
 
string error_message
 The error message. More...
 
uint16_t http_status
 HTTP status code. More...
 
string body
 The response from the server, usually JSON. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const answer &answer)
 Returns body as std::ostream. More...
 

Detailed Description

Return type for Requests.

Since
0.1.0

Error codes

Code Explanation
0 No error.

Member Function Documentation

◆ operator bool()

mastodonpp::answer::operator bool ( ) const
explicit

Returns true if error_code is 0, false otherwise.

Since
0.1.0
23 {
24  return (error_code == 0);
25 }

◆ operator string_view()

mastodonpp::answer::operator string_view ( ) const
explicit

Returns body as std::string_view.

Since
0.1.0
28 {
29  return body;
30 }

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const answer answer 
)
friend

Returns body as std::ostream.

Since
0.1.0
33 {
34  out << answer.body;
35  return out;
36 }

Member Data Documentation

◆ body

string mastodonpp::answer::body

The response from the server, usually JSON.

Since
0.1.0

◆ error_code

uint8_t mastodonpp::answer::error_code

Error code.

Since
0.1.0

◆ error_message

string mastodonpp::answer::error_message

The error message.

Since
0.1.0

◆ http_status

uint16_t mastodonpp::answer::http_status

HTTP status code.

Since
0.1.0

The documentation for this struct was generated from the following files:
mastodonpp::answer::body
string body
The response from the server, usually JSON.
Definition: return_types.hpp:67
mastodonpp::answer::error_code
uint8_t error_code
Error code.
Definition: return_types.hpp:49