def getList(self) -> str: uuid = self.skillInstance.getConfig('uuid') uuidList = self.skillInstance.getConfig('listUuid') bringList = BringApi(uuid, uuidList) translation = BringApi.loadTranslations( self.LanguageManager.activeLanguageAndCountryCode) items = bringList.get_items()['purchase'] details = bringList.get_items_detail() itemList = [{ "text": self.translate(item['name'], translation), "image": self.get_image(details, item['name']) } for item in items] return json.dumps(itemList)
def getList(self) -> dict: try: bringList = self.skillInstance.bring() translation = BringApi.loadTranslations( self.LanguageManager.activeLanguageAndCountryCode) items = bringList.get_items()['purchase'] details = bringList.get_items_detail() itemList = [{ "text": self.translate(item['name'], translation), "image": self.get_image(details, item['name']) } for item in items] return {'success': True, 'items': itemList} except Exception as e: return {'success': False, 'message': str(e)}