Skip to content

Commit

Permalink
Merge #116
Browse files Browse the repository at this point in the history
116: refactor: renamed methods r=myConsciousness a=myConsciousness

# 1. Description

<!-- Provide a description of what this PR is doing.
If you're modifying existing behavior, describe the existing behavior, how this PR is changing it,
and what motivated the change. If this is a breaking change, specify explicitly which APIs have been
changed. -->

## 1.1. Checklist

<!-- Before you create this PR confirm that it meets all requirements listed below by checking the
relevant checkboxes (`[x]`). This will ensure a smooth and quick review process. -->

- [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `docs:` etc).
- [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs.
- [x] I have updated/added tests for ALL new/updated/fixed functionality.
- [x] I have updated/added relevant documentation in `docs` and added dartdoc comments with `///`.
- [x] I have updated/added relevant examples in `examples`.

## 1.2. Breaking Change

<!-- Does your PR require users to manually update their apps to accommodate your change?

If the PR is a breaking change this should be indicated with suffix "!"  (for example, `feat!:`, `fix!:`). See [Conventional Commit] for details.
-->

- [ ] Yes, this is a breaking change.
- [x] No, this is _not_ a breaking change.

## 1.3. Related Issues

<!-- Provide a list of issues related to this PR from the [issue database].
Indicate which of these issues are resolved or fixed by this PR, i.e. Fixes #xxxx* !-->

<!-- Links -->

[issue database]: https://github.com/mastodon-dart/mastodon-api/issues
[contributor guide]: https://github.com/mastodon-dart/mastodon-api/blob/main/CONTRIBUTING.md
[style guide]: https://github.com/mastodon-dart/mastodon-api/blob/main/STYLEGUIDE.md
[conventional commit]: https://conventionalcommits.org


Co-authored-by: Kraigo <kraigo@live.com>
Co-authored-by: myConsciousness <contact@shinyakato.dev>
  • Loading branch information
3 people committed Feb 2, 2023
2 parents 7b6ea6c + 3b59c57 commit 9681e8a
Show file tree
Hide file tree
Showing 9 changed files with 2,001 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/src/service/entities/status_context.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2023 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';

// 🌎 Project imports:
import '../../../mastodon_api.dart';

part 'status_context.freezed.dart';
part 'status_context.g.dart';

@freezed
class StatusContext with _$StatusContext {
@JsonSerializable(includeIfNull: false)
const factory StatusContext({
/// Parents in the thread.
required List<Status> ancestors,

/// Children in the thread.
required List<Status> descendants,
}) = _StatusesContext;

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

StatusContext _$StatusContextFromJson(Map<String, dynamic> json) {
return _StatusesContext.fromJson(json);
}

/// @nodoc
mixin _$StatusContext {
/// Parents in the thread.
List<Status> get ancestors => throw _privateConstructorUsedError;

/// Children in the thread.
List<Status> get descendants => throw _privateConstructorUsedError;

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

/// @nodoc
abstract class $StatusContextCopyWith<$Res> {
factory $StatusContextCopyWith(
StatusContext value, $Res Function(StatusContext) then) =
_$StatusContextCopyWithImpl<$Res, StatusContext>;
@useResult
$Res call({List<Status> ancestors, List<Status> descendants});
}

/// @nodoc
class _$StatusContextCopyWithImpl<$Res, $Val extends StatusContext>
implements $StatusContextCopyWith<$Res> {
_$StatusContextCopyWithImpl(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? ancestors = null,
Object? descendants = null,
}) {
return _then(_value.copyWith(
ancestors: null == ancestors
? _value.ancestors
: ancestors // ignore: cast_nullable_to_non_nullable
as List<Status>,
descendants: null == descendants
? _value.descendants
: descendants // ignore: cast_nullable_to_non_nullable
as List<Status>,
) as $Val);
}
}

/// @nodoc
abstract class _$$_StatusesContextCopyWith<$Res>
implements $StatusContextCopyWith<$Res> {
factory _$$_StatusesContextCopyWith(
_$_StatusesContext value, $Res Function(_$_StatusesContext) then) =
__$$_StatusesContextCopyWithImpl<$Res>;
@override
@useResult
$Res call({List<Status> ancestors, List<Status> descendants});
}

/// @nodoc
class __$$_StatusesContextCopyWithImpl<$Res>
extends _$StatusContextCopyWithImpl<$Res, _$_StatusesContext>
implements _$$_StatusesContextCopyWith<$Res> {
__$$_StatusesContextCopyWithImpl(
_$_StatusesContext _value, $Res Function(_$_StatusesContext) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
@override
$Res call({
Object? ancestors = null,
Object? descendants = null,
}) {
return _then(_$_StatusesContext(
ancestors: null == ancestors
? _value._ancestors
: ancestors // ignore: cast_nullable_to_non_nullable
as List<Status>,
descendants: null == descendants
? _value._descendants
: descendants // ignore: cast_nullable_to_non_nullable
as List<Status>,
));
}
}

/// @nodoc
@JsonSerializable(includeIfNull: false)
class _$_StatusesContext implements _StatusesContext {
const _$_StatusesContext(
{required final List<Status> ancestors,
required final List<Status> descendants})
: _ancestors = ancestors,
_descendants = descendants;

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

/// Parents in the thread.
final List<Status> _ancestors;

/// Parents in the thread.
@override
List<Status> get ancestors {
if (_ancestors is EqualUnmodifiableListView) return _ancestors;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_ancestors);
}

/// Children in the thread.
final List<Status> _descendants;

/// Children in the thread.
@override
List<Status> get descendants {
if (_descendants is EqualUnmodifiableListView) return _descendants;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_descendants);
}

@override
String toString() {
return 'StatusContext(ancestors: $ancestors, descendants: $descendants)';
}

@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_StatusesContext &&
const DeepCollectionEquality()
.equals(other._ancestors, _ancestors) &&
const DeepCollectionEquality()
.equals(other._descendants, _descendants));
}

@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_ancestors),
const DeepCollectionEquality().hash(_descendants));

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

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

abstract class _StatusesContext implements StatusContext {
const factory _StatusesContext(
{required final List<Status> ancestors,
required final List<Status> descendants}) = _$_StatusesContext;

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

@override

/// Parents in the thread.
List<Status> get ancestors;
@override

/// Children in the thread.
List<Status> get descendants;
@override
@JsonKey(ignore: true)
_$$_StatusesContextCopyWith<_$_StatusesContext> get copyWith =>
throw _privateConstructorUsedError;
}
37 changes: 37 additions & 0 deletions lib/src/service/entities/status_context.g.dart

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

Loading

0 comments on commit 9681e8a

Please sign in to comment.