Skip to main content

nitori_client 0.1.25 copy "nitori_client: ^0.1.25" to clipboard
nitori_client: ^0.1.25 copied to clipboard

Dart client implementation for the Satori Protocol, providing the HTTP API caller and WebSocket gateway.

nitori_client #

A Dart client for the Satori Protocol: a WebSocket gateway plus the full HTTP API surface.

Usage #

import 'package:nitori_client/nitori_client.dart';

Future<void> main() async {
  final client = NitoriClient(
    baseUrl: 'http://localhost:5140',
    token: 'your-token',
  );

  client.events.listen((event) {
    print('[${event.type}] ${event.data}');
  });

  await client.start();

  for (final bot in client.bots) {
    await bot.createMessage('channel-id', 'hello');
  }

  await client.stop();
  client.close();
}

API calls #

NitoriClient resolves the bot list from the gateway READY payload and keeps it in sync with login-added / login-updated / login-removed events. Every NitoriBot carries the identity headers (satori-platform, satori-user-id) and exposes the protocol methods:

final message = await bot.getMessage(channelId, messageId);
final page = await bot.getMessageList(channelId, limit: 50);
final channel = await bot.createDirectChannel(userId);

HTTP-only usage is supported too: build a NitoriBot directly with an explicit platform and user id, and never call start().

Reconnection #

The gateway reconnects automatically. The next IDENTIFY after a drop carries the last received event sequence, so the server replays missed events.

Example #

See example/nitori_client_example.dart for a runnable demo. Point SATORI_BASE_URL and SATORI_TOKEN at your endpoint, then:

dart run example/nitori_client_example.dart

Supported methods #

All 37 protocol methods are implemented, including the multipart upload.create. Responses are deserialized into the nitori_core models (Channel, Message, Guild, Login, ...) with Pagination / BidiList for list payloads.

0
likes
160
points
916
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart client implementation for the Satori Protocol, providing the HTTP API caller and WebSocket gateway.

Repository (GitHub)
View/report issues

Topics

#nitori #satori #chat #client #bot

License

Apache-2.0 (license)

Dependencies

http, http_parser, mime, nitori_core, nitori_message, web_socket_channel

More

Packages that depend on nitori_client