EndpointResponse.fromJson constructor

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

Implementation

factory EndpointResponse.fromJson(Map<String, dynamic> json) {
  return EndpointResponse(
    address: json['Address'] as String?,
    applicationId: json['ApplicationId'] as String?,
    attributes: (json['Attributes'] as Map<String, dynamic>?)?.map((k, e) =>
        MapEntry(
            k, (e as List).whereNotNull().map((e) => e as String).toList())),
    channelType: (json['ChannelType'] as String?)?.toChannelType(),
    cohortId: json['CohortId'] as String?,
    creationDate: json['CreationDate'] as String?,
    demographic: json['Demographic'] != null
        ? EndpointDemographic.fromJson(
            json['Demographic'] as Map<String, dynamic>)
        : null,
    effectiveDate: json['EffectiveDate'] as String?,
    endpointStatus: json['EndpointStatus'] as String?,
    id: json['Id'] as String?,
    location: json['Location'] != null
        ? EndpointLocation.fromJson(json['Location'] as Map<String, dynamic>)
        : null,
    metrics: (json['Metrics'] as Map<String, dynamic>?)
        ?.map((k, e) => MapEntry(k, e as double)),
    optOut: json['OptOut'] as String?,
    requestId: json['RequestId'] as String?,
    user: json['User'] != null
        ? EndpointUser.fromJson(json['User'] as Map<String, dynamic>)
        : null,
  );
}