import { BaseApi } from "../base-api"; import type { UnknownJob } from "../jobs/types"; import type { ApiRecords } from "../types"; import type { DatasetStatisticsConfiguration, StatisticsConfigurationResponse } from "./statistics-types"; import type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetInterfaceError, DatasetInterfaceRef, DatasetInterfaceValidation, DatasetStatus, DatasetTableSummary, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, IngestDatasetFileRequest, JsonSchemaValidationNode, RecalculationInfo, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value } from "./types"; interface GetDatasetsParameters extends Record { /** Page number, starting from 1. */ page?: number; per_page?: number; /** Free-text keyword query matched against dataset name. */ q?: string; data_plane_id?: string; /** Filter to datasets carrying this tag. Repeat to require every supplied tag (all-of semantics). */ tag?: string | string[]; } export type { CronRefresh, DatasetFieldConfig, DatasetFieldNamespace, DatasetStatisticsConfiguration, HistogramOptions, HistogramOverflow, ManualRefresh, NestedNodeConfig, NestedPropertyConfig, NonPrimitiveNodeConfig, OnUpdateRefresh, PrimitiveNodeConfig, RefreshTrigger, RosettaStoneFieldConfig, RosettaStoneFieldNamespace, StatConfig, StatisticsConfigurationResponse, StatName, StatOptions, } from "./statistics-types"; export type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetInterfaceError, DatasetInterfaceRef, DatasetInterfaceValidation, DatasetStatus, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, GetDatasetsParameters, Histogram, JsonSchemaValidationNode, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value, }; /** * @module DatasetApi * @description This module provides methods for fetching datasets. * @extends BaseApi */ export declare class DatasetApi extends BaseApi { /** * Get a single dataset by its ID * @param {number} datasetId - The ID of the dataset * @returns {Promise} - Promise resolving to the requested dataset */ getDataset(datasetId: number): Promise; /** * Get a list of all datasets * @param {GetDatasetsParameters} [parameters] - Optional filtering/pagination parameters. * @returns {Promise>} - Promise resolving to an array of datasets */ getDatasets(parameters?: GetDatasetsParameters): Promise>; /** * Deletes a specific dataset from the system. * This method sends a DELETE request to the specified endpoint to remove the dataset. * * @param {number} datasetId - The ID of the dataset to be deleted. * @returns {Promise} A promise that resolves when the dataset has been successfully deleted. */ deleteDataset(datasetId: number): Promise; /** * Updates an existing dataset with the provided data. * * @param {UpdateDatasetRequest} request - The request containing the dataset information to be updated. * @returns {Promise} - Returns a Promise that resolves to the updated Dataset. * @public * @async */ updateDataset(request: UpdateDatasetRequest): Promise; /** * Creates a dataset based on the provided request. * * @param {CreateDatasetRequest} request - The request payload for creating a dataset. * @returns {Promise} A promise that resolves with the newly created dataset. */ createDataset(request: CreateDatasetRequest): Promise; /** * Adds tags to an existing dataset without removing existing tags. * Duplicate tags will be ignored. * * **Note**: This method performs a read-modify-write operation. * Concurrent calls may result in lost updates. * * @param {number} datasetId - The ID of the dataset to add tags to. * @param {string[]} tags - The tags to add to the dataset. Empty array returns the dataset unchanged. * @returns {Promise} A promise that resolves with the updated dataset. */ addTags(datasetId: number, tags: string[]): Promise; /** * Removes specified tags from an existing dataset. * Tags that don't exist on the dataset will be ignored. * * **Note**: This method performs a read-modify-write operation. * Concurrent calls may result in lost updates. * * @param {number} datasetId - The ID of the dataset to remove tags from. * @param {string[]} tags - The tags to remove from the dataset. Empty array returns the dataset unchanged. * @returns {Promise} A promise that resolves with the updated dataset. */ removeTags(datasetId: number, tags: string[]): Promise; /** * Activates a dataset with the specified dataset ID. * * @param {number} datasetId - The ID of the dataset to activate. * @returns {Promise} A promise that resolves when the dataset has been activated. */ activateDataset(datasetId: number): Promise; /** * Ingests a dataset file with the provided source_file url to the dataset with the specified dataset ID. * * @param {IngestDatasetFileRequest} request - The request containing the source_file url * @param {number} datasetId - The ID of the dataset to which to ingest the file. * @returns {Promise} A promise that resolve when the operation is successful. */ ingestDatasetFile(request: IngestDatasetFileRequest, datasetId: number): Promise; /** * Get summary information for a dataset. * * @param {number} datasetId - The ID of the dataset to get summary information for. * @param {boolean} [allRecords=false] - If `true`, all records in the dataset will be returned. If `false`, only a limited number of records will be returned. * @param {number} [perPage=100] - The number of records to return per page. * @param {number} [offset=0] - The offset to start returning records from. * @returns {Promise} A promise that resolves with the dataset summary information. */ getDatasetSummary(datasetId: number, allRecords?: boolean, perPage?: number, offset?: number): Promise; /** Retrieve a sample of records from a specified dataset by its ID. @async @function @param {number} datasetId - The ID of the dataset to retrieve records from. @param {number} [size=1000] - The number of records to retrieve. Defaults to 1000 if not specified. @returns {Promise>} A Promise that resolves with an object containing the requested records and additional metadata. @throws {Error} If the request fails or if the response is not in the expected format. @example const datasetId = 1234; const size = 500; const records = await getDatasetSample(datasetId, size); */ getDatasetSample(datasetId: number, size?: number): Promise>>; /** * Fetches a list of dataset files based on the provided parameters. * * @param {number} datasetId - The ID of the dataset to fetch files for. * @param {number} [size] - The number of snapshots to return. Optional. * @param {number} [offset] - The starting index of the file list. Optional. * @param {string} [afterTimestamp] - Fetch files with a timestamp greater than or equal to the given value. Optional. * @param {number} [fromSnapshotId] - Fetch files from the specified snapshot ID. Optional. * @returns {Promise} A Promise that resolves with the fetched dataset files. * @throws {Error} If there is an issue with the request or the response. * @memberof DatasetApi * @public */ getDatasetFiles(datasetId: number, size?: number, offset?: number, afterTimestamp?: string, fromSnapshotId?: number): Promise; /** * Fetches the download URL for a specific dataset file. * * @param {number} datasetId - The ID of the dataset to fetch the file download URL for. * @param {number} snapshotId - The ID of the snapshot the file is associated with. * @param {string} fileId - The ID of the file to fetch the download URL for. * @returns {Promise<{ download_url: string }>} A Promise that resolves with an object containing the download URL. * @throws {Error} If there is an issue with the request or the response. * @memberof DatasetApi * @public */ getDatasetFileDownloadUrl(datasetId: number, snapshotId: string, fileId: string): Promise<{ download_url: string; }>; /** * Fetches column statistics for a given dataset. * * @param {number} datasetId - The ID of the dataset to fetch column statistics for. * @returns {Promise} A Promise that resolves with an object containing the column statistics. * @throws {Error} If there is an issue with the request or the response. * @memberof DatasetApi * @public */ getColumnStats(datasetId: number): Promise; /** * Fetches the summary statistics for a given dataset. * * @param {number} datasetId - The ID of the dataset to fetch summary statistics for. * @returns {Promise>} A Promise that resolves with an object containing the dataset summary statistics. * @throws {Error} If there is an issue with the request or the response. * @memberof DatasetApi * @public */ getStatistics(datasetId: number, offset?: number, size?: number): Promise>; /** * Updates the retention policy of a specific dataset. * * @param {number} datasetId - The ID of the dataset to update the retention policy for. * @param {RetentionPolicy} policy - The new retention policy to be applied. * @returns {Promise} A Promise that resolves with the updated dataset object. * @throws {Error} If there is an issue with the request or the response. * @memberof DatasetApi * @public */ updateRetentionPolicy(datasetId: number, policy: RetentionPolicy): Promise; upsertRetentionPolicies(datasetId: number, request: UpsertRetentionPoliciesRequest): Promise; disableDatasetRetentionPolicy(datasetId: number, policy: TTLPolicy): Promise; /** * Configures the statistics for a specific dataset column. * This method sends a PUT request to the specified endpoint to update the statistics configuration. * * @param {number} datasetId - The ID of the dataset whose column statistics need to be configured. * @returns {Promise} A promise that resolves when the operation is complete. */ configureDatasetColumnStatistics(datasetId: number): Promise; /** * Initiates a recalculation of the column statistics for a specific dataset. * This method sends a POST request to the specified endpoint to start the recalculation process. * * @param {number} datasetId - The ID of the dataset whose column statistics need to be recalculated. * @returns {Promise} A promise that resolves when the operation is complete. */ recalculateDatasetColumnStatistics(datasetId: number): Promise; /** * Requests a sample of records from a specified dataset by its ID. * * @param {number} datasetId - The ID of the dataset to request a sample from. * @returns {Promise<{ job_id: string }>} A Promise that resolves with the job_id for tracking the sample request. * @throws {Error} If there is an issue with the request or the response. * @memberof DatasetApi */ requestDatasetSample(datasetId: number, request?: { compute_pool_id?: string; }): Promise<{ job_id: string; }>; /** * Deletes a sample of a specified dataset by its ID. * * @param {number} datasetId - The ID of the dataset to delete the sample from. * @returns {Promise} A Promise that resolves when the operation is complete. * @throws {Error} If there is an issue with the request or the response. * @memberof DatasetApi */ deleteDatasetSample(datasetId: number): Promise; /** * Refreshes the materialized view for the given dataset id. * * @param {number} datasetId - The ID of the dataset for which to refresh the materialized view. * @returns {Promise} A Promise that resolves with a job object to track the refresh operation. * @throws {Error} If there is an issue with the request or the response. * @memberof DatasetApi * @public */ refreshMaterializedView(datasetId: number): Promise; createDatasetRefreshSchedule(datasetId: number, refreshSchedule: CreateDatasetRefreshScheduleRequest): Promise; updateDatasetRefreshSchedule(datasetId: number, refreshSchedule: UpdateDatasetRefreshScheduleRequest): Promise; deleteDatasetRefreshSchedule(datasetId: number): Promise; /** * Validate which connector interfaces are compatible with a dataset. * Filtered by the user's installed apps and optionally by tags. * * @param {number} datasetId - The ID of the dataset to validate interfaces against. * @param {string[]} [tags] - Optional tags to filter interfaces (e.g. ["audience_delivery"]). * @returns {Promise} - Accepted interface IDs and per-interface validation errors. */ getDatasetInterfaces(datasetId: number, tags?: string[]): Promise; putStatisticsConfiguration(datasetId: number, configuration: DatasetStatisticsConfiguration): Promise; getStatisticsConfiguration(datasetId: number): Promise; deleteStatisticsConfiguration(datasetId: number): Promise; }