fromJson static method
Returns a new CreateTenantBody instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CreateTenantBody? 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'name'), 'Required key "CreateTenantBody[name]" is missing from JSON.');
assert(json[r'name'] != null, 'Required key "CreateTenantBody[name]" has a null value in JSON.');
assert(json.containsKey(r'domainConfiguration'), 'Required key "CreateTenantBody[domainConfiguration]" is missing from JSON.');
assert(json[r'domainConfiguration'] != null, 'Required key "CreateTenantBody[domainConfiguration]" has a null value in JSON.');
return true;
}());
return CreateTenantBody(
name: mapValueOfType<String>(json, r'name')!,
domainConfiguration: APIDomainConfiguration.listFromJson(json[r'domainConfiguration']),
email: mapValueOfType<String>(json, r'email'),
signUpDate: mapValueOfType<double>(json, r'signUpDate'),
packageId: mapValueOfType<String>(json, r'packageId'),
paymentFrequency: mapValueOfType<double>(json, r'paymentFrequency'),
billingInfoValid: mapValueOfType<bool>(json, r'billingInfoValid'),
billingHandledExternally: mapValueOfType<bool>(json, r'billingHandledExternally'),
createdBy: mapValueOfType<String>(json, r'createdBy'),
isSetup: mapValueOfType<bool>(json, r'isSetup'),
billingInfo: BillingInfo.fromJson(json[r'billingInfo']),
stripeCustomerId: mapValueOfType<String>(json, r'stripeCustomerId'),
stripeSubscriptionId: mapValueOfType<String>(json, r'stripeSubscriptionId'),
stripePlanId: mapValueOfType<String>(json, r'stripePlanId'),
enableProfanityFilter: mapValueOfType<bool>(json, r'enableProfanityFilter'),
enableSpamFilter: mapValueOfType<bool>(json, r'enableSpamFilter'),
removeUnverifiedComments: mapValueOfType<bool>(json, r'removeUnverifiedComments'),
unverifiedCommentsTTLms: mapValueOfType<double>(json, r'unverifiedCommentsTTLms'),
commentsRequireApproval: mapValueOfType<bool>(json, r'commentsRequireApproval'),
autoApproveCommentOnVerification: mapValueOfType<bool>(json, r'autoApproveCommentOnVerification'),
sendProfaneToSpam: mapValueOfType<bool>(json, r'sendProfaneToSpam'),
deAnonIpAddr: mapValueOfType<double>(json, r'deAnonIpAddr'),
meta: mapCastOfType<String, String>(json, r'meta') ?? const {},
);
}
return null;
}