mister_frodo

Last updated:

0 purchases

mister_frodo Image
mister_frodo Images
Add to Cart

Description:

mister frodo

Mister Frodo #

Another pure dart lib to access the https://the-one-api.dev/v2 APIs.
This lib is named after the way Samwise Gamgee addresses Frodo
Baggins: https://scifi.stackexchange.com/questions/11113/why-does-samwise-gamgee-call-frodo-baggins-mr-frodo
Features #

Mirrors API exposed by
Implements most Sorting and Filtering functionalities of https://the-one-api.dev/v2
see: The One API Docs

Install #
Add this to pubspec.yaml
dependencies:
mister_frodo: <latest_version>
copied to clipboard
In your library add the following import:
import 'package:mister_frodo/mister_frodo.dart';
copied to clipboard
Usage #

var misterFrodo = MisterFrodo(apiKey: "<YourApiKey>");
ResponseWrapper<Book> responseWrapper = await misterFrodo.getBooks();

print(jsonEncode(responseWrapper));
copied to clipboard
The ResponseWrapper object lets you access the following variables (if available)
final List<T> docs;
final int total;
final int limit;
final int offset;
final int? page;
final int? pages;
copied to clipboard
The SDK supports pagination, sorting, filtering throughout the API using named parameters.
Pagination #
Using limit and offset.
example:

ResponseWrapper<Character> responseWrapper = await misterFrodo.getCharacters(limit: 10, offset: 10);
List<Character> characters = response.docs;
copied to clipboard
Sorting #
Results can be sorted according to any attribute exposed by the API.
The sort can be either ascending (asc) or descending (desc):
await misterFrodo.getCharacters(sort: "name:asc");
copied to clipboard
Filtering #
You can filter out results only based on matching key=value:
await misterFrodo.getCharacters(filter: {"name": "Frodo Baggins"});
copied to clipboard
For more examples see the example/ or test/ folder in this repository
Additional information #
There are api rate limits in place on the API, please check details on https://the-one-api.dev/ and the complete API
docs here: https://the-one-api.dev/documentation
Design #
See DESIGN.md
TODO #

Improve filtering capabilities by adding more comparison operators
Add more unit tests to pagination, filtering and sorting combinations use-cases
Add Retry Dio Interceptor
Add a Rate Limiter to prevent 429 errors when accessing the API

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.