def deleteAll(): response = Connection.notificationRequest("delete-all", {}) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message)
def deleteOne(): try: notificationId = int(input("Notification Id -> ")) except ValueError: Common.printNegativeText("Notification id must be integer") return response = Connection.notificationRequest("delete-one", {"id": notificationId}) successful = response.get("successful") message = response.get("message") if successful: Common.printPositiveText(message) else: Common.printNegativeText(message)
def read(): response = Connection.notificationRequest("read", {}) notifications = response.get("notifications") Common.printNotificationText("Notifications:\n") for notification in notifications: if notification.get("content") is None: continue notificationId = notification.get("id") date = notification.get("date") content = notification.get("content") Common.printNotificationText( f"id -> {notificationId}\ndate -> {date}\ncontent -> {content}\n" )