Add codegen files

This commit is contained in:
krawieck 2020-08-10 19:23:21 +02:00
parent 29dd4dcc35
commit 5902cd8f6f
7 changed files with 225 additions and 0 deletions

View File

@ -0,0 +1,15 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'captcha.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Captcha _$CaptchaFromJson(Map<String, dynamic> json) {
return Captcha(
png: json['png'] as String,
wav: json['wav'] as String,
uuid: json['uuid'] as String,
);
}

View File

@ -0,0 +1,14 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'category.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Category _$CategoryFromJson(Map<String, dynamic> json) {
return Category(
id: json['id'] as int,
name: json['name'] as String,
);
}

View File

@ -44,3 +44,45 @@ CommunityView _$CommunityViewFromJson(Map<String, dynamic> json) {
subscribed: json['subscribed'] as bool,
);
}
CommunityFollowerView _$CommunityFollowerViewFromJson(
Map<String, dynamic> json) {
return CommunityFollowerView(
id: json['id'] as int,
communityId: json['community_id'] as int,
userId: json['user_id'] as int,
published: json['published'] == null
? null
: DateTime.parse(json['published'] as String),
userActorId: json['user_actor_id'] as String,
userLocal: json['user_local'] as bool,
userName: json['user_name'] as String,
userPreferredUsername: json['user_preferred_username'] as String,
avatar: json['avatar'] as String,
communityActorId: json['community_actor_id'] as String,
communityLocal: json['community_local'] as bool,
communityName: json['community_name'] as String,
communityIcon: json['community_icon'] as String,
);
}
CommunityModeratorView _$CommunityModeratorViewFromJson(
Map<String, dynamic> json) {
return CommunityModeratorView(
id: json['id'] as int,
communityId: json['community_id'] as int,
userId: json['user_id'] as int,
published: json['published'] == null
? null
: DateTime.parse(json['published'] as String),
userActorId: json['user_actor_id'] as String,
userLocal: json['user_local'] as bool,
userName: json['user_name'] as String,
userPreferredUsername: json['user_preferred_username'] as String,
avatar: json['avatar'] as String,
communityActorId: json['community_actor_id'] as String,
communityLocal: json['community_local'] as bool,
communityName: json['community_name'] as String,
communityIcon: json['community_icon'] as String,
);
}

View File

@ -64,3 +64,23 @@ PostView _$PostViewFromJson(Map<String, dynamic> json) {
saved: json['saved'] as bool,
);
}
FullPost _$FullPostFromJson(Map<String, dynamic> json) {
return FullPost(
post: json['post'] == null
? null
: PostView.fromJson(json['post'] as Map<String, dynamic>),
comments: (json['comments'] as List)
?.map((e) =>
e == null ? null : CommentView.fromJson(e as Map<String, dynamic>))
?.toList(),
community: json['community'] == null
? null
: CommunityView.fromJson(json['community'] as Map<String, dynamic>),
moderators: (json['moderators'] as List)
?.map((e) => e == null
? null
: CommunityModeratorView.fromJson(e as Map<String, dynamic>))
?.toList(),
);
}

View File

@ -0,0 +1,30 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'search.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Search _$SearchFromJson(Map<String, dynamic> json) {
return Search(
type_: json['type_'] as String,
comments: (json['comments'] as List)
?.map((e) =>
e == null ? null : CommentView.fromJson(e as Map<String, dynamic>))
?.toList(),
posts: (json['posts'] as List)
?.map((e) =>
e == null ? null : PostView.fromJson(e as Map<String, dynamic>))
?.toList(),
communities: (json['communities'] as List)
?.map((e) => e == null
? null
: CommunityView.fromJson(e as Map<String, dynamic>))
?.toList(),
users: (json['users'] as List)
?.map((e) =>
e == null ? null : UserView.fromJson(e as Map<String, dynamic>))
?.toList(),
);
}

View File

@ -0,0 +1,34 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'site.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
SiteView _$SiteViewFromJson(Map<String, dynamic> json) {
return SiteView(
id: json['id'] as int,
name: json['name'] as String,
description: json['description'] as String,
creatorId: json['creator_id'] as int,
published: json['published'] == null
? null
: DateTime.parse(json['published'] as String),
updated: json['updated'] == null
? null
: DateTime.parse(json['updated'] as String),
enableDownvotes: json['enable_downvotes'] as bool,
openRegistration: json['open_registration'] as bool,
enableNsfw: json['enable_nsfw'] as bool,
icon: json['icon'] as String,
banner: json['banner'] as String,
creatorName: json['creator_name'] as String,
creatorPreferredUsername: json['creator_preferred_username'] as String,
creatorAvatar: json['creator_avatar'] as String,
numberOfUsers: json['number_of_users'] as int,
numberOfPosts: json['number_of_posts'] as int,
numberOfComments: json['number_of_comments'] as int,
numberOfCommunities: json['number_of_communities'] as int,
);
}

View File

@ -31,3 +31,73 @@ UserView _$UserViewFromJson(Map<String, dynamic> json) {
commentScore: json['comment_score'] as int,
);
}
UserMentionView _$UserMentionViewFromJson(Map<String, dynamic> json) {
return UserMentionView(
id: json['id'] as int,
userMentionId: json['user_mention_id'] as int,
creatorId: json['creator_id'] as int,
creatorActorId: json['creator_actor_id'] as String,
creatorLocal: json['creator_local'] as bool,
postId: json['post_id'] as int,
postName: json['post_name'] as String,
parentId: json['parent_id'] as int,
content: json['content'] as String,
removed: json['removed'] as bool,
read: json['read'] as bool,
published: json['published'] == null
? null
: DateTime.parse(json['published'] as String),
updated: json['updated'] == null
? null
: DateTime.parse(json['updated'] as String),
deleted: json['deleted'] as bool,
communityId: json['community_id'] as int,
communityActorId: json['community_actor_id'] as String,
communityLocal: json['community_local'] as bool,
communityName: json['community_name'] as String,
communityIcon: json['community_icon'] as String,
banned: json['banned'] as bool,
bannedFromCommunity: json['banned_from_community'] as bool,
creatorName: json['creator_name'] as String,
creatorPreferredUsername: json['creator_preferred_username'] as String,
creatorAvatar: json['creator_avatar'] as String,
score: json['score'] as int,
upvotes: json['upvotes'] as int,
downvotes: json['downvotes'] as int,
hotRank: json['hot_rank'] as int,
hotRankActive: json['hot_rank_active'] as int,
userId: json['user_id'] as int,
myVote: json['my_vote'] as int,
saved: json['saved'] as bool,
recipientId: json['recipient_id'] as int,
recipientActorId: json['recipient_actor_id'] as String,
recipientLocal: json['recipient_local'] as bool,
);
}
UserDetails _$UserDetailsFromJson(Map<String, dynamic> json) {
return UserDetails(
user: json['user'] == null
? null
: UserView.fromJson(json['user'] as Map<String, dynamic>),
follows: (json['follows'] as List)
?.map((e) => e == null
? null
: CommunityFollowerView.fromJson(e as Map<String, dynamic>))
?.toList(),
moderates: (json['moderates'] as List)
?.map((e) => e == null
? null
: CommunityModeratorView.fromJson(e as Map<String, dynamic>))
?.toList(),
comments: (json['comments'] as List)
?.map((e) =>
e == null ? null : CommentView.fromJson(e as Map<String, dynamic>))
?.toList(),
posts: (json['posts'] as List)
?.map((e) =>
e == null ? null : PostView.fromJson(e as Map<String, dynamic>))
?.toList(),
);
}