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.crsrcr/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
- #backoff_time(*args, **options)
- #backoff_time(*args, **options, &)
-
#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.
-
#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.
Instance Method Detail
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.
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.