Skip to content

Commit

Permalink
Remove api_version as there is only one
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz-fink committed Feb 5, 2022
1 parent dd54575 commit 433b6fd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .packages
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
17 changes: 12 additions & 5 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -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<Quote> 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);
}
```
3 changes: 1 addition & 2 deletions lib/lotr_api.dart
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion lib/src/config/api_version.dart

This file was deleted.

8 changes: 5 additions & 3 deletions lib/src/lotr_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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";
}

Expand Down

0 comments on commit 433b6fd

Please sign in to comment.