Returns a new Endpoints instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static Endpoints? 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'date_created'), 'Required key "Endpoints[date_created]" is missing from JSON.');
assert(json[r'date_created'] != null, 'Required key "Endpoints[date_created]" has a null value in JSON.');
assert(json.containsKey(r'last_updated'), 'Required key "Endpoints[last_updated]" is missing from JSON.');
assert(json[r'last_updated'] != null, 'Required key "Endpoints[last_updated]" has a null value in JSON.');
assert(json.containsKey(r'company_id'), 'Required key "Endpoints[company_id]" is missing from JSON.');
assert(json[r'company_id'] != null, 'Required key "Endpoints[company_id]" has a null value in JSON.');
assert(json.containsKey(r'connection_id'), 'Required key "Endpoints[connection_id]" is missing from JSON.');
assert(json[r'connection_id'] != null, 'Required key "Endpoints[connection_id]" has a null value in JSON.');
assert(json.containsKey(r'sell_in_marketplace'), 'Required key "Endpoints[sell_in_marketplace]" is missing from JSON.');
assert(json[r'sell_in_marketplace'] != null, 'Required key "Endpoints[sell_in_marketplace]" has a null value in JSON.');
assert(json.containsKey(r'name'), 'Required key "Endpoints[name]" is missing from JSON.');
assert(json[r'name'] != null, 'Required key "Endpoints[name]" has a null value in JSON.');
assert(json.containsKey(r'status'), 'Required key "Endpoints[status]" is missing from JSON.');
assert(json[r'status'] != null, 'Required key "Endpoints[status]" has a null value in JSON.');
assert(json.containsKey(r'export_enabled'), 'Required key "Endpoints[export_enabled]" is missing from JSON.');
assert(json[r'export_enabled'] != null, 'Required key "Endpoints[export_enabled]" has a null value in JSON.');
assert(json.containsKey(r'active'), 'Required key "Endpoints[active]" is missing from JSON.');
assert(json[r'active'] != null, 'Required key "Endpoints[active]" has a null value in JSON.');
return true;
}());
return Endpoints(
dateCreated: mapDateTime(json, r'date_created', r'')!,
lastUpdated: mapDateTime(json, r'last_updated', r'')!,
endpointId: mapValueOfType<String>(json, r'endpoint_id'),
userId: mapValueOfType<String>(json, r'user_id'),
companyId: mapValueOfType<String>(json, r'company_id')!,
connectionId: mapValueOfType<String>(json, r'connection_id')!,
industryId: mapValueOfType<int>(json, r'industry_id'),
aucId: mapValueOfType<int>(json, r'auc_id'),
approvalStatus: EndpointsApprovalStatusEnum.fromJson(json[r'approval_status']),
approvedByUserId: mapValueOfType<String>(json, r'approved_by_user_id'),
approvedAt: mapDateTime(json, r'approved_at', r''),
sellInMarketplace: mapValueOfType<bool>(json, r'sell_in_marketplace')!,
name: mapValueOfType<String>(json, r'name')!,
slug: mapValueOfType<String>(json, r'slug'),
description: mapValueOfType<String>(json, r'description'),
detailedDescription: mapValueOfType<String>(json, r'detailed_description'),
topQuestions: mapValueOfType<String>(json, r'top_questions'),
sourceSchemaName: mapValueOfType<String>(json, r'source_schema_name'),
sourceTableName: mapValueOfType<String>(json, r'source_table_name'),
customerName: mapValueOfType<String>(json, r'customer_name'),
endpointSchema: mapValueOfType<Object>(json, r'endpoint_schema'),
rateLimitNumber: mapValueOfType<int>(json, r'rate_limit_number'),
rateLimitPeriod: EndpointsRateLimitPeriodEnum.fromJson(json[r'rate_limit_period']),
rateLimitGranularity: EndpointsRateLimitGranularityEnum.fromJson(json[r'rate_limit_granularity']),
accessMethod: EndpointsAccessMethodEnum.fromJson(json[r'access_method']),
accessWhitelist: mapValueOfType<Object>(json, r'access_whitelist'),
status: EndpointsStatusEnum.fromJson(json[r'status'])!,
dataTimePeriodStart: mapDateTime(json, r'data_time_period_start', r''),
dataTimePeriodEnd: mapDateTime(json, r'data_time_period_end', r''),
dateCollectionStart: mapDateTime(json, r'date_collection_start', r''),
geographicCoverageType: EndpointsGeographicCoverageTypeEnum.fromJson(json[r'geographic_coverage_type']),
geographicCoverageDetails: mapValueOfType<String>(json, r'geographic_coverage_details'),
dataSourceRefreshFrequency: EndpointsDataSourceRefreshFrequencyEnum.fromJson(json[r'data_source_refresh_frequency']),
tags: mapValueOfType<String>(json, r'tags'),
lastAccessed: mapDateTime(json, r'last_accessed', r''),
maxRecordsPerRequest: mapValueOfType<int>(json, r'max_records_per_request'),
exportEnabled: mapValueOfType<bool>(json, r'export_enabled')!,
maxRecordsPerExport: mapValueOfType<int>(json, r'max_records_per_export'),
sampleResponse: mapValueOfType<Object>(json, r'sample_response'),
active: mapValueOfType<bool>(json, r'active')!,
);
}
return null;
}