module Srcom::Api

Overview

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.

Extended Modules

Defined in:

srcr/apis/categories.cr
srcr/base.cr

Constant Summary

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 Method Summary

Instance Method Detail

def backoff_time(*args, **options) #

[View source]
def backoff_time(*args, **options, &) #

[View source]
def request(endpoint : String, url : String, method : String, headers : HTTP::Headers? = nil, body : String? = 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.


[View source]
def request_single_item(endpoint : String, url : String, method : String, headers : HTTP::Headers = HTTP::Headers.new, body : String? = 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.


[View source]