Skip to content

Commit

Permalink
docs: fixed for the issue (#30)
Browse files Browse the repository at this point in the history
Co-authored-by: myConsciousness <contact@shinyakato.dev>”
  • Loading branch information
myConsciousness committed Dec 31, 2022
1 parent 6008a87 commit 90ed93b
Show file tree
Hide file tree
Showing 15 changed files with 750 additions and 283 deletions.
3 changes: 2 additions & 1 deletion lib/mastodon_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export 'package:mastodon_api/src/service/entities/instance_usage.dart';
export 'package:mastodon_api/src/service/entities/instance_usage_users.dart';
export 'package:mastodon_api/src/service/entities/media_attachment.dart';
export 'package:mastodon_api/src/service/entities/media_attachment_type.dart';
export 'package:mastodon_api/src/service/entities/notification_snapshot.dart';
export 'package:mastodon_api/src/service/entities/poll.dart';
export 'package:mastodon_api/src/service/entities/poll_option.dart';
export 'package:mastodon_api/src/service/entities/position_marker.dart';
Expand All @@ -52,12 +53,12 @@ export 'package:mastodon_api/src/service/entities/preview_card_type.dart';
export 'package:mastodon_api/src/service/entities/rate_limit.dart';
export 'package:mastodon_api/src/service/entities/registered_application.dart';
export 'package:mastodon_api/src/service/entities/status.dart';
export 'package:mastodon_api/src/service/entities/status_snapshot.dart';
export 'package:mastodon_api/src/service/entities/suggested_reason.dart';
export 'package:mastodon_api/src/service/entities/suggestion.dart';
export 'package:mastodon_api/src/service/entities/tag.dart';
export 'package:mastodon_api/src/service/entities/thumbnail.dart';
export 'package:mastodon_api/src/service/entities/thumbnail_version.dart';
export 'package:mastodon_api/src/service/entities/timeline_snapshot.dart';
export 'package:mastodon_api/src/service/entities/token.dart';
export 'package:mastodon_api/src/service/entities/usage_statistics.dart';
export 'package:mastodon_api/src/service/mastodon_v1_service.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@ import 'package:freezed_annotation/freezed_annotation.dart';

import 'position_marker.dart';

part 'timeline_snapshot.freezed.dart';
part 'timeline_snapshot.g.dart';
part 'notification_snapshot.freezed.dart';
part 'notification_snapshot.g.dart';

/// Represents the last read position within a user's timelines.
@freezed
class TimelineSnapshot with _$TimelineSnapshot {
@JsonSerializable(includeIfNull: false)
const factory TimelineSnapshot({
class NotificationSnapshot with _$NotificationSnapshot {
const factory NotificationSnapshot({
/// Snapshot for notifications.
PositionMarker? notifications,
@JsonKey(name: 'notifications') required PositionMarker marker,
}) = _NotificationSnapshot;

/// Snapshot for home timeline.
PositionMarker? home,
}) = _TimelineSnapshot;

factory TimelineSnapshot.fromJson(Map<String, Object?> json) =>
_$TimelineSnapshotFromJson(json);
factory NotificationSnapshot.fromJson(Map<String, Object?> json) =>
_$NotificationSnapshotFromJson(json);
}
176 changes: 176 additions & 0 deletions lib/src/service/entities/notification_snapshot.freezed.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
// 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 'notification_snapshot.dart';

// **************************************************************************
// FreezedGenerator
// **************************************************************************

T _$identity<T>(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');

NotificationSnapshot _$NotificationSnapshotFromJson(Map<String, dynamic> json) {
return _NotificationSnapshot.fromJson(json);
}

/// @nodoc
mixin _$NotificationSnapshot {
/// Snapshot for notifications.
@JsonKey(name: 'notifications')
PositionMarker get marker => throw _privateConstructorUsedError;

Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$NotificationSnapshotCopyWith<NotificationSnapshot> get copyWith =>
throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $NotificationSnapshotCopyWith<$Res> {
factory $NotificationSnapshotCopyWith(NotificationSnapshot value,
$Res Function(NotificationSnapshot) then) =
_$NotificationSnapshotCopyWithImpl<$Res, NotificationSnapshot>;
@useResult
$Res call({@JsonKey(name: 'notifications') PositionMarker marker});

$PositionMarkerCopyWith<$Res> get marker;
}

/// @nodoc
class _$NotificationSnapshotCopyWithImpl<$Res,
$Val extends NotificationSnapshot>
implements $NotificationSnapshotCopyWith<$Res> {
_$NotificationSnapshotCopyWithImpl(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? marker = null,
}) {
return _then(_value.copyWith(
marker: null == marker
? _value.marker
: marker // ignore: cast_nullable_to_non_nullable
as PositionMarker,
) as $Val);
}

@override
@pragma('vm:prefer-inline')
$PositionMarkerCopyWith<$Res> get marker {
return $PositionMarkerCopyWith<$Res>(_value.marker, (value) {
return _then(_value.copyWith(marker: value) as $Val);
});
}
}

/// @nodoc
abstract class _$$_NotificationSnapshotCopyWith<$Res>
implements $NotificationSnapshotCopyWith<$Res> {
factory _$$_NotificationSnapshotCopyWith(_$_NotificationSnapshot value,
$Res Function(_$_NotificationSnapshot) then) =
__$$_NotificationSnapshotCopyWithImpl<$Res>;
@override
@useResult
$Res call({@JsonKey(name: 'notifications') PositionMarker marker});

@override
$PositionMarkerCopyWith<$Res> get marker;
}

/// @nodoc
class __$$_NotificationSnapshotCopyWithImpl<$Res>
extends _$NotificationSnapshotCopyWithImpl<$Res, _$_NotificationSnapshot>
implements _$$_NotificationSnapshotCopyWith<$Res> {
__$$_NotificationSnapshotCopyWithImpl(_$_NotificationSnapshot _value,
$Res Function(_$_NotificationSnapshot) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
@override
$Res call({
Object? marker = null,
}) {
return _then(_$_NotificationSnapshot(
marker: null == marker
? _value.marker
: marker // ignore: cast_nullable_to_non_nullable
as PositionMarker,
));
}
}

/// @nodoc
@JsonSerializable()
class _$_NotificationSnapshot implements _NotificationSnapshot {
const _$_NotificationSnapshot(
{@JsonKey(name: 'notifications') required this.marker});

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

/// Snapshot for notifications.
@override
@JsonKey(name: 'notifications')
final PositionMarker marker;

@override
String toString() {
return 'NotificationSnapshot(marker: $marker)';
}

@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_NotificationSnapshot &&
(identical(other.marker, marker) || other.marker == marker));
}

@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, marker);

@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$_NotificationSnapshotCopyWith<_$_NotificationSnapshot> get copyWith =>
__$$_NotificationSnapshotCopyWithImpl<_$_NotificationSnapshot>(
this, _$identity);

@override
Map<String, dynamic> toJson() {
return _$$_NotificationSnapshotToJson(
this,
);
}
}

abstract class _NotificationSnapshot implements NotificationSnapshot {
const factory _NotificationSnapshot(
{@JsonKey(name: 'notifications')
required final PositionMarker marker}) = _$_NotificationSnapshot;

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

@override

/// Snapshot for notifications.
@JsonKey(name: 'notifications')
PositionMarker get marker;
@override
@JsonKey(ignore: true)
_$$_NotificationSnapshotCopyWith<_$_NotificationSnapshot> get copyWith =>
throw _privateConstructorUsedError;
}
31 changes: 31 additions & 0 deletions lib/src/service/entities/notification_snapshot.g.dart

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

25 changes: 25 additions & 0 deletions lib/src/service/entities/status_snapshot.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2022 Kato Shinya. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided the conditions.

// ignore_for_file: invalid_annotation_target

// 📦 Package imports:
import 'package:freezed_annotation/freezed_annotation.dart';

import 'position_marker.dart';

part 'status_snapshot.freezed.dart';
part 'status_snapshot.g.dart';

/// Represents the last read position within a user's timelines.
@freezed
class StatusSnapshot with _$StatusSnapshot {
const factory StatusSnapshot({
/// Snapshot for home timeline.
@JsonKey(name: 'home') required PositionMarker marker,
}) = _StatusSnapshot;

factory StatusSnapshot.fromJson(Map<String, Object?> json) =>
_$StatusSnapshotFromJson(json);
}

0 comments on commit 90ed93b

Please sign in to comment.