toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final json = <String, dynamic>{};
  json[r'attachments'] = this.attachments;
  if (this.beforeMessageSendFailed != null) {
    json[r'before_message_send_failed'] = this.beforeMessageSendFailed;
  } else {
    json[r'before_message_send_failed'] = null;
  }
  json[r'cid'] = this.cid;
  if (this.command != null) {
    json[r'command'] = this.command;
  } else {
    json[r'command'] = null;
  }
  json[r'created_at'] = this.createdAt.toUtc().toIso8601String();
  json[r'custom'] = this.custom;
  if (this.deletedAt != null) {
    json[r'deleted_at'] = this.deletedAt!.toUtc().toIso8601String();
  } else {
    json[r'deleted_at'] = null;
  }
  json[r'deleted_reply_count'] = this.deletedReplyCount;
  json[r'html'] = this.html;
  json[r'i18n'] = this.i18n;
  json[r'id'] = this.id;
  json[r'image_labels'] = this.imageLabels;
  json[r'latest_reactions'] = this.latestReactions;
  json[r'mentioned_users'] = this.mentionedUsers;
  if (this.messageTextUpdatedAt != null) {
    json[r'message_text_updated_at'] =
        this.messageTextUpdatedAt!.toUtc().toIso8601String();
  } else {
    json[r'message_text_updated_at'] = null;
  }
  if (this.mml != null) {
    json[r'mml'] = this.mml;
  } else {
    json[r'mml'] = null;
  }
  json[r'own_reactions'] = this.ownReactions;
  if (this.parentId != null) {
    json[r'parent_id'] = this.parentId;
  } else {
    json[r'parent_id'] = null;
  }
  if (this.pinExpires != null) {
    json[r'pin_expires'] = this.pinExpires!.toUtc().toIso8601String();
  } else {
    json[r'pin_expires'] = null;
  }
  json[r'pinned'] = this.pinned;
  if (this.pinnedAt != null) {
    json[r'pinned_at'] = this.pinnedAt!.toUtc().toIso8601String();
  } else {
    json[r'pinned_at'] = null;
  }
  if (this.pinnedBy != null) {
    json[r'pinned_by'] = this.pinnedBy;
  } else {
    json[r'pinned_by'] = null;
  }
  if (this.poll != null) {
    json[r'poll'] = this.poll;
  } else {
    json[r'poll'] = null;
  }
  if (this.pollId != null) {
    json[r'poll_id'] = this.pollId;
  } else {
    json[r'poll_id'] = null;
  }
  if (this.quotedMessage != null) {
    json[r'quoted_message'] = this.quotedMessage;
  } else {
    json[r'quoted_message'] = null;
  }
  if (this.quotedMessageId != null) {
    json[r'quoted_message_id'] = this.quotedMessageId;
  } else {
    json[r'quoted_message_id'] = null;
  }
  json[r'reaction_counts'] = this.reactionCounts;
  json[r'reaction_groups'] = this.reactionGroups;
  json[r'reaction_scores'] = this.reactionScores;
  json[r'reply_count'] = this.replyCount;
  json[r'shadowed'] = this.shadowed;
  if (this.showInChannel != null) {
    json[r'show_in_channel'] = this.showInChannel;
  } else {
    json[r'show_in_channel'] = null;
  }
  json[r'silent'] = this.silent;
  json[r'text'] = this.text;
  json[r'thread_participants'] = this.threadParticipants;
  json[r'type'] = this.type;
  json[r'updated_at'] = this.updatedAt.toUtc().toIso8601String();
  if (this.user != null) {
    json[r'user'] = this.user;
  } else {
    json[r'user'] = null;
  }
  return json;
}