Sansossio / twisted

Fetching riot games api data
125 stars 47 forks source link

[PoC] Implement an interface to get TFT league data by tier and division #120

Closed SpicyCoffee closed 3 months ago

SpicyCoffee commented 3 months ago

This PR connects to https://github.com/Sansossio/twisted/issues/119 .

What

Implement an interface to get TFT league data by tier and division. This interface requests to GET /tft/league/v1/entries/{tier}/{division} of https://developer.riotgames.com/apis#tft-league-v1/GET_getLeagueEntries

Why

Detail: https://github.com/Sansossio/twisted/issues/119

I would like to obtain TFT match data for a specific tier and division, such as matches in "DIAMOND IV."

How

Add new function to src/apis/tft/league/league.tft.ts and endpoint definition to src/endpoints/endpoints.ts

Testing

Screenshots / Logs

I added console.log to example file to confirm the result.

$ RIOT_API_KEY=RGAPI-xxxxxxxx yarn example TftLeagueByTierDivision
yarn run v1.22.22
$ ts-node runExamples TftLeagueByTierDivision
Total examples: 1
------------------------------------------------
Run TftLeagueByTierDivision
[
    {
      puuid: 'jozZcqrcsKv2AfTXdtkTPqBonabGZP2-JAEDlOMSjRTNYJc-m4wKxnq5ZmB0lSDEMgV9ZTubroaQXQ',
      leagueId: 'ebbb3bf9-47a1-41c5-a5c4-f26962194ef3',
      queueType: 'RANKED_TFT',
      tier: 'DIAMOND',
      rank: 'I',
      summonerId: '9uJtzbZnUstrmdR7_l2Nu9_byDkxf8rE1mT6mhbQU7tbYz14',
      leaguePoints: 0,
      wins: 99,
      losses: 98,
      veteran: false,
      inactive: false,
      freshBlood: false,
      hotStreak: false
    },
    ...
]
undefined
Method TftLeagueByTierDivision: OK
TftLeagueByTierDivision: 923.355ms
------------------------------------------------
✨  Done in 3.17s.

Anything Else

This implementation is like a proof of concept (PoC), meaning I have not thoroughly checked the results, behavior, and necessity of this feature. However, I have done the minimum necessary checks for the functionality I need. If you find it unsuitable, please feel free to reject it.

Additionally, this is my first OSS contribution, so if there are any issues such as not following your project's conventions, please let me know.

Thank you.