fromJson static method
Returns a new ReplaceTenantUserBody instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static ReplaceTenantUserBody? 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(() {
assert(json.containsKey(r'username'), 'Required key "ReplaceTenantUserBody[username]" is missing from JSON.');
assert(json[r'username'] != null, 'Required key "ReplaceTenantUserBody[username]" has a null value in JSON.');
assert(json.containsKey(r'email'), 'Required key "ReplaceTenantUserBody[email]" is missing from JSON.');
assert(json[r'email'] != null, 'Required key "ReplaceTenantUserBody[email]" has a null value in JSON.');
return true;
}());
return ReplaceTenantUserBody(
username: mapValueOfType<String>(json, r'username')!,
email: mapValueOfType<String>(json, r'email')!,
displayName: mapValueOfType<String>(json, r'displayName'),
websiteUrl: mapValueOfType<String>(json, r'websiteUrl'),
signUpDate: mapValueOfType<double>(json, r'signUpDate'),
locale: mapValueOfType<String>(json, r'locale'),
verified: mapValueOfType<bool>(json, r'verified'),
loginCount: mapValueOfType<double>(json, r'loginCount'),
optedInNotifications: mapValueOfType<bool>(json, r'optedInNotifications'),
optedInTenantNotifications: mapValueOfType<bool>(json, r'optedInTenantNotifications'),
hideAccountCode: mapValueOfType<bool>(json, r'hideAccountCode'),
avatarSrc: mapValueOfType<String>(json, r'avatarSrc'),
isHelpRequestAdmin: mapValueOfType<bool>(json, r'isHelpRequestAdmin'),
isAccountOwner: mapValueOfType<bool>(json, r'isAccountOwner'),
isAdminAdmin: mapValueOfType<bool>(json, r'isAdminAdmin'),
isBillingAdmin: mapValueOfType<bool>(json, r'isBillingAdmin'),
isAnalyticsAdmin: mapValueOfType<bool>(json, r'isAnalyticsAdmin'),
isCustomizationAdmin: mapValueOfType<bool>(json, r'isCustomizationAdmin'),
isManageDataAdmin: mapValueOfType<bool>(json, r'isManageDataAdmin'),
isCommentModeratorAdmin: mapValueOfType<bool>(json, r'isCommentModeratorAdmin'),
isAPIAdmin: mapValueOfType<bool>(json, r'isAPIAdmin'),
moderatorIds: json[r'moderatorIds'] is Iterable
? (json[r'moderatorIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
digestEmailFrequency: mapValueOfType<double>(json, r'digestEmailFrequency'),
displayLabel: mapValueOfType<String>(json, r'displayLabel'),
createdFromUrlId: mapValueOfType<String>(json, r'createdFromUrlId'),
createdFromTenantId: mapValueOfType<String>(json, r'createdFromTenantId'),
lastLoginDate: mapValueOfType<double>(json, r'lastLoginDate'),
karma: mapValueOfType<double>(json, r'karma'),
);
}
return null;
}