fromJson static method
Returns a new CreateTenantPackageBody instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CreateTenantPackageBody? 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 "CreateTenantPackageBody[name]" is missing from JSON.');
assert(json[r'name'] != null, 'Required key "CreateTenantPackageBody[name]" has a null value in JSON.');
assert(json.containsKey(r'maxMonthlyPageLoads'), 'Required key "CreateTenantPackageBody[maxMonthlyPageLoads]" is missing from JSON.');
assert(json[r'maxMonthlyPageLoads'] != null, 'Required key "CreateTenantPackageBody[maxMonthlyPageLoads]" has a null value in JSON.');
assert(json.containsKey(r'maxMonthlyAPICredits'), 'Required key "CreateTenantPackageBody[maxMonthlyAPICredits]" is missing from JSON.');
assert(json[r'maxMonthlyAPICredits'] != null, 'Required key "CreateTenantPackageBody[maxMonthlyAPICredits]" has a null value in JSON.');
assert(json.containsKey(r'maxMonthlyComments'), 'Required key "CreateTenantPackageBody[maxMonthlyComments]" is missing from JSON.');
assert(json[r'maxMonthlyComments'] != null, 'Required key "CreateTenantPackageBody[maxMonthlyComments]" has a null value in JSON.');
assert(json.containsKey(r'maxConcurrentUsers'), 'Required key "CreateTenantPackageBody[maxConcurrentUsers]" is missing from JSON.');
assert(json[r'maxConcurrentUsers'] != null, 'Required key "CreateTenantPackageBody[maxConcurrentUsers]" has a null value in JSON.');
assert(json.containsKey(r'maxTenantUsers'), 'Required key "CreateTenantPackageBody[maxTenantUsers]" is missing from JSON.');
assert(json[r'maxTenantUsers'] != null, 'Required key "CreateTenantPackageBody[maxTenantUsers]" has a null value in JSON.');
assert(json.containsKey(r'maxSSOUsers'), 'Required key "CreateTenantPackageBody[maxSSOUsers]" is missing from JSON.');
assert(json[r'maxSSOUsers'] != null, 'Required key "CreateTenantPackageBody[maxSSOUsers]" has a null value in JSON.');
assert(json.containsKey(r'maxModerators'), 'Required key "CreateTenantPackageBody[maxModerators]" is missing from JSON.');
assert(json[r'maxModerators'] != null, 'Required key "CreateTenantPackageBody[maxModerators]" has a null value in JSON.');
assert(json.containsKey(r'maxDomains'), 'Required key "CreateTenantPackageBody[maxDomains]" is missing from JSON.');
assert(json[r'maxDomains'] != null, 'Required key "CreateTenantPackageBody[maxDomains]" has a null value in JSON.');
assert(json.containsKey(r'hasDebranding'), 'Required key "CreateTenantPackageBody[hasDebranding]" is missing from JSON.');
assert(json[r'hasDebranding'] != null, 'Required key "CreateTenantPackageBody[hasDebranding]" has a null value in JSON.');
assert(json.containsKey(r'forWhoText'), 'Required key "CreateTenantPackageBody[forWhoText]" is missing from JSON.');
assert(json[r'forWhoText'] != null, 'Required key "CreateTenantPackageBody[forWhoText]" has a null value in JSON.');
assert(json.containsKey(r'featureTaglines'), 'Required key "CreateTenantPackageBody[featureTaglines]" is missing from JSON.');
assert(json[r'featureTaglines'] != null, 'Required key "CreateTenantPackageBody[featureTaglines]" has a null value in JSON.');
assert(json.containsKey(r'hasFlexPricing'), 'Required key "CreateTenantPackageBody[hasFlexPricing]" is missing from JSON.');
assert(json[r'hasFlexPricing'] != null, 'Required key "CreateTenantPackageBody[hasFlexPricing]" has a null value in JSON.');
return true;
}());
return CreateTenantPackageBody(
name: mapValueOfType<String>(json, r'name')!,
monthlyCostUSD: mapValueOfType<double>(json, r'monthlyCostUSD'),
yearlyCostUSD: mapValueOfType<double>(json, r'yearlyCostUSD'),
monthlyStripePlanId: mapValueOfType<String>(json, r'monthlyStripePlanId'),
yearlyStripePlanId: mapValueOfType<String>(json, r'yearlyStripePlanId'),
maxMonthlyPageLoads: mapValueOfType<double>(json, r'maxMonthlyPageLoads')!,
maxMonthlyAPICredits: mapValueOfType<double>(json, r'maxMonthlyAPICredits')!,
maxMonthlySmallWidgetsCredits: mapValueOfType<double>(json, r'maxMonthlySmallWidgetsCredits'),
maxMonthlyComments: mapValueOfType<double>(json, r'maxMonthlyComments')!,
maxConcurrentUsers: mapValueOfType<double>(json, r'maxConcurrentUsers')!,
maxTenantUsers: mapValueOfType<double>(json, r'maxTenantUsers')!,
maxSSOUsers: mapValueOfType<double>(json, r'maxSSOUsers')!,
maxModerators: mapValueOfType<double>(json, r'maxModerators')!,
maxDomains: mapValueOfType<double>(json, r'maxDomains')!,
maxWhiteLabeledTenants: mapValueOfType<double>(json, r'maxWhiteLabeledTenants'),
maxMonthlyEventLogRequests: mapValueOfType<double>(json, r'maxMonthlyEventLogRequests'),
maxCustomCollectionSize: mapValueOfType<double>(json, r'maxCustomCollectionSize'),
hasWhiteLabeling: mapValueOfType<bool>(json, r'hasWhiteLabeling'),
hasDebranding: mapValueOfType<bool>(json, r'hasDebranding')!,
hasLLMSpamDetection: mapValueOfType<bool>(json, r'hasLLMSpamDetection'),
forWhoText: mapValueOfType<String>(json, r'forWhoText')!,
featureTaglines: json[r'featureTaglines'] is Iterable
? (json[r'featureTaglines'] as Iterable).cast<String>().toList(growable: false)
: const [],
hasAuditing: mapValueOfType<bool>(json, r'hasAuditing'),
hasFlexPricing: mapValueOfType<bool>(json, r'hasFlexPricing')!,
enableSAML: mapValueOfType<bool>(json, r'enableSAML'),
flexPageLoadCostCents: mapValueOfType<double>(json, r'flexPageLoadCostCents'),
flexPageLoadUnit: mapValueOfType<double>(json, r'flexPageLoadUnit'),
flexCommentCostCents: mapValueOfType<double>(json, r'flexCommentCostCents'),
flexCommentUnit: mapValueOfType<double>(json, r'flexCommentUnit'),
flexSSOUserCostCents: mapValueOfType<double>(json, r'flexSSOUserCostCents'),
flexSSOUserUnit: mapValueOfType<double>(json, r'flexSSOUserUnit'),
flexAPICreditCostCents: mapValueOfType<double>(json, r'flexAPICreditCostCents'),
flexAPICreditUnit: mapValueOfType<double>(json, r'flexAPICreditUnit'),
flexSmallWidgetsCreditCostCents: mapValueOfType<double>(json, r'flexSmallWidgetsCreditCostCents'),
flexSmallWidgetsCreditUnit: mapValueOfType<double>(json, r'flexSmallWidgetsCreditUnit'),
flexModeratorCostCents: mapValueOfType<double>(json, r'flexModeratorCostCents'),
flexModeratorUnit: mapValueOfType<double>(json, r'flexModeratorUnit'),
flexAdminCostCents: mapValueOfType<double>(json, r'flexAdminCostCents'),
flexAdminUnit: mapValueOfType<double>(json, r'flexAdminUnit'),
flexDomainCostCents: mapValueOfType<double>(json, r'flexDomainCostCents'),
flexDomainUnit: mapValueOfType<double>(json, r'flexDomainUnit'),
flexLLMCostCents: mapValueOfType<double>(json, r'flexLLMCostCents'),
flexLLMUnit: mapValueOfType<double>(json, r'flexLLMUnit'),
flexMinimumCostCents: mapValueOfType<double>(json, r'flexMinimumCostCents'),
flexManagedTenantCostCents: mapValueOfType<double>(json, r'flexManagedTenantCostCents'),
flexSSOAdminCostCents: mapValueOfType<double>(json, r'flexSSOAdminCostCents'),
flexSSOAdminUnit: mapValueOfType<double>(json, r'flexSSOAdminUnit'),
flexSSOModeratorCostCents: mapValueOfType<double>(json, r'flexSSOModeratorCostCents'),
flexSSOModeratorUnit: mapValueOfType<double>(json, r'flexSSOModeratorUnit'),
);
}
return null;
}