Realm channels

This commit is contained in:
2024-05-29 23:22:24 +08:00
parent 6bb29dfbc0
commit cd08e65840
7 changed files with 216 additions and 78 deletions

View File

@ -21,6 +21,22 @@ class ChannelProvider extends GetxController {
return resp;
}
Future<Response> listChannel({String scope = 'global'}) async {
final AuthProvider auth = Get.find();
if (!await auth.isAuthorized) throw Exception('unauthorized');
final client = GetConnect(maxAuthRetries: 3);
client.httpClient.baseUrl = ServiceFinder.services['messaging'];
client.httpClient.addAuthenticator(auth.requestAuthenticator);
final resp = await client.get('/api/channels/$scope');
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');