mastodon_dart 0.1.4+2 copy "mastodon_dart: ^0.1.4+2" to clipboard
mastodon_dart: ^0.1.4+2 copied to clipboard

outdated

A Dart library for accessing the Mastodon API.

mastodon_dart #

A Dart API for the Mastodon network. Work in progress.

Mastodon API documentation: https://docs.joinmastodon.org/api/

Status #

This package is not production ready.

Contributing #

Create an issue, back it with a PR, and tag an active contributor.

Mock Client #

import 'package:mastodon_dart/mastodon_dart.dart';

main() async {
  final mock = MockMastodon();

  /// Hit the endpoints with blank parameters
  mock.account("").then((a) => print(
      [a, a.id, a.username, a.avatar, a.followersCount, a.followingCount]));

  /// Get mock data classes for building UIs
  /// [Instance of 'Account', 78056791, onegerbal4511, https://randomuser.me/api/portraits/men/64.jpg, 861, 34]
}

Auth'd Client #

import 'package:mastodon_dart/mastodon_dart.dart';

main() async {
  final mastodon = Mastodon()
    ..baseUrl = Uri.parse("https://mastodon.technology")
    ..key = "my_awesome_oauth2_key";

  final verify = await mastodon.verifyAppCredentials();

  print([verify.name, verify.website]);

  /// Our oauth2 key is correct! Lets make some real network calls.
  /// [oauth2_client_name, https://oauth2_website.com]
}
7
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A Dart library for accessing the Mastodon API.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http, json_annotation, rxdart, web_socket_channel

More

Packages that depend on mastodon_dart