lemmy_api_client 0.10.1 copy "lemmy_api_client: ^0.10.1" to clipboard
lemmy_api_client: ^0.10.1 copied to clipboard

outdated

Future-based http client for the Lemmy API. Provides an easy interface and statically typed responses.

Lemmy Dart API client #

A Dart client for the Lemmy API

Features #

  • Future-based
  • Works both for Web and Native environments
  • Strictly typed responses
  • Http and websocket interface
  • Pictrs endpoints
  • API v1 and v2 support
  • Models have a .instanceHost property that indicate the instance that returned this model

Example #

import 'package:lemmy_api_client/v2.dart';

Future<void> main() async {
  // instantiate your lemmy instance with the host uri
  const lemmy = LemmyApiV2('lemmy.ml');

  // call methods that are named after op codes from the lemmy docs
  final token = await lemmy.run(Login(usernameOrEmail: 'asd', password: 'ads'));
  final messages =
      await lemmy.run(GetPrivateMessages(unreadOnly: true, auth: token.raw));

  print(messages);
}

check out Lemmur, a mobile Lemmy client in Flutter


Original Lemmy logo made by Andy Cuccaro (@andycuccaro) under the CC-BY-SA 4.0 license. Remixed by Marcin Wojnarowski (@shilangyu) and re-released under the CC-BY-SA 4.0 license.

1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Future-based http client for the Lemmy API. Provides an easy interface and statically typed responses.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

freezed_annotation, http, json_annotation, meta

More

Packages that depend on lemmy_api_client