Giter VIP home page Giter VIP logo

riot-cpp's Introduction

Welcome to Riot-cpp

ci build

Simple Api client for the Riot Games Resful API implemented in C++ 20.

This library implements rate limiting to prevent api key blacklisting from exceeding Riot's rate limits. The library handles server response error's and will retry when a successful request is possible (429, 500, 503 errors). The client contains a logging class to help with debugging dependent code as well as providing information of the running of the client. Riot-cpp will adapt to the specific api key's rate limits after the first request and try to recover from errors.

Riot-cpp uses libcurl to send https get requests. The Json parser simdjson is used as a dependency for testing but NOT in the library. Parsing is done by the user.

Documentation is located at following page.

view - Documentation

Basic Usage

Below demonstrates a request to Match V5 endpoint using PUUID with optional arguements. All endpoints return a unique pointer to a vector of chars. Dependency on Jsoncpp or an individual Json library was remoed to allow the user to decide how they wanted to parse json, allows flexibility for users if performance is a key concern for large responses.

#include "path/to/client.h"

using json_ptr = std::unique_ptr<std::vector<char>>

int main() {
    
    client::RiotApiClient example_client("<path/to/api/key>", "<path/to/logging/file>", logging::LEVEL::<level>, <bool verbose>);

    json_ptr response = example_client.Match.by_puuid("routing", "puuid", {"startTime", <user_arg>}, {"endTime", <user_arg>}, ...);
}

Including your API Key

It is highly recommended not to included api keys in source code as one may unintentionally share source coded publically with the api key exposed.

Riot-cpp accepts a path to a json file to extract your api key. The file should be of the following format.

{
    "api-key" : "<API KEY>"
}

Techincally, as long as "RGAPI-..." is anywhere in the file the client will find it.

Installation

Currently the repository must be cloned or downloaded via the releases.

git clone git+https://github.com/Dan-Tan/riot-cpp.git

Git submodules are highly recommended for use as a project dependency.

git submodule add git+https://github.com/Dan-Tan/riot-cpp.git

Option 1: CMake

Linking to executable or library

add_subdirectory(<path/to/riot-cpp/src>)
target_include_directories(<your library or executable> <PRIVATE/PUBLIC> <path/to/riot-cpp/src/riot-cpp>)
target_link_libraries(<your library or executable> <PRIVATE/PUBLIC> riot-cpp)

Option 2: Manually with libriot-cpp.

The shared object file is located as "riot-cpp/build/src/riot-cpp/libriot-cpp.so" and can be manually linked with your compiler of choice. You must include the following in your includes

#include "path/to/riot-cpp/src/client/client.h"

See options for linking with gcc, Options for Linking

Disclaimer

Riot-cpp is not developed by or affiliated with Riot Games.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.