UsageRecordCreateOptions.fromJson constructor

UsageRecordCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory UsageRecordCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return UsageRecordCreateOptions(
    action: map['action'] == null
        ? null
        : UsageRecordAction.fromJson(map['action']),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    quantity: (map['quantity'] as num).toInt(),
    timestamp: map['timestamp'] == null
        ? null
        : UsageRecordTimestamp.fromJson(map['timestamp']),
  );
}