Viam SDK
    Preparing search index...

    Interface DataClient

    interface DataClient {
        addBinaryDataToDatasetByIds(
            ids: string[] | BinaryID[],
            datasetId: string,
        ): Promise<void>;
        addBoundingBoxToImageById(
            binaryId: string | BinaryID,
            label: string,
            xMinNormalized: number,
            yMinNormalized: number,
            xMaxNormalized: number,
            yMaxNormalized: number,
            confidence?: number,
        ): Promise<string>;
        addSequencesToDataset(
            sequenceIds: string[],
            datasetId: string,
        ): Promise<void>;
        addTagsToBinaryDataByFilter(tags: string[], filter?: Filter): Promise<void>;
        addTagsToBinaryDataByIds(
            tags: string[],
            ids: string[] | BinaryID[],
        ): Promise<void>;
        binaryDataByFilter(
            filter?: Filter,
            limit?: number,
            sortOrder?: Order,
            last?: string,
            includeBinary?: boolean,
            countOnly?: boolean,
            includeInternalData?: boolean,
        ): Promise<{ count: bigint; data: BinaryData[]; last: string }>;
        binaryDataByIds(
            ids: string[] | BinaryID[],
            includeBinary?: boolean,
        ): Promise<BinaryData[]>;
        binaryDataCaptureUpload(
            binaryData: Uint8Array,
            partId: string,
            componentType: string,
            componentName: string,
            methodName: string,
            dataRequestTimes: [Date, Date],
            options?: BinaryDataCaptureUploadOptions,
        ): Promise<string>;
        boundingBoxLabelsByFilter(filter?: Filter): Promise<string[]>;
        configureDatabaseUser(
            organizationId: string,
            password: string,
        ): Promise<void>;
        createBinaryDataSignedURL(
            binaryDataId: string,
            expirationMinutes?: number,
        ): Promise<string>;
        createDataPipeline(
            organizationId: string,
            name: string,
            query: Uint8Array<ArrayBufferLike>[] | Record<string, Date | JsonValue>[],
            schedule: string,
            enableBackfill: boolean,
            dataSourceType?: TabularDataSourceType,
        ): Promise<string>;
        createDataset(name: string, organizationId: string): Promise<string>;
        createIndex(
            organizationId: string,
            collectionType: IndexableCollection,
            indexSpec: {
                keys: Record<string, number>;
                options?: Record<string, unknown>;
            },
            pipelineName?: string,
        ): Promise<void>;
        createSequence(
            partId: string,
            resources: PartialMessage<SequenceResourceFilter>[],
            sequenceTags?: string[],
            startTime?: Date,
            endTime?: Date,
        ): Promise<string>;
        deleteBinaryDataByFilter(
            filter?: Filter,
            includeInternalData?: boolean,
        ): Promise<bigint>;
        deleteBinaryDataByIds(ids: string[] | BinaryID[]): Promise<bigint>;
        deleteDataPipeline(pipelineId: string): Promise<void>;
        deleteDataset(id: string): Promise<void>;
        deleteIndex(
            organizationId: string,
            collectionType: IndexableCollection,
            indexName: string,
            pipelineName?: string,
        ): Promise<void>;
        deleteSequence(id: string): Promise<void>;
        deleteTabularData(
            organizationId: string,
            deleteOlderThanDays: number,
            filter?: PartialMessage<DeleteTabularFilter>,
        ): Promise<bigint>;
        exportTabularData(
            partId: string,
            resourceName: string,
            resourceSubtype: string,
            methodName: string,
            startTime?: Date,
            endTime?: Date,
            additionalParams?: Record<string, JsonValue>,
        ): Promise<TabularDataPoint[]>;
        fileUpload(
            binaryData: Uint8Array,
            partId: string,
            options?: FileUploadOptions,
        ): Promise<string>;
        getDatabaseConnection(organizationId: string): Promise<string>;
        getDataPipeline(pipelineId: string): Promise<DataPipeline | null>;
        getLatestTabularData(
            partId: string,
            resourceName: string,
            resourceSubtype: string,
            methodName: string,
            additionalParams?: Record<string, JsonValue>,
        ): Promise<[Date, Date, Record<string, JsonValue>] | null>;
        getSequence(id: string): Promise<Sequence>;
        getSequenceDatasetExport(
            jobId: string,
        ): Promise<GetSequenceDatasetExportResponse>;
        listDataPipelineRuns(
            pipelineId: string,
            pageSize?: number,
        ): Promise<ListDataPipelineRunsPage>;
        listDataPipelines(organizationId: string): Promise<DataPipeline[]>;
        listDatasetsByIds(ids: string[]): Promise<Dataset[]>;
        listDatasetsByOrganizationID(
            organizationId: string,
            type?: DatasetType,
        ): Promise<Dataset[]>;
        listIndexes(
            organizationId: string,
            collectionType: IndexableCollection,
            pipelineName?: string,
        ): Promise<Index[]>;
        listSequences(
            organizationId: string,
            pageToken?: string,
            pageSize?: number,
        ): Promise<{ nextPageToken: string; sequences: Sequence[] }>;
        removeBinaryDataFromDatasetByIds(
            ids: string[] | BinaryID[],
            datasetId: string,
        ): Promise<void>;
        removeBoundingBoxFromImageById(
            binId: string | BinaryID,
            bboxId: string,
        ): Promise<void>;
        removeSequencesFromDataset(
            sequenceIds: string[],
            datasetId: string,
        ): Promise<void>;
        removeTagsFromBinaryDataByFilter(
            tags: string[],
            filter?: Filter,
        ): Promise<bigint>;
        removeTagsFromBinaryDataByIds(
            tags: string[],
            ids: string[] | BinaryID[],
        ): Promise<bigint>;
        renameDataset(id: string, name: string): Promise<void>;
        sequencesByDatasetID(
            datasetId: string,
            pageToken?: string,
            pageSize?: number,
        ): Promise<{ nextPageToken: string; sequences: Sequence[] }>;
        startSequenceDatasetExport(datasetId: string): Promise<string>;
        tabularDataByFilter(
            filter?: Filter,
            limit?: number,
            sortOrder?: Order,
            last?: string,
            countOnly?: boolean,
            includeInternalData?: boolean,
        ): Promise<{ count: bigint; data: TabularData[]; last: string }>;
        tabularDataByMQL(
            organizationId: string,
            query: Uint8Array<ArrayBufferLike>[] | Record<string, Date | JsonValue>[],
            useRecentData?: boolean,
            tabularDataSource?: TabularDataSource,
            queryPrefixName?: string,
        ): Promise<(Object | any[])[]>;
        tabularDataBySQL(
            organizationId: string,
            query: string,
        ): Promise<(Object | any[])[]>;
        tabularDataCaptureUpload(
            tabularData: Record<string, JsonValue>[],
            partId: string,
            componentType: string,
            componentName: string,
            methodName: string,
            dataRequestTimes: [Date, Date][],
            tags?: string[],
        ): Promise<string>;
        tagsByFilter(filter?: Filter): Promise<string[]>;
        updateBoundingBox(
            binaryId: string | BinaryID,
            bboxId: string,
            label?: string,
            xMinNormalized?: number,
            yMinNormalized?: number,
            xMaxNormalized?: number,
            yMaxNormalized?: number,
            confidence?: number,
        ): Promise<void>;
        updateSequence(
            id: string,
            resources?: PartialMessage<SequenceResourceFilter>[],
            sequenceTags?: string[],
            startTime?: Date,
            endTime?: Date,
            fieldMask?: PartialMessage<FieldMask>,
        ): Promise<void>;
    }
    Index

    Methods

    • Add BinaryData to the provided dataset.

      Parameters

      • ids: string[] | BinaryID[]

        The IDs of binary data to add to dataset

      • datasetId: string

        The ID of the dataset to be added to

      Returns Promise<void>

      await dataClient.addBinaryDataToDatasetByIds(
      [
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      ],
      '12ab3de4f56a7bcd89ef0ab1',
      );

      For more information, see Data API.

    • Add bounding box to an image.

      Parameters

      • binaryId: string | BinaryID

        The ID of the image to add the bounding box to

      • label: string

        A label for the bounding box

      • xMinNormalized: number

        The min X value of the bounding box normalized from 0 to 1

      • yMinNormalized: number

        The min Y value of the bounding box normalized from 0 to 1

      • xMaxNormalized: number

        The max X value of the bounding box normalized from 0 to 1

      • yMaxNormalized: number

        The max Y value of the bounding box normalized from 0 to 1

      • Optionalconfidence: number

        Model's confidence in a predicted bounding box expressed as a normalized value from 0 to 1

      Returns Promise<string>

      The bounding box ID

      const bboxId = await dataClient.addBoundingBoxToImageById(
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      'label1',
      0.3,
      0.3,
      0.6,
      0.6,
      0.4,
      );

      For more information, see Data API.

    • Add sequences to the provided dataset.

      Parameters

      • sequenceIds: string[]

        The IDs of the sequences to add to the dataset

      • datasetId: string

        The ID of the dataset to add the sequences to

      Returns Promise<void>

      await dataClient.addSequencesToDataset(
      ['sequence-id-1', 'sequence-id-2'],
      '12ab3de4f56a7bcd89ef0ab1',
      );
    • Add tags to binary data, specified by filter.

      Parameters

      • tags: string[]

        The tags to add to the data

      • Optionalfilter: Filter

        Optional pb.Filter specifying binary data to add tags to. No filter implies all binary data.

      Returns Promise<void>

      const data = await dataClient.addTagsToBinaryDataByFilter(
      ['tag1', 'tag2'],
      [
      {
      componentName: 'camera-1',
      } as Filter,
      ],
      );

      For more information, see Data API.

    • Add tags to binary data, specified by ID.

      Parameters

      • tags: string[]

        The list of tags to add to specified binary data. Must be non-empty.

      • ids: string[] | BinaryID[]

        The IDs of the data to be tagged. Must be non-empty.

      Returns Promise<void>

      const data = await dataClient.addTagsToBinaryDataByIds(
      ['tag1', 'tag2'],
      [
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      ],
      );

      For more information, see Data API.

    • Filter and get a page of binary data. The returned metadata might be empty if the metadata index of the data is out of the bounds of the returned metadata list. The data will be paginated into pages of limit items, and the pagination ID will be included in the returned tuple.

      Parameters

      • Optionalfilter: Filter

        Optional pb.Filter specifying binary data to retrieve. No filter implies all binary data.

      • Optionallimit: number

        The maximum number of entries to include in a page. Defaults to 50 if unspecfied

      • OptionalsortOrder: Order

        The desired sort order of the data

      • last: string = ''

        Optional string indicating the ID of the last-returned data. If provided, the server will return the next data entries after the last ID.

      • includeBinary: boolean = true

        Whether to include binary file data with each retrieved file

      • countOnly: boolean = false

        Whether to return only the total count of entries

      • includeInternalData: boolean = false

        Whether to retun internal data. Internal data is used for Viam-specific data ingestion, like cloud SLAM. Defaults to false.

      Returns Promise<{ count: bigint; data: BinaryData[]; last: string }>

      An array of data objects, the count (number of entries), and the last-returned page ID.

      const data = await dataClient.binaryDataByFilter(
      {
      componentName: 'camera-1',
      componentType: 'rdk:component:camera',
      } as Filter,
      1,
      );

      For more information, see Data API.

    • Get binary data using the binary data ID.

      Parameters

      • ids: string[] | BinaryID[]

        The IDs of the requested binary data

      • includeBinary: boolean = true

        Whether to include binary file data with each retrieved file

      Returns Promise<BinaryData[]>

      An array of data objects

      const data = await dataClient.binaryDataByIds([
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      ]);

      For more information, see Data API.

    • Uploads the content and metadata for binary data.

      Upload binary data collected on a robot through a specific component (for example, a motor) along with the relevant metadata to app.viam.com. binary data can be found under the "Sensors" subtab of the Data tab on app.viam.com.

      Parameters

      • binaryData: Uint8Array

        The data to be uploaded, represented in bytes

      • partId: string

        The part ID of the component used to capture the data

      • componentType: string

        The type of the component used to capture the data (for example, "movementSensor")

      • componentName: string

        The name of the component used to capture the data

      • methodName: string

        The name of the method used to capture the data.

      • dataRequestTimes: [Date, Date]

        Tuple containing Date objects denoting the times this data was requested[0] by the robot and received[1] from the appropriate sensor.

      • Optionaloptions: BinaryDataCaptureUploadOptions

        Optional parameters including mimeType, fileExtension, tags, and datasetIds.

      Returns Promise<string>

      The binary data ID of the uploaded data

      const binaryDataId = await dataClient.binaryDataCaptureUpload(
      binaryData,
      '123abc45-1234-5678-90ab-cdef12345678',
      'rdk:component:camera',
      'my-camera',
      'ReadImage',
      [new Date('2025-03-19'), new Date('2025-03-19')],
      { mimeType: 'image/jpeg' },
      );

      For more information, see Data API.

    • Get a list of bounding box labels using a Filter.

      Parameters

      • Optionalfilter: Filter

        Optional pb.Filter specifying what data to get tags from. No filter implies all labels.

      Returns Promise<string[]>

      The list of bounding box labels

      const data = await dataClient.boundingBoxLabelsByFilter({
      componentName: 'camera-1',
      } as Filter);

      For more information, see Data API.

    • Configure a database user for the Viam organization's MongoDB Atlas Data Federation instance. It can also be used to reset the password of the existing database user.

      Parameters

      • organizationId: string

        The ID of the organization

      • password: string

        The password of the user

      Returns Promise<void>

      await dataClient.configureDatabaseUser(
      '123abc45-1234-5678-90ab-cdef12345678',
      'Password01!',
      );

      For more information, see Data API.

    • Create a signed URL for binary data.

      Parameters

      • binaryDataId: string

        The ID of the binary data

      • OptionalexpirationMinutes: number

      Returns Promise<string>

      A signed URL string for accessing the binary data

      const signedUrl = await dataClient.createBinaryDataSignedURL(
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      );

      For more information, see Data API.

    • Creates a new data pipeline using the given query and schedule.

      Parameters

      • organizationId: string

        The ID of the organization

      • name: string

        The name of the data pipeline

      • query: Uint8Array<ArrayBufferLike>[] | Record<string, Date | JsonValue>[]

        The MQL query to run as a list of BSON documents

      • schedule: string

        The schedule to run the query on (cron expression)

      • enableBackfill: boolean

        Whether to enable backfill for the data pipeline

      • OptionaldataSourceType: TabularDataSourceType

        The type of data source to use for the data pipeline

      Returns Promise<string>

      The ID of the created data pipeline

      // {@link JsonValue} is imported from @bufbuild/protobuf
      const mqlQuery: Record<string, JsonValue>[] = [
      {
      $match: {
      component_name: 'sensor-1',
      },
      },
      {
      $limit: 5,
      },
      ];

      const pipelineId = await dataClient.createDataPipeline(
      '123abc45-1234-5678-90ab-cdef12345678',
      'my-pipeline',
      mqlQuery,
      '0 0 * * *'
      false,
      0
      );
    • Create a new dataset.

      Parameters

      • name: string

        The name of the new dataset

      • organizationId: string

        The ID of the organization the dataset is being created in

      Returns Promise<string>

      The ID of the dataset

      const datasetId = await dataClient.createDataset(
      'my-new-dataset',
      '123abc45-1234-5678-90ab-cdef12345678',
      );

      For more information, see Data API.

    • CreateIndex starts a custom index build

      Parameters

      • organizationId: string

        The ID of the organization

      • collectionType: IndexableCollection

        The type of collection to create the index on

      • indexSpec: { keys: Record<string, number>; options?: Record<string, unknown> }

        The MongoDB index specification in JSON format, as a Uint8Array

      • OptionalpipelineName: string

        Optional name of the pipeline if collectionType is PIPELINE_SINK

      Returns Promise<void>

      await dataClient.createIndex(
      '123abc45-1234-5678-90ab-cdef12345678',
      IndexableCollection.HOT_STORE,
      [new TextEncoder().encode(JSON.stringify({ field: 1 }))],
      );
    • Create a new sequence.

      Parameters

      • partId: string

        The ID of the part that owns the sequence

      • resources: PartialMessage<SequenceResourceFilter>[]

        The resource filters for the sequence

      • OptionalsequenceTags: string[]

        Optional tags for the sequence

      • OptionalstartTime: Date

        Optional start time of the sequence

      • OptionalendTime: Date

        Optional end time of the sequence

      Returns Promise<string>

      The ID of the created sequence

      const sequenceId = await dataClient.createSequence(
      'part-id',
      [
      {
      resourceName: 'my-sensor',
      methodName: 'Readings',
      },
      ],
      ['tag1', 'tag2'],
      new Date('2025-01-01'),
      new Date('2025-12-31'),
      );
    • Filter and delete binary data.

      Parameters

      • Optionalfilter: Filter

        Optional pb.Filter specifying binary data to delete. No filter implies all binary data.

      • includeInternalData: boolean = true

        Whether or not to delete internal data. Default is true

      Returns Promise<bigint>

      The number of items deleted

      const data = await dataClient.deleteBinaryDataByFilter({
      componentName: 'camera-1',
      componentType: 'rdk:component:camera',
      organizationIds: ['123abc45-1234-5678-90ab-cdef12345678'],
      startTime: new Date('2025-03-19'),
      endTime: new Date('2025-03-20'),
      } as Filter);

      For more information, see Data API.

    • Delete binary data, specified by ID.

      Parameters

      • ids: string[] | BinaryID[]

        The IDs of the data to be deleted. Must be non-empty.

      Returns Promise<bigint>

      The number of items deleted

      const data = await dataClient.deleteBinaryDataByIds([
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      ]);

      For more information, see Data API.

    • Deletes a data pipeline by its ID.

      Parameters

      • pipelineId: string

        The ID of the data pipeline

      Returns Promise<void>

      await dataClient.deleteDataPipeline('123abc45-1234-5678-90ab-cdef12345678');
      
    • Delete a dataset.

      Parameters

      • id: string

        The ID of the dataset.

      Returns Promise<void>

      await dataClient.deleteDataset('12ab3de4f56a7bcd89ef0ab1');
      

      For more information, see Data API.

    • DeleteIndex drops the specified custom index from a collection

      Parameters

      • organizationId: string

        The ID of the organization

      • collectionType: IndexableCollection

        The type of collection to delete the index from

      • indexName: string

        The name of the index to delete

      • OptionalpipelineName: string

        Optional name of the pipeline if collectionType is PIPELINE_SINK

      Returns Promise<void>

      await dataClient.deleteIndex(
      '123abc45-1234-5678-90ab-cdef12345678',
      IndexableCollection.HOT_STORE,
      'my_index',
      );
    • Delete a sequence by ID.

      Parameters

      • id: string

        The ID of the sequence to delete

      Returns Promise<void>

      await dataClient.deleteSequence('sequence-id');
      
    • Delete tabular data older than a specified number of days.

      Parameters

      • organizationId: string

        The ID of organization to delete data from

      • deleteOlderThanDays: number

        Delete data that was captured more than this many days ago. For example, a value of 10 deletes any data that was captured more than 10 days ago. A value of 0 deletes all existing data.

      • Optionalfilter: PartialMessage<DeleteTabularFilter>

        Optional filter to further constrain which data is deleted. If provided, only data matching the filter will be deleted. If omitted, data is deleted based on organization_id and delete_older_than_days.

      Returns Promise<bigint>

      The number of items deleted

      const data = await dataClient.deleteTabularData(
      '123abc45-1234-5678-90ab-cdef12345678',
      10,
      );

      // Delete with additional filter constraints
      const data = await dataClient.deleteTabularData(
      '123abc45-1234-5678-90ab-cdef12345678',
      10,
      {
      locationIds: ['location-id'],
      componentName: 'camera',
      },
      );

      For more information, see Data API.

    • Obtain unified tabular data and metadata from the specified data source.

      Parameters

      • partId: string

        The ID of the part that owns the data

      • resourceName: string

        The name of the requested resource that captured the data

      • resourceSubtype: string

        The subtype of the requested resource that captured the data

      • methodName: string

        The data capture method name

      • OptionalstartTime: Date

        Optional start time (Date object) for requesting a specific range of data

      • OptionalendTime: Date

        Optional end time (Date object) for requesting a specific range of data

      • OptionaladditionalParams: Record<string, JsonValue>

      Returns Promise<TabularDataPoint[]>

      An array of unified tabular data and metadata.

      const data = await dataClient.exportTabularData(
      '123abc45-1234-5678-90ab-cdef12345678',
      'my-sensor',
      'rdk:component:sensor',
      'Readings',
      new Date('2025-03-25'),
      new Date('2024-03-27'),
      );

      For more information, see Data API.

    • Upload arbitrary file data.

      Upload file data that may be stored on a robot along with the relevant metadata. File data can be found in the Files tab of the DATA page.

      Parameters

      • binaryData: Uint8Array

        The data to be uploaded

      • partId: string

        The part ID of the machine that captured the data

      • Optionaloptions: FileUploadOptions

        Options for the file upload

      Returns Promise<string>

      The binary data ID of the uploaded data

      const binaryDataId = await dataClient.fileUpload(binaryData, 'INSERT YOUR PART ID', {
      fileExtension: '.jpeg',
      tags: ['tag_1', 'tag_2'],
      });

      For more information, see Data API.

    • Get a connection to access a MongoDB Atlas Data federation instance.

      Parameters

      • organizationId: string

        Organization to retrieve connection for

      Returns Promise<string>

      Hostname of the federated database

      const hostname = await dataClient.getDatabaseConnection(
      '123abc45-1234-5678-90ab-cdef12345678',
      );

      For more information, see Data API.

    • Get a data pipeline configuration by its ID.

      Parameters

      • pipelineId: string

        The ID of the data pipeline

      Returns Promise<DataPipeline | null>

      The data pipeline configuration or null if it does not exist

      const pipeline = await dataClient.getPipeline('123abc45-1234-5678-90ab-cdef12345678');
      
    • Gets the most recent tabular data captured from the specified data source, as long as it was synced within the last year.

      Parameters

      • partId: string

        The ID of the part that owns the data

      • resourceName: string

        The name of the requested resource that captured the data. Ex: "my-sensor"

      • resourceSubtype: string

        The subtype of the requested resource that captured the data. Ex: "rdk:component:sensor"

      • methodName: string

        The data capture method name. Ex: "Readings"

      • OptionaladditionalParams: Record<string, JsonValue>

      Returns Promise<[Date, Date, Record<string, JsonValue>] | null>

      A tuple containing [timeCaptured, timeSynced, payload] or null if no data has been synced for the specified resource OR the most recently captured data was over a year ago

      const data = await dataClient.getLatestTabularData(
      '123abc45-1234-5678-90ab-cdef12345678',
      'my-sensor',
      'rdk:component:sensor',
      'Readings',
      );

      For more information, see Data API.

    • Retrieve a sequence by ID.

      Parameters

      • id: string

        The ID of the sequence

      Returns Promise<Sequence>

      The sequence

      const sequence = await dataClient.getSequence('sequence-id');
      
    • Get the current status of a sequence dataset export job.

      Parameters

      • jobId: string

        The ID of the export job

      Returns Promise<GetSequenceDatasetExportResponse>

      The current status of the export job

      const status = await dataClient.getSequenceDatasetExport('job-id');
      
    • List all runs of a data pipeline.

      Parameters

      • pipelineId: string

        The ID of the data pipeline

      • OptionalpageSize: number

        The number of runs to return per page

      Returns Promise<ListDataPipelineRunsPage>

      A page of data pipeline runs

      const page = await dataClient.listDataPipelineRuns('123abc45-1234-5678-90ab-cdef12345678');
      page.runs.forEach((run) => {
      console.log(run);
      });
      page = await page.nextPage();
      page.runs.forEach((run) => {
      console.log(run);
      });
    • List all data pipelines for an organization.

      Parameters

      • organizationId: string

        The ID of the organization

      Returns Promise<DataPipeline[]>

      The list of data pipelines

      const pipelines = await dataClient.listDataPipelines(
      '123abc45-1234-5678-90ab-cdef12345678',
      );
    • List all of the datasets specified by the given dataset IDs.

      Parameters

      • ids: string[]

        The list of IDs of the datasets

      Returns Promise<Dataset[]>

      The list of datasets

      const datasets = await dataClient.listDatasetsByIds(['12ab3de4f56a7bcd89ef0ab1']);
      

      For more information, see Data API.

    • List all of the datasets for an organization.

      Parameters

      • organizationId: string

        The ID of the organization

      • Optionaltype: DatasetType

        Optional dataset type to filter on

      Returns Promise<Dataset[]>

      The list of datasets in the organization

      const datasets = await dataClient.listDatasetsByOrganizationID(
      '123abc45-1234-5678-90ab-cdef12345678',
      );

      For more information, see Data API.

    • ListIndexes returns all the indexes for a given collection

      Parameters

      • organizationId: string

        The ID of the organization

      • collectionType: IndexableCollection

        The type of collection to list indexes for

      • OptionalpipelineName: string

        Optional name of the pipeline if collectionType is PIPELINE_SINK

      Returns Promise<Index[]>

      An array of indexes

      const indexes = await dataClient.listIndexes(
      '123abc45-1234-5678-90ab-cdef12345678',
      IndexableCollection.HOT_STORE,
      );
    • List sequences for a given organization.

      Parameters

      • organizationId: string

        The ID of the organization

      • OptionalpageToken: string

        Optional page token for pagination

      • OptionalpageSize: number

        Optional page size

      Returns Promise<{ nextPageToken: string; sequences: Sequence[] }>

      The list of sequences and a next page token

      const { sequences, nextPageToken } = await dataClient.listSequences(
      '123abc45-1234-5678-90ab-cdef12345678',
      );
    • Remove BinaryData from the provided dataset.

      Parameters

      • ids: string[] | BinaryID[]

        The IDs of the binary data to remove from dataset

      • datasetId: string

        The ID of the dataset to be removed from

      Returns Promise<void>

      await dataClient.removeBinaryDataFromDatasetByIds(
      [
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      ],
      '12ab3de4f56a7bcd89ef0ab1',
      );

      For more information, see Data API.

    • Remove a bounding box from an image.

      Parameters

      • binId: string | BinaryID

        The ID of the image to remove the bounding box from

      • bboxId: string

        The ID of the bounding box to remove

      Returns Promise<void>

      await dataClient.removeBoundingBoxFromImageById(
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      '5Z9ryhkW7ULaXROjJO6ghPYulNllnH20QImda1iZFroZpQbjahK6igQ1WbYigXED',
      );

      For more information, see Data API.

    • Remove sequences from the provided dataset.

      Parameters

      • sequenceIds: string[]

        The IDs of the sequences to remove from the dataset

      • datasetId: string

        The ID of the dataset to remove the sequences from

      Returns Promise<void>

      await dataClient.removeSequencesFromDataset(
      ['sequence-id-1', 'sequence-id-2'],
      '12ab3de4f56a7bcd89ef0ab1',
      );
    • Remove tags from binary data, specified by filter.

      Parameters

      • tags: string[]

        List of tags to remove from specified binary data. Must be non-empty.

      • Optionalfilter: Filter

        Optional pb.Filter specifying binary data to add tags to. No filter implies all binary data.

      Returns Promise<bigint>

      The number of items deleted

      const data = await dataClient.removeTagsFromBinaryDataByFilter(['tag1', 'tag2'], {
      componentName: 'camera-1',
      componentType: 'rdk:component:camera',
      organizationIds: ['123abc45-1234-5678-90ab-cdef12345678'],
      startTime: new Date('2025-03-19'),
      endTime: new Date('2025-03-20'),
      } as Filter);

      For more information, see Data API.

    • Remove tags from binary data, specified by ID.

      Parameters

      • tags: string[]

        List of tags to remove from specified binary data. Must be non-empty.

      • ids: string[] | BinaryID[]

        The IDs of the data to be edited. Must be non-empty.

      Returns Promise<bigint>

      The number of items deleted

      const data = await dataClient.removeTagsFromBinaryDataByIds(
      ['tag1', 'tag2'],
      [
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      ],
      );

      For more information, see Data API.

    • Rename a dataset.

      Parameters

      • id: string

        The ID of the dataset

      • name: string

        The new name of the dataset

      Returns Promise<void>

      await dataClient.renameDataset('12ab3de4f56a7bcd89ef0ab1', 'my-new-dataset');
      

      For more information, see Data API.

    • List sequences that belong to the given dataset.

      Parameters

      • datasetId: string

        The ID of the dataset

      • OptionalpageToken: string

        Optional page token for pagination

      • OptionalpageSize: number

        Optional page size

      Returns Promise<{ nextPageToken: string; sequences: Sequence[] }>

      The list of sequences and a next page token

      const { sequences, nextPageToken } = await dataClient.sequencesByDatasetID(
      '12ab3de4f56a7bcd89ef0ab1',
      );
    • Start an async export of all data for a sequence dataset.

      Parameters

      • datasetId: string

        The ID of the sequence dataset to export

      Returns Promise<string>

      The job ID of the export job

      const jobId = await dataClient.startSequenceDatasetExport('12ab3de4f56a7bcd89ef0ab1');
      
    • Filter and get a page of tabular data. The returned metadata might be empty if the metadata index of the data is out of the bounds of the returned metadata list. The data will be paginated into pages of limit items, and the pagination ID will be included in the returned tuple.

      Parameters

      • Optionalfilter: Filter

        Optional pb.Filter specifying tabular data to retrieve. No filter implies all tabular data.

      • Optionallimit: number

        The maximum number of entries to include in a page. Defaults to 50 if unspecfied

      • OptionalsortOrder: Order

        The desired sort order of the data

      • last: string = ''

        Optional string indicating the ID of the last-returned data. If provided, the server will return the next data entries after the last ID.

      • countOnly: boolean = false

        Whether to return only the total count of entries

      • includeInternalData: boolean = false

        Whether to retun internal data. Internal data is used for Viam-specific data ingestion, like cloud SLAM. Defaults to false.

      Returns Promise<{ count: bigint; data: TabularData[]; last: string }>

      An array of data objects, the count (number of entries), and the last-returned page ID.

      const data = await dataClient.tabularDataByFilter(
      {
      componentName: 'sensor-1',
      componentType: 'rdk:component:sensor',
      } as Filter,
      5,
      );

      For more information, see Data API.

    • Obtain unified tabular data and metadata, queried with MQL.

      Parameters

      • organizationId: string

        The ID of the organization that owns the data

      • query: Uint8Array<ArrayBufferLike>[] | Record<string, Date | JsonValue>[]

        The MQL query to run as a list of BSON documents

      • OptionaluseRecentData: boolean

        Whether to query blob storage or your recent data store. Defaults to false. Deprecated - use dataSource instead.

      • OptionaltabularDataSource: TabularDataSource
      • OptionalqueryPrefixName: string

        Optional name of the query prefix.

      Returns Promise<(Object | any[])[]>

      An array of data objects

      // {@link JsonValue} is imported from @bufbuild/protobuf
      const mqlQuery: Record<string, JsonValue>[] = [
      {
      $match: {
      component_name: 'sensor-1',
      },
      },
      {
      $limit: 5,
      },
      ];

      const data = await dataClient.tabularDataByMQL(
      '123abc45-1234-5678-90ab-cdef12345678',
      mqlQuery,
      );

      For more information, see Data API.

    • Obtain unified tabular data and metadata, queried with SQL.

      Parameters

      • organizationId: string

        The ID of the organization that owns the data

      • query: string

        The SQL query to run

      Returns Promise<(Object | any[])[]>

      An array of data objects

      const data = await dataClient.tabularDataBySQL(
      '123abc45-1234-5678-90ab-cdef12345678',
      'SELECT * FROM readings LIMIT 5',
      );

      For more information, see Data API.

    • Uploads the content and metadata for tabular data.

      Upload tabular data collected on a robot through a specific component (for example, a motor) along with the relevant metadata to app.viam.com. Tabular data can be found under the "Sensors" subtab of the Data tab on app.viam.com.

      Parameters

      • tabularData: Record<string, JsonValue>[]

        The list of data to be uploaded, represented tabularly as an array.

      • partId: string

        The part ID of the component used to capture the data

      • componentType: string

        The type of the component used to capture the data (for example, "movementSensor")

      • componentName: string

        The name of the component used to capture the data

      • methodName: string

        The name of the method used to capture the data.

      • dataRequestTimes: [Date, Date][]

        Array of Date tuples, each containing two Date objects denoting the times this data was requested[0] by the robot and received[1] from the appropriate sensor. Passing a list of tabular data and Timestamps with length n > 1 will result in n datapoints being uploaded, all tied to the same metadata.

      • Optionaltags: string[]

        The list of tags to allow for tag-based filtering when retrieving data

      Returns Promise<string>

      The file ID of the uploaded data

      const fileId = await dataClient.tabularDataCaptureUpload(
      [
      {
      readings: {
      timestamp: '2025-03-26T10:00:00Z',
      value: 10,
      },
      },
      ],
      '123abc45-1234-5678-90ab-cdef12345678',
      'rdk:component:sensor',
      'my-sensor',
      'Readings',
      [[new Date('2025-03-26T10:00:00Z'), new Date('2025-03-26T10:00:00Z')]],
      );

      For more information, see Data API.

    • Get a list of tags using a filter.

      Parameters

      • Optionalfilter: Filter

        Optional pb.Filter specifying what data to get tags from. No filter implies all data.

      Returns Promise<string[]>

      The list of tags

      const data = await dataClient.tagsByFilter({
      componentName: 'camera-1',
      } as Filter);

      For more information, see Data API.

    • Update an existing bounding box

      Parameters

      • binaryId: string | BinaryID

        The ID of the image that the target bounding box is attached to

      • bboxId: string

        The ID of the bounding box

      • Optionallabel: string

        A label for the bounding box

      • OptionalxMinNormalized: number

        The min X value of the bounding box normalized from 0 to 1

      • OptionalyMinNormalized: number

        The min Y value of the bounding box normalized from 0 to 1

      • OptionalxMaxNormalized: number

        The max X value of the bounding box normalized from 0 to 1

      • OptionalyMaxNormalized: number

        The max Y value of the bounding box normalized from 0 to 1

      • Optionalconfidence: number

        Model's confidence in a predicted bounding box expressed as a normalized value from 0 to 1

      Returns Promise<void>

      await dataClient.updateBoundingBox(
      'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
      '691361a6f124d202010cf415'
      'label1',
      0.3,
      0.3,
      0.6,
      0.6,
      0.4
      );
    • Update the mutable fields of a sequence.

      Parameters

      • id: string

        The ID of the sequence to update

      • Optionalresources: PartialMessage<SequenceResourceFilter>[]

        The updated resource filters

      • OptionalsequenceTags: string[]

        The updated tags

      • OptionalstartTime: Date

        The updated start time

      • OptionalendTime: Date

        The updated end time

      • OptionalfieldMask: PartialMessage<FieldMask>

        Optional field mask specifying which fields to update

      Returns Promise<void>

      await dataClient.updateSequence(
      'sequence-id',
      [
      {
      partId: 'part-id',
      resourceName: 'my-sensor',
      methodName: 'Readings',
      },
      ],
      ['tag1'],
      new Date('2025-01-01'),
      new Date('2025-12-31'),
      { paths: ['resources', 'sequence_tags'] },
      );