obs_models.dart
2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
class ObsTokenRequest {
const ObsTokenRequest({
this.source = 'doublefeel',
required this.fileType,
required this.count,
required this.scene,
});
final String source;
final String fileType;
final int count;
final String scene;
factory ObsTokenRequest.fromJson(Map<String, dynamic> json) {
return ObsTokenRequest(
source: (json['source'] as String?) ?? 'doublefeel',
fileType: json['file_type'] as String,
count: json['count'] as int,
scene: json['scene'] as String,
);
}
Map<String, dynamic> toJson() {
return <String, dynamic>{
'source': source,
'file_type': fileType,
'count': count,
'scene': scene,
};
}
}
class ObsTokenResponse {
const ObsTokenResponse({
this.keys,
this.token,
this.host,
this.endPoint,
this.bucket,
});
final List<String>? keys;
final ObsToken? token;
final String? host;
final String? endPoint;
final String? bucket;
factory ObsTokenResponse.fromJson(Map<String, dynamic> json) {
return ObsTokenResponse(
keys: (json['keys'] as List<dynamic>?)?.map((e) => e as String).toList(),
token: json['token'] == null
? null
: ObsToken.fromJson(json['token'] as Map<String, dynamic>),
host: json['host'] as String?,
endPoint: json['endpoint'] as String?,
bucket: json['bucket'] as String?,
);
}
Map<String, dynamic> toJson() {
final val = <String, dynamic>{};
if (keys != null) val['keys'] = keys;
if (token != null) val['token'] = token!.toJson();
if (host != null) val['host'] = host;
if (endPoint != null) val['endpoint'] = endPoint;
if (bucket != null) val['bucket'] = bucket;
return val;
}
}
class ObsToken {
const ObsToken({
this.accessKey,
this.secretKey,
this.securityToken,
this.expiration,
});
final String? accessKey;
final String? secretKey;
final String? securityToken;
final String? expiration;
factory ObsToken.fromJson(Map<String, dynamic> json) {
return ObsToken(
accessKey: json['access_key'] as String?,
secretKey: json['secret_key'] as String?,
securityToken: json['security_token'] as String?,
expiration: json['expiration'] as String?,
);
}
Map<String, dynamic> toJson() {
final val = <String, dynamic>{};
if (accessKey != null) val['access_key'] = accessKey;
if (secretKey != null) val['secret_key'] = secretKey;
if (securityToken != null) val['security_token'] = securityToken;
if (expiration != null) val['expiration'] = expiration;
return val;
}
}