epicstore_api icon indicating copy to clipboard operation
epicstore_api copied to clipboard

get_offers_data ignores first OfferData Object passed

Open PureFallen opened this issue 9 months ago • 4 comments

The current implementation of get_offers_data seems to ignore the first OfferData Object passed. This leads to the API responding with an error when only passing one argument directly or in a list (Variable x of required type y was not provided) and only returning results starting with the second object when multiple are passed within a list, as shown in the example code in the README.

Here an example with hardcoded values to reproduce the behavior:

from epicstore_api import EpicGamesStoreAPI, OfferData

if __name__ == '__main__':
    api = EpicGamesStoreAPI()

    # Doesn't work
    print(api.get_offers_data(OfferData('fn', '09176f4ff7564bbbb499bbe20bd6348f')))
    print()

    # Doesn't work
    offers = []
    offers.append(OfferData('fn', '09176f4ff7564bbbb499bbe20bd6348f'))
    print(api.get_offers_data(*offers))
    print()

    # Only returns the second offer
    offers = []
    offers.append(OfferData('fn', '09176f4ff7564bbbb499bbe20bd6348f'))
    offers.append(OfferData('bf333e6236914222a95a536389c05813', 'f6fb771bec434d1082cc419b9b4b8bfb'))
    print(api.get_offers_data(*offers))
    print()

    # Only returns starting from the second offer
    offers = []
    offers.append(OfferData('bf333e6236914222a95a536389c05813', 'f6fb771bec434d1082cc419b9b4b8bfb'))
    offers.append(OfferData('fn', '09176f4ff7564bbbb499bbe20bd6348f'))
    offers.append(OfferData('crab', '29dc519a46d341ad9abcd13d86809c8a'))
    print(api.get_offers_data(*offers))

PureFallen avatar May 04 '24 16:05 PureFallen