CampaignResponse.fromJson constructor

CampaignResponse.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory CampaignResponse.fromJson(Map<String, dynamic> json) {
  return CampaignResponse(
    applicationId: json['ApplicationId'] as String,
    arn: json['Arn'] as String,
    creationDate: json['CreationDate'] as String,
    id: json['Id'] as String,
    lastModifiedDate: json['LastModifiedDate'] as String,
    segmentId: json['SegmentId'] as String,
    segmentVersion: json['SegmentVersion'] as int,
    additionalTreatments: (json['AdditionalTreatments'] as List?)
        ?.whereNotNull()
        .map((e) => TreatmentResource.fromJson(e as Map<String, dynamic>))
        .toList(),
    customDeliveryConfiguration: json['CustomDeliveryConfiguration'] != null
        ? CustomDeliveryConfiguration.fromJson(
            json['CustomDeliveryConfiguration'] as Map<String, dynamic>)
        : null,
    defaultState: json['DefaultState'] != null
        ? CampaignState.fromJson(json['DefaultState'] as Map<String, dynamic>)
        : null,
    description: json['Description'] as String?,
    holdoutPercent: json['HoldoutPercent'] as int?,
    hook: json['Hook'] != null
        ? CampaignHook.fromJson(json['Hook'] as Map<String, dynamic>)
        : null,
    isPaused: json['IsPaused'] as bool?,
    limits: json['Limits'] != null
        ? CampaignLimits.fromJson(json['Limits'] as Map<String, dynamic>)
        : null,
    messageConfiguration: json['MessageConfiguration'] != null
        ? MessageConfiguration.fromJson(
            json['MessageConfiguration'] as Map<String, dynamic>)
        : null,
    name: json['Name'] as String?,
    schedule: json['Schedule'] != null
        ? Schedule.fromJson(json['Schedule'] as Map<String, dynamic>)
        : null,
    state: json['State'] != null
        ? CampaignState.fromJson(json['State'] as Map<String, dynamic>)
        : null,
    templateConfiguration: json['TemplateConfiguration'] != null
        ? TemplateConfiguration.fromJson(
            json['TemplateConfiguration'] as Map<String, dynamic>)
        : null,
    treatmentDescription: json['TreatmentDescription'] as String?,
    treatmentName: json['TreatmentName'] as String?,
    version: json['Version'] as int?,
    tags: (json['tags'] as Map<String, dynamic>?)
        ?.map((k, e) => MapEntry(k, e as String)),
  );
}