interaction_models.dart
2.44 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
import 'package:json_annotation/json_annotation.dart';
part 'interaction_models.g.dart';
@JsonSerializable()
class InteractionData {
const InteractionData({
this.interactionType,
this.actionType,
this.action,
});
@JsonKey(name: 'interaction_type')
final int? interactionType;
@JsonKey(name: 'action_type')
final int? actionType;
@JsonKey(name: 'action_variables')
final InteractionDataAction? action;
factory InteractionData.fromJson(Map<String, dynamic> json) =>
_$InteractionDataFromJson(json);
Map<String, dynamic> toJson() => _$InteractionDataToJson(this);
}
@JsonSerializable()
class InteractionRecordResponse {
const InteractionRecordResponse({this.records});
final List<InteractionRecord>? records;
factory InteractionRecordResponse.fromJson(Map<String, dynamic> json) =>
_$InteractionRecordResponseFromJson(json);
Map<String, dynamic> toJson() => _$InteractionRecordResponseToJson(this);
}
@JsonSerializable()
class InteractionRecord {
const InteractionRecord({
this.id,
this.createTime,
this.userId,
this.pairId,
this.interactionType,
this.actionType,
this.action,
this.text,
});
final int? id;
@JsonKey(name: 'create_time')
final int? createTime;
@JsonKey(name: 'user_id')
final int? userId;
@JsonKey(name: 'pair_id')
final int? pairId;
@JsonKey(name: 'interaction_type')
final int? interactionType;
@JsonKey(name: 'action_type')
final int? actionType;
@JsonKey(name: 'action_variables')
final InteractionDataAction? action;
final String? text;
factory InteractionRecord.fromJson(Map<String, dynamic> json) =>
_$InteractionRecordFromJson(json);
Map<String, dynamic> toJson() => _$InteractionRecordToJson(this);
}
@JsonSerializable()
class InteractionDataAction {
const InteractionDataAction({
this.objectTarget,
this.status,
this.type,
this.date,
this.value,
this.unit,
this.action,
});
@JsonKey(name: 'object')
final int? objectTarget;
@JsonKey(name: 'data_status')
final String? status;
@JsonKey(name: 'data_type')
final String? type;
@JsonKey(name: 'data_date')
final String? date;
@JsonKey(name: 'data_value')
final String? value;
@JsonKey(name: 'data_unit')
final String? unit;
final String? action;
factory InteractionDataAction.fromJson(Map<String, dynamic> json) =>
_$InteractionDataActionFromJson(json);
Map<String, dynamic> toJson() => _$InteractionDataActionToJson(this);
}