Files
customer-im-client-dev/apps/im_app/lib/data/remote/send_otp_request.dart
2026-03-09 19:05:55 +08:00

71 lines
1.7 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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,
});
}