Skip to content

Commit

Permalink
Merge #100
Browse files Browse the repository at this point in the history
100: feat: fixed for the issue (#15) 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: myConsciousness <contact@shinyakato.dev>
  • Loading branch information
bors[bot] and myConsciousness committed Dec 30, 2022
2 parents 30298a2 + d0ea8c0 commit cbd49d3
Show file tree
Hide file tree
Showing 9 changed files with 769 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
- `GET /api/v1/tags/:id`
- `POST /api/v1/tags/:id/follow`
- `POST /api/v1/tags/:id/unfollow`
- Supported `reports API methods`. ([#15](https://github.com/mastodon-dart/mastodon-api/issues/15))
- `POST /api/v1/reports`

## v0.2.2

Expand Down
2 changes: 2 additions & 0 deletions lib/mastodon_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export 'package:mastodon_api/src/service/entities/preview_card.dart';
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/report.dart';
export 'package:mastodon_api/src/service/entities/report_category.dart';
export 'package:mastodon_api/src/service/entities/rule.dart';
export 'package:mastodon_api/src/service/entities/status.dart';
export 'package:mastodon_api/src/service/entities/suggested_reason.dart';
Expand Down
52 changes: 52 additions & 0 deletions lib/src/service/entities/report.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// 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 'account.dart';
import 'report_category.dart';

part 'report.freezed.dart';
part 'report.g.dart';

@freezed
class Report with _$Report {
@JsonSerializable(includeIfNull: false)
const factory Report({
/// The ID of the report in the database.
required String id,

/// The generic reason for the report.
required ReportCategory category,

/// The reason for the report.
required String comment,

/// The domain name of the instance.
List<String>? statusIds,

/// The domain name of the instance.
List<String>? ruleIds,

/// The account that was reported.
@JsonKey(name: 'target_account') required Account account,

/// Whether the report was forwarded to a remote domain.
@JsonKey(name: 'forwarded') required bool isForwarded,

/// Whether an action was taken yet.
@JsonKey(name: 'action_taken') required bool isActionTaken,

/// When an action was taken against the report.
DateTime? actionTakenAt,

/// When the report was created.
required DateTime createdAt,
}) = _Report;

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

0 comments on commit cbd49d3

Please sign in to comment.