class Srcom::Api::Games

Defined in:

srcr/apis/games.cr

Constant Summary

Log = Srcom::Log.for("games")

Class Method Summary

Class Method Detail

def self.find_by(name : String? = nil, abbreviation : String? = nil, released : Int32? = nil, gametype : String? = nil, platform : String? = nil, region : String? = nil, genre : String? = nil, engine : String? = nil, developer : String? = nil, publisher : String? = nil, moderator : String? = nil, order_by : String? = nil, sort_direction : String? = nil, page_size : Int32 = 20) : PageIterator(Game) #

Searches through all Games using the given query parameters.

Searching by name performs a fuzzy search across game names and abbreviations.

Seaching by abbreviation performs an exact-match search.

Searching by released restricts to search to games released in that exact year.

All other search parameters must be an ID.

Possible values for order_by: "name.jap", "name.int", "abbreviation", "released", or "created", with the default being "name.int".

Possible values for sort_direction: "desc" or "asc", with the default being "asc".

NOTE Not specifying any filter probably leads to the request eventually crashing, leading to incomplete data. If you need every game and can afford to lose some data per game, consider using .find_by_bulk instead.

NOTE Since Games are very large objects this method defaults to a small page size to give the request a reasonable speed.


[View source]
def self.find_by_bulk(name : String? = nil, abbreviation : String? = nil, released : Int32? = nil, gametype : String? = nil, platform : String? = nil, region : String? = nil, genre : String? = nil, engine : String? = nil, developer : String? = nil, publisher : String? = nil, moderator : String? = nil, order_by : String? = nil, sort_direction : String? = nil, page_size : Int32 = 1000) : PageIterator(BulkGame) #

Searches through all Games using the given query parameters, returning BulkGames, which have a greatly reduced amount of data present.

Searching by name performs a fuzzy search across game names and abbreviations.

Seaching by abbreviation performs an exact-match search.

Searching by released restricts to search to games released in that exact year.

All other search parameters must be an ID.

Possible values for order_by: "name.jap", "name.int", "abbreviation", "released", or "created", with the default being "name.int".

Possible values for sort_direction: "desc" or "asc", with the default being "asc".

NOTE As opposed to .find_by it is very much feasible to get every game on speedrun.com with this method.


[View source]
def self.find_by_id(id : String) : Srcom::Game #

Finds a Game given its id or abbreviation.


[View source]
def self.get_categories(id : String, miscellaneous : Bool? = nil, order_by : String? = nil, sort_direction : String? = nil) : Array(Category) #

Gets the categories belonging to the Game given by its id or abbreviation.

Possible values for order_by: "name", "miscellaneous", or "pos", with the default being "pos".

Possible values for sort_direction: "desc" or "asc", with the default being "asc".

NOTE If miscellaneous is set to true only miscellaneous categories will be returned. If it is set to false only non-miscellaneous categories will be returned. If it is set to nil both miscellaneous and non-miscellaneous categories will be returned.


[View source]
def self.get_derived_games(id : String, name : String? = nil, abbreviation : String? = nil, released : Int32? = nil, gametype : String? = nil, platform : String? = nil, region : String? = nil, genre : String? = nil, engine : String? = nil, developer : String? = nil, publisher : String? = nil, moderator : String? = nil, order_by : String? = nil, sort_direction : String? = nil, page_size : Int32 = 200) : PageIterator(Game) #

Searches through all the derived games of the Game given by its id or abbreviation using the given query parameters (and gets all derived games if none of the filters are used).

Searching by name performs a fuzzy search across game names and abbreviations.

Seaching by abbreviation performs an exact-match search.

Searching by released restricts to search to games released in that exact year.

All other search parameters must be an ID.

Possible values for order_by: "name.jap", "name.int", "abbreviation", "released", or "created", with the default being "name.int".

Possible values for sort_direction: "desc" or "asc", with the default being "asc".

NOTE Since Games typically don't have too many derived games it is very much feasible to get everything here.


[View source]
def self.get_levels(id : String, order_by : String? = nil, sort_direction : String? = nil) : Array(Level) #

Gets the Levels belonging to the Game given by its id or abbreviation.

Possible values for order_by: "name" or "pos", with the default being "pos".

Possible values for sort_direction: "desc" or "asc", with the default being "asc".


[View source]
def self.get_records(id : String, top : Int32 = 3, scope : String? = nil, miscellaneous : Bool = true, skip_empty : Bool = false, page_size : Int32 = 200) : PageIterator(Leaderboard) #

Gets every Leaderboard with the top N runs for the Game given by its id or abbreviation, skipping over empty Leaderboards if skip_empty is true.

If miscellaneous is set to false, only Leaderboards for non-miscellaneous categories will be returned. If it is set to true Leaderboards for both miscellaneous and non-miscellaneous categories will be returned.

NOTE This can result in more than N runs per Leaderboard, as ties can occur.


[View source]
def self.get_variables(id : String, order_by : String? = nil, sort_direction : String? = nil) : Array(Variable) #

Gets the Variables belonging to the Game given by its id or abbreviation.

Possible values for order_by: "name", "mandatory", "pos" or "user-defined", with the default being "pos".

Possible values for sort_direction: "desc" or "asc", with the default being "asc".


[View source]