From 34bb850ab4155388fe3e3fc3dab8f8138780a721 Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Tue, 9 Apr 2024 19:51:41 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AE=E3=83=A3=E3=83=A9=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E9=96=A2=E9=80=A3=E3=81=AE=E3=82=A8=E3=83=B3=E3=83=89=E3=83=9D?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=83=88=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/misskey_dart.dart | 13 + lib/src/data/base/gallery_post.dart | 27 ++ lib/src/data/base/gallery_post.freezed.dart | 454 ++++++++++++++++++ lib/src/data/base/gallery_post.g.dart | 44 ++ .../gallery/gallery_featured_request.dart | 15 + .../gallery_featured_request.freezed.dart | 174 +++++++ .../gallery/gallery_featured_request.g.dart | 21 + .../data/gallery/gallery_posts_request.dart | 16 + .../gallery_posts_request.freezed.dart | 187 ++++++++ .../data/gallery/gallery_posts_request.g.dart | 23 + .../posts/gallery_posts_create_request.dart | 17 + .../gallery_posts_create_request.freezed.dart | 231 +++++++++ .../posts/gallery_posts_create_request.g.dart | 26 + .../posts/gallery_posts_delete_request.dart | 14 + .../gallery_posts_delete_request.freezed.dart | 158 ++++++ .../posts/gallery_posts_delete_request.g.dart | 19 + .../posts/gallery_posts_like_request.dart | 14 + .../gallery_posts_like_request.freezed.dart | 158 ++++++ .../posts/gallery_posts_like_request.g.dart | 19 + .../posts/gallery_posts_show_request.dart | 14 + .../gallery_posts_show_request.freezed.dart | 158 ++++++ .../posts/gallery_posts_show_request.g.dart | 19 + .../posts/gallery_posts_unlike_request.dart | 14 + .../gallery_posts_unlike_request.freezed.dart | 158 ++++++ .../posts/gallery_posts_unlike_request.g.dart | 19 + .../posts/gallery_posts_update_request.dart | 18 + .../gallery_posts_update_request.freezed.dart | 251 ++++++++++ .../posts/gallery_posts_update_request.g.dart | 28 ++ .../i/gallery/i_gallery_likes_request.dart | 16 + .../i_gallery_likes_request.freezed.dart | 189 ++++++++ .../i/gallery/i_gallery_likes_request.g.dart | 23 + .../i/gallery/i_gallery_likes_response.dart | 16 + .../i_gallery_likes_response.freezed.dart | 187 ++++++++ .../i/gallery/i_gallery_likes_response.g.dart | 21 + .../i/gallery/i_gallery_posts_request.dart | 16 + .../i_gallery_posts_request.freezed.dart | 189 ++++++++ .../i/gallery/i_gallery_posts_request.g.dart | 23 + lib/src/misskey_dart_base.dart | 2 + lib/src/misskey_gallery.dart | 83 ++++ lib/src/misskey_i.dart | 24 + test/misskey_gallery_test.dart | 138 ++++++ test/misskey_i_test.dart | 28 ++ 42 files changed, 3264 insertions(+) create mode 100644 lib/src/data/base/gallery_post.dart create mode 100644 lib/src/data/base/gallery_post.freezed.dart create mode 100644 lib/src/data/base/gallery_post.g.dart create mode 100644 lib/src/data/gallery/gallery_featured_request.dart create mode 100644 lib/src/data/gallery/gallery_featured_request.freezed.dart create mode 100644 lib/src/data/gallery/gallery_featured_request.g.dart create mode 100644 lib/src/data/gallery/gallery_posts_request.dart create mode 100644 lib/src/data/gallery/gallery_posts_request.freezed.dart create mode 100644 lib/src/data/gallery/gallery_posts_request.g.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_create_request.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_create_request.freezed.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_create_request.g.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_delete_request.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_delete_request.freezed.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_delete_request.g.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_like_request.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_like_request.freezed.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_like_request.g.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_show_request.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_show_request.freezed.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_show_request.g.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_unlike_request.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_unlike_request.freezed.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_unlike_request.g.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_update_request.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_update_request.freezed.dart create mode 100644 lib/src/data/gallery/posts/gallery_posts_update_request.g.dart create mode 100644 lib/src/data/i/gallery/i_gallery_likes_request.dart create mode 100644 lib/src/data/i/gallery/i_gallery_likes_request.freezed.dart create mode 100644 lib/src/data/i/gallery/i_gallery_likes_request.g.dart create mode 100644 lib/src/data/i/gallery/i_gallery_likes_response.dart create mode 100644 lib/src/data/i/gallery/i_gallery_likes_response.freezed.dart create mode 100644 lib/src/data/i/gallery/i_gallery_likes_response.g.dart create mode 100644 lib/src/data/i/gallery/i_gallery_posts_request.dart create mode 100644 lib/src/data/i/gallery/i_gallery_posts_request.freezed.dart create mode 100644 lib/src/data/i/gallery/i_gallery_posts_request.g.dart create mode 100644 lib/src/misskey_gallery.dart create mode 100644 test/misskey_gallery_test.dart diff --git a/lib/misskey_dart.dart b/lib/misskey_dart.dart index a286fa42..7d32a8a8 100644 --- a/lib/misskey_dart.dart +++ b/lib/misskey_dart.dart @@ -29,6 +29,7 @@ export 'src/data/antennas/antennas_update_request.dart'; export 'src/data/ap/ap_show_request.dart'; export 'src/data/ap/ap_show_response.dart'; export 'src/data/base/blocking.dart'; +export 'src/data/base/gallery_post.dart'; export 'src/data/base/muting.dart'; export 'src/data/base/note.dart'; export 'src/data/base/renote_muting.dart'; @@ -113,12 +114,23 @@ export 'src/data/flash/flash_my_request.dart'; export 'src/data/flash/flash_show_request.dart'; export 'src/data/flash/flash_unlike_request.dart'; export 'src/data/flash/flash_update_request.dart'; +export 'src/data/gallery/gallery_featured_request.dart'; +export 'src/data/gallery/gallery_posts_request.dart'; +export 'src/data/gallery/posts/gallery_posts_create_request.dart'; +export 'src/data/gallery/posts/gallery_posts_delete_request.dart'; +export 'src/data/gallery/posts/gallery_posts_like_request.dart'; +export 'src/data/gallery/posts/gallery_posts_show_request.dart'; +export 'src/data/gallery/posts/gallery_posts_unlike_request.dart'; +export 'src/data/gallery/posts/gallery_posts_update_request.dart'; export 'src/data/i/i_notifications_request.dart'; export 'src/data/i/i_notifications_response.dart'; export 'src/data/i/i_favorites_request.dart'; export 'src/data/i/i_favorites_response.dart'; export 'src/data/i/i_update_request.dart'; export 'src/data/i/i_read_announcement_request.dart'; +export 'src/data/i/gallery/i_gallery_likes_request.dart'; +export 'src/data/i/gallery/i_gallery_likes_response.dart'; +export 'src/data/i/gallery/i_gallery_posts_request.dart'; export 'src/data/i/registry/i_registry_get_all_request.dart'; export 'src/data/i/registry/i_registry_get_detail_request.dart'; export 'src/data/i/registry/i_registry_get_detail_response.dart'; @@ -241,6 +253,7 @@ export 'src/misskey_clips.dart'; export 'src/misskey_drive.dart'; export 'src/misskey_federation.dart'; export 'src/misskey_following.dart'; +export 'src/misskey_gallery.dart'; export 'src/misskey_hashtags.dart'; export 'src/misskey_i.dart'; export 'src/misskey_mute.dart'; diff --git a/lib/src/data/base/gallery_post.dart b/lib/src/data/base/gallery_post.dart new file mode 100644 index 00000000..06b1d741 --- /dev/null +++ b/lib/src/data/base/gallery_post.dart @@ -0,0 +1,27 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:misskey_dart/misskey_dart.dart'; + +part 'gallery_post.freezed.dart'; +part 'gallery_post.g.dart'; + +@freezed +class GalleryPost with _$GalleryPost { + const factory GalleryPost({ + required String id, + required DateTime createdAt, + required DateTime updatedAt, + required String userId, + required UserLite user, + required String title, + String? description, + List? fileIds, + List? files, + List? tags, + required bool isSensitive, + required int likedCount, + bool? isLiked, + }) = _GalleryPost; + + factory GalleryPost.fromJson(Map json) => + _$GalleryPostFromJson(json); +} diff --git a/lib/src/data/base/gallery_post.freezed.dart b/lib/src/data/base/gallery_post.freezed.dart new file mode 100644 index 00000000..39b34eb5 --- /dev/null +++ b/lib/src/data/base/gallery_post.freezed.dart @@ -0,0 +1,454 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'gallery_post.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GalleryPost _$GalleryPostFromJson(Map json) { + return _GalleryPost.fromJson(json); +} + +/// @nodoc +mixin _$GalleryPost { + String get id => throw _privateConstructorUsedError; + DateTime get createdAt => throw _privateConstructorUsedError; + DateTime get updatedAt => throw _privateConstructorUsedError; + String get userId => throw _privateConstructorUsedError; + UserLite get user => throw _privateConstructorUsedError; + String get title => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + List? get fileIds => throw _privateConstructorUsedError; + List? get files => throw _privateConstructorUsedError; + List? get tags => throw _privateConstructorUsedError; + bool get isSensitive => throw _privateConstructorUsedError; + int get likedCount => throw _privateConstructorUsedError; + bool? get isLiked => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $GalleryPostCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GalleryPostCopyWith<$Res> { + factory $GalleryPostCopyWith( + GalleryPost value, $Res Function(GalleryPost) then) = + _$GalleryPostCopyWithImpl<$Res, GalleryPost>; + @useResult + $Res call( + {String id, + DateTime createdAt, + DateTime updatedAt, + String userId, + UserLite user, + String title, + String? description, + List? fileIds, + List? files, + List? tags, + bool isSensitive, + int likedCount, + bool? isLiked}); + + $UserLiteCopyWith<$Res> get user; +} + +/// @nodoc +class _$GalleryPostCopyWithImpl<$Res, $Val extends GalleryPost> + implements $GalleryPostCopyWith<$Res> { + _$GalleryPostCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? createdAt = null, + Object? updatedAt = null, + Object? userId = null, + Object? user = null, + Object? title = null, + Object? description = freezed, + Object? fileIds = freezed, + Object? files = freezed, + Object? tags = freezed, + Object? isSensitive = null, + Object? likedCount = null, + Object? isLiked = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _value.user + : user // ignore: cast_nullable_to_non_nullable + as UserLite, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + fileIds: freezed == fileIds + ? _value.fileIds + : fileIds // ignore: cast_nullable_to_non_nullable + as List?, + files: freezed == files + ? _value.files + : files // ignore: cast_nullable_to_non_nullable + as List?, + tags: freezed == tags + ? _value.tags + : tags // ignore: cast_nullable_to_non_nullable + as List?, + isSensitive: null == isSensitive + ? _value.isSensitive + : isSensitive // ignore: cast_nullable_to_non_nullable + as bool, + likedCount: null == likedCount + ? _value.likedCount + : likedCount // ignore: cast_nullable_to_non_nullable + as int, + isLiked: freezed == isLiked + ? _value.isLiked + : isLiked // ignore: cast_nullable_to_non_nullable + as bool?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $UserLiteCopyWith<$Res> get user { + return $UserLiteCopyWith<$Res>(_value.user, (value) { + return _then(_value.copyWith(user: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$GalleryPostImplCopyWith<$Res> + implements $GalleryPostCopyWith<$Res> { + factory _$$GalleryPostImplCopyWith( + _$GalleryPostImpl value, $Res Function(_$GalleryPostImpl) then) = + __$$GalleryPostImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + DateTime createdAt, + DateTime updatedAt, + String userId, + UserLite user, + String title, + String? description, + List? fileIds, + List? files, + List? tags, + bool isSensitive, + int likedCount, + bool? isLiked}); + + @override + $UserLiteCopyWith<$Res> get user; +} + +/// @nodoc +class __$$GalleryPostImplCopyWithImpl<$Res> + extends _$GalleryPostCopyWithImpl<$Res, _$GalleryPostImpl> + implements _$$GalleryPostImplCopyWith<$Res> { + __$$GalleryPostImplCopyWithImpl( + _$GalleryPostImpl _value, $Res Function(_$GalleryPostImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? createdAt = null, + Object? updatedAt = null, + Object? userId = null, + Object? user = null, + Object? title = null, + Object? description = freezed, + Object? fileIds = freezed, + Object? files = freezed, + Object? tags = freezed, + Object? isSensitive = null, + Object? likedCount = null, + Object? isLiked = freezed, + }) { + return _then(_$GalleryPostImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as DateTime, + updatedAt: null == updatedAt + ? _value.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as DateTime, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + user: null == user + ? _value.user + : user // ignore: cast_nullable_to_non_nullable + as UserLite, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + fileIds: freezed == fileIds + ? _value._fileIds + : fileIds // ignore: cast_nullable_to_non_nullable + as List?, + files: freezed == files + ? _value._files + : files // ignore: cast_nullable_to_non_nullable + as List?, + tags: freezed == tags + ? _value._tags + : tags // ignore: cast_nullable_to_non_nullable + as List?, + isSensitive: null == isSensitive + ? _value.isSensitive + : isSensitive // ignore: cast_nullable_to_non_nullable + as bool, + likedCount: null == likedCount + ? _value.likedCount + : likedCount // ignore: cast_nullable_to_non_nullable + as int, + isLiked: freezed == isLiked + ? _value.isLiked + : isLiked // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GalleryPostImpl implements _GalleryPost { + const _$GalleryPostImpl( + {required this.id, + required this.createdAt, + required this.updatedAt, + required this.userId, + required this.user, + required this.title, + this.description, + final List? fileIds, + final List? files, + final List? tags, + required this.isSensitive, + required this.likedCount, + this.isLiked}) + : _fileIds = fileIds, + _files = files, + _tags = tags; + + factory _$GalleryPostImpl.fromJson(Map json) => + _$$GalleryPostImplFromJson(json); + + @override + final String id; + @override + final DateTime createdAt; + @override + final DateTime updatedAt; + @override + final String userId; + @override + final UserLite user; + @override + final String title; + @override + final String? description; + final List? _fileIds; + @override + List? get fileIds { + final value = _fileIds; + if (value == null) return null; + if (_fileIds is EqualUnmodifiableListView) return _fileIds; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + final List? _files; + @override + List? get files { + final value = _files; + if (value == null) return null; + if (_files is EqualUnmodifiableListView) return _files; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + final List? _tags; + @override + List? get tags { + final value = _tags; + if (value == null) return null; + if (_tags is EqualUnmodifiableListView) return _tags; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + final bool isSensitive; + @override + final int likedCount; + @override + final bool? isLiked; + + @override + String toString() { + return 'GalleryPost(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, userId: $userId, user: $user, title: $title, description: $description, fileIds: $fileIds, files: $files, tags: $tags, isSensitive: $isSensitive, likedCount: $likedCount, isLiked: $isLiked)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GalleryPostImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt) && + (identical(other.userId, userId) || other.userId == userId) && + (identical(other.user, user) || other.user == user) && + (identical(other.title, title) || other.title == title) && + (identical(other.description, description) || + other.description == description) && + const DeepCollectionEquality().equals(other._fileIds, _fileIds) && + const DeepCollectionEquality().equals(other._files, _files) && + const DeepCollectionEquality().equals(other._tags, _tags) && + (identical(other.isSensitive, isSensitive) || + other.isSensitive == isSensitive) && + (identical(other.likedCount, likedCount) || + other.likedCount == likedCount) && + (identical(other.isLiked, isLiked) || other.isLiked == isLiked)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + id, + createdAt, + updatedAt, + userId, + user, + title, + description, + const DeepCollectionEquality().hash(_fileIds), + const DeepCollectionEquality().hash(_files), + const DeepCollectionEquality().hash(_tags), + isSensitive, + likedCount, + isLiked); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GalleryPostImplCopyWith<_$GalleryPostImpl> get copyWith => + __$$GalleryPostImplCopyWithImpl<_$GalleryPostImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GalleryPostImplToJson( + this, + ); + } +} + +abstract class _GalleryPost implements GalleryPost { + const factory _GalleryPost( + {required final String id, + required final DateTime createdAt, + required final DateTime updatedAt, + required final String userId, + required final UserLite user, + required final String title, + final String? description, + final List? fileIds, + final List? files, + final List? tags, + required final bool isSensitive, + required final int likedCount, + final bool? isLiked}) = _$GalleryPostImpl; + + factory _GalleryPost.fromJson(Map json) = + _$GalleryPostImpl.fromJson; + + @override + String get id; + @override + DateTime get createdAt; + @override + DateTime get updatedAt; + @override + String get userId; + @override + UserLite get user; + @override + String get title; + @override + String? get description; + @override + List? get fileIds; + @override + List? get files; + @override + List? get tags; + @override + bool get isSensitive; + @override + int get likedCount; + @override + bool? get isLiked; + @override + @JsonKey(ignore: true) + _$$GalleryPostImplCopyWith<_$GalleryPostImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/data/base/gallery_post.g.dart b/lib/src/data/base/gallery_post.g.dart new file mode 100644 index 00000000..05d4c652 --- /dev/null +++ b/lib/src/data/base/gallery_post.g.dart @@ -0,0 +1,44 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'gallery_post.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GalleryPostImpl _$$GalleryPostImplFromJson(Map json) => + _$GalleryPostImpl( + id: json['id'] as String, + createdAt: DateTime.parse(json['createdAt'] as String), + updatedAt: DateTime.parse(json['updatedAt'] as String), + userId: json['userId'] as String, + user: UserLite.fromJson(json['user'] as Map), + title: json['title'] as String, + description: json['description'] as String?, + fileIds: + (json['fileIds'] as List?)?.map((e) => e as String).toList(), + files: (json['files'] as List?) + ?.map((e) => DriveFile.fromJson(e as Map)) + .toList(), + tags: (json['tags'] as List?)?.map((e) => e as String).toList(), + isSensitive: json['isSensitive'] as bool, + likedCount: json['likedCount'] as int, + isLiked: json['isLiked'] as bool?, + ); + +Map _$$GalleryPostImplToJson(_$GalleryPostImpl instance) => + { + 'id': instance.id, + 'createdAt': instance.createdAt.toIso8601String(), + 'updatedAt': instance.updatedAt.toIso8601String(), + 'userId': instance.userId, + 'user': instance.user.toJson(), + 'title': instance.title, + 'description': instance.description, + 'fileIds': instance.fileIds, + 'files': instance.files?.map((e) => e.toJson()).toList(), + 'tags': instance.tags, + 'isSensitive': instance.isSensitive, + 'likedCount': instance.likedCount, + 'isLiked': instance.isLiked, + }; diff --git a/lib/src/data/gallery/gallery_featured_request.dart b/lib/src/data/gallery/gallery_featured_request.dart new file mode 100644 index 00000000..c78cc336 --- /dev/null +++ b/lib/src/data/gallery/gallery_featured_request.dart @@ -0,0 +1,15 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'gallery_featured_request.freezed.dart'; +part 'gallery_featured_request.g.dart'; + +@freezed +class GalleryFeaturedRequest with _$GalleryFeaturedRequest { + const factory GalleryFeaturedRequest({ + int? limit, + String? untilId, + }) = _GalleryFeaturedRequest; + + factory GalleryFeaturedRequest.fromJson(Map json) => + _$GalleryFeaturedRequestFromJson(json); +} diff --git a/lib/src/data/gallery/gallery_featured_request.freezed.dart b/lib/src/data/gallery/gallery_featured_request.freezed.dart new file mode 100644 index 00000000..6a0d4aa4 --- /dev/null +++ b/lib/src/data/gallery/gallery_featured_request.freezed.dart @@ -0,0 +1,174 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'gallery_featured_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GalleryFeaturedRequest _$GalleryFeaturedRequestFromJson( + Map json) { + return _GalleryFeaturedRequest.fromJson(json); +} + +/// @nodoc +mixin _$GalleryFeaturedRequest { + int? get limit => throw _privateConstructorUsedError; + String? get untilId => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $GalleryFeaturedRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GalleryFeaturedRequestCopyWith<$Res> { + factory $GalleryFeaturedRequestCopyWith(GalleryFeaturedRequest value, + $Res Function(GalleryFeaturedRequest) then) = + _$GalleryFeaturedRequestCopyWithImpl<$Res, GalleryFeaturedRequest>; + @useResult + $Res call({int? limit, String? untilId}); +} + +/// @nodoc +class _$GalleryFeaturedRequestCopyWithImpl<$Res, + $Val extends GalleryFeaturedRequest> + implements $GalleryFeaturedRequestCopyWith<$Res> { + _$GalleryFeaturedRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? limit = freezed, + Object? untilId = freezed, + }) { + return _then(_value.copyWith( + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + untilId: freezed == untilId + ? _value.untilId + : untilId // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GalleryFeaturedRequestImplCopyWith<$Res> + implements $GalleryFeaturedRequestCopyWith<$Res> { + factory _$$GalleryFeaturedRequestImplCopyWith( + _$GalleryFeaturedRequestImpl value, + $Res Function(_$GalleryFeaturedRequestImpl) then) = + __$$GalleryFeaturedRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int? limit, String? untilId}); +} + +/// @nodoc +class __$$GalleryFeaturedRequestImplCopyWithImpl<$Res> + extends _$GalleryFeaturedRequestCopyWithImpl<$Res, + _$GalleryFeaturedRequestImpl> + implements _$$GalleryFeaturedRequestImplCopyWith<$Res> { + __$$GalleryFeaturedRequestImplCopyWithImpl( + _$GalleryFeaturedRequestImpl _value, + $Res Function(_$GalleryFeaturedRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? limit = freezed, + Object? untilId = freezed, + }) { + return _then(_$GalleryFeaturedRequestImpl( + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + untilId: freezed == untilId + ? _value.untilId + : untilId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GalleryFeaturedRequestImpl implements _GalleryFeaturedRequest { + const _$GalleryFeaturedRequestImpl({this.limit, this.untilId}); + + factory _$GalleryFeaturedRequestImpl.fromJson(Map json) => + _$$GalleryFeaturedRequestImplFromJson(json); + + @override + final int? limit; + @override + final String? untilId; + + @override + String toString() { + return 'GalleryFeaturedRequest(limit: $limit, untilId: $untilId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GalleryFeaturedRequestImpl && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.untilId, untilId) || other.untilId == untilId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, limit, untilId); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GalleryFeaturedRequestImplCopyWith<_$GalleryFeaturedRequestImpl> + get copyWith => __$$GalleryFeaturedRequestImplCopyWithImpl< + _$GalleryFeaturedRequestImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GalleryFeaturedRequestImplToJson( + this, + ); + } +} + +abstract class _GalleryFeaturedRequest implements GalleryFeaturedRequest { + const factory _GalleryFeaturedRequest( + {final int? limit, final String? untilId}) = _$GalleryFeaturedRequestImpl; + + factory _GalleryFeaturedRequest.fromJson(Map json) = + _$GalleryFeaturedRequestImpl.fromJson; + + @override + int? get limit; + @override + String? get untilId; + @override + @JsonKey(ignore: true) + _$$GalleryFeaturedRequestImplCopyWith<_$GalleryFeaturedRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/gallery/gallery_featured_request.g.dart b/lib/src/data/gallery/gallery_featured_request.g.dart new file mode 100644 index 00000000..651a42b2 --- /dev/null +++ b/lib/src/data/gallery/gallery_featured_request.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'gallery_featured_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GalleryFeaturedRequestImpl _$$GalleryFeaturedRequestImplFromJson( + Map json) => + _$GalleryFeaturedRequestImpl( + limit: json['limit'] as int?, + untilId: json['untilId'] as String?, + ); + +Map _$$GalleryFeaturedRequestImplToJson( + _$GalleryFeaturedRequestImpl instance) => + { + 'limit': instance.limit, + 'untilId': instance.untilId, + }; diff --git a/lib/src/data/gallery/gallery_posts_request.dart b/lib/src/data/gallery/gallery_posts_request.dart new file mode 100644 index 00000000..0864ec3e --- /dev/null +++ b/lib/src/data/gallery/gallery_posts_request.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'gallery_posts_request.freezed.dart'; +part 'gallery_posts_request.g.dart'; + +@freezed +class GalleryPostsRequest with _$GalleryPostsRequest { + const factory GalleryPostsRequest({ + int? limit, + String? sinceId, + String? untilId, + }) = _GalleryPostsRequest; + + factory GalleryPostsRequest.fromJson(Map json) => + _$GalleryPostsRequestFromJson(json); +} diff --git a/lib/src/data/gallery/gallery_posts_request.freezed.dart b/lib/src/data/gallery/gallery_posts_request.freezed.dart new file mode 100644 index 00000000..037f0df9 --- /dev/null +++ b/lib/src/data/gallery/gallery_posts_request.freezed.dart @@ -0,0 +1,187 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'gallery_posts_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GalleryPostsRequest _$GalleryPostsRequestFromJson(Map json) { + return _GalleryPostsRequest.fromJson(json); +} + +/// @nodoc +mixin _$GalleryPostsRequest { + int? get limit => throw _privateConstructorUsedError; + String? get sinceId => throw _privateConstructorUsedError; + String? get untilId => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $GalleryPostsRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GalleryPostsRequestCopyWith<$Res> { + factory $GalleryPostsRequestCopyWith( + GalleryPostsRequest value, $Res Function(GalleryPostsRequest) then) = + _$GalleryPostsRequestCopyWithImpl<$Res, GalleryPostsRequest>; + @useResult + $Res call({int? limit, String? sinceId, String? untilId}); +} + +/// @nodoc +class _$GalleryPostsRequestCopyWithImpl<$Res, $Val extends GalleryPostsRequest> + implements $GalleryPostsRequestCopyWith<$Res> { + _$GalleryPostsRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? limit = freezed, + Object? sinceId = freezed, + Object? untilId = freezed, + }) { + return _then(_value.copyWith( + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + sinceId: freezed == sinceId + ? _value.sinceId + : sinceId // ignore: cast_nullable_to_non_nullable + as String?, + untilId: freezed == untilId + ? _value.untilId + : untilId // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GalleryPostsRequestImplCopyWith<$Res> + implements $GalleryPostsRequestCopyWith<$Res> { + factory _$$GalleryPostsRequestImplCopyWith(_$GalleryPostsRequestImpl value, + $Res Function(_$GalleryPostsRequestImpl) then) = + __$$GalleryPostsRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int? limit, String? sinceId, String? untilId}); +} + +/// @nodoc +class __$$GalleryPostsRequestImplCopyWithImpl<$Res> + extends _$GalleryPostsRequestCopyWithImpl<$Res, _$GalleryPostsRequestImpl> + implements _$$GalleryPostsRequestImplCopyWith<$Res> { + __$$GalleryPostsRequestImplCopyWithImpl(_$GalleryPostsRequestImpl _value, + $Res Function(_$GalleryPostsRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? limit = freezed, + Object? sinceId = freezed, + Object? untilId = freezed, + }) { + return _then(_$GalleryPostsRequestImpl( + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + sinceId: freezed == sinceId + ? _value.sinceId + : sinceId // ignore: cast_nullable_to_non_nullable + as String?, + untilId: freezed == untilId + ? _value.untilId + : untilId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GalleryPostsRequestImpl implements _GalleryPostsRequest { + const _$GalleryPostsRequestImpl({this.limit, this.sinceId, this.untilId}); + + factory _$GalleryPostsRequestImpl.fromJson(Map json) => + _$$GalleryPostsRequestImplFromJson(json); + + @override + final int? limit; + @override + final String? sinceId; + @override + final String? untilId; + + @override + String toString() { + return 'GalleryPostsRequest(limit: $limit, sinceId: $sinceId, untilId: $untilId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GalleryPostsRequestImpl && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.sinceId, sinceId) || other.sinceId == sinceId) && + (identical(other.untilId, untilId) || other.untilId == untilId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, limit, sinceId, untilId); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GalleryPostsRequestImplCopyWith<_$GalleryPostsRequestImpl> get copyWith => + __$$GalleryPostsRequestImplCopyWithImpl<_$GalleryPostsRequestImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$GalleryPostsRequestImplToJson( + this, + ); + } +} + +abstract class _GalleryPostsRequest implements GalleryPostsRequest { + const factory _GalleryPostsRequest( + {final int? limit, + final String? sinceId, + final String? untilId}) = _$GalleryPostsRequestImpl; + + factory _GalleryPostsRequest.fromJson(Map json) = + _$GalleryPostsRequestImpl.fromJson; + + @override + int? get limit; + @override + String? get sinceId; + @override + String? get untilId; + @override + @JsonKey(ignore: true) + _$$GalleryPostsRequestImplCopyWith<_$GalleryPostsRequestImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/data/gallery/gallery_posts_request.g.dart b/lib/src/data/gallery/gallery_posts_request.g.dart new file mode 100644 index 00000000..1e0a6f71 --- /dev/null +++ b/lib/src/data/gallery/gallery_posts_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'gallery_posts_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GalleryPostsRequestImpl _$$GalleryPostsRequestImplFromJson( + Map json) => + _$GalleryPostsRequestImpl( + limit: json['limit'] as int?, + sinceId: json['sinceId'] as String?, + untilId: json['untilId'] as String?, + ); + +Map _$$GalleryPostsRequestImplToJson( + _$GalleryPostsRequestImpl instance) => + { + 'limit': instance.limit, + 'sinceId': instance.sinceId, + 'untilId': instance.untilId, + }; diff --git a/lib/src/data/gallery/posts/gallery_posts_create_request.dart b/lib/src/data/gallery/posts/gallery_posts_create_request.dart new file mode 100644 index 00000000..00648199 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_create_request.dart @@ -0,0 +1,17 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'gallery_posts_create_request.freezed.dart'; +part 'gallery_posts_create_request.g.dart'; + +@freezed +class GalleryPostsCreateRequest with _$GalleryPostsCreateRequest { + const factory GalleryPostsCreateRequest({ + required String title, + String? description, + required List fileIds, + bool? isSensitive, + }) = _GalleryPostsCreateRequest; + + factory GalleryPostsCreateRequest.fromJson(Map json) => + _$GalleryPostsCreateRequestFromJson(json); +} diff --git a/lib/src/data/gallery/posts/gallery_posts_create_request.freezed.dart b/lib/src/data/gallery/posts/gallery_posts_create_request.freezed.dart new file mode 100644 index 00000000..c2374be1 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_create_request.freezed.dart @@ -0,0 +1,231 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'gallery_posts_create_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GalleryPostsCreateRequest _$GalleryPostsCreateRequestFromJson( + Map json) { + return _GalleryPostsCreateRequest.fromJson(json); +} + +/// @nodoc +mixin _$GalleryPostsCreateRequest { + String get title => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + List get fileIds => throw _privateConstructorUsedError; + bool? get isSensitive => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $GalleryPostsCreateRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GalleryPostsCreateRequestCopyWith<$Res> { + factory $GalleryPostsCreateRequestCopyWith(GalleryPostsCreateRequest value, + $Res Function(GalleryPostsCreateRequest) then) = + _$GalleryPostsCreateRequestCopyWithImpl<$Res, GalleryPostsCreateRequest>; + @useResult + $Res call( + {String title, + String? description, + List fileIds, + bool? isSensitive}); +} + +/// @nodoc +class _$GalleryPostsCreateRequestCopyWithImpl<$Res, + $Val extends GalleryPostsCreateRequest> + implements $GalleryPostsCreateRequestCopyWith<$Res> { + _$GalleryPostsCreateRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? title = null, + Object? description = freezed, + Object? fileIds = null, + Object? isSensitive = freezed, + }) { + return _then(_value.copyWith( + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + fileIds: null == fileIds + ? _value.fileIds + : fileIds // ignore: cast_nullable_to_non_nullable + as List, + isSensitive: freezed == isSensitive + ? _value.isSensitive + : isSensitive // ignore: cast_nullable_to_non_nullable + as bool?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GalleryPostsCreateRequestImplCopyWith<$Res> + implements $GalleryPostsCreateRequestCopyWith<$Res> { + factory _$$GalleryPostsCreateRequestImplCopyWith( + _$GalleryPostsCreateRequestImpl value, + $Res Function(_$GalleryPostsCreateRequestImpl) then) = + __$$GalleryPostsCreateRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String title, + String? description, + List fileIds, + bool? isSensitive}); +} + +/// @nodoc +class __$$GalleryPostsCreateRequestImplCopyWithImpl<$Res> + extends _$GalleryPostsCreateRequestCopyWithImpl<$Res, + _$GalleryPostsCreateRequestImpl> + implements _$$GalleryPostsCreateRequestImplCopyWith<$Res> { + __$$GalleryPostsCreateRequestImplCopyWithImpl( + _$GalleryPostsCreateRequestImpl _value, + $Res Function(_$GalleryPostsCreateRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? title = null, + Object? description = freezed, + Object? fileIds = null, + Object? isSensitive = freezed, + }) { + return _then(_$GalleryPostsCreateRequestImpl( + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + fileIds: null == fileIds + ? _value._fileIds + : fileIds // ignore: cast_nullable_to_non_nullable + as List, + isSensitive: freezed == isSensitive + ? _value.isSensitive + : isSensitive // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GalleryPostsCreateRequestImpl implements _GalleryPostsCreateRequest { + const _$GalleryPostsCreateRequestImpl( + {required this.title, + this.description, + required final List fileIds, + this.isSensitive}) + : _fileIds = fileIds; + + factory _$GalleryPostsCreateRequestImpl.fromJson(Map json) => + _$$GalleryPostsCreateRequestImplFromJson(json); + + @override + final String title; + @override + final String? description; + final List _fileIds; + @override + List get fileIds { + if (_fileIds is EqualUnmodifiableListView) return _fileIds; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_fileIds); + } + + @override + final bool? isSensitive; + + @override + String toString() { + return 'GalleryPostsCreateRequest(title: $title, description: $description, fileIds: $fileIds, isSensitive: $isSensitive)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GalleryPostsCreateRequestImpl && + (identical(other.title, title) || other.title == title) && + (identical(other.description, description) || + other.description == description) && + const DeepCollectionEquality().equals(other._fileIds, _fileIds) && + (identical(other.isSensitive, isSensitive) || + other.isSensitive == isSensitive)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, title, description, + const DeepCollectionEquality().hash(_fileIds), isSensitive); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GalleryPostsCreateRequestImplCopyWith<_$GalleryPostsCreateRequestImpl> + get copyWith => __$$GalleryPostsCreateRequestImplCopyWithImpl< + _$GalleryPostsCreateRequestImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GalleryPostsCreateRequestImplToJson( + this, + ); + } +} + +abstract class _GalleryPostsCreateRequest implements GalleryPostsCreateRequest { + const factory _GalleryPostsCreateRequest( + {required final String title, + final String? description, + required final List fileIds, + final bool? isSensitive}) = _$GalleryPostsCreateRequestImpl; + + factory _GalleryPostsCreateRequest.fromJson(Map json) = + _$GalleryPostsCreateRequestImpl.fromJson; + + @override + String get title; + @override + String? get description; + @override + List get fileIds; + @override + bool? get isSensitive; + @override + @JsonKey(ignore: true) + _$$GalleryPostsCreateRequestImplCopyWith<_$GalleryPostsCreateRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/gallery/posts/gallery_posts_create_request.g.dart b/lib/src/data/gallery/posts/gallery_posts_create_request.g.dart new file mode 100644 index 00000000..ecc19ea5 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_create_request.g.dart @@ -0,0 +1,26 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'gallery_posts_create_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GalleryPostsCreateRequestImpl _$$GalleryPostsCreateRequestImplFromJson( + Map json) => + _$GalleryPostsCreateRequestImpl( + title: json['title'] as String, + description: json['description'] as String?, + fileIds: + (json['fileIds'] as List).map((e) => e as String).toList(), + isSensitive: json['isSensitive'] as bool?, + ); + +Map _$$GalleryPostsCreateRequestImplToJson( + _$GalleryPostsCreateRequestImpl instance) => + { + 'title': instance.title, + 'description': instance.description, + 'fileIds': instance.fileIds, + 'isSensitive': instance.isSensitive, + }; diff --git a/lib/src/data/gallery/posts/gallery_posts_delete_request.dart b/lib/src/data/gallery/posts/gallery_posts_delete_request.dart new file mode 100644 index 00000000..3066eebe --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_delete_request.dart @@ -0,0 +1,14 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'gallery_posts_delete_request.freezed.dart'; +part 'gallery_posts_delete_request.g.dart'; + +@freezed +class GalleryPostsDeleteRequest with _$GalleryPostsDeleteRequest { + const factory GalleryPostsDeleteRequest({ + required String postId, + }) = _GalleryPostsDeleteRequest; + + factory GalleryPostsDeleteRequest.fromJson(Map json) => + _$GalleryPostsDeleteRequestFromJson(json); +} diff --git a/lib/src/data/gallery/posts/gallery_posts_delete_request.freezed.dart b/lib/src/data/gallery/posts/gallery_posts_delete_request.freezed.dart new file mode 100644 index 00000000..54570d1f --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_delete_request.freezed.dart @@ -0,0 +1,158 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'gallery_posts_delete_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GalleryPostsDeleteRequest _$GalleryPostsDeleteRequestFromJson( + Map json) { + return _GalleryPostsDeleteRequest.fromJson(json); +} + +/// @nodoc +mixin _$GalleryPostsDeleteRequest { + String get postId => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $GalleryPostsDeleteRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GalleryPostsDeleteRequestCopyWith<$Res> { + factory $GalleryPostsDeleteRequestCopyWith(GalleryPostsDeleteRequest value, + $Res Function(GalleryPostsDeleteRequest) then) = + _$GalleryPostsDeleteRequestCopyWithImpl<$Res, GalleryPostsDeleteRequest>; + @useResult + $Res call({String postId}); +} + +/// @nodoc +class _$GalleryPostsDeleteRequestCopyWithImpl<$Res, + $Val extends GalleryPostsDeleteRequest> + implements $GalleryPostsDeleteRequestCopyWith<$Res> { + _$GalleryPostsDeleteRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + }) { + return _then(_value.copyWith( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GalleryPostsDeleteRequestImplCopyWith<$Res> + implements $GalleryPostsDeleteRequestCopyWith<$Res> { + factory _$$GalleryPostsDeleteRequestImplCopyWith( + _$GalleryPostsDeleteRequestImpl value, + $Res Function(_$GalleryPostsDeleteRequestImpl) then) = + __$$GalleryPostsDeleteRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String postId}); +} + +/// @nodoc +class __$$GalleryPostsDeleteRequestImplCopyWithImpl<$Res> + extends _$GalleryPostsDeleteRequestCopyWithImpl<$Res, + _$GalleryPostsDeleteRequestImpl> + implements _$$GalleryPostsDeleteRequestImplCopyWith<$Res> { + __$$GalleryPostsDeleteRequestImplCopyWithImpl( + _$GalleryPostsDeleteRequestImpl _value, + $Res Function(_$GalleryPostsDeleteRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + }) { + return _then(_$GalleryPostsDeleteRequestImpl( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GalleryPostsDeleteRequestImpl implements _GalleryPostsDeleteRequest { + const _$GalleryPostsDeleteRequestImpl({required this.postId}); + + factory _$GalleryPostsDeleteRequestImpl.fromJson(Map json) => + _$$GalleryPostsDeleteRequestImplFromJson(json); + + @override + final String postId; + + @override + String toString() { + return 'GalleryPostsDeleteRequest(postId: $postId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GalleryPostsDeleteRequestImpl && + (identical(other.postId, postId) || other.postId == postId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, postId); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GalleryPostsDeleteRequestImplCopyWith<_$GalleryPostsDeleteRequestImpl> + get copyWith => __$$GalleryPostsDeleteRequestImplCopyWithImpl< + _$GalleryPostsDeleteRequestImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GalleryPostsDeleteRequestImplToJson( + this, + ); + } +} + +abstract class _GalleryPostsDeleteRequest implements GalleryPostsDeleteRequest { + const factory _GalleryPostsDeleteRequest({required final String postId}) = + _$GalleryPostsDeleteRequestImpl; + + factory _GalleryPostsDeleteRequest.fromJson(Map json) = + _$GalleryPostsDeleteRequestImpl.fromJson; + + @override + String get postId; + @override + @JsonKey(ignore: true) + _$$GalleryPostsDeleteRequestImplCopyWith<_$GalleryPostsDeleteRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/gallery/posts/gallery_posts_delete_request.g.dart b/lib/src/data/gallery/posts/gallery_posts_delete_request.g.dart new file mode 100644 index 00000000..7af404da --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_delete_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'gallery_posts_delete_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GalleryPostsDeleteRequestImpl _$$GalleryPostsDeleteRequestImplFromJson( + Map json) => + _$GalleryPostsDeleteRequestImpl( + postId: json['postId'] as String, + ); + +Map _$$GalleryPostsDeleteRequestImplToJson( + _$GalleryPostsDeleteRequestImpl instance) => + { + 'postId': instance.postId, + }; diff --git a/lib/src/data/gallery/posts/gallery_posts_like_request.dart b/lib/src/data/gallery/posts/gallery_posts_like_request.dart new file mode 100644 index 00000000..64283ae1 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_like_request.dart @@ -0,0 +1,14 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'gallery_posts_like_request.freezed.dart'; +part 'gallery_posts_like_request.g.dart'; + +@freezed +class GalleryPostsLikeRequest with _$GalleryPostsLikeRequest { + const factory GalleryPostsLikeRequest({ + required String postId, + }) = _GalleryPostsLikeRequest; + + factory GalleryPostsLikeRequest.fromJson(Map json) => + _$GalleryPostsLikeRequestFromJson(json); +} diff --git a/lib/src/data/gallery/posts/gallery_posts_like_request.freezed.dart b/lib/src/data/gallery/posts/gallery_posts_like_request.freezed.dart new file mode 100644 index 00000000..b75a99d8 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_like_request.freezed.dart @@ -0,0 +1,158 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'gallery_posts_like_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GalleryPostsLikeRequest _$GalleryPostsLikeRequestFromJson( + Map json) { + return _GalleryPostsLikeRequest.fromJson(json); +} + +/// @nodoc +mixin _$GalleryPostsLikeRequest { + String get postId => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $GalleryPostsLikeRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GalleryPostsLikeRequestCopyWith<$Res> { + factory $GalleryPostsLikeRequestCopyWith(GalleryPostsLikeRequest value, + $Res Function(GalleryPostsLikeRequest) then) = + _$GalleryPostsLikeRequestCopyWithImpl<$Res, GalleryPostsLikeRequest>; + @useResult + $Res call({String postId}); +} + +/// @nodoc +class _$GalleryPostsLikeRequestCopyWithImpl<$Res, + $Val extends GalleryPostsLikeRequest> + implements $GalleryPostsLikeRequestCopyWith<$Res> { + _$GalleryPostsLikeRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + }) { + return _then(_value.copyWith( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GalleryPostsLikeRequestImplCopyWith<$Res> + implements $GalleryPostsLikeRequestCopyWith<$Res> { + factory _$$GalleryPostsLikeRequestImplCopyWith( + _$GalleryPostsLikeRequestImpl value, + $Res Function(_$GalleryPostsLikeRequestImpl) then) = + __$$GalleryPostsLikeRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String postId}); +} + +/// @nodoc +class __$$GalleryPostsLikeRequestImplCopyWithImpl<$Res> + extends _$GalleryPostsLikeRequestCopyWithImpl<$Res, + _$GalleryPostsLikeRequestImpl> + implements _$$GalleryPostsLikeRequestImplCopyWith<$Res> { + __$$GalleryPostsLikeRequestImplCopyWithImpl( + _$GalleryPostsLikeRequestImpl _value, + $Res Function(_$GalleryPostsLikeRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + }) { + return _then(_$GalleryPostsLikeRequestImpl( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GalleryPostsLikeRequestImpl implements _GalleryPostsLikeRequest { + const _$GalleryPostsLikeRequestImpl({required this.postId}); + + factory _$GalleryPostsLikeRequestImpl.fromJson(Map json) => + _$$GalleryPostsLikeRequestImplFromJson(json); + + @override + final String postId; + + @override + String toString() { + return 'GalleryPostsLikeRequest(postId: $postId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GalleryPostsLikeRequestImpl && + (identical(other.postId, postId) || other.postId == postId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, postId); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GalleryPostsLikeRequestImplCopyWith<_$GalleryPostsLikeRequestImpl> + get copyWith => __$$GalleryPostsLikeRequestImplCopyWithImpl< + _$GalleryPostsLikeRequestImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GalleryPostsLikeRequestImplToJson( + this, + ); + } +} + +abstract class _GalleryPostsLikeRequest implements GalleryPostsLikeRequest { + const factory _GalleryPostsLikeRequest({required final String postId}) = + _$GalleryPostsLikeRequestImpl; + + factory _GalleryPostsLikeRequest.fromJson(Map json) = + _$GalleryPostsLikeRequestImpl.fromJson; + + @override + String get postId; + @override + @JsonKey(ignore: true) + _$$GalleryPostsLikeRequestImplCopyWith<_$GalleryPostsLikeRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/gallery/posts/gallery_posts_like_request.g.dart b/lib/src/data/gallery/posts/gallery_posts_like_request.g.dart new file mode 100644 index 00000000..0a4bb074 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_like_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'gallery_posts_like_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GalleryPostsLikeRequestImpl _$$GalleryPostsLikeRequestImplFromJson( + Map json) => + _$GalleryPostsLikeRequestImpl( + postId: json['postId'] as String, + ); + +Map _$$GalleryPostsLikeRequestImplToJson( + _$GalleryPostsLikeRequestImpl instance) => + { + 'postId': instance.postId, + }; diff --git a/lib/src/data/gallery/posts/gallery_posts_show_request.dart b/lib/src/data/gallery/posts/gallery_posts_show_request.dart new file mode 100644 index 00000000..d70a8926 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_show_request.dart @@ -0,0 +1,14 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'gallery_posts_show_request.freezed.dart'; +part 'gallery_posts_show_request.g.dart'; + +@freezed +class GalleryPostsShowRequest with _$GalleryPostsShowRequest { + const factory GalleryPostsShowRequest({ + required String postId, + }) = _GalleryPostsShowRequest; + + factory GalleryPostsShowRequest.fromJson(Map json) => + _$GalleryPostsShowRequestFromJson(json); +} diff --git a/lib/src/data/gallery/posts/gallery_posts_show_request.freezed.dart b/lib/src/data/gallery/posts/gallery_posts_show_request.freezed.dart new file mode 100644 index 00000000..2c4de249 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_show_request.freezed.dart @@ -0,0 +1,158 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'gallery_posts_show_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GalleryPostsShowRequest _$GalleryPostsShowRequestFromJson( + Map json) { + return _GalleryPostsShowRequest.fromJson(json); +} + +/// @nodoc +mixin _$GalleryPostsShowRequest { + String get postId => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $GalleryPostsShowRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GalleryPostsShowRequestCopyWith<$Res> { + factory $GalleryPostsShowRequestCopyWith(GalleryPostsShowRequest value, + $Res Function(GalleryPostsShowRequest) then) = + _$GalleryPostsShowRequestCopyWithImpl<$Res, GalleryPostsShowRequest>; + @useResult + $Res call({String postId}); +} + +/// @nodoc +class _$GalleryPostsShowRequestCopyWithImpl<$Res, + $Val extends GalleryPostsShowRequest> + implements $GalleryPostsShowRequestCopyWith<$Res> { + _$GalleryPostsShowRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + }) { + return _then(_value.copyWith( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GalleryPostsShowRequestImplCopyWith<$Res> + implements $GalleryPostsShowRequestCopyWith<$Res> { + factory _$$GalleryPostsShowRequestImplCopyWith( + _$GalleryPostsShowRequestImpl value, + $Res Function(_$GalleryPostsShowRequestImpl) then) = + __$$GalleryPostsShowRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String postId}); +} + +/// @nodoc +class __$$GalleryPostsShowRequestImplCopyWithImpl<$Res> + extends _$GalleryPostsShowRequestCopyWithImpl<$Res, + _$GalleryPostsShowRequestImpl> + implements _$$GalleryPostsShowRequestImplCopyWith<$Res> { + __$$GalleryPostsShowRequestImplCopyWithImpl( + _$GalleryPostsShowRequestImpl _value, + $Res Function(_$GalleryPostsShowRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + }) { + return _then(_$GalleryPostsShowRequestImpl( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GalleryPostsShowRequestImpl implements _GalleryPostsShowRequest { + const _$GalleryPostsShowRequestImpl({required this.postId}); + + factory _$GalleryPostsShowRequestImpl.fromJson(Map json) => + _$$GalleryPostsShowRequestImplFromJson(json); + + @override + final String postId; + + @override + String toString() { + return 'GalleryPostsShowRequest(postId: $postId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GalleryPostsShowRequestImpl && + (identical(other.postId, postId) || other.postId == postId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, postId); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GalleryPostsShowRequestImplCopyWith<_$GalleryPostsShowRequestImpl> + get copyWith => __$$GalleryPostsShowRequestImplCopyWithImpl< + _$GalleryPostsShowRequestImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GalleryPostsShowRequestImplToJson( + this, + ); + } +} + +abstract class _GalleryPostsShowRequest implements GalleryPostsShowRequest { + const factory _GalleryPostsShowRequest({required final String postId}) = + _$GalleryPostsShowRequestImpl; + + factory _GalleryPostsShowRequest.fromJson(Map json) = + _$GalleryPostsShowRequestImpl.fromJson; + + @override + String get postId; + @override + @JsonKey(ignore: true) + _$$GalleryPostsShowRequestImplCopyWith<_$GalleryPostsShowRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/gallery/posts/gallery_posts_show_request.g.dart b/lib/src/data/gallery/posts/gallery_posts_show_request.g.dart new file mode 100644 index 00000000..baa653bd --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_show_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'gallery_posts_show_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GalleryPostsShowRequestImpl _$$GalleryPostsShowRequestImplFromJson( + Map json) => + _$GalleryPostsShowRequestImpl( + postId: json['postId'] as String, + ); + +Map _$$GalleryPostsShowRequestImplToJson( + _$GalleryPostsShowRequestImpl instance) => + { + 'postId': instance.postId, + }; diff --git a/lib/src/data/gallery/posts/gallery_posts_unlike_request.dart b/lib/src/data/gallery/posts/gallery_posts_unlike_request.dart new file mode 100644 index 00000000..454618b4 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_unlike_request.dart @@ -0,0 +1,14 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'gallery_posts_unlike_request.freezed.dart'; +part 'gallery_posts_unlike_request.g.dart'; + +@freezed +class GalleryPostsUnlikeRequest with _$GalleryPostsUnlikeRequest { + const factory GalleryPostsUnlikeRequest({ + required String postId, + }) = _GalleryPostsUnlikeRequest; + + factory GalleryPostsUnlikeRequest.fromJson(Map json) => + _$GalleryPostsUnlikeRequestFromJson(json); +} diff --git a/lib/src/data/gallery/posts/gallery_posts_unlike_request.freezed.dart b/lib/src/data/gallery/posts/gallery_posts_unlike_request.freezed.dart new file mode 100644 index 00000000..08994fb9 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_unlike_request.freezed.dart @@ -0,0 +1,158 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'gallery_posts_unlike_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GalleryPostsUnlikeRequest _$GalleryPostsUnlikeRequestFromJson( + Map json) { + return _GalleryPostsUnlikeRequest.fromJson(json); +} + +/// @nodoc +mixin _$GalleryPostsUnlikeRequest { + String get postId => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $GalleryPostsUnlikeRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GalleryPostsUnlikeRequestCopyWith<$Res> { + factory $GalleryPostsUnlikeRequestCopyWith(GalleryPostsUnlikeRequest value, + $Res Function(GalleryPostsUnlikeRequest) then) = + _$GalleryPostsUnlikeRequestCopyWithImpl<$Res, GalleryPostsUnlikeRequest>; + @useResult + $Res call({String postId}); +} + +/// @nodoc +class _$GalleryPostsUnlikeRequestCopyWithImpl<$Res, + $Val extends GalleryPostsUnlikeRequest> + implements $GalleryPostsUnlikeRequestCopyWith<$Res> { + _$GalleryPostsUnlikeRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + }) { + return _then(_value.copyWith( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GalleryPostsUnlikeRequestImplCopyWith<$Res> + implements $GalleryPostsUnlikeRequestCopyWith<$Res> { + factory _$$GalleryPostsUnlikeRequestImplCopyWith( + _$GalleryPostsUnlikeRequestImpl value, + $Res Function(_$GalleryPostsUnlikeRequestImpl) then) = + __$$GalleryPostsUnlikeRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String postId}); +} + +/// @nodoc +class __$$GalleryPostsUnlikeRequestImplCopyWithImpl<$Res> + extends _$GalleryPostsUnlikeRequestCopyWithImpl<$Res, + _$GalleryPostsUnlikeRequestImpl> + implements _$$GalleryPostsUnlikeRequestImplCopyWith<$Res> { + __$$GalleryPostsUnlikeRequestImplCopyWithImpl( + _$GalleryPostsUnlikeRequestImpl _value, + $Res Function(_$GalleryPostsUnlikeRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + }) { + return _then(_$GalleryPostsUnlikeRequestImpl( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GalleryPostsUnlikeRequestImpl implements _GalleryPostsUnlikeRequest { + const _$GalleryPostsUnlikeRequestImpl({required this.postId}); + + factory _$GalleryPostsUnlikeRequestImpl.fromJson(Map json) => + _$$GalleryPostsUnlikeRequestImplFromJson(json); + + @override + final String postId; + + @override + String toString() { + return 'GalleryPostsUnlikeRequest(postId: $postId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GalleryPostsUnlikeRequestImpl && + (identical(other.postId, postId) || other.postId == postId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, postId); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GalleryPostsUnlikeRequestImplCopyWith<_$GalleryPostsUnlikeRequestImpl> + get copyWith => __$$GalleryPostsUnlikeRequestImplCopyWithImpl< + _$GalleryPostsUnlikeRequestImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GalleryPostsUnlikeRequestImplToJson( + this, + ); + } +} + +abstract class _GalleryPostsUnlikeRequest implements GalleryPostsUnlikeRequest { + const factory _GalleryPostsUnlikeRequest({required final String postId}) = + _$GalleryPostsUnlikeRequestImpl; + + factory _GalleryPostsUnlikeRequest.fromJson(Map json) = + _$GalleryPostsUnlikeRequestImpl.fromJson; + + @override + String get postId; + @override + @JsonKey(ignore: true) + _$$GalleryPostsUnlikeRequestImplCopyWith<_$GalleryPostsUnlikeRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/gallery/posts/gallery_posts_unlike_request.g.dart b/lib/src/data/gallery/posts/gallery_posts_unlike_request.g.dart new file mode 100644 index 00000000..2470e400 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_unlike_request.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'gallery_posts_unlike_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GalleryPostsUnlikeRequestImpl _$$GalleryPostsUnlikeRequestImplFromJson( + Map json) => + _$GalleryPostsUnlikeRequestImpl( + postId: json['postId'] as String, + ); + +Map _$$GalleryPostsUnlikeRequestImplToJson( + _$GalleryPostsUnlikeRequestImpl instance) => + { + 'postId': instance.postId, + }; diff --git a/lib/src/data/gallery/posts/gallery_posts_update_request.dart b/lib/src/data/gallery/posts/gallery_posts_update_request.dart new file mode 100644 index 00000000..1c2c7a1b --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_update_request.dart @@ -0,0 +1,18 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'gallery_posts_update_request.freezed.dart'; +part 'gallery_posts_update_request.g.dart'; + +@freezed +class GalleryPostsUpdateRequest with _$GalleryPostsUpdateRequest { + const factory GalleryPostsUpdateRequest({ + required String postId, + required String title, + String? description, + required List fileIds, + bool? isSensitive, + }) = _GalleryPostsUpdateRequest; + + factory GalleryPostsUpdateRequest.fromJson(Map json) => + _$GalleryPostsUpdateRequestFromJson(json); +} diff --git a/lib/src/data/gallery/posts/gallery_posts_update_request.freezed.dart b/lib/src/data/gallery/posts/gallery_posts_update_request.freezed.dart new file mode 100644 index 00000000..e4283524 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_update_request.freezed.dart @@ -0,0 +1,251 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'gallery_posts_update_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GalleryPostsUpdateRequest _$GalleryPostsUpdateRequestFromJson( + Map json) { + return _GalleryPostsUpdateRequest.fromJson(json); +} + +/// @nodoc +mixin _$GalleryPostsUpdateRequest { + String get postId => throw _privateConstructorUsedError; + String get title => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + List get fileIds => throw _privateConstructorUsedError; + bool? get isSensitive => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $GalleryPostsUpdateRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GalleryPostsUpdateRequestCopyWith<$Res> { + factory $GalleryPostsUpdateRequestCopyWith(GalleryPostsUpdateRequest value, + $Res Function(GalleryPostsUpdateRequest) then) = + _$GalleryPostsUpdateRequestCopyWithImpl<$Res, GalleryPostsUpdateRequest>; + @useResult + $Res call( + {String postId, + String title, + String? description, + List fileIds, + bool? isSensitive}); +} + +/// @nodoc +class _$GalleryPostsUpdateRequestCopyWithImpl<$Res, + $Val extends GalleryPostsUpdateRequest> + implements $GalleryPostsUpdateRequestCopyWith<$Res> { + _$GalleryPostsUpdateRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + Object? title = null, + Object? description = freezed, + Object? fileIds = null, + Object? isSensitive = freezed, + }) { + return _then(_value.copyWith( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + fileIds: null == fileIds + ? _value.fileIds + : fileIds // ignore: cast_nullable_to_non_nullable + as List, + isSensitive: freezed == isSensitive + ? _value.isSensitive + : isSensitive // ignore: cast_nullable_to_non_nullable + as bool?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GalleryPostsUpdateRequestImplCopyWith<$Res> + implements $GalleryPostsUpdateRequestCopyWith<$Res> { + factory _$$GalleryPostsUpdateRequestImplCopyWith( + _$GalleryPostsUpdateRequestImpl value, + $Res Function(_$GalleryPostsUpdateRequestImpl) then) = + __$$GalleryPostsUpdateRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String postId, + String title, + String? description, + List fileIds, + bool? isSensitive}); +} + +/// @nodoc +class __$$GalleryPostsUpdateRequestImplCopyWithImpl<$Res> + extends _$GalleryPostsUpdateRequestCopyWithImpl<$Res, + _$GalleryPostsUpdateRequestImpl> + implements _$$GalleryPostsUpdateRequestImplCopyWith<$Res> { + __$$GalleryPostsUpdateRequestImplCopyWithImpl( + _$GalleryPostsUpdateRequestImpl _value, + $Res Function(_$GalleryPostsUpdateRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? postId = null, + Object? title = null, + Object? description = freezed, + Object? fileIds = null, + Object? isSensitive = freezed, + }) { + return _then(_$GalleryPostsUpdateRequestImpl( + postId: null == postId + ? _value.postId + : postId // ignore: cast_nullable_to_non_nullable + as String, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + fileIds: null == fileIds + ? _value._fileIds + : fileIds // ignore: cast_nullable_to_non_nullable + as List, + isSensitive: freezed == isSensitive + ? _value.isSensitive + : isSensitive // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GalleryPostsUpdateRequestImpl implements _GalleryPostsUpdateRequest { + const _$GalleryPostsUpdateRequestImpl( + {required this.postId, + required this.title, + this.description, + required final List fileIds, + this.isSensitive}) + : _fileIds = fileIds; + + factory _$GalleryPostsUpdateRequestImpl.fromJson(Map json) => + _$$GalleryPostsUpdateRequestImplFromJson(json); + + @override + final String postId; + @override + final String title; + @override + final String? description; + final List _fileIds; + @override + List get fileIds { + if (_fileIds is EqualUnmodifiableListView) return _fileIds; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_fileIds); + } + + @override + final bool? isSensitive; + + @override + String toString() { + return 'GalleryPostsUpdateRequest(postId: $postId, title: $title, description: $description, fileIds: $fileIds, isSensitive: $isSensitive)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GalleryPostsUpdateRequestImpl && + (identical(other.postId, postId) || other.postId == postId) && + (identical(other.title, title) || other.title == title) && + (identical(other.description, description) || + other.description == description) && + const DeepCollectionEquality().equals(other._fileIds, _fileIds) && + (identical(other.isSensitive, isSensitive) || + other.isSensitive == isSensitive)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, postId, title, description, + const DeepCollectionEquality().hash(_fileIds), isSensitive); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GalleryPostsUpdateRequestImplCopyWith<_$GalleryPostsUpdateRequestImpl> + get copyWith => __$$GalleryPostsUpdateRequestImplCopyWithImpl< + _$GalleryPostsUpdateRequestImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GalleryPostsUpdateRequestImplToJson( + this, + ); + } +} + +abstract class _GalleryPostsUpdateRequest implements GalleryPostsUpdateRequest { + const factory _GalleryPostsUpdateRequest( + {required final String postId, + required final String title, + final String? description, + required final List fileIds, + final bool? isSensitive}) = _$GalleryPostsUpdateRequestImpl; + + factory _GalleryPostsUpdateRequest.fromJson(Map json) = + _$GalleryPostsUpdateRequestImpl.fromJson; + + @override + String get postId; + @override + String get title; + @override + String? get description; + @override + List get fileIds; + @override + bool? get isSensitive; + @override + @JsonKey(ignore: true) + _$$GalleryPostsUpdateRequestImplCopyWith<_$GalleryPostsUpdateRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/gallery/posts/gallery_posts_update_request.g.dart b/lib/src/data/gallery/posts/gallery_posts_update_request.g.dart new file mode 100644 index 00000000..2b6fef73 --- /dev/null +++ b/lib/src/data/gallery/posts/gallery_posts_update_request.g.dart @@ -0,0 +1,28 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'gallery_posts_update_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GalleryPostsUpdateRequestImpl _$$GalleryPostsUpdateRequestImplFromJson( + Map json) => + _$GalleryPostsUpdateRequestImpl( + postId: json['postId'] as String, + title: json['title'] as String, + description: json['description'] as String?, + fileIds: + (json['fileIds'] as List).map((e) => e as String).toList(), + isSensitive: json['isSensitive'] as bool?, + ); + +Map _$$GalleryPostsUpdateRequestImplToJson( + _$GalleryPostsUpdateRequestImpl instance) => + { + 'postId': instance.postId, + 'title': instance.title, + 'description': instance.description, + 'fileIds': instance.fileIds, + 'isSensitive': instance.isSensitive, + }; diff --git a/lib/src/data/i/gallery/i_gallery_likes_request.dart b/lib/src/data/i/gallery/i_gallery_likes_request.dart new file mode 100644 index 00000000..931dfe7d --- /dev/null +++ b/lib/src/data/i/gallery/i_gallery_likes_request.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'i_gallery_likes_request.freezed.dart'; +part 'i_gallery_likes_request.g.dart'; + +@freezed +class IGalleryLikesRequest with _$IGalleryLikesRequest { + const factory IGalleryLikesRequest({ + int? limit, + String? sinceId, + String? untilId, + }) = _IGalleryLikesRequest; + + factory IGalleryLikesRequest.fromJson(Map json) => + _$IGalleryLikesRequestFromJson(json); +} diff --git a/lib/src/data/i/gallery/i_gallery_likes_request.freezed.dart b/lib/src/data/i/gallery/i_gallery_likes_request.freezed.dart new file mode 100644 index 00000000..79dc62ea --- /dev/null +++ b/lib/src/data/i/gallery/i_gallery_likes_request.freezed.dart @@ -0,0 +1,189 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'i_gallery_likes_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +IGalleryLikesRequest _$IGalleryLikesRequestFromJson(Map json) { + return _IGalleryLikesRequest.fromJson(json); +} + +/// @nodoc +mixin _$IGalleryLikesRequest { + int? get limit => throw _privateConstructorUsedError; + String? get sinceId => throw _privateConstructorUsedError; + String? get untilId => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $IGalleryLikesRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $IGalleryLikesRequestCopyWith<$Res> { + factory $IGalleryLikesRequestCopyWith(IGalleryLikesRequest value, + $Res Function(IGalleryLikesRequest) then) = + _$IGalleryLikesRequestCopyWithImpl<$Res, IGalleryLikesRequest>; + @useResult + $Res call({int? limit, String? sinceId, String? untilId}); +} + +/// @nodoc +class _$IGalleryLikesRequestCopyWithImpl<$Res, + $Val extends IGalleryLikesRequest> + implements $IGalleryLikesRequestCopyWith<$Res> { + _$IGalleryLikesRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? limit = freezed, + Object? sinceId = freezed, + Object? untilId = freezed, + }) { + return _then(_value.copyWith( + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + sinceId: freezed == sinceId + ? _value.sinceId + : sinceId // ignore: cast_nullable_to_non_nullable + as String?, + untilId: freezed == untilId + ? _value.untilId + : untilId // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$IGalleryLikesRequestImplCopyWith<$Res> + implements $IGalleryLikesRequestCopyWith<$Res> { + factory _$$IGalleryLikesRequestImplCopyWith(_$IGalleryLikesRequestImpl value, + $Res Function(_$IGalleryLikesRequestImpl) then) = + __$$IGalleryLikesRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int? limit, String? sinceId, String? untilId}); +} + +/// @nodoc +class __$$IGalleryLikesRequestImplCopyWithImpl<$Res> + extends _$IGalleryLikesRequestCopyWithImpl<$Res, _$IGalleryLikesRequestImpl> + implements _$$IGalleryLikesRequestImplCopyWith<$Res> { + __$$IGalleryLikesRequestImplCopyWithImpl(_$IGalleryLikesRequestImpl _value, + $Res Function(_$IGalleryLikesRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? limit = freezed, + Object? sinceId = freezed, + Object? untilId = freezed, + }) { + return _then(_$IGalleryLikesRequestImpl( + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + sinceId: freezed == sinceId + ? _value.sinceId + : sinceId // ignore: cast_nullable_to_non_nullable + as String?, + untilId: freezed == untilId + ? _value.untilId + : untilId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$IGalleryLikesRequestImpl implements _IGalleryLikesRequest { + const _$IGalleryLikesRequestImpl({this.limit, this.sinceId, this.untilId}); + + factory _$IGalleryLikesRequestImpl.fromJson(Map json) => + _$$IGalleryLikesRequestImplFromJson(json); + + @override + final int? limit; + @override + final String? sinceId; + @override + final String? untilId; + + @override + String toString() { + return 'IGalleryLikesRequest(limit: $limit, sinceId: $sinceId, untilId: $untilId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$IGalleryLikesRequestImpl && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.sinceId, sinceId) || other.sinceId == sinceId) && + (identical(other.untilId, untilId) || other.untilId == untilId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, limit, sinceId, untilId); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$IGalleryLikesRequestImplCopyWith<_$IGalleryLikesRequestImpl> + get copyWith => + __$$IGalleryLikesRequestImplCopyWithImpl<_$IGalleryLikesRequestImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$IGalleryLikesRequestImplToJson( + this, + ); + } +} + +abstract class _IGalleryLikesRequest implements IGalleryLikesRequest { + const factory _IGalleryLikesRequest( + {final int? limit, + final String? sinceId, + final String? untilId}) = _$IGalleryLikesRequestImpl; + + factory _IGalleryLikesRequest.fromJson(Map json) = + _$IGalleryLikesRequestImpl.fromJson; + + @override + int? get limit; + @override + String? get sinceId; + @override + String? get untilId; + @override + @JsonKey(ignore: true) + _$$IGalleryLikesRequestImplCopyWith<_$IGalleryLikesRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/i/gallery/i_gallery_likes_request.g.dart b/lib/src/data/i/gallery/i_gallery_likes_request.g.dart new file mode 100644 index 00000000..6a0d6ffc --- /dev/null +++ b/lib/src/data/i/gallery/i_gallery_likes_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'i_gallery_likes_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$IGalleryLikesRequestImpl _$$IGalleryLikesRequestImplFromJson( + Map json) => + _$IGalleryLikesRequestImpl( + limit: json['limit'] as int?, + sinceId: json['sinceId'] as String?, + untilId: json['untilId'] as String?, + ); + +Map _$$IGalleryLikesRequestImplToJson( + _$IGalleryLikesRequestImpl instance) => + { + 'limit': instance.limit, + 'sinceId': instance.sinceId, + 'untilId': instance.untilId, + }; diff --git a/lib/src/data/i/gallery/i_gallery_likes_response.dart b/lib/src/data/i/gallery/i_gallery_likes_response.dart new file mode 100644 index 00000000..fb5c704f --- /dev/null +++ b/lib/src/data/i/gallery/i_gallery_likes_response.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:misskey_dart/misskey_dart.dart'; + +part 'i_gallery_likes_response.freezed.dart'; +part 'i_gallery_likes_response.g.dart'; + +@freezed +class IGalleryLikesResponse with _$IGalleryLikesResponse { + const factory IGalleryLikesResponse({ + required String id, + required GalleryPost post, + }) = _IGalleryLikesResponse; + + factory IGalleryLikesResponse.fromJson(Map json) => + _$IGalleryLikesResponseFromJson(json); +} diff --git a/lib/src/data/i/gallery/i_gallery_likes_response.freezed.dart b/lib/src/data/i/gallery/i_gallery_likes_response.freezed.dart new file mode 100644 index 00000000..00a5860f --- /dev/null +++ b/lib/src/data/i/gallery/i_gallery_likes_response.freezed.dart @@ -0,0 +1,187 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'i_gallery_likes_response.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +IGalleryLikesResponse _$IGalleryLikesResponseFromJson( + Map json) { + return _IGalleryLikesResponse.fromJson(json); +} + +/// @nodoc +mixin _$IGalleryLikesResponse { + String get id => throw _privateConstructorUsedError; + GalleryPost get post => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $IGalleryLikesResponseCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $IGalleryLikesResponseCopyWith<$Res> { + factory $IGalleryLikesResponseCopyWith(IGalleryLikesResponse value, + $Res Function(IGalleryLikesResponse) then) = + _$IGalleryLikesResponseCopyWithImpl<$Res, IGalleryLikesResponse>; + @useResult + $Res call({String id, GalleryPost post}); + + $GalleryPostCopyWith<$Res> get post; +} + +/// @nodoc +class _$IGalleryLikesResponseCopyWithImpl<$Res, + $Val extends IGalleryLikesResponse> + implements $IGalleryLikesResponseCopyWith<$Res> { + _$IGalleryLikesResponseCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? post = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + post: null == post + ? _value.post + : post // ignore: cast_nullable_to_non_nullable + as GalleryPost, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $GalleryPostCopyWith<$Res> get post { + return $GalleryPostCopyWith<$Res>(_value.post, (value) { + return _then(_value.copyWith(post: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$IGalleryLikesResponseImplCopyWith<$Res> + implements $IGalleryLikesResponseCopyWith<$Res> { + factory _$$IGalleryLikesResponseImplCopyWith( + _$IGalleryLikesResponseImpl value, + $Res Function(_$IGalleryLikesResponseImpl) then) = + __$$IGalleryLikesResponseImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String id, GalleryPost post}); + + @override + $GalleryPostCopyWith<$Res> get post; +} + +/// @nodoc +class __$$IGalleryLikesResponseImplCopyWithImpl<$Res> + extends _$IGalleryLikesResponseCopyWithImpl<$Res, + _$IGalleryLikesResponseImpl> + implements _$$IGalleryLikesResponseImplCopyWith<$Res> { + __$$IGalleryLikesResponseImplCopyWithImpl(_$IGalleryLikesResponseImpl _value, + $Res Function(_$IGalleryLikesResponseImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? post = null, + }) { + return _then(_$IGalleryLikesResponseImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + post: null == post + ? _value.post + : post // ignore: cast_nullable_to_non_nullable + as GalleryPost, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$IGalleryLikesResponseImpl implements _IGalleryLikesResponse { + const _$IGalleryLikesResponseImpl({required this.id, required this.post}); + + factory _$IGalleryLikesResponseImpl.fromJson(Map json) => + _$$IGalleryLikesResponseImplFromJson(json); + + @override + final String id; + @override + final GalleryPost post; + + @override + String toString() { + return 'IGalleryLikesResponse(id: $id, post: $post)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$IGalleryLikesResponseImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.post, post) || other.post == post)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, id, post); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$IGalleryLikesResponseImplCopyWith<_$IGalleryLikesResponseImpl> + get copyWith => __$$IGalleryLikesResponseImplCopyWithImpl< + _$IGalleryLikesResponseImpl>(this, _$identity); + + @override + Map toJson() { + return _$$IGalleryLikesResponseImplToJson( + this, + ); + } +} + +abstract class _IGalleryLikesResponse implements IGalleryLikesResponse { + const factory _IGalleryLikesResponse( + {required final String id, + required final GalleryPost post}) = _$IGalleryLikesResponseImpl; + + factory _IGalleryLikesResponse.fromJson(Map json) = + _$IGalleryLikesResponseImpl.fromJson; + + @override + String get id; + @override + GalleryPost get post; + @override + @JsonKey(ignore: true) + _$$IGalleryLikesResponseImplCopyWith<_$IGalleryLikesResponseImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/i/gallery/i_gallery_likes_response.g.dart b/lib/src/data/i/gallery/i_gallery_likes_response.g.dart new file mode 100644 index 00000000..44bc9e96 --- /dev/null +++ b/lib/src/data/i/gallery/i_gallery_likes_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'i_gallery_likes_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$IGalleryLikesResponseImpl _$$IGalleryLikesResponseImplFromJson( + Map json) => + _$IGalleryLikesResponseImpl( + id: json['id'] as String, + post: GalleryPost.fromJson(json['post'] as Map), + ); + +Map _$$IGalleryLikesResponseImplToJson( + _$IGalleryLikesResponseImpl instance) => + { + 'id': instance.id, + 'post': instance.post.toJson(), + }; diff --git a/lib/src/data/i/gallery/i_gallery_posts_request.dart b/lib/src/data/i/gallery/i_gallery_posts_request.dart new file mode 100644 index 00000000..aa1673c2 --- /dev/null +++ b/lib/src/data/i/gallery/i_gallery_posts_request.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'i_gallery_posts_request.freezed.dart'; +part 'i_gallery_posts_request.g.dart'; + +@freezed +class IGalleryPostsRequest with _$IGalleryPostsRequest { + const factory IGalleryPostsRequest({ + int? limit, + String? sinceId, + String? untilId, + }) = _IGalleryPostsRequest; + + factory IGalleryPostsRequest.fromJson(Map json) => + _$IGalleryPostsRequestFromJson(json); +} diff --git a/lib/src/data/i/gallery/i_gallery_posts_request.freezed.dart b/lib/src/data/i/gallery/i_gallery_posts_request.freezed.dart new file mode 100644 index 00000000..98e20be8 --- /dev/null +++ b/lib/src/data/i/gallery/i_gallery_posts_request.freezed.dart @@ -0,0 +1,189 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'i_gallery_posts_request.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +IGalleryPostsRequest _$IGalleryPostsRequestFromJson(Map json) { + return _IGalleryPostsRequest.fromJson(json); +} + +/// @nodoc +mixin _$IGalleryPostsRequest { + int? get limit => throw _privateConstructorUsedError; + String? get sinceId => throw _privateConstructorUsedError; + String? get untilId => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $IGalleryPostsRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $IGalleryPostsRequestCopyWith<$Res> { + factory $IGalleryPostsRequestCopyWith(IGalleryPostsRequest value, + $Res Function(IGalleryPostsRequest) then) = + _$IGalleryPostsRequestCopyWithImpl<$Res, IGalleryPostsRequest>; + @useResult + $Res call({int? limit, String? sinceId, String? untilId}); +} + +/// @nodoc +class _$IGalleryPostsRequestCopyWithImpl<$Res, + $Val extends IGalleryPostsRequest> + implements $IGalleryPostsRequestCopyWith<$Res> { + _$IGalleryPostsRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? limit = freezed, + Object? sinceId = freezed, + Object? untilId = freezed, + }) { + return _then(_value.copyWith( + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + sinceId: freezed == sinceId + ? _value.sinceId + : sinceId // ignore: cast_nullable_to_non_nullable + as String?, + untilId: freezed == untilId + ? _value.untilId + : untilId // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$IGalleryPostsRequestImplCopyWith<$Res> + implements $IGalleryPostsRequestCopyWith<$Res> { + factory _$$IGalleryPostsRequestImplCopyWith(_$IGalleryPostsRequestImpl value, + $Res Function(_$IGalleryPostsRequestImpl) then) = + __$$IGalleryPostsRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int? limit, String? sinceId, String? untilId}); +} + +/// @nodoc +class __$$IGalleryPostsRequestImplCopyWithImpl<$Res> + extends _$IGalleryPostsRequestCopyWithImpl<$Res, _$IGalleryPostsRequestImpl> + implements _$$IGalleryPostsRequestImplCopyWith<$Res> { + __$$IGalleryPostsRequestImplCopyWithImpl(_$IGalleryPostsRequestImpl _value, + $Res Function(_$IGalleryPostsRequestImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? limit = freezed, + Object? sinceId = freezed, + Object? untilId = freezed, + }) { + return _then(_$IGalleryPostsRequestImpl( + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, + sinceId: freezed == sinceId + ? _value.sinceId + : sinceId // ignore: cast_nullable_to_non_nullable + as String?, + untilId: freezed == untilId + ? _value.untilId + : untilId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$IGalleryPostsRequestImpl implements _IGalleryPostsRequest { + const _$IGalleryPostsRequestImpl({this.limit, this.sinceId, this.untilId}); + + factory _$IGalleryPostsRequestImpl.fromJson(Map json) => + _$$IGalleryPostsRequestImplFromJson(json); + + @override + final int? limit; + @override + final String? sinceId; + @override + final String? untilId; + + @override + String toString() { + return 'IGalleryPostsRequest(limit: $limit, sinceId: $sinceId, untilId: $untilId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$IGalleryPostsRequestImpl && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.sinceId, sinceId) || other.sinceId == sinceId) && + (identical(other.untilId, untilId) || other.untilId == untilId)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, limit, sinceId, untilId); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$IGalleryPostsRequestImplCopyWith<_$IGalleryPostsRequestImpl> + get copyWith => + __$$IGalleryPostsRequestImplCopyWithImpl<_$IGalleryPostsRequestImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$IGalleryPostsRequestImplToJson( + this, + ); + } +} + +abstract class _IGalleryPostsRequest implements IGalleryPostsRequest { + const factory _IGalleryPostsRequest( + {final int? limit, + final String? sinceId, + final String? untilId}) = _$IGalleryPostsRequestImpl; + + factory _IGalleryPostsRequest.fromJson(Map json) = + _$IGalleryPostsRequestImpl.fromJson; + + @override + int? get limit; + @override + String? get sinceId; + @override + String? get untilId; + @override + @JsonKey(ignore: true) + _$$IGalleryPostsRequestImplCopyWith<_$IGalleryPostsRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data/i/gallery/i_gallery_posts_request.g.dart b/lib/src/data/i/gallery/i_gallery_posts_request.g.dart new file mode 100644 index 00000000..94bc1d0f --- /dev/null +++ b/lib/src/data/i/gallery/i_gallery_posts_request.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'i_gallery_posts_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$IGalleryPostsRequestImpl _$$IGalleryPostsRequestImplFromJson( + Map json) => + _$IGalleryPostsRequestImpl( + limit: json['limit'] as int?, + sinceId: json['sinceId'] as String?, + untilId: json['untilId'] as String?, + ); + +Map _$$IGalleryPostsRequestImplToJson( + _$IGalleryPostsRequestImpl instance) => + { + 'limit': instance.limit, + 'sinceId': instance.sinceId, + 'untilId': instance.untilId, + }; diff --git a/lib/src/misskey_dart_base.dart b/lib/src/misskey_dart_base.dart index f6df80be..c64cbd0d 100644 --- a/lib/src/misskey_dart_base.dart +++ b/lib/src/misskey_dart_base.dart @@ -27,6 +27,7 @@ class Misskey { late final MisskeyAntenna antennas; late final MisskeyDrive drive; late final MisskeyFollowing following; + late final MisskeyGallery gallery; late final MisskeyBlocking blocking; late final MisskeyMute mute; late final MisskeyRenoteMute renoteMute; @@ -66,6 +67,7 @@ class Misskey { antennas = MisskeyAntenna(apiService: apiService); drive = MisskeyDrive(apiService); following = MisskeyFollowing(apiService: apiService); + gallery = MisskeyGallery(apiService: apiService); blocking = MisskeyBlocking(apiService: apiService); mute = MisskeyMute(apiService: apiService); renoteMute = MisskeyRenoteMute(apiService: apiService); diff --git a/lib/src/misskey_gallery.dart b/lib/src/misskey_gallery.dart new file mode 100644 index 00000000..eb8f6b96 --- /dev/null +++ b/lib/src/misskey_gallery.dart @@ -0,0 +1,83 @@ +import 'package:misskey_dart/misskey_dart.dart'; +import 'package:misskey_dart/src/services/api_service.dart'; + +class MisskeyGallery { + final MisskeyGalleryPosts posts; + + final ApiService _apiService; + + MisskeyGallery({required ApiService apiService}) + : _apiService = apiService, + posts = MisskeyGalleryPosts(apiService: apiService); + + /// 人気なギャラリーの投稿の一覧を取得します。 + Future> featured( + GalleryFeaturedRequest request, + ) async { + final response = + await _apiService.post("gallery/featured", request.toJson()); + return response.map((e) => GalleryPost.fromJson(e)); + } + + /// いいねの多いギャラリーの投稿の一覧を取得します。 + Future> popular() async { + final response = await _apiService.post("gallery/popular", {}); + return response.map((e) => GalleryPost.fromJson(e)); + } +} + +class MisskeyGalleryPosts { + final ApiService _apiService; + + MisskeyGalleryPosts({required ApiService apiService}) + : _apiService = apiService; + + /// ギャラリーの投稿を作成します。 + Future create(GalleryPostsCreateRequest request) async { + final response = await _apiService.post>( + "gallery/posts/create", + request.toJson(), + ); + return GalleryPost.fromJson(response); + } + + /// ギャラリーの投稿を削除します。 + Future delete(GalleryPostsDeleteRequest request) async { + await _apiService.post("gallery/posts/delete", request.toJson()); + } + + /// ギャラリーの投稿をいいねします。 + Future like(GalleryPostsLikeRequest request) async { + await _apiService.post("gallery/posts/like", request.toJson()); + } + + /// ギャラリーの投稿の一覧を取得します。 + Future> posts(GalleryPostsRequest request) async { + final response = + await _apiService.post("gallery/posts", request.toJson()); + return response.map((e) => GalleryPost.fromJson(e)); + } + + /// ギャラリーの投稿の情報を取得します。 + Future show(GalleryPostsShowRequest request) async { + final response = await _apiService.post>( + "gallery/posts/show", + request.toJson(), + ); + return GalleryPost.fromJson(response); + } + + /// ギャラリーの投稿のいいねを解除します。 + Future unlike(GalleryPostsUnlikeRequest request) async { + await _apiService.post("gallery/posts/unlike", request.toJson()); + } + + /// ギャラリーの投稿を更新します。 + Future update(GalleryPostsUpdateRequest request) async { + final response = await _apiService.post>( + "gallery/posts/update", + request.toJson(), + ); + return GalleryPost.fromJson(response); + } +} diff --git a/lib/src/misskey_i.dart b/lib/src/misskey_i.dart index 10880181..8e59063d 100644 --- a/lib/src/misskey_i.dart +++ b/lib/src/misskey_i.dart @@ -5,10 +5,12 @@ import 'package:misskey_dart/src/services/api_service.dart'; class MisskeyI { final ApiService _apiService; + final MisskeyIGallery gallery; final MisskeyIRegistry registry; MisskeyI({required ApiService apiService}) : _apiService = apiService, + gallery = MisskeyIGallery(apiService: apiService), registry = MisskeyIRegistry(apiService: apiService); /// 自分自身の情報を取得します。 @@ -48,6 +50,28 @@ class MisskeyI { } } +class MisskeyIGallery { + final ApiService _apiService; + + MisskeyIGallery({required ApiService apiService}) : _apiService = apiService; + + /// ギャラリーの投稿の一覧を取得します。 + Future> likes( + IGalleryLikesRequest request, + ) async { + final response = + await _apiService.post("i/gallery/likes", request.toJson()); + return response.map((e) => IGalleryLikesResponse.fromJson(e)); + } + + /// ギャラリーの投稿の一覧を取得します。 + Future> posts(IGalleryPostsRequest request) async { + final response = + await _apiService.post("i/gallery/posts", request.toJson()); + return response.map((e) => GalleryPost.fromJson(e)); + } +} + class MisskeyIRegistry { final ApiService _apiService; diff --git a/test/misskey_gallery_test.dart b/test/misskey_gallery_test.dart new file mode 100644 index 00000000..3c1a2108 --- /dev/null +++ b/test/misskey_gallery_test.dart @@ -0,0 +1,138 @@ +import 'package:misskey_dart/misskey_dart.dart'; +import 'package:test/test.dart'; + +import 'util/misskey_dart_test_util.dart'; + +void main() async { + test("featured", () async { + final file = await adminClient.createDriveFile(); + final post = await adminClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + await userClient.gallery.posts + .like(GalleryPostsLikeRequest(postId: post.id)); + final response = + await userClient.gallery.featured(GalleryFeaturedRequest()); + expect(response.toList(), isNotEmpty); + }); + + test("popular", () async { + final file = await adminClient.createDriveFile(); + final post = await adminClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + await userClient.gallery.posts + .like(GalleryPostsLikeRequest(postId: post.id)); + final response = await userClient.gallery.popular(); + expect(response.toList(), isNotEmpty); + }); + + group("post", () { + test("create", () async { + final file = await userClient.createDriveFile(); + final post = await userClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + description: "description", + fileIds: [file.id], + isSensitive: false, + ), + ); + expect(post.title, equals("test")); + }); + + test("delete", () async { + final file = await userClient.createDriveFile(); + final post = await userClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + await userClient.gallery.posts + .delete(GalleryPostsDeleteRequest(postId: post.id)); + final posts = await userClient.i.gallery.posts(IGalleryPostsRequest()); + expect(posts.map((e) => e.id), isNot(contains(post.id))); + }); + + test("like", () async { + final file = await adminClient.createDriveFile(); + final post = await adminClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + await userClient.gallery.posts + .like(GalleryPostsLikeRequest(postId: post.id)); + }); + + test("posts", () async { + final file = await userClient.createDriveFile(); + final post = await userClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + final response = + await userClient.gallery.posts.posts(GalleryPostsRequest()); + expect(response.map((e) => e.id), contains(post.id)); + }); + + test("show", () async { + final file = await userClient.createDriveFile(); + final post = await userClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + final response = await userClient.gallery.posts + .show(GalleryPostsShowRequest(postId: post.id)); + expect(response.title, equals(post.title)); + }); + + test("unlike", () async { + final file = await adminClient.createDriveFile(); + final post = await adminClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + await userClient.gallery.posts + .like(GalleryPostsLikeRequest(postId: post.id)); + await userClient.gallery.posts + .unlike(GalleryPostsUnlikeRequest(postId: post.id)); + final likes = await userClient.i.gallery.likes(IGalleryLikesRequest()); + expect(likes.map((e) => e.post.id), isNot(contains(post.id))); + }); + + test("update", () async { + final file = await userClient.createDriveFile(); + final post = await userClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + final updated = await userClient.gallery.posts.update( + GalleryPostsUpdateRequest( + postId: post.id, + title: "updated", + description: "updated", + fileIds: [file.id], + isSensitive: true, + ), + ); + expect(updated.title, equals("updated")); + }); + }); +} diff --git a/test/misskey_i_test.dart b/test/misskey_i_test.dart index 49737d30..154382cb 100644 --- a/test/misskey_i_test.dart +++ b/test/misskey_i_test.dart @@ -50,6 +50,34 @@ void main() async { await userClient.i.update(IUpdateRequest()); }); + group("gallery", () { + test("likes", () async { + final file = await adminClient.createDriveFile(); + final post = await adminClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + await userClient.gallery.posts + .like(GalleryPostsLikeRequest(postId: post.id)); + final response = await userClient.i.gallery.likes(IGalleryLikesRequest()); + expect(response.map((e) => e.post.id), contains(post.id)); + }); + + test("posts", () async { + final file = await userClient.createDriveFile(); + final post = await userClient.gallery.posts.create( + GalleryPostsCreateRequest( + title: "test", + fileIds: [file.id], + ), + ); + final response = await userClient.i.gallery.posts(IGalleryPostsRequest()); + expect(response.map((e) => e.id), contains(post.id)); + }); + }); + group("registry", () { test("getAll", () async { final key = Uuid().v4();