fromJson static method

APIBanUserChangedValues? fromJson(
  1. dynamic value
)

Returns a new APIBanUserChangedValues instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static APIBanUserChangedValues? fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();

    // Ensure that the map contains the required keys.
    // Note 1: the values aren't checked for validity beyond being non-null.
    // Note 2: this code is stripped in release mode!
    assert(() {
      return true;
    }());

    return APIBanUserChangedValues(
      id: mapValueOfType<String>(json, r'_id'),
      tenantId: mapValueOfType<String>(json, r'tenantId'),
      userId: mapValueOfType<String>(json, r'userId'),
      email: mapValueOfType<String>(json, r'email'),
      username: mapValueOfType<String>(json, r'username'),
      ipHash: mapValueOfType<String>(json, r'ipHash'),
      createdAt: mapDateTime(json, r'createdAt', r''),
      bannedByUserId: mapValueOfType<String>(json, r'bannedByUserId'),
      bannedCommentText: mapValueOfType<String>(json, r'bannedCommentText'),
      banType: mapValueOfType<String>(json, r'banType'),
      bannedUntil: mapDateTime(json, r'bannedUntil', r''),
      hasEmailWildcard: mapValueOfType<bool>(json, r'hasEmailWildcard'),
      banReason: mapValueOfType<String>(json, r'banReason'),
    );
  }
  return null;
}