Skip to content

Handling the Response

supergrecko edited this page Apr 3, 2019 · 2 revisions

Working with responses from RiotQuest is incredibly easy and simple. Every endpoint except Code::id() and Mastery::score() return an object which extends Collection.

Collections

Collections are the bread and butter of RiotQuest and make up the entire framework. Each collection comes with a set of methods which modify your response or access different parts of the dataset.

You can see each property and submethod in the documentation page for that collection. For example the documentation for the MatchHistory collection can be found at /wiki/Match-History. Note that these files are generated using Reflection so if you find anything you believe is wrong, please let us know by creating an issue!

You can read more about collections here.

Example

By looking at the documentation for the Summoner collection we'll find a method named getMatchlist(). When we read the documentation for this method (which can be found here) we find out that this method will pull the matchlist for the summoner you've already got. This will return a MatchHistory object.

By looking at the documentation for the MatchHistory collection we'll find a method named getWhereQueue(). When we read the documentation for this method (which can be found here) we find out that this method will get every game where the champion played was the one specified. Here's an example.

<?php

use RiotQuest\Client;

Client::summoner('euw', 7200)->name('supergrecko')
    ->getMatchlist() // Get the match list for summoner name "supergrecko" on EUW1.
    ->getWhereChampion(64); // Get every match in the MatchHistory collection where the champion played was 64.

For large collections like the Match one you'll find yourself able to chain dozens of methods to access your wanted data. Each function is documented in its collections document sheet which can be located in the sidebar.

Rate Limiting

Rate Limiting is handled automatically by RiotQuest. RiotQuest limits your requests by region and endpoint so you'll never have to worry about passing the rate limit. You can read a little more about the behaviour of the Rate Limiter here.

Caching

RiotQuest throws every successful request into a Cache of your choice. Read about caching

Each response is stored as JSON and they're stored for as long as you want them to (defaulted to one hour).

Clone this wiki locally
You can’t perform that action at this time.