xcAlarmVideoCalendar method
Implementation
Future<List<String>> xcAlarmVideoCalendar({
required String deviceId,
required String userId,
DateTime? monthDateTime,
DateTime? startTime,
DateTime? endTime,
int? channel,
String? mUserid,
bool needAuth = true,
}) async {
if (monthDateTime == null && startTime != null && endTime != null) {
assert(startTime.isBefore(endTime) || startTime == endTime,
'开始日期必须早于等于结束日期');
}
String jsonStr = paramConfig(
deviceId: deviceId,
type: CalendarType.alarmVideo,
monthDateTime: monthDateTime,
startTime: startTime,
endTime: endTime,
userId: userId,
mUserid: mUserid,
needAuth: needAuth);
final originResponse =
await _api.xcAlarmCalendar(deviceId, jsonStr, ApiSeq.instance.getSeq());
XCloudResponse<Map<String, dynamic>> response =
XCloudResponse.fromOriginResponse<Map<String, dynamic>>(originResponse);
if (response.code < 0) {
return Future.error(XCloudAPIException(
code: response.code, commandId: originResponse.commandId));
}
final dateMapList = response.data['dt'];
final List<String> result = [];
for (var dateMap in dateMapList) {
result.add(dateMap['tm']);
}
return Future.value(result);
}