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 (const endpoint_type &endpoint)
 Constructs an API object. You should never need this. More...
 
string_view to_string_view () const
 Convert endpoint_type to std::string_view. 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 ( const 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
28  : _endpoint{endpoint}
29 {}

Member Function Documentation

◆ to_string_view()

string_view mastodonpp::API::to_string_view ( ) const

Convert endpoint_type to std::string_view.

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

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