Client

public class Client

Client is the root of all requests. It contains two built-in types of making requests

  • Reactive Single events
  • Completion callbacks

A request may have a few different parameters

  • Page and Per Page
    • standard pagination, optional
  • Filter and Range
    • A ParameterObject with optional fields for filtering or applying ranges
  • Sort
    • A SortObject that contains keys to sort by (ascending or decending)

Certain requests may also include an id parameter. Those will return only a single element. All other requests return an array of elements

  • Public initializer

    Declaration

    Swift

    public init(_ token: String)

    Parameters

    token

    The access token to use. Will be passed as an HTTP header

  • List all champions for the latest version

    Declaration

    Swift

    func getChampions(ids: [Int]? = nil, page: Int? = nil, per_page: Int? = nil, completion: @escaping APIResponse<[Champion]>)

    Parameters

    ids

    A list of champion IDs to filter for

    page

    The pagination page to return

    per_page

    The number of items per page

    completion

    Callback with list of champions matching any filters that are applied

  • List all champions for the latest version

    Declaration

    Swift

    func getChampions(ids: [Int]? = nil, page: Int? = nil, per_page: Int? = nil) -> Single<[Champion]>

    Parameters

    ids

    A list of champion IDs to filter for

    page

    The pagination page to return

    per_page

    The number of items per page

    Return Value

    A Single event emitting a list of champions matching any filters that are applied

  • Get play-by-play events for a game

    Declaration

    Swift

    func getPlayByPlayEvents(for game: Int, page: Int? = nil, per_page: Int? = nil, completion: @escaping APIResponse<[GameEvent]>)

    Parameters

    id

    The game to fetch events for

    page

    The pagination page to return

    per_page

    The number of items per page

    completion

    APIResponse containing play-by-play events

  • Get play-by-play events for a game

    Declaration

    Swift

    func getPlayByPlayEvents(for game: Int, page: Int? = nil, per_page: Int? = nil) -> Single<[GameEvent]>

    Parameters

    id

    The game to fetch events for

    page

    The pagination page to return

    per_page

    The number of items per page

    Return Value

    Emits a single event containing a list of play-by-play events

  • Get play-by-play frames for a game

    Declaration

    Swift

    func getPlayByPlayFrames(for game: Int, page: Int? = nil, per_page: Int? = nil, completion: @escaping APIResponse<[GameFrame]>)

    Parameters

    id

    The game to fetch events for

    page

    The pagination page to return

    per_page

    The number of items per page

    completion

    APIResponse containing play-by-play frames

  • Get play-by-play frames for a game

    Declaration

    Swift

    func getPlayByPlayFrames(for game: Int, page: Int? = nil, per_page: Int? = nil) -> Single<[GameFrame]>

    Parameters

    id

    The game to fetch events for

    page

    The pagination page to return

    per_page

    The number of items per page

    Return Value

    Emits a single event containing a list of play-by-play frames