diff --git a/.packages b/.packages index d3d9e43..b7b7b0b 100644 --- a/.packages +++ b/.packages @@ -3,7 +3,7 @@ # # For more info see: https://dart.dev/go/dot-packages-deprecation # -# Generated by pub on 2022-02-04 14:06:34.601754. +# Generated by pub on 2022-02-05 00:00:57.539877. async:file:///Users/moritz.fink/.pub-cache/hosted/pub.dartlang.org/async-2.8.2/lib/ charcode:file:///Users/moritz.fink/.pub-cache/hosted/pub.dartlang.org/charcode-1.3.1/lib/ collection:file:///Users/moritz.fink/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib/ diff --git a/example/README.md b/example/README.md index 5d99ba2..7df6233 100644 --- a/example/README.md +++ b/example/README.md @@ -1,19 +1,26 @@ # The Lord of the Rings API ``` +import 'package:lotr_api/lotr_api.dart'; + +void main() async { var lotrApi = LotrApi( apiKey: 'INSERT_YOUR_API_ACCESS_KEY_HERE', ); - Response quotes = await lotrApi.getQuotes( - sorting: QuoteSortings.byDialogAsc, + var quotes = await lotrApi.getQuotes( pagination: Pagination( limit: 10, - offset: 2, ), + sorting: QuoteSortings.byIdAsc, + idFilters: [ + Exists(), + ], dialogFilters: [ - MatchesRegex('Frodo'), + MatchesRegex('Saruman'), ], ); - print(quotes); + + print(quotes.docs); +} ``` diff --git a/lib/lotr_api.dart b/lib/lotr_api.dart index c6f315a..e38dc92 100644 --- a/lib/lotr_api.dart +++ b/lib/lotr_api.dart @@ -1,5 +1,3 @@ -export 'src/config/api_version.dart' show ApiVersion; - export 'src/model/book.dart' show Book; export 'src/model/chapter.dart' show Chapter; export 'src/model/character.dart' show Character; @@ -17,6 +15,7 @@ export 'src/query/filter/impl/includes.dart' show Includes; export 'src/query/filter/impl/less_than.dart' show LessThan; export 'src/query/filter/impl/less_than_or_equals.dart' show LessThanOrEquals; export 'src/query/filter/impl/matches.dart' show Matches; +export 'src/query/filter/impl/matches_regex.dart' show MatchesRegex; export 'src/query/filter/impl/not_equals.dart' show NotEquals; export 'src/query/filter/impl/not_exists.dart' show NotExists; export 'src/query/filter/impl/not_matches.dart' show NotMatches; diff --git a/lib/src/config/api_version.dart b/lib/src/config/api_version.dart deleted file mode 100644 index 4c9cc59..0000000 --- a/lib/src/config/api_version.dart +++ /dev/null @@ -1 +0,0 @@ -enum ApiVersion { v2 } diff --git a/lib/src/lotr_api.dart b/lib/src/lotr_api.dart index 840354f..ec14b67 100644 --- a/lib/src/lotr_api.dart +++ b/lib/src/lotr_api.dart @@ -9,8 +9,8 @@ import 'package:lotr_api/src/query/sorting/character/character_sorting.dart'; import 'package:lotr_api/src/query/sorting/movie/movie_sorting.dart'; import 'package:lotr_api/src/query/sorting/quote/quote_sorting.dart'; import 'package:lotr_api/src/query/sorting/sorting.dart'; +import 'package:lotr_api/src/util/utils.dart'; -import 'config/api_version.dart'; import 'model/book.dart'; import 'model/chapter.dart'; import 'model/character.dart'; @@ -22,14 +22,16 @@ import 'query/pagination/pagination.dart'; class LotrApi { final String? apiKey; - final ApiVersion apiVersion; late final String _baseUrl; LotrApi({ this.apiKey, - this.apiVersion = ApiVersion.v2, }) { + if (apiKey == null) { + Utils.printWarning( + 'No API key provided. Only open endpoints will be available.'); + } _baseUrl = "https://the-one-api.dev/v2"; }