API class

API client.

Annotations

Constructors

API({Client? client, Hosts hosts = const Hosts(), BeforeRequestCallback? beforeRequest, int maxRetries = 5, String? userAgent})
Creates API client.
API.proxy(String proxyUri, {Hosts hosts = const Hosts(), BeforeRequestCallback? beforeRequest, int maxRetries = 5, String? userAgent})
Creates API client with provided proxy config.

Properties

beforeRequest BeforeRequestCallback?
Before request callback. Used to pre process requests.
final
client Client
Client used for requests.
final
hashCode int
The hash code for this object.
read-onlyinherited
hosts Hosts
Hosts settings.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

getAvatarUrl(User user) Uri
Returns Uri for user's avatar via hosts config.
getBook(int id) Future<Book>
Returns book with given id.
getComments(int bookId) Future<List<Comment>>
Returns comments for book with given bookId.
getImageUrl(Image image) Uri
Returns Uri for image via hosts config.
getRandomBook() Future<Book?>
Returns random book.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
Returns Stream of Search pages for text query.
searchSinglePage(String query, {int page = 1, SearchSort sort = SearchSort.recent}) Future<Search>
Returns single Search page for text query.
searchTagged(Tag tag, {int page = 1, int? count, SearchSort sort = SearchSort.recent}) Stream<Search>
Returns Stream of pages of Search for books tagged with tag.
searchTaggedSinglePage(Tag tag, {int page = 1, SearchSort sort = SearchSort.recent}) Future<Search>
Returns single page of Search for books tagged with tag.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

defaultUserAgent String
Default API client User Agent string.
read / write