mastodonpp  0.0.0
Public Types | Public Member Functions | List of all members
mastodonpp::API Class Reference

Holds API endpoints. More...

#include <mastodonpp/api.hpp>

Public Types

enum  v1 { instance }
 An enumeration of all v1 API endpoints. More...
 
enum  v2 { search }
 An enumeration of all v2 API endpoints. More...
 
using endpoint_type = variant< v1, v2 >
 Type for endpoints. Either API::v1 or API::v2. More...
 

Public Member Functions

 API (endpoint_type &endpoint)
 Constructs an API object. You should never need this. More...
 
string to_string () const
 Convert endpoint_type to string. More...
 

Detailed Description

Holds API endpoints.

Since
0.1.0

Member Typedef Documentation

◆ endpoint_type

Type for endpoints. Either API::v1 or API::v2.

Since
0.1.0

Member Enumeration Documentation

◆ v1

enum mastodonpp::API::v1
strong

An enumeration of all v1 API endpoints.

The original / are substituted with _.

Since
0.1.0
48  {
49  instance
50  };

◆ v2

enum mastodonpp::API::v2
strong

An enumeration of all v2 API endpoints.

The original / are substituted with _.

Since
0.1.0
60  {
61  search
62  };

Constructor & Destructor Documentation

◆ API()

mastodonpp::API::API ( endpoint_type endpoint)
explicit

Constructs an API object. You should never need this.

This constructor exists to hide away the class members, which are used internally.

Since
0.1.0
31  : _endpoint{move(endpoint)}
32 {}

Member Function Documentation

◆ to_string()

string mastodonpp::API::to_string ( ) const

Convert endpoint_type to string.

Since
0.1.0
35 {
36  static const map<endpoint_type,string_view> endpoint_map
37  {
38  {v1::instance, "/api/v1/instance"},
39  {v2::search, "/api/v2/search"}
40  };
41  return endpoint_map.at(_endpoint).data();
42 }

The documentation for this class was generated from the following files: