dumb_api_dart 1.0.0
dumb_api_dart: ^1.0.0 copied to clipboard
api for DUMBMessenger
DUMB Messenger API #
made by debianrose!
Why? #
Just for fun. And for android client
Usage Example #
import 'package:chat_client/chat_client.dart';
// Create client instance
final client = ChatClient(
baseUrl: 'http://localhost:3000',
token: 'your-auth-token',
);
// Authentication
final loginResult = await client.login('username', 'password');
if (loginResult.requires2FA) {
// Handle 2FA
final verified = await client.verify2FALogin(
'username',
loginResult.sessionId!,
'123456'
);
}
// Send message
final message = await client.sendMessage(
channel: 'general',
text: 'Hello World!',
);
// WebSocket for real-time updates
final channel = client.createWebSocketChannel();
channel.stream.listen((data) {
final message = ChatMessage.fromJson(json.decode(data));
// Handle incoming message
});