mirror of
https://github.com/RxReader/tencent_kit.git
synced 2025-05-21 09:16:31 +08:00
41 lines
1023 B
Dart
41 lines
1023 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'tencent_sdk_resp.g.dart';
|
|
|
|
@JsonSerializable(
|
|
explicitToJson: true,
|
|
fieldRename: FieldRename.snake,
|
|
)
|
|
class TencentSdkResp {
|
|
const TencentSdkResp({
|
|
required this.ret,
|
|
this.msg,
|
|
});
|
|
|
|
factory TencentSdkResp.fromJson(Map<String, dynamic> json) =>
|
|
_$TencentSdkRespFromJson(json);
|
|
|
|
/// 网络请求成功发送至服务器,并且服务器返回数据格式正确
|
|
/// 这里包括所请求业务操作失败的情况,例如没有授权等原因导致
|
|
static const int RET_SUCCESS = 0;
|
|
|
|
/// 网络异常,或服务器返回的数据格式不正确导致无法解析
|
|
static const int RET_FAILED = 1;
|
|
|
|
static const int RET_COMMON = -1;
|
|
|
|
static const int RET_USERCANCEL = -2;
|
|
|
|
@JsonKey(
|
|
defaultValue: RET_SUCCESS,
|
|
)
|
|
final int ret;
|
|
final String? msg;
|
|
|
|
bool get isSuccessful => ret == RET_SUCCESS;
|
|
|
|
bool get isCancelled => ret == RET_USERCANCEL;
|
|
|
|
Map<String, dynamic> toJson() => _$TencentSdkRespToJson(this);
|
|
}
|