Swiftpack.co - Package - MatrixSenpai/pandascore-api

PandaScoreAPI

Package Managers Cocoapods platforms Cocoapods Discord

A Swift implementation of the PandaScore API

A callback based API client with built-in reactive extensions

Currently, this package does not support Live (wss://)

Overview

To get started, create a client and pass in your token, like so:

let client: Client = Client("<PANDASCORE_API_TOKEN>")
Making a request

Each endpoint has a similar structure.

Simple endpoints like getChampion and getItem can take an ID or a list of IDs, and return a single object or a filtered list.

More complex endpoints, like those for games, matches, series, and tournaments, have a slightly more complex structure

There are 3 main parts to these requests:

  • page/per_page
  • filter/range
  • sort

Page and per_page are relatively self-explainatory. They deal with the pagination of the request

Note: In future versions, a response will contain the next and previous paging information, to allow for easier pagination of requests

Filter and range allow the limitations on the data returned by applying filters on the properties of the returning object.

Sort allows the data returned to be sorted by a property on the returning objects

A quick sample of making requests

let filterObject = GetMatchesParametersObject(finished: true, number_of_games: 1)
let sortObject = GetMatchesSortObject(keys: [(.begin_at, true)])
client.getMatches(filter: filterObject) { response in 
  // Do something
}

This request gets only finished matches with one game, and sorts them in ascending order by when they began.

For further documentation on how the API works, check out the PandaScore official documentation.

Problems?

Submit an issue

Github

link
Stars: 1
Help us keep the lights on

Dependencies

Used By

Total: 0