The official open-source C++ wrapper for the Top.gg API.
This is a simple C++ SDK for interacting with the Top.gg API.
- Making authenticated requests to the Top.gg API using a bot token
- Parsing Top.gg API responses into convenient C++ objects
- Examples demonstrating how to use the SDK to implement a votebot and leaderboard
- Clone the repository:
git clone https://github.com/pneb/cpp-sdk.git
-
Add the
include
andsrc
directories to your project's include path and library path, respectively. -
Build the
topgg
library:
cd cpp-sdk
mkdir build
cd build
cmake ..
make
- Build the examples:
make example-votebot
make example-leaderboard
- Run the examples:
./example-votebot
./example-leaderboard
Note that the examples require you to have a Top.gg bot token set as an environment variable TOPGG_BOT_TOKEN
.
Include the topgg/http/client.hpp
header and create an instance of topgg::Api
with your Top.gg bot token:
#include <string>
#include "topgg/topgg.hpp"
// Put your bot token here
const std::string BOT_TOKEN = "YOUR_BOT_TOKEN";
int main()
{
topgg::Api api(BOT_TOKEN);
// Use the api object to make requests to the Top.gg API
return 0;
}
Refer to the Top.gg API documentation for information on the available endpoints and request structures.
Pull requests are welcome! Please include unit tests for any added or modified functionality.