e621

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

e621

A client library for the API of imageboards using the e621 fork of gelbooru.
Features #

Implements all the endpoints of the e621 API : e621 API
Use Dart's native http package for making requests alloowing for using more advanced implementation on the fly.

Getting started #
Add the package to your project by running the following command:
# http is a required dependency since we rely on ClientException
dart pub add e621 http
copied to clipboard
Usage #
// Simple example to collect last ten post and display link

import 'package:e621/e621.dart';
import 'package:http/http.dart';

Future<void> main() async {

/// You should see the `http`[https://pub.dev/packages/http#choosing-an-implementation](https://pub.dev/packages/http#choosing-an-implementation) package documentation for using an adequate [Client] for your platform
final E621Client client = E621Client(host: Uri.parse('https://e621.net'), login: 'username', apiKey: 'api_key', userAgent: 'MyApp/1.0 (by username on e621)');

final List<Post> posts;

try {

/// limit is optional but 10 will get the last 10 posts
posts = await client.posts.list(limit: 10);

/// [ClientException] is found in the `http` package
/// it will be throw in case something went wrong with the request AT the connection time
} on ClientException catch (e) {
print('Failed to get posts: $e');
return;

/// [E621Exception] is found in the `e621` package
/// It will throw is something went wrong with the request AFTER the connection time
} on E621Exception catch (e) {
print('Failed to get posts: $e');
return;
}

if (posts.isEmpty) {
print('No posts found');
return;
}

for (final post in posts) {
print('Post: ${post.id} - ${post.file.url}');
}

}
copied to clipboard
No AI project / AI free Project #
This project is written WITHOUT any AI assistance.
If you fork this project and use AI please remove this section.
Special Thanks #

Dasa: Your honesty and the morale boost to actually start this project.

License

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

Files:

Customer Reviews

There are no reviews.