网络请求打通,ws 打通
This commit is contained in:
70
apps/im_app/lib/data/remote/send_otp_request.dart
Normal file
70
apps/im_app/lib/data/remote/send_otp_request.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
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,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user