Skip to content

Commit

Permalink
Misskey 2023.9 お知らせ対応
Browse files Browse the repository at this point in the history
  • Loading branch information
shiosyakeyakini-info committed Aug 28, 2023
1 parent a933c8f commit e430a65
Show file tree
Hide file tree
Showing 16 changed files with 472 additions and 30 deletions.
3 changes: 3 additions & 0 deletions lib/misskey_dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export 'src/enums/reaction_acceptance.dart';
export 'src/enums/streaming_request_type.dart';
export 'src/enums/users_sort_type.dart';
export 'src/enums/users_state.dart';
export 'src/enums/announcement_display_type.dart';
export 'src/enums/announcement_icon_type.dart';
export 'src/data/antennas/antennas_create_request.dart';
export 'src/data/antennas/antennas_delete_request.dart';
export 'src/data/antennas/antennas_notes_request.dart';
Expand Down Expand Up @@ -86,6 +88,7 @@ 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/notes/notes_clips_request.dart';
export 'src/data/notes/notes_timeline_request.dart';
export 'src/data/notes/notes_create_request.dart';
Expand Down
10 changes: 5 additions & 5 deletions lib/src/data/announcements_request.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:freezed_annotation/freezed_annotation.dart';

part 'announcements_request.freezed.dart';
Expand All @@ -8,11 +7,12 @@ part 'announcements_request.g.dart';
class AnnouncementsRequest with _$AnnouncementsRequest {
const factory AnnouncementsRequest({
int? limit,
bool? withUnreads,
@Deprecated("removed in Misskey 2023.9") bool? withUnreads,
bool? isActive,
String? sinceId,
String? untilId,
}) = _AnnouncementsRequest;

factory AnnouncementsRequest.fromJson(Map<String, Object?> json)
=> _$AnnouncementsRequestFromJson(json);
}
factory AnnouncementsRequest.fromJson(Map<String, Object?> json) =>
_$AnnouncementsRequestFromJson(json);
}
47 changes: 41 additions & 6 deletions lib/src/data/announcements_request.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ AnnouncementsRequest _$AnnouncementsRequestFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$AnnouncementsRequest {
int? get limit => throw _privateConstructorUsedError;
@Deprecated("removed in Misskey 2023.9")
bool? get withUnreads => throw _privateConstructorUsedError;
bool? get isActive => throw _privateConstructorUsedError;
String? get sinceId => throw _privateConstructorUsedError;
String? get untilId => throw _privateConstructorUsedError;

Expand All @@ -37,7 +39,12 @@ abstract class $AnnouncementsRequestCopyWith<$Res> {
$Res Function(AnnouncementsRequest) then) =
_$AnnouncementsRequestCopyWithImpl<$Res, AnnouncementsRequest>;
@useResult
$Res call({int? limit, bool? withUnreads, String? sinceId, String? untilId});
$Res call(
{int? limit,
@Deprecated("removed in Misskey 2023.9") bool? withUnreads,
bool? isActive,
String? sinceId,
String? untilId});
}

/// @nodoc
Expand All @@ -56,6 +63,7 @@ class _$AnnouncementsRequestCopyWithImpl<$Res,
$Res call({
Object? limit = freezed,
Object? withUnreads = freezed,
Object? isActive = freezed,
Object? sinceId = freezed,
Object? untilId = freezed,
}) {
Expand All @@ -68,6 +76,10 @@ class _$AnnouncementsRequestCopyWithImpl<$Res,
? _value.withUnreads
: withUnreads // ignore: cast_nullable_to_non_nullable
as bool?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool?,
sinceId: freezed == sinceId
? _value.sinceId
: sinceId // ignore: cast_nullable_to_non_nullable
Expand All @@ -88,7 +100,12 @@ abstract class _$$_AnnouncementsRequestCopyWith<$Res>
__$$_AnnouncementsRequestCopyWithImpl<$Res>;
@override
@useResult
$Res call({int? limit, bool? withUnreads, String? sinceId, String? untilId});
$Res call(
{int? limit,
@Deprecated("removed in Misskey 2023.9") bool? withUnreads,
bool? isActive,
String? sinceId,
String? untilId});
}

/// @nodoc
Expand All @@ -104,6 +121,7 @@ class __$$_AnnouncementsRequestCopyWithImpl<$Res>
$Res call({
Object? limit = freezed,
Object? withUnreads = freezed,
Object? isActive = freezed,
Object? sinceId = freezed,
Object? untilId = freezed,
}) {
Expand All @@ -116,6 +134,10 @@ class __$$_AnnouncementsRequestCopyWithImpl<$Res>
? _value.withUnreads
: withUnreads // ignore: cast_nullable_to_non_nullable
as bool?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool?,
sinceId: freezed == sinceId
? _value.sinceId
: sinceId // ignore: cast_nullable_to_non_nullable
Expand All @@ -132,23 +154,30 @@ class __$$_AnnouncementsRequestCopyWithImpl<$Res>
@JsonSerializable()
class _$_AnnouncementsRequest implements _AnnouncementsRequest {
const _$_AnnouncementsRequest(
{this.limit, this.withUnreads, this.sinceId, this.untilId});
{this.limit,
@Deprecated("removed in Misskey 2023.9") this.withUnreads,
this.isActive,
this.sinceId,
this.untilId});

factory _$_AnnouncementsRequest.fromJson(Map<String, dynamic> json) =>
_$$_AnnouncementsRequestFromJson(json);

@override
final int? limit;
@override
@Deprecated("removed in Misskey 2023.9")
final bool? withUnreads;
@override
final bool? isActive;
@override
final String? sinceId;
@override
final String? untilId;

@override
String toString() {
return 'AnnouncementsRequest(limit: $limit, withUnreads: $withUnreads, sinceId: $sinceId, untilId: $untilId)';
return 'AnnouncementsRequest(limit: $limit, withUnreads: $withUnreads, isActive: $isActive, sinceId: $sinceId, untilId: $untilId)';
}

@override
Expand All @@ -159,14 +188,16 @@ class _$_AnnouncementsRequest implements _AnnouncementsRequest {
(identical(other.limit, limit) || other.limit == limit) &&
(identical(other.withUnreads, withUnreads) ||
other.withUnreads == withUnreads) &&
(identical(other.isActive, isActive) ||
other.isActive == isActive) &&
(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, withUnreads, sinceId, untilId);
Object.hash(runtimeType, limit, withUnreads, isActive, sinceId, untilId);

@JsonKey(ignore: true)
@override
Expand All @@ -186,7 +217,8 @@ class _$_AnnouncementsRequest implements _AnnouncementsRequest {
abstract class _AnnouncementsRequest implements AnnouncementsRequest {
const factory _AnnouncementsRequest(
{final int? limit,
final bool? withUnreads,
@Deprecated("removed in Misskey 2023.9") final bool? withUnreads,
final bool? isActive,
final String? sinceId,
final String? untilId}) = _$_AnnouncementsRequest;

Expand All @@ -196,8 +228,11 @@ abstract class _AnnouncementsRequest implements AnnouncementsRequest {
@override
int? get limit;
@override
@Deprecated("removed in Misskey 2023.9")
bool? get withUnreads;
@override
bool? get isActive;
@override
String? get sinceId;
@override
String? get untilId;
Expand Down
2 changes: 2 additions & 0 deletions lib/src/data/announcements_request.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 14 additions & 11 deletions lib/src/data/announcements_response.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:misskey_dart/src/converters/date_time_converter.dart';
import 'package:misskey_dart/src/converters/uri_converter.dart';
import 'package:misskey_dart/src/enums/announcement_display_type.dart';
import 'package:misskey_dart/src/enums/announcement_icon_type.dart';

part 'announcements_response.freezed.dart';
part 'announcements_response.g.dart';
Expand All @@ -10,18 +11,20 @@ part 'announcements_response.g.dart';
class AnnouncementsResponse with _$AnnouncementsResponse {
const factory AnnouncementsResponse({
required String id,
@DateTimeConverter()
required DateTime createdAt,
@NullableDateTimeConverter()
DateTime? updatedAt,
@DateTimeConverter() required DateTime createdAt,
@NullableDateTimeConverter() DateTime? updatedAt,
required String text,
required String title,
@UriConverter()
Uri? imageUrl,
@UriConverter() Uri? imageUrl,
AnnouncementIconType? icon,
AnnouncementDisplayType? display,
bool? needConfirmationToRead,
bool? forYou,
bool? isRead,

@Default(false) bool forExistingUsers,
String? userId,
}) = _AnnouncementsResponse;

factory AnnouncementsResponse.fromJson(Map<String, Object?> json)
=> _$AnnouncementsResponseFromJson(json);
}
factory AnnouncementsResponse.fromJson(Map<String, Object?> json) =>
_$AnnouncementsResponseFromJson(json);
}
Loading

0 comments on commit e430a65

Please sign in to comment.