fromJson static method
Returns a new APITenant instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static APITenant? 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'id'), 'Required key "APITenant[id]" is missing from JSON.');
assert(json[r'id'] != null, 'Required key "APITenant[id]" has a null value in JSON.');
assert(json.containsKey(r'name'), 'Required key "APITenant[name]" is missing from JSON.');
assert(json[r'name'] != null, 'Required key "APITenant[name]" has a null value in JSON.');
assert(json.containsKey(r'signUpDate'), 'Required key "APITenant[signUpDate]" is missing from JSON.');
assert(json[r'signUpDate'] != null, 'Required key "APITenant[signUpDate]" has a null value in JSON.');
assert(json.containsKey(r'packageId'), 'Required key "APITenant[packageId]" is missing from JSON.');
assert(json[r'packageId'] != null, 'Required key "APITenant[packageId]" has a null value in JSON.');
assert(json.containsKey(r'paymentFrequency'), 'Required key "APITenant[paymentFrequency]" is missing from JSON.');
assert(json[r'paymentFrequency'] != null, 'Required key "APITenant[paymentFrequency]" has a null value in JSON.');
assert(json.containsKey(r'billingInfoValid'), 'Required key "APITenant[billingInfoValid]" is missing from JSON.');
assert(json[r'billingInfoValid'] != null, 'Required key "APITenant[billingInfoValid]" has a null value in JSON.');
assert(json.containsKey(r'createdBy'), 'Required key "APITenant[createdBy]" is missing from JSON.');
assert(json[r'createdBy'] != null, 'Required key "APITenant[createdBy]" has a null value in JSON.');
assert(json.containsKey(r'isSetup'), 'Required key "APITenant[isSetup]" is missing from JSON.');
assert(json[r'isSetup'] != null, 'Required key "APITenant[isSetup]" has a null value in JSON.');
assert(json.containsKey(r'domainConfiguration'), 'Required key "APITenant[domainConfiguration]" is missing from JSON.');
assert(json[r'domainConfiguration'] != null, 'Required key "APITenant[domainConfiguration]" has a null value in JSON.');
assert(json.containsKey(r'enableProfanityFilter'), 'Required key "APITenant[enableProfanityFilter]" is missing from JSON.');
assert(json[r'enableProfanityFilter'] != null, 'Required key "APITenant[enableProfanityFilter]" has a null value in JSON.');
assert(json.containsKey(r'enableSpamFilter'), 'Required key "APITenant[enableSpamFilter]" is missing from JSON.');
assert(json[r'enableSpamFilter'] != null, 'Required key "APITenant[enableSpamFilter]" has a null value in JSON.');
return true;
}());
return APITenant(
id: mapValueOfType<String>(json, r'id')!,
name: mapValueOfType<String>(json, r'name')!,
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')!,
domainConfiguration: APIDomainConfiguration.listFromJson(json[r'domainConfiguration']),
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')!,
lastBillingIssueReminderDate: mapDateTime(json, r'lastBillingIssueReminderDate', r''),
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'),
hasFlexPricing: mapValueOfType<bool>(json, r'hasFlexPricing'),
hasAuditing: mapValueOfType<bool>(json, r'hasAuditing'),
flexLastBilledAmount: mapValueOfType<double>(json, r'flexLastBilledAmount'),
deAnonIpAddr: mapValueOfType<double>(json, r'deAnonIpAddr'),
meta: mapCastOfType<String, String>(json, r'meta') ?? const {},
);
}
return null;
}