def contact_notifications(self, api_result=None): """Returns pending contact notifications.""" results = {} rowset = api_result.result.find("rowset") for row in rowset.findall("row"): a = row.attrib note = { "id": int(a["notificationID"]), "sender": {"id": int(a["senderID"]), "name": a["senderName"]}, "timestamp": api.parse_ts(a["sentDate"]), "data": api.parse_keyval_data(a["messageData"]), } results[note["id"]] = note return api.APIResult(results, api_result.timestamp, api_result.expires)
def notification_texts(self, notification_ids, api_result=None): """Returns the message bodies for notifications.""" result = {} rowset = api_result.result.find('rowset') for row in rowset.findall('row'): notification_id = int(row.attrib['notificationID']) notification = {'id': notification_id} notification.update(api.parse_keyval_data(row.text)) result[notification_id] = notification missing_ids = api_result.result.find('missingIDs') if missing_ids is not None: for missing_id in missing_ids.text.split(","): result[missing_id] = None return api.APIResult(result, api_result.timestamp, api_result.expires)
def contact_notifications(self, api_result=None): """Returns pending contact notifications.""" results = {} rowset = api_result.result.find('rowset') for row in rowset.findall('row'): a = row.attrib note = { 'id': int(a['notificationID']), 'sender': { 'id': int(a['senderID']), 'name': a['senderName'], }, 'timestamp': api.parse_ts(a['sentDate']), 'data': api.parse_keyval_data(a['messageData']), } results[note['id']] = note return api.APIResult(results, api_result.timestamp, api_result.expires)
def notification_texts(self, notification_ids): """Returns the message bodies for notifications.""" api_result = self.api.get('char/NotificationTexts', {'characterID': self.char_id, 'IDs': notification_ids}) result = {} rowset = api_result.find('rowset') for row in rowset.findall('row'): notification_id = int(row.attrib['notificationID']) notification = {'id': notification_id} notification.update(api.parse_keyval_data(row.text)) result[notification_id] = notification missing_ids = api_result.find('missingIDs') if missing_ids is not None: for missing_id in missing_ids.text.split(","): result[missing_id] = None return result
def contact_notifications(self): """Returns pending contact notifications.""" api_result = self.api.get('char/ContactNotifications', {'characterID': self.char_id}) results = {} rowset = api_result.find('rowset') for row in rowset.findall('row'): a = row.attrib note = { 'id': int(a['notificationID']), 'sender': { 'id': int(a['senderID']), 'name': a['senderName'], }, 'timestamp': api.parse_ts(a['sentDate']), 'data': api.parse_keyval_data(a['messageData']), } results[note['id']] = note return results