ChatFullInfo.fromJson constructor

ChatFullInfo.fromJson(
  1. Map<String, dynamic> json
)

Creates a Chat object from json.

Implementation

factory ChatFullInfo.fromJson(Map<String, dynamic> json) {
  return ChatFullInfo(
    id: json['id'] as int,
    type: ChatType.fromJson(json['type'] as String),
    title: json['title'],
    username: json['username'],
    firstName: json['first_name'],
    lastName: json['last_name'],
    isForum: json['is_forum'],
    photo: json['photo'] == null ? null : ChatPhoto.fromJson(json['photo']),
    activeUsernames: (json['active_usernames'] as List<dynamic>?)
        ?.map((e) => e as String)
        .toList(),
    bio: json['bio'],
    hasPrivateForwards: json['has_private_forwards'],
    hasRestrictedVoiceAndVideoMessages:
        json['has_restricted_voice_and_video_messages'],
    joinToSendMessages: json['join_to_send_messages'],
    joinByRequest: json['join_by_request'],
    description: json['description'],
    inviteLink: json['invite_link'],
    pinnedMessage: json['pinned_message'] == null
        ? null
        : Message.fromJson(json['pinned_message']),
    permissions: json['permissions'] == null
        ? null
        : ChatPermissions.fromJson(json['permissions']),
    slowModeDelay: json['slow_mode_delay'],
    messageAutoDeleteTime: json['message_auto_delete_time'],
    hasProtectedContent: json['has_protected_content'],
    stickerSetName: json['sticker_set_name'],
    canSetStickerSet: json['can_set_sticker_set'],
    linkedChatId: json['linked_chat_id'],
    location: json['location'] == null
        ? null
        : ChatLocation.fromJson(json['location']),
    hasHiddenMembers: json['has_hidden_members'],
    hasAggressiveAntiSpamEnabled: json['has_aggressive_anti_spam_enabled'],
    emojiStatusExpirationDate: json['emoji_status_expiration_date'],
    availableReactions: (json['available_reactions'] as List<dynamic>?)
        ?.map((e) => ReactionType.fromJson(e))
        .toList(),
    emojiStatusCustomEmojiId: json['emoji_status_custom_emoji_id'],
    accentColorId: json['accent_color_id'],
    backgroundCustomEmojiId: json['background_custom_emoji_id'],
    profileAccentColorId: json['profile_accent_color_id'],
    profileBackgroundCustomEmojiId:
        json['profile_background_custom_emoji_id'],
    hasVisibleHistory: json['has_visible_history'],
    unrestrictBoostCount: json['unrestrict_boost_count'],
    customEmojiStickerSetName: json['custom_emoji_sticker_set_name'],
    businessIntro: json['business_intro'] == null
        ? null
        : BusinessIntro.fromJson(json['business_intro']),
    businessLocation: json['business_location'] == null
        ? null
        : BusinessLocation.fromJson(json['business_location']),
    businessOpeningHours: json['business_opening_hours'] == null
        ? null
        : BusinessOpeningHours.fromJson(json['business_opening_hours']),
    personalChat: json['personal_chat'] == null
        ? null
        : Chat.fromJson(json['personal_chat']),
    birthdate: json['birthdate'] == null
        ? null
        : Birthdate.fromJson(json['birthdate']),
    maxReactionCount: json["max_reaction_count"],
    canSendPaidMedia: json["can_send_paid_media"],
  );
}