fromJson static method
Returns a new Organization instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static Organization? 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 "Organization[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "Organization[$key]" has a null value in JSON.');
});
return true;
}());
return Organization(
id: mapValueOfType<String>(json, r'id')!,
name: mapValueOfType<String>(json, r'name')!,
slug: mapValueOfType<String>(json, r'slug')!,
domain: mapValueOfType<String>(json, r'domain'),
logoUrl: mapValueOfType<String>(json, r'logoUrl'),
samlEnabled: mapValueOfType<bool>(json, r'samlEnabled'),
samlEntityId: mapValueOfType<String>(json, r'samlEntityId'),
samlSsoUrl: mapValueOfType<String>(json, r'samlSsoUrl'),
samlCertificate: mapValueOfType<String>(json, r'samlCertificate'),
scimEnabled: mapValueOfType<bool>(json, r'scimEnabled'),
scimToken: mapValueOfType<String>(json, r'scimToken'),
scimBaseUrl: mapValueOfType<String>(json, r'scimBaseUrl'),
plan: mapValueOfType<String>(json, r'plan'),
maxMembers: mapValueOfType<String>(json, r'maxMembers'),
domains: UserMetadata.fromJson(json[r'domains']),
metadata: UserMetadata.fromJson(json[r'metadata']),
type: mapValueOfType<String>(json, r'type'),
parentTenantId: mapValueOfType<String>(json, r'parentTenantId'),
rateLimit: mapValueOfType<int>(json, r'rateLimit'),
createdAt: mapValueOfType<String>(json, r'createdAt'),
updatedAt: mapValueOfType<String>(json, r'updatedAt'),
);
}
return null;
}