93 lines
2.0 KiB
Dart
93 lines
2.0 KiB
Dart
|
import 'dart:typed_data';
|
||
|
|
||
|
import 'package:dio/dio.dart';
|
||
|
|
||
|
import 'server.dart';
|
||
|
|
||
|
Future<Map<String, dynamic>> applyFriend(
|
||
|
String applicant,
|
||
|
String recipient,
|
||
|
String hello,
|
||
|
String friendRemark,
|
||
|
String friendGroup,
|
||
|
) async {
|
||
|
Response response = await request.post(
|
||
|
'/apply/friend',
|
||
|
data: {
|
||
|
'relation': 0,
|
||
|
'applicant': applicant,
|
||
|
'recipient': recipient,
|
||
|
'hello': hello,
|
||
|
'setting': {
|
||
|
'friendGroup': friendGroup,
|
||
|
'friendRemark': friendRemark,
|
||
|
}
|
||
|
},
|
||
|
);
|
||
|
return response.data;
|
||
|
}
|
||
|
|
||
|
Future<Map<String, dynamic>> getApplyList(String id) async {
|
||
|
Response response = await request.get(
|
||
|
'/apply/list',
|
||
|
queryParameters: {'recipient': id},
|
||
|
);
|
||
|
|
||
|
return response.data;
|
||
|
}
|
||
|
|
||
|
Future<Map<String, dynamic>> getApplicantProfile(
|
||
|
List<String> applicantIds) async {
|
||
|
Response response = await request.get(
|
||
|
'/apply/applicant_profiles',
|
||
|
queryParameters: {
|
||
|
'applicant_ids': applicantIds,
|
||
|
},
|
||
|
);
|
||
|
return response.data;
|
||
|
}
|
||
|
|
||
|
Future<Uint8List> downloadApplicantAvatars(List<String> avatars) async {
|
||
|
Response response = await request.get(
|
||
|
'/apply/applicant_avatars',
|
||
|
queryParameters: {'avatars': avatars},
|
||
|
options: Options(responseType: ResponseType.bytes),
|
||
|
);
|
||
|
|
||
|
return response.data;
|
||
|
}
|
||
|
|
||
|
Future<Map<String, dynamic>> acceptApply(
|
||
|
int relation,
|
||
|
String applicant,
|
||
|
String recipient,
|
||
|
Map<String, dynamic> applicantSetting,
|
||
|
Map<String, String> recipientSetting,
|
||
|
) async {
|
||
|
Response response = await request.post('/apply/accept', data: {
|
||
|
'relation': relation,
|
||
|
'applicant': applicant,
|
||
|
'recipient': recipient,
|
||
|
'applicant_setting': applicantSetting,
|
||
|
'recipient_setting': recipientSetting,
|
||
|
});
|
||
|
|
||
|
return response.data;
|
||
|
}
|
||
|
|
||
|
Future<Map<String, dynamic>> refuseApply(
|
||
|
int relation,
|
||
|
String applicant,
|
||
|
String recipient,
|
||
|
) async {
|
||
|
Response response = await request.post(
|
||
|
'/apply/refuse',
|
||
|
data: {
|
||
|
'relation': relation,
|
||
|
'applicant': applicant,
|
||
|
'recipient': recipient,
|
||
|
},
|
||
|
);
|
||
|
return response.data;
|
||
|
}
|