def cmd_notification_id(client, args): """Returns the data about a specific notification""" notification = client.get_notification(args.notification_id) notification = notification.__dict__ if 'comment' in notification['content']: notification['content'] = format_comment_tree(notification['content']) generate_output({'notification': notification})
def cmd_notification_all(client, args): """Get all notifications for the user that's currently logged in""" notifications_all = client.get_notifications(args.new) notifications_all['messages'] = [message.__dict__ for message in notifications_all['messages']] formatted_replies = [] for reply in notifications_all['replies']: formatted_reply = reply.__dict__ formatted_reply['content'] = format_comment_tree(formatted_reply['content']) formatted_replies.append(formatted_reply) notifications_all['replies'] = formatted_replies generate_output({'notifications_all': notifications_all}, args.output_file)
def cmd_notification_all(client, args): """Get all notifications for the user that's currently logged in""" notifications_all = client.get_notifications(args.new) notifications_all['messages'] = [ message.__dict__ for message in notifications_all['messages'] ] formatted_replies = [] for reply in notifications_all['replies']: formatted_reply = reply.__dict__ formatted_reply['content'] = format_comment_tree( formatted_reply['content']) formatted_replies.append(formatted_reply) notifications_all['replies'] = formatted_replies generate_output({'notifications_all': notifications_all}, args.output_file)
def cmd_gallery_comments(client, args): """Get comments on an item in the gallery""" gallery_comments = client.gallery_item_comments(args.item_id, args.sort) data = format_comment_tree(gallery_comments) generate_output({'gallery_comments': data}, args.output_file)
def cmd_comment_replies(client, args): """Get the comment with all of the replies for the comment""" comment_replies = client.get_comment_replies(args.comment_id) data = format_comment_tree(comment_replies) generate_output({'comment_replies': data}, args.output_file)
def cmd_account_comments(client, args): """Return the comments the user has created""" account_comments = client.get_account_comments(args.username, args.sort, args.page) data = format_comment_tree(account_comments) generate_output({'account_comments': data})