SubscriptionScheduleCreateOptions.fromJson constructor

SubscriptionScheduleCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory SubscriptionScheduleCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SubscriptionScheduleCreateOptions(
    customer: map['customer'] == null ? null : (map['customer'] as String),
    defaultSettings: map['default_settings'] == null
        ? null
        : SubscriptionScheduleDefaultSettings.fromJson(
            map['default_settings']),
    endBehavior: map['end_behavior'] == null
        ? null
        : SubscriptionScheduleEndBehavior.fromJson(map['end_behavior']),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    fromSubscription: map['from_subscription'] == null
        ? null
        : (map['from_subscription'] as String),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    phases: map['phases'] == null
        ? null
        : (map['phases'] as List<Object?>)
            .map((el) => SubscriptionSchedulePhasesItem.fromJson(el))
            .toList(),
    startDate: map['start_date'] == null
        ? null
        : SubscriptionScheduleStartDate.fromJson(map['start_date']),
  );
}