Surface/lib/types/post.g.dart

190 lines
7.5 KiB
Dart
Raw Normal View History

2024-11-08 16:09:46 +00:00
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'post.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$SnPostImpl _$$SnPostImplFromJson(Map<String, dynamic> json) => _$SnPostImpl(
id: (json['id'] as num).toInt(),
2024-11-08 16:46:32 +00:00
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
deletedAt: json['deleted_at'] == null
2024-11-08 16:09:46 +00:00
? null
2024-11-08 16:46:32 +00:00
: DateTime.parse(json['deleted_at'] as String),
2024-11-08 16:09:46 +00:00
type: json['type'] as String,
2024-11-09 04:04:03 +00:00
body: json['body'] as Map<String, dynamic>,
2024-11-08 16:09:46 +00:00
language: json['language'] as String,
alias: json['alias'] as String?,
2024-11-08 16:46:32 +00:00
aliasPrefix: json['alias_prefix'] as String?,
2024-11-08 16:09:46 +00:00
tags: json['tags'] as List<dynamic>,
categories: json['categories'] as List<dynamic>,
2024-11-13 14:05:40 +00:00
replies: (json['replies'] as List<dynamic>?)
?.map((e) => SnPost.fromJson(e as Map<String, dynamic>))
.toList(),
replyId: (json['reply_id'] as num?)?.toInt(),
repostId: (json['repost_id'] as num?)?.toInt(),
replyTo: json['reply_to'] == null
? null
: SnPost.fromJson(json['reply_to'] as Map<String, dynamic>),
repostTo: json['repost_to'] == null
? null
: SnPost.fromJson(json['repost_to'] as Map<String, dynamic>),
visibleUsersList: (json['visible_users_list'] as List<dynamic>?)
?.map((e) => (e as num).toInt())
.toList(),
invisibleUsersList: (json['invisible_users_list'] as List<dynamic>?)
?.map((e) => (e as num).toInt())
.toList(),
2024-11-08 16:09:46 +00:00
visibility: (json['visibility'] as num).toInt(),
2024-11-08 16:46:32 +00:00
editedAt: json['edited_at'] == null
2024-11-08 16:09:46 +00:00
? null
2024-11-08 16:46:32 +00:00
: DateTime.parse(json['edited_at'] as String),
pinnedAt: json['pinned_at'] == null
2024-11-08 16:09:46 +00:00
? null
2024-11-08 16:46:32 +00:00
: DateTime.parse(json['pinned_at'] as String),
lockedAt: json['locked_at'] == null
2024-11-08 16:09:46 +00:00
? null
2024-11-08 16:46:32 +00:00
: DateTime.parse(json['locked_at'] as String),
isDraft: json['is_draft'] as bool,
publishedAt: json['published_at'] == null
? null
: DateTime.parse(json['published_at'] as String),
publishedUntil: json['published_until'] == null
? null
: DateTime.parse(json['published_until'] as String),
2024-11-08 16:46:32 +00:00
totalUpvote: (json['total_upvote'] as num).toInt(),
totalDownvote: (json['total_downvote'] as num).toInt(),
publisherId: (json['publisher_id'] as num).toInt(),
2024-11-08 16:09:46 +00:00
publisher:
SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
metric: SnMetric.fromJson(json['metric'] as Map<String, dynamic>),
2024-11-09 04:04:03 +00:00
preload: json['preload'] == null
? null
: SnPostPreload.fromJson(json['preload'] as Map<String, dynamic>),
2024-11-08 16:09:46 +00:00
);
Map<String, dynamic> _$$SnPostImplToJson(_$SnPostImpl instance) =>
<String, dynamic>{
'id': instance.id,
2024-11-08 16:46:32 +00:00
'created_at': instance.createdAt.toIso8601String(),
'updated_at': instance.updatedAt.toIso8601String(),
'deleted_at': instance.deletedAt?.toIso8601String(),
2024-11-08 16:09:46 +00:00
'type': instance.type,
'body': instance.body,
'language': instance.language,
'alias': instance.alias,
2024-11-08 16:46:32 +00:00
'alias_prefix': instance.aliasPrefix,
2024-11-08 16:09:46 +00:00
'tags': instance.tags,
'categories': instance.categories,
2024-11-13 14:05:40 +00:00
'replies': instance.replies?.map((e) => e.toJson()).toList(),
2024-11-08 16:46:32 +00:00
'reply_id': instance.replyId,
'repost_id': instance.repostId,
2024-11-13 14:05:40 +00:00
'reply_to': instance.replyTo?.toJson(),
'repost_to': instance.repostTo?.toJson(),
2024-11-08 16:46:32 +00:00
'visible_users_list': instance.visibleUsersList,
'invisible_users_list': instance.invisibleUsersList,
2024-11-08 16:09:46 +00:00
'visibility': instance.visibility,
2024-11-08 16:46:32 +00:00
'edited_at': instance.editedAt?.toIso8601String(),
'pinned_at': instance.pinnedAt?.toIso8601String(),
'locked_at': instance.lockedAt?.toIso8601String(),
'is_draft': instance.isDraft,
'published_at': instance.publishedAt?.toIso8601String(),
'published_until': instance.publishedUntil?.toIso8601String(),
2024-11-08 16:46:32 +00:00
'total_upvote': instance.totalUpvote,
'total_downvote': instance.totalDownvote,
'publisher_id': instance.publisherId,
'publisher': instance.publisher.toJson(),
'metric': instance.metric.toJson(),
2024-11-09 04:04:03 +00:00
'preload': instance.preload?.toJson(),
};
_$SnPostPreloadImpl _$$SnPostPreloadImplFromJson(Map<String, dynamic> json) =>
_$SnPostPreloadImpl(
attachments: (json['attachments'] as List<dynamic>?)
2024-11-17 16:55:39 +00:00
?.map((e) => e == null
? null
: SnAttachment.fromJson(e as Map<String, dynamic>))
2024-11-09 04:04:03 +00:00
.toList(),
);
Map<String, dynamic> _$$SnPostPreloadImplToJson(_$SnPostPreloadImpl instance) =>
<String, dynamic>{
2024-11-17 16:55:39 +00:00
'attachments': instance.attachments?.map((e) => e?.toJson()).toList(),
2024-11-08 16:09:46 +00:00
};
_$SnBodyImpl _$$SnBodyImplFromJson(Map<String, dynamic> json) => _$SnBodyImpl(
attachments: (json['attachments'] as List<dynamic>)
.map((e) => e as String)
.toList(),
content: json['content'] as String,
location: json['location'],
thumbnail: json['thumbnail'],
title: json['title'],
);
Map<String, dynamic> _$$SnBodyImplToJson(_$SnBodyImpl instance) =>
<String, dynamic>{
'attachments': instance.attachments,
'content': instance.content,
'location': instance.location,
'thumbnail': instance.thumbnail,
'title': instance.title,
};
_$SnMetricImpl _$$SnMetricImplFromJson(Map<String, dynamic> json) =>
_$SnMetricImpl(
2024-11-08 16:46:32 +00:00
replyCount: (json['reply_count'] as num).toInt(),
reactionCount: (json['reaction_count'] as num).toInt(),
2024-11-12 12:47:40 +00:00
reactionList: (json['reaction_list'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, (e as num).toInt()),
) ??
const {},
2024-11-08 16:09:46 +00:00
);
Map<String, dynamic> _$$SnMetricImplToJson(_$SnMetricImpl instance) =>
<String, dynamic>{
2024-11-08 16:46:32 +00:00
'reply_count': instance.replyCount,
'reaction_count': instance.reactionCount,
2024-11-12 12:47:40 +00:00
'reaction_list': instance.reactionList,
2024-11-08 16:09:46 +00:00
};
_$SnPublisherImpl _$$SnPublisherImplFromJson(Map<String, dynamic> json) =>
_$SnPublisherImpl(
id: (json['id'] as num).toInt(),
2024-11-08 16:46:32 +00:00
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
deletedAt: json['deleted_at'] == null
2024-11-08 16:09:46 +00:00
? null
2024-11-08 16:46:32 +00:00
: DateTime.parse(json['deleted_at'] as String),
2024-11-08 16:09:46 +00:00
type: (json['type'] as num).toInt(),
name: json['name'] as String,
nick: json['nick'] as String,
description: json['description'] as String,
avatar: json['avatar'] as String,
banner: json['banner'] as String,
2024-11-08 16:46:32 +00:00
totalUpvote: (json['total_upvote'] as num).toInt(),
totalDownvote: (json['total_downvote'] as num).toInt(),
realmId: (json['realm_id'] as num?)?.toInt(),
accountId: (json['account_id'] as num).toInt(),
2024-11-08 16:09:46 +00:00
);
Map<String, dynamic> _$$SnPublisherImplToJson(_$SnPublisherImpl instance) =>
<String, dynamic>{
'id': instance.id,
2024-11-08 16:46:32 +00:00
'created_at': instance.createdAt.toIso8601String(),
'updated_at': instance.updatedAt.toIso8601String(),
'deleted_at': instance.deletedAt?.toIso8601String(),
2024-11-08 16:09:46 +00:00
'type': instance.type,
'name': instance.name,
'nick': instance.nick,
'description': instance.description,
'avatar': instance.avatar,
'banner': instance.banner,
2024-11-08 16:46:32 +00:00
'total_upvote': instance.totalUpvote,
'total_downvote': instance.totalDownvote,
'realm_id': instance.realmId,
'account_id': instance.accountId,
2024-11-08 16:09:46 +00:00
};