这是基于vue-vben-admin 模板适用于abp Vnext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

54 lines
1.7 KiB

import 'package:core/models/abp.dto.dart';
import 'package:core/services/rest.service.dart';
import 'package:core/services/service.base.dart';
import '../models/notification.dart';
class NotificationService extends ServiceBase {
RestService get _restService => find();
Future<void> sendAsyncByInput(NotificationSendDto input) {
return _restService.post('/api/notifications',
data: input,
);
}
Future<void> subscribe(String name) {
return _restService.post<void>('/api/notifications/my-subscribes',
data: {
'name': name,
},
);
}
Future<void> unSubscribe(String name) {
return _restService.delete<void>('/api/notifications/my-subscribes?name=$name');
}
Future<ListResultDto<UserSubscreNotificationDto>> getMySubscribedListAsync() {
return _restService.get('/api/notifications/my-subscribes/all',
).then((res) {
return ListResultDto<UserSubscreNotificationDto>(
items: (res.data['items'] as List<dynamic>).map((e) => UserSubscreNotificationDto.fromJson(e)).toList(),
);
});
}
Future<ListResultDto<NotificationGroupDto>> getAssignableNotifiersAsync() {
return _restService.get('/api/notifications/assignables',
).then((res) {
return ListResultDto<NotificationGroupDto>(
items: (res.data['items'] as List<dynamic>).map((e) => NotificationGroupDto.fromJson(e)).toList(),
);
});
}
Future<ListResultDto<NotificationTemplateDto>> getAssignableTemplatesAsync() {
return _restService.get('/api/notifications/assignable-templates',
).then((res) => ListResultDto<NotificationTemplateDto>(
items: (res.data['items'] as List<dynamic>)
.map((e) => NotificationTemplateDto.fromJson(e)).toList()
),
);
}
}