Chat basis

This commit is contained in:
2024-05-26 01:21:08 +08:00
parent 657f36c1f8
commit 5b45718ebd
16 changed files with 379 additions and 28 deletions

View File

@ -3,6 +3,21 @@ import 'package:solian/providers/auth.dart';
import 'package:solian/services.dart';
class ChannelProvider extends GetxController {
Future<Response> getChannel(String alias, {String realm = 'global'}) async {
final AuthProvider auth = Get.find();
if (!await auth.isAuthorized) throw Exception('unauthorized');
final client = GetConnect();
client.httpClient.baseUrl = ServiceFinder.services['messaging'];
final resp = await client.get('/api/channels/$realm/$alias');
if (resp.statusCode != 200) {
throw Exception(resp.bodyString);
}
return resp;
}
Future<Response> listAvailableChannel({String realm = 'global'}) async {
final AuthProvider auth = Get.find();
if (!await auth.isAuthorized) throw Exception('unauthorized');