Skip to content

Commit

Permalink
rename top enum and format files
Browse files Browse the repository at this point in the history
  • Loading branch information
javoeria committed Mar 18, 2023
1 parent 32c504c commit 94ecdee
Show file tree
Hide file tree
Showing 48 changed files with 1,270 additions and 656 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.1.0

* Updated `Review` and `UserReview` models.
* Top subtype enum renamed to filter.

## 2.0.0

* **BREAKING**: Migrate to the new REST API v4.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# jikan_api

[![Build Status](https://app.travis-ci.com/javoeria/jikan-dart.svg?branch=master)](https://app.travis-ci.com/javoeria/jikan-dart)
[![pub package](https://img.shields.io/pub/v/jikan_api.svg)](https://pub.dartlang.org/packages/jikan_api)
[![Build Status](https://github.com/javoeria/jikan-dart/actions/workflows/dart.yml/badge.svg?branch=master)](https://github.com/javoeria/jikan-dart/actions/workflows/dart.yml)
[![pub package](https://img.shields.io/pub/v/jikan_api.svg)](https://pub.dev/packages/jikan_api)

### Anime

Expand Down Expand Up @@ -54,9 +54,9 @@ Future<BuiltList<Picture>> getCharacterPictures(int id);

```dart
Future<BuiltList<Anime>> searchAnime(
{String? query, AnimeType? type, List<int>? genres, List<int>? producers, String? orderBy, String? sort, String? rawQuery, int page = 1});
{String? query, AnimeType? type, List<int>? genres, List<int>? producers, String? orderBy, String? sort, int page = 1});
Future<BuiltList<Manga>> searchManga(
{String? query, MangaType? type, List<int>? genres, List<int>? magazines, String? orderBy, String? sort, String? rawQuery, int page = 1});
{String? query, MangaType? type, List<int>? genres, List<int>? magazines, String? orderBy, String? sort, int page = 1});
Future<BuiltList<Person>> searchPeople({String? query, String? orderBy, String? sort, int page = 1});
Future<BuiltList<Character>> searchCharacters({String? query, String? orderBy, String? sort, int page = 1});
```
Expand All @@ -78,8 +78,8 @@ Future<BuiltList<Anime>> getSchedules({WeekDay? weekday, int page = 1});
### Top

```dart
Future<BuiltList<Anime>> getTopAnime({TopType? type, TopSubtype? subtype, int page = 1});
Future<BuiltList<Manga>> getTopManga({TopType? type, TopSubtype? subtype, int page = 1});
Future<BuiltList<Anime>> getTopAnime({TopType? type, TopFilter? filter, int page = 1});
Future<BuiltList<Manga>> getTopManga({TopType? type, TopFilter? filter, int page = 1});
Future<BuiltList<Person>> getTopPeople({int page = 1});
Future<BuiltList<Character>> getTopCharacters({int page = 1});
Future<BuiltList<UserReview>> getTopReviews({int page = 1});
Expand Down Expand Up @@ -132,5 +132,5 @@ Future<BuiltList<UserRecommendation>> getRecentMangaRecommendations({int page =

```dart
Future<BuiltList<WatchEpisode>> getWatchEpisodes({bool popular = false});
Future<BuiltList<WatchPromoEpisode>> getWatchPromos({bool popular = false});
Future<BuiltList<WatchPromo>> getWatchPromos({bool popular = false});
```
2 changes: 1 addition & 1 deletion example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import 'package:jikan_api/jikan_api.dart';

void main() async {
var jikan = Jikan();
var top = await jikan.getTopAnime(type: TopType.tv, subtype: TopSubtype.airing);
var top = await jikan.getTopAnime(type: TopType.tv, filter: TopFilter.airing);
print(top);
}
8 changes: 4 additions & 4 deletions lib/src/jikan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -370,21 +370,21 @@ class Jikan {
}

Future<BuiltList<Anime>> getTopAnime(
{TopType? type, TopSubtype? subtype, int page = 1}) async {
{TopType? type, TopFilter? filter, int page = 1}) async {
var url = '/top/anime?page=$page';
if (type != null) url += '&type=${_enumToString(type)}';
if (subtype != null) url += '&filter=${_enumToString(subtype)}';
if (filter != null) url += '&filter=${_enumToString(filter)}';
var response = await _getResponse(url);

final top = response['data'] ?? [];
return BuiltList(top.map((i) => Anime.fromJson(i)));
}

Future<BuiltList<Manga>> getTopManga(
{TopType? type, TopSubtype? subtype, int page = 1}) async {
{TopType? type, TopFilter? filter, int page = 1}) async {
var url = '/top/manga?page=$page';
if (type != null) url += '&type=${_enumToString(type)}';
if (subtype != null) url += '&filter=${_enumToString(subtype)}';
if (filter != null) url += '&filter=${_enumToString(filter)}';
var response = await _getResponse(url);

final top = response['data'] ?? [];
Expand Down
80 changes: 41 additions & 39 deletions lib/src/model/anime/anime.g.dart

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

19 changes: 10 additions & 9 deletions lib/src/model/anime/anime_meta.g.dart

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

36 changes: 15 additions & 21 deletions lib/src/model/anime/episode.g.dart

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

10 changes: 7 additions & 3 deletions lib/src/model/anime/promo.g.dart

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

36 changes: 15 additions & 21 deletions lib/src/model/character/character.g.dart

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

22 changes: 11 additions & 11 deletions lib/src/model/character/character_meta.g.dart

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

8 changes: 6 additions & 2 deletions lib/src/model/common/archive.g.dart

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

Loading

0 comments on commit 94ecdee

Please sign in to comment.