fromJson static method

AssetsUpdate? fromJson(
  1. dynamic value
)

Returns a new AssetsUpdate instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static AssetsUpdate? 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(() {
      requiredKeys.forEach((key) {
        assert(json.containsKey(key), 'Required key "AssetsUpdate[$key]" is missing from JSON.');
        assert(json[key] != null, 'Required key "AssetsUpdate[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return AssetsUpdate(
      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'),
      approvalStatus: mapValueOfType<String>(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'),
      source_: AssetsUpdateSource_Enum.fromJson(json[r'source']),
      assetType: AssetsUpdateAssetTypeEnum.fromJson(json[r'asset_type']),
      assetSchema: mapValueOfType<Object>(json, r'asset_schema'),
      tags: mapValueOfType<String>(json, r'tags'),
      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'),
      vizChartLibrary: AssetsUpdateVizChartLibraryEnum.fromJson(json[r'viz_chart_library']),
      vizChartType: AssetsUpdateVizChartTypeEnum.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: AssetsUpdateVizDataAggregationEnum.fromJson(json[r'viz_data_aggregation']),
      vizSortDirection: AssetsUpdateVizSortDirectionEnum.fromJson(json[r'viz_sort_direction']),
      vizDataLimit: mapValueOfType<int>(json, r'viz_data_limit'),
      vizColorScheme: AssetsUpdateVizColorSchemeEnum.fromJson(json[r'viz_color_scheme']),
      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''),
      geographicCoverageType: AssetsUpdateGeographicCoverageTypeEnum.fromJson(json[r'geographic_coverage_type']),
      geographicCoverageDetails: mapValueOfType<String>(json, r'geographic_coverage_details'),
      dataSourceRefreshFrequency: AssetsUpdateDataSourceRefreshFrequencyEnum.fromJson(json[r'data_source_refresh_frequency']),
      dataSourceLastRefreshed: mapDateTime(json, r'data_source_last_refreshed', r''),
    );
  }
  return null;
}