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.

58 lines
1.9 KiB

3 years ago
import 'package:bytedesk_kefu/http/bytedesk_message_api.dart';
import 'package:bytedesk_kefu/model/jsonResult.dart';
import 'package:bytedesk_kefu/model/message.dart';
import 'package:bytedesk_kefu/model/requestAnswer.dart';
3 years ago
import 'package:bytedesk_kefu/model/requestCategory.dart';
3 years ago
import 'package:bytedesk_kefu/model/uploadJsonResult.dart';
class MessageRepository {
final BytedeskMessageHttpApi bytedeskHttpApi = BytedeskMessageHttpApi();
MessageRepository();
Future<JsonResult> sendMessageRest(String? jsonString) async {
return await bytedeskHttpApi.sendMessageRest(jsonString);
}
Future<List<Message>> loadHistoryMessages(
String? uid, int? page, int? size) async {
return await bytedeskHttpApi.loadHistoryMessages(uid, page, size);
}
Future<List<Message>> loadTopicMessages(
String? topic, int? page, int? size) async {
return await bytedeskHttpApi.loadTopicMessages(topic, page, size);
}
Future<List<Message>> loadChannelMessages(
String? cid, int? page, int? size) async {
return await bytedeskHttpApi.loadChannelMessages(cid, page, size);
}
3 years ago
Future<RequestAnswerResult> queryAnswer(String? tid, String? aid, String? mid) async {
return await bytedeskHttpApi.queryAnswer2(tid, aid, mid);
3 years ago
}
3 years ago
Future<RequestCategoryResult> queryCategory(
String? tid, String? cid) async {
return await bytedeskHttpApi.queryCategory(tid, cid);
}
Future<RequestAnswerResult> messageAnswer(String? wid, String? content) async {
return await bytedeskHttpApi.messageAnswer(wid, content);
3 years ago
}
Future<RequestAnswerResult> rateAnswer(
String? aid, String? mid, bool? rate) async {
return await bytedeskHttpApi.rateAnswer(aid, mid, rate);
}
Future<UploadJsonResult> uploadImage(String? filePath) async {
return await bytedeskHttpApi.uploadImage(filePath);
}
Future<UploadJsonResult> uploadVideo(String? filePath) async {
return await bytedeskHttpApi.uploadVideo(filePath);
}
}