76 lines
1.9 KiB
Dart
76 lines
1.9 KiB
Dart
import '../api_client.dart';
|
||
import '../api_config.dart';
|
||
import '../proxy_client.dart';
|
||
|
||
/// 用户相关 API
|
||
abstract final class UserApi {
|
||
static final _client = ApiClient.instance.proxy;
|
||
|
||
/// 设备快速登录
|
||
/// 参数使用 V2 字段名:digest=referer, resolution=sign, origin=deviceId
|
||
static Future<ApiResponse> fastLogin({
|
||
required String origin,
|
||
required String resolution,
|
||
String? digest,
|
||
String? crest,
|
||
String? accolade,
|
||
}) async {
|
||
return _client.request(
|
||
path: '/v1/user/fast_login',
|
||
method: 'POST',
|
||
queryParams: {
|
||
if (crest != null) 'crest': crest,
|
||
'portal': ApiConfig.packageName,
|
||
if (accolade != null) 'accolade': accolade,
|
||
},
|
||
body: {
|
||
'digest': digest ?? '',
|
||
'resolution': resolution,
|
||
'origin': origin,
|
||
},
|
||
);
|
||
}
|
||
|
||
/// 获取用户通用信息
|
||
static Future<ApiResponse> getCommonInfo({
|
||
required String sentinel,
|
||
String? shield,
|
||
String? asset,
|
||
String? crest,
|
||
String? item,
|
||
String? origin,
|
||
String? gauntlet,
|
||
String? portal,
|
||
}) async {
|
||
return _client.request(
|
||
path: '/v1/user/common_info',
|
||
method: 'GET',
|
||
queryParams: {
|
||
'sentinel': sentinel,
|
||
if (shield != null) 'shield': shield,
|
||
if (asset != null) 'asset': asset,
|
||
if (crest != null) 'crest': crest,
|
||
if (item != null) 'item': item,
|
||
if (origin != null) 'origin': origin,
|
||
if (gauntlet != null) 'gauntlet': gauntlet,
|
||
if (portal != null) 'portal': portal,
|
||
},
|
||
);
|
||
}
|
||
|
||
/// 获取用户账户信息
|
||
static Future<ApiResponse> getAccount({
|
||
required String sentinel,
|
||
String? asset,
|
||
}) async {
|
||
return _client.request(
|
||
path: '/v1/user/account',
|
||
method: 'GET',
|
||
queryParams: {
|
||
'sentinel': sentinel,
|
||
if (asset != null) 'asset': asset,
|
||
},
|
||
);
|
||
}
|
||
}
|