CreateRequest.fromJson constructor

CreateRequest.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory CreateRequest.fromJson(Map<String, Object?> json) => CreateRequest(
      type: TargetType.fromJson(json['type']),
      profile: coupon_models.OfferProfile.fromJson(
        (json['profile'] as Map).cast<String, Object?>(),
      ),
      schedule: ScheduleParams.fromJson(
        (json['schedule'] as Map).cast<String, Object?>(),
      ),
      activation: Activation.fromJson(
        (json['activation'] as Map).cast<String, Object?>(),
      ),
      priority: (json['priority'] as num).toInt(),
      coupon: json['coupon'] == null
          ? null
          : TargetReference.fromJson(
              (json['coupon'] as Map).cast<String, Object?>()),
      discount: json['discount'] == null
          ? null
          : TargetReference.fromJson(
              (json['discount'] as Map).cast<String, Object?>()),
      customData: json['custom_data'] == null
          ? null
          : core.CustomDataInput.fromJson(json['custom_data']),
    );