fromJson static method

IamCreateOrganizationInput? fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static IamCreateOrganizationInput? 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(() {
      requiredKeys.forEach((key) {
        assert(json.containsKey(key), 'Required key "IamCreateOrganizationInput[$key]" is missing from JSON.');
        assert(json[key] != null, 'Required key "IamCreateOrganizationInput[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return IamCreateOrganizationInput(
      accountItems: IamAccountItem.listFromJson(json[r'accountItems']),
      accountMenu: mapValueOfType<String>(json, r'accountMenu'),
      avatar: mapValueOfType<String>(json, r'avatar'),
      balanceCredit: num.parse('${json[r'balanceCredit']}'),
      balanceCurrency: mapValueOfType<String>(json, r'balanceCurrency'),
      countryCodes: json[r'countryCodes'] is Iterable
          ? (json[r'countryCodes'] as Iterable).cast<String>().toList(growable: false)
          : const [],
      createdAt: mapDateTime(json, r'createdAt', r''),
      createdTime: mapValueOfType<String>(json, r'createdTime'),
      dcrPolicy: mapValueOfType<String>(json, r'dcrPolicy'),
      defaultApplication: mapValueOfType<String>(json, r'defaultApplication'),
      defaultAvatar: mapValueOfType<String>(json, r'defaultAvatar'),
      defaultPassword: mapValueOfType<String>(json, r'defaultPassword'),
      deleted: mapValueOfType<bool>(json, r'deleted'),
      disableSignin: mapValueOfType<bool>(json, r'disableSignin'),
      displayName: mapValueOfType<String>(json, r'displayName'),
      emoji: mapValueOfType<String>(json, r'emoji'),
      enableSoftDeletion: mapValueOfType<bool>(json, r'enableSoftDeletion'),
      enableTour: mapValueOfType<bool>(json, r'enableTour'),
      failedSigninFrozenTime: mapValueOfType<int>(json, r'failedSigninFrozenTime'),
      failedSigninLimit: mapValueOfType<int>(json, r'failedSigninLimit'),
      favicon: mapValueOfType<String>(json, r'favicon'),
      founder: mapValueOfType<String>(json, r'founder'),
      hasPrivilegeConsent: mapValueOfType<bool>(json, r'hasPrivilegeConsent'),
      id: mapValueOfType<String>(json, r'id'),
      initScore: mapValueOfType<int>(json, r'initScore'),
      ipRestriction: mapValueOfType<String>(json, r'ipRestriction'),
      ipWhitelist: mapValueOfType<String>(json, r'ipWhitelist'),
      isPersonal: mapValueOfType<bool>(json, r'isPersonal'),
      isProfilePublic: mapValueOfType<bool>(json, r'isProfilePublic'),
      kerberosKdcHost: mapValueOfType<String>(json, r'kerberosKdcHost'),
      kerberosKeytab: mapValueOfType<String>(json, r'kerberosKeytab'),
      kerberosRealm: mapValueOfType<String>(json, r'kerberosRealm'),
      kerberosServiceName: mapValueOfType<String>(json, r'kerberosServiceName'),
      languages: json[r'languages'] is Iterable
          ? (json[r'languages'] as Iterable).cast<String>().toList(growable: false)
          : const [],
      ldapAttributes: json[r'ldapAttributes'] is Iterable
          ? (json[r'ldapAttributes'] as Iterable).cast<String>().toList(growable: false)
          : const [],
      logo: mapValueOfType<String>(json, r'logo'),
      logoDark: mapValueOfType<String>(json, r'logoDark'),
      masterPassword: mapValueOfType<String>(json, r'masterPassword'),
      masterVerificationCode: mapValueOfType<String>(json, r'masterVerificationCode'),
      mfaItems: IamMfaItem.listFromJson(json[r'mfaItems']),
      mfaRememberInHours: mapValueOfType<int>(json, r'mfaRememberInHours'),
      name: mapValueOfType<String>(json, r'name'),
      navItems: json[r'navItems'] is Iterable
          ? (json[r'navItems'] as Iterable).cast<String>().toList(growable: false)
          : const [],
      orgBalance: num.parse('${json[r'orgBalance']}'),
      owner: mapValueOfType<String>(json, r'owner'),
      passwordExpireDays: mapValueOfType<int>(json, r'passwordExpireDays'),
      passwordObfuscatorKey: mapValueOfType<String>(json, r'passwordObfuscatorKey'),
      passwordObfuscatorType: mapValueOfType<String>(json, r'passwordObfuscatorType'),
      passwordOptions: json[r'passwordOptions'] is Iterable
          ? (json[r'passwordOptions'] as Iterable).cast<String>().toList(growable: false)
          : const [],
      passwordSalt: mapValueOfType<String>(json, r'passwordSalt'),
      passwordType: mapValueOfType<String>(json, r'passwordType'),
      tags: json[r'tags'] is Iterable
          ? (json[r'tags'] as Iterable).cast<String>().toList(growable: false)
          : const [],
      themeData: IamThemeData.fromJson(json[r'themeData']),
      updatedAt: mapDateTime(json, r'updatedAt', r''),
      useEmailAsUsername: mapValueOfType<bool>(json, r'useEmailAsUsername'),
      usePermanentAvatar: mapValueOfType<bool>(json, r'usePermanentAvatar'),
      userBalance: num.parse('${json[r'userBalance']}'),
      userNavItems: json[r'userNavItems'] is Iterable
          ? (json[r'userNavItems'] as Iterable).cast<String>().toList(growable: false)
          : const [],
      userTypes: json[r'userTypes'] is Iterable
          ? (json[r'userTypes'] as Iterable).cast<String>().toList(growable: false)
          : const [],
      websiteUrl: mapValueOfType<String>(json, r'websiteUrl'),
      widgetItems: json[r'widgetItems'] is Iterable
          ? (json[r'widgetItems'] as Iterable).cast<String>().toList(growable: false)
          : const [],
    );
  }
  return null;
}