darrenfoley / Asiago

A Discord bot written in C#
GNU General Public License v3.0
1 stars 0 forks source link

Update IsThereAnyDeal code to use new API #14

Closed darrenfoley closed 1 month ago

darrenfoley commented 3 months ago

IsThereAnyDeal has released a new API, deprecating the old one. The old API also won't be available soon. This issue is to either move to the new API or switch to something else.

darrenfoley commented 2 months ago

Might as well fix bot responses for ITAD stuff to be consistent with the rest while doing this.

darrenfoley commented 1 month ago

New ITAD api docs: https://docs.isthereanydeal.com/

darrenfoley commented 1 month ago

I took a quick look at the CheapShark API, but it doesn't seem like you can request prices for different countries. The new ITAD API docs show improvements over the old API. For example, they actually tell you if return fields are required or may be null. I think we should give it a shot and see if the API behaviour is better (the old API could be quite inconsistent).

I've mapped out the data we need along with the old and new endpoints below.

Data Old API Endpoint New API Endpoint Comments
game id /v02/game/plain /games/lookup/v1
title /v01/game/info /games/info/v2
image url /v01/game/info /games/info/v2 assets contains boxart and various banners
ITAD url /v01/game/info /games/info/v2 urls.game
lowest current price /v01/game/overview /games/overview/v2 prices[?].current.price.amount
lowest current price cut percent /v01/game/overview /games/overview/v2 prices[?].current.cut
lowest current price store /v01/game/overview /games/overview/v2 prices[?].current.shop.name
lowest current price url /v01/game/overview /games/overview/v2 prices[?].current.url
regular price /v01/game/prices or calculated /games/overview/v2 prices[?].current.regular.amount
lowest historical price /v01/game/overview /games/overview/v2 prices[?].lowest.price.amount
lowest historical price cut percent /v01/game/overview /games/overview/v2 prices[?].lowest.cut
lowest historical price store /v01/game/overview /games/overview/v2 prices[?].lowest.shop.name
lowest historical price formatted recorded date /v01/game/overview /games/overview/v2 prices[?].loweset.timestamp - not formatted, have to do it ourselves
steam review text /v01/game/info none? could calculate if we really care
steam review percent positive /v01/game/info /games/info/v2 reviews[?].score
steam review total votes /v01/game/info /games/info/v2 reviews[?].count
autocomplete game titles /v02/search/search/ /games/search/v1 could consider using id as value to avoid needing to call /games/lookup/v1