class Trefoil::Client
- Trefoil::Client
- Reference
- Object
Overview
Used for making API requests. Instances are rate limited to one request per second as per the API documentation.
Defined in:
trefoil/board.crtrefoil/client.cr
Constant Summary
-
BASE_URL =
"https://a.4cdn.org/"
-
Base url for all API requests.
Constructors
Instance Method Summary
-
#board(name : String)
Creates a new board for making board specific requests
- #boards
-
#get(endpoint : String, if_modified_since : Time = Time::UNIX_EPOCH) : String
Get the body of a request from a given endpoint.
-
#get?(endpoint : String, if_modified_since : Time = Time::UNIX_EPOCH) : String | Nil
Like
#get
but if we're rate limited it returnsnil
instead of blocking. -
#rate_limited? : Bool
Whether or not we are able to make another request
- #request(endpoint : String, if_modified_since : Time = Time::UNIX_EPOCH)
-
#retry_after : Time::Span
The time span we have to wait before another request can be made
- #troll_flags
Constructor Detail
Instance Method Detail
Get the body of a request from a given endpoint. If we're rate limited the request is queued.
Like #get
but if we're rate limited it returns nil
instead of blocking.