class Srcom::Api::Runs

Defined in:

srcr/apis/runs.cr

Constant Summary

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

Class Method Summary

Class Method Detail

def self.change_players(id : String, players : Array(Run::Submission::Player), api_key : String) : Srcom::SimpleRun #

Changes the players who played the Run with the given id to players in the name of the user authenticated with the given api_key, returning the changed run if successful.

BUG Currently using this method will always return 500 Internal Server Error for an unknown reason. Unfortunately, since the fault lies on speedrun.com's side, this can not be fixed.

NOTE Obviously the authenticated user must be a moderator for the game the run was submitted to, or a global moderator.


[View source]
def self.change_status(id : String, status : String, api_key : String, reason : String? = nil) : Srcom::SimpleRun #

Changes the status of the Run with the given id to the given status, which must either be "verified" or "rejected", with the given reason if the new status should be rejected, in the name of the user authenticated with the given api_key, returning the run if successful.

NOTE Obviously the authenticated user must be a moderator for the game the run was submitted to, or a global moderator.

NOTE This method exists only to retain an exact mapping to the API's methods. It is highly recommended to use the .verify and .reject methods instead of this!


[View source]
def self.delete(id : String, api_key : String) : Srcom::SimpleRun #

Deletes the Run with the given id as the user authenticated using the given api_key, returning the newly verified run if successful.

NOTE Obviously the authenticated user must be a moderator for the game the run was submitted to, or a global moderator.


[View source]
def self.find_by(user : String? = nil, guest : String? = nil, examiner : String? = nil, game : String? = nil, level : String? = nil, category : String? = nil, platform : String? = nil, region : String? = nil, emulated : Bool = false, status : String? = nil, order_by : String? = nil, sort_direction : String? = nil, page_size : Int32 = 200) : PageIterator(Run) #

Searches through all Runs using the given query parameters.

Searching by guest requires a Guest's name.

Setting emulated to true returns only runs done on an emulated system. Setting it to false will return both runs that are done on an emulated and runs that done on a real system.

Possible values for status: "new", "verified", or "rejected".

All other search parameters must be an ID.

Possible values for order_by: "category", "level", "platform", "region", "emulated", "date", "submitted", "status", "game", or "verify-date", with the default being "game".

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.

NOTE While Runs are very large objects, using the maximum page size does usually work, and so that is what is defaulted to. If your requests are timing out or taking too long, try setting a smaller page size.


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

Gets a Run given its id.


[View source]
def self.reject(id : String, reason : String, api_key : String) : Srcom::SimpleRun #

Rejects the Run with the given id for the given reason as the user authenticated using the given api_key, returning the newly verified run if successful.

NOTE Obviously the authenticated user must be a moderator for the game the run was submitted to, or a global moderator.


[View source]
def self.submit(run : Srcom::Run::Submission, api_key : String) : Srcom::SimpleRun #

Submits a Run::Submission to speedrun.com in the name of the user authenticated with the given api_key, returning the newly submitted run as a SimpleRun if the submission was successful.

While most fields of a Run::Submission are optional it is highly recommended to fill out as many of them as possible.

NOTE It is very important to respect the notes listed for Run::Submission.new!


[View source]
def self.verify(id : String, api_key : String) : Srcom::SimpleRun #

Verifies the Run with the given id as the user authenticated using the given api_key, returning the newly verified run if successful.

NOTE Obviously the authenticated user must be a moderator for the game the run was submitted to, or a global moderator.


[View source]