fromJson static method
Returns a new AssetsInput instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static AssetsInput? 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'company_id'), 'Required key "AssetsInput[company_id]" is missing from JSON.');
assert(json[r'company_id'] != null, 'Required key "AssetsInput[company_id]" has a null value in JSON.');
assert(json.containsKey(r'name'), 'Required key "AssetsInput[name]" is missing from JSON.');
assert(json[r'name'] != null, 'Required key "AssetsInput[name]" has a null value in JSON.');
assert(json.containsKey(r'source'), 'Required key "AssetsInput[source]" is missing from JSON.');
assert(json[r'source'] != null, 'Required key "AssetsInput[source]" has a null value in JSON.');
return true;
}());
return AssetsInput(
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'),
functionId: mapValueOfType<String>(json, r'function_id'),
approvalStatus: AssetsInputApprovalStatusEnum.fromJson(json[r'approval_status']),
approvedByUserId: mapValueOfType<String>(json, r'approved_by_user_id'),
approvedAt: mapDateTime(json, r'approved_at', r''),
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'),
source_: AssetsInputSource_Enum.fromJson(json[r'source'])!,
assetType: AssetsInputAssetTypeEnum.fromJson(json[r'asset_type']),
assetSchema: mapValueOfType<Object>(json, r'asset_schema'),
tags: mapValueOfType<String>(json, r'tags'),
topQuestions: mapValueOfType<String>(json, r'top_questions'),
shortCode: mapValueOfType<String>(json, r'short_code'),
restrictedDomains: mapValueOfType<String>(json, r'restricted_domains'),
sqlLogic: mapValueOfType<String>(json, r'sql_logic'),
sourceSchemaName: mapValueOfType<String>(json, r'source_schema_name'),
sourceTableName: mapValueOfType<String>(json, r'source_table_name'),
sellInMarketplace: mapValueOfType<bool>(json, r'sell_in_marketplace'),
requireCustomization: mapValueOfType<bool>(json, r'require_customization'),
vizSpec: mapValueOfType<Object>(json, r'viz_spec'),
vizChartLibrary: AssetsInputVizChartLibraryEnum.fromJson(json[r'viz_chart_library']),
vizChartType: AssetsInputVizChartTypeEnum.fromJson(json[r'viz_chart_type']),
vizDepVarColName: mapValueOfType<String>(json, r'viz_dep_var_col_name'),
vizIndepVarColName: mapValueOfType<String>(json, r'viz_indep_var_col_name'),
vizSizeColName: mapValueOfType<String>(json, r'viz_size_col_name'),
vizColorColName: mapValueOfType<String>(json, r'viz_color_col_name'),
vizDataAggregation: AssetsInputVizDataAggregationEnum.fromJson(json[r'viz_data_aggregation']),
vizSortDirection: AssetsInputVizSortDirectionEnum.fromJson(json[r'viz_sort_direction']),
vizDataLimit: mapValueOfType<int>(json, r'viz_data_limit'),
vizColorScheme: AssetsInputVizColorSchemeEnum.fromJson(json[r'viz_color_scheme']),
vizShowLegend: mapValueOfType<bool>(json, r'viz_show_legend'),
vizShowGrid: mapValueOfType<bool>(json, r'viz_show_grid'),
vizShowTrendline: mapValueOfType<bool>(json, r'viz_show_trendline'),
vizLineSmoothing: mapValueOfType<bool>(json, r'viz_line_smoothing'),
vizBarStacked: mapValueOfType<bool>(json, r'viz_bar_stacked'),
vizFilterDirection: AssetsInputVizFilterDirectionEnum.fromJson(json[r'viz_filter_direction']),
allowParams: mapValueOfType<bool>(json, r'allow_params'),
acceptTerms: mapValueOfType<bool>(json, r'accept_terms'),
cached: mapValueOfType<bool>(json, r'cached'),
schedule: mapValueOfType<String>(json, r'schedule'),
nextRun: mapDateTime(json, r'next_run', r''),
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: AssetsInputGeographicCoverageTypeEnum.fromJson(json[r'geographic_coverage_type']),
geographicCoverageDetails: mapValueOfType<String>(json, r'geographic_coverage_details'),
dataSourceRefreshFrequency: AssetsInputDataSourceRefreshFrequencyEnum.fromJson(json[r'data_source_refresh_frequency']),
rateLimitNumber: mapValueOfType<int>(json, r'rate_limit_number'),
rateLimitPeriod: AssetsInputRateLimitPeriodEnum.fromJson(json[r'rate_limit_period']),
rateLimitGranularity: AssetsInputRateLimitGranularityEnum.fromJson(json[r'rate_limit_granularity']),
);
}
return null;
}