71 lines
1.7 KiB
Dart
71 lines
1.7 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
||
import 'package:networks_sdk/networks_sdk.dart';
|
||
|
||
import 'package:im_app/core/foundation/api_paths.dart';
|
||
|
||
part 'send_otp_request.g.dart';
|
||
|
||
/// 发送验证码响应
|
||
///
|
||
/// code: 0 时 [expiryTime] 有值;
|
||
/// code: 30174(触发图片验证)时 [android] / [ios] / [web] / [extras] 有值。
|
||
class SendOtpResponse {
|
||
/// 验证码有效期(秒)
|
||
@JsonKey(name: 'expiry_time')
|
||
final int? expiryTime;
|
||
|
||
/// Android CAPTCHA SDK token
|
||
final String? android;
|
||
|
||
/// iOS CAPTCHA SDK token
|
||
final String? ios;
|
||
|
||
/// Web CAPTCHA SDK token
|
||
final String? web;
|
||
|
||
/// CAPTCHA 平台扩展参数(预留字段)
|
||
final Map<String, dynamic>? extras;
|
||
|
||
const SendOtpResponse({
|
||
this.expiryTime,
|
||
this.android,
|
||
this.ios,
|
||
this.web,
|
||
this.extras,
|
||
});
|
||
}
|
||
|
||
/// # /app/api/auth/vcode/get — 发送手机验证码
|
||
///
|
||
/// 响应 `data: { "expiry_time": 180 }`,返回验证码有效期(秒)。
|
||
///
|
||
/// ## 数据流位置
|
||
///
|
||
/// ```
|
||
/// AuthRepositoryImpl.sendOtp(countryCode, contact)
|
||
/// → _client.executeRequest( ★ SendOtpRequest ★ ) ← 你在这里
|
||
/// → 服务端 POST /app/api/auth/vcode/get
|
||
/// → 响应 { expiry_time: 180 } → SendOtpResponse
|
||
/// ```
|
||
@ApiRequest(
|
||
path: ApiPaths.authSendOtp,
|
||
method: HttpMethod.post,
|
||
responseType: SendOtpResponse,
|
||
requestType: ApiRequestType.login,
|
||
)
|
||
class SendOtpRequest extends ApiRequestable<SendOtpResponse>
|
||
with _$SendOtpRequestApi {
|
||
@JsonKey(name: 'country_code')
|
||
final String countryCode;
|
||
final String contact;
|
||
|
||
/// type=1 表示手机号验证
|
||
final int type;
|
||
|
||
SendOtpRequest({
|
||
required this.countryCode,
|
||
required this.contact,
|
||
this.type = 1,
|
||
});
|
||
}
|