module

Srcom::Api

Setting the #backoff_time determines how much longer (in seconds) than absolutely necessary the RateLimiter waits until it allows new requests. This defaults to 1 second.

Constants

BASE_URL = "https://www.speedrun.com/api/v1/"
Log = Srcom::Log.for("rest")
USER_AGENT = "SRCR Client (https://github.com/shardlab/srcr), version #{VERSION}"

Instance methods

backoff_time(*args, **options)
Source
backoff_time(*args, **options, &)
Source
request(endpoint : String, url : String, method : String, headers : HTTP::Headers | Nil = nil, body : String | Nil = nil, page : Int32 = 1)

Makes a request to the given url using the given method with the given headers and body, returning both the relevant data if the request is successful and the link to the next page if the resource requested is paginated and has a next page.

NOTE: endpoint and page are only used for logging purposes.

NOTE: It is not recommended to use this method directly.

Source
request_single_item(endpoint : String, url : String, method : String, headers : HTTP::Headers = HTTP::Headers.new, body : String | Nil = nil)

Makes a request to the given url using the given method with the given headers and body, with the difference to .request being that only a single item is returned from the API, which is formatted slightly different by speedrun.com.

NOTE: endpoint is just used for logging purposes.

NOTE: It is not recommended to use this method directly.

Source

Nested types