Class DataClient

Constructors

Properties

dataClient: PromiseClient<{
    methods: {
        addBinaryDataToDatasetByIDs: {
            I: typeof AddBinaryDataToDatasetByIDsRequest;
            O: typeof AddBinaryDataToDatasetByIDsResponse;
            kind: Unary;
            name: "AddBinaryDataToDatasetByIDs";
        };
        addBoundingBoxToImageByID: {
            I: typeof AddBoundingBoxToImageByIDRequest;
            O: typeof AddBoundingBoxToImageByIDResponse;
            kind: Unary;
            name: "AddBoundingBoxToImageByID";
        };
        addTagsToBinaryDataByFilter: {
            I: typeof AddTagsToBinaryDataByFilterRequest;
            O: typeof AddTagsToBinaryDataByFilterResponse;
            kind: Unary;
            name: "AddTagsToBinaryDataByFilter";
        };
        addTagsToBinaryDataByIDs: {
            I: typeof AddTagsToBinaryDataByIDsRequest;
            O: typeof AddTagsToBinaryDataByIDsResponse;
            kind: Unary;
            name: "AddTagsToBinaryDataByIDs";
        };
        binaryDataByFilter: {
            I: typeof BinaryDataByFilterRequest;
            O: typeof BinaryDataByFilterResponse;
            kind: Unary;
            name: "BinaryDataByFilter";
        };
        binaryDataByIDs: {
            I: typeof BinaryDataByIDsRequest;
            O: typeof BinaryDataByIDsResponse;
            kind: Unary;
            name: "BinaryDataByIDs";
        };
        boundingBoxLabelsByFilter: {
            I: typeof BoundingBoxLabelsByFilterRequest;
            O: typeof BoundingBoxLabelsByFilterResponse;
            kind: Unary;
            name: "BoundingBoxLabelsByFilter";
        };
        configureDatabaseUser: {
            I: typeof ConfigureDatabaseUserRequest;
            O: typeof ConfigureDatabaseUserResponse;
            kind: Unary;
            name: "ConfigureDatabaseUser";
        };
        deleteBinaryDataByFilter: {
            I: typeof DeleteBinaryDataByFilterRequest;
            O: typeof DeleteBinaryDataByFilterResponse;
            kind: Unary;
            name: "DeleteBinaryDataByFilter";
        };
        deleteBinaryDataByIDs: {
            I: typeof DeleteBinaryDataByIDsRequest;
            O: typeof DeleteBinaryDataByIDsResponse;
            kind: Unary;
            name: "DeleteBinaryDataByIDs";
        };
        deleteTabularData: {
            I: typeof DeleteTabularDataRequest;
            O: typeof DeleteTabularDataResponse;
            kind: Unary;
            name: "DeleteTabularData";
        };
        exportTabularData: {
            I: typeof ExportTabularDataRequest;
            O: typeof ExportTabularDataResponse;
            kind: ServerStreaming;
            name: "ExportTabularData";
        };
        getDatabaseConnection: {
            I: typeof GetDatabaseConnectionRequest;
            O: typeof GetDatabaseConnectionResponse;
            kind: Unary;
            name: "GetDatabaseConnection";
        };
        getLatestTabularData: {
            I: typeof GetLatestTabularDataRequest;
            O: typeof GetLatestTabularDataResponse;
            kind: Unary;
            name: "GetLatestTabularData";
        };
        removeBinaryDataFromDatasetByIDs: {
            I: typeof RemoveBinaryDataFromDatasetByIDsRequest;
            O: typeof RemoveBinaryDataFromDatasetByIDsResponse;
            kind: Unary;
            name: "RemoveBinaryDataFromDatasetByIDs";
        };
        removeBoundingBoxFromImageByID: {
            I: typeof RemoveBoundingBoxFromImageByIDRequest;
            O: typeof RemoveBoundingBoxFromImageByIDResponse;
            kind: Unary;
            name: "RemoveBoundingBoxFromImageByID";
        };
        removeTagsFromBinaryDataByFilter: {
            I: typeof RemoveTagsFromBinaryDataByFilterRequest;
            O: typeof RemoveTagsFromBinaryDataByFilterResponse;
            kind: Unary;
            name: "RemoveTagsFromBinaryDataByFilter";
        };
        removeTagsFromBinaryDataByIDs: {
            I: typeof RemoveTagsFromBinaryDataByIDsRequest;
            O: typeof RemoveTagsFromBinaryDataByIDsResponse;
            kind: Unary;
            name: "RemoveTagsFromBinaryDataByIDs";
        };
        tabularDataByFilter: {
            I: typeof TabularDataByFilterRequest;
            O: typeof TabularDataByFilterResponse;
            kind: Unary;
            name: "TabularDataByFilter";
        };
        tabularDataByMQL: {
            I: typeof TabularDataByMQLRequest;
            O: typeof TabularDataByMQLResponse;
            kind: Unary;
            name: "TabularDataByMQL";
        };
        tabularDataBySQL: {
            I: typeof TabularDataBySQLRequest;
            O: typeof TabularDataBySQLResponse;
            kind: Unary;
            name: "TabularDataBySQL";
        };
        tagsByFilter: {
            I: typeof TagsByFilterRequest;
            O: typeof TagsByFilterResponse;
            kind: Unary;
            name: "TagsByFilter";
        };
        updateBoundingBox: {
            I: typeof UpdateBoundingBoxRequest;
            O: typeof UpdateBoundingBoxResponse;
            kind: Unary;
            name: "UpdateBoundingBox";
        };
    };
    typeName: "viam.app.data.v1.DataService";
}>

Type declaration

dataSyncClient: PromiseClient<{
    methods: {
        dataCaptureUpload: {
            I: typeof DataCaptureUploadRequest;
            O: typeof DataCaptureUploadResponse;
            kind: Unary;
            name: "DataCaptureUpload";
        };
        fileUpload: {
            I: typeof FileUploadRequest;
            O: typeof FileUploadResponse;
            kind: ClientStreaming;
            name: "FileUpload";
        };
        streamingDataCaptureUpload: {
            I: typeof StreamingDataCaptureUploadRequest;
            O: typeof StreamingDataCaptureUploadResponse;
            kind: ClientStreaming;
            name: "StreamingDataCaptureUpload";
        };
    };
    typeName: "viam.app.datasync.v1.DataSyncService";
}>

Type declaration

  • Readonly methods: {
        dataCaptureUpload: {
            I: typeof DataCaptureUploadRequest;
            O: typeof DataCaptureUploadResponse;
            kind: Unary;
            name: "DataCaptureUpload";
        };
        fileUpload: {
            I: typeof FileUploadRequest;
            O: typeof FileUploadResponse;
            kind: ClientStreaming;
            name: "FileUpload";
        };
        streamingDataCaptureUpload: {
            I: typeof StreamingDataCaptureUploadRequest;
            O: typeof StreamingDataCaptureUploadResponse;
            kind: ClientStreaming;
            name: "StreamingDataCaptureUpload";
        };
    }
    • Readonly dataCaptureUpload: {
          I: typeof DataCaptureUploadRequest;
          O: typeof DataCaptureUploadResponse;
          kind: Unary;
          name: "DataCaptureUpload";
      }

      DataCaptureUpload uploads the contents and metadata for tabular data.

      Generated

      from rpc viam.app.datasync.v1.DataSyncService.DataCaptureUpload

      • Readonly I: typeof DataCaptureUploadRequest
      • Readonly O: typeof DataCaptureUploadResponse
      • Readonly kind: Unary
      • Readonly name: "DataCaptureUpload"
    • Readonly fileUpload: {
          I: typeof FileUploadRequest;
          O: typeof FileUploadResponse;
          kind: ClientStreaming;
          name: "FileUpload";
      }

      FileUpload uploads the contents and metadata for binary (image + file) data, where the first packet must be the UploadMetadata.

      Generated

      from rpc viam.app.datasync.v1.DataSyncService.FileUpload

      • Readonly I: typeof FileUploadRequest
      • Readonly O: typeof FileUploadResponse
      • Readonly kind: ClientStreaming
      • Readonly name: "FileUpload"
    • Readonly streamingDataCaptureUpload: {
          I: typeof StreamingDataCaptureUploadRequest;
          O: typeof StreamingDataCaptureUploadResponse;
          kind: ClientStreaming;
          name: "StreamingDataCaptureUpload";
      }

      StreamingDataCaptureUpload uploads the streaming contents and metadata for streaming binary (image + file) data, where the first packet must be the UploadMetadata.

      Generated

      from rpc viam.app.datasync.v1.DataSyncService.StreamingDataCaptureUpload

      • Readonly I: typeof StreamingDataCaptureUploadRequest
      • Readonly O: typeof StreamingDataCaptureUploadResponse
      • Readonly kind: ClientStreaming
      • Readonly name: "StreamingDataCaptureUpload"
  • Readonly typeName: "viam.app.datasync.v1.DataSyncService"
datasetClient: PromiseClient<{
    methods: {
        createDataset: {
            I: typeof CreateDatasetRequest;
            O: typeof CreateDatasetResponse;
            kind: Unary;
            name: "CreateDataset";
        };
        deleteDataset: {
            I: typeof DeleteDatasetRequest;
            O: typeof DeleteDatasetResponse;
            kind: Unary;
            name: "DeleteDataset";
        };
        listDatasetsByIDs: {
            I: typeof ListDatasetsByIDsRequest;
            O: typeof ListDatasetsByIDsResponse;
            kind: Unary;
            name: "ListDatasetsByIDs";
        };
        listDatasetsByOrganizationID: {
            I: typeof ListDatasetsByOrganizationIDRequest;
            O: typeof ListDatasetsByOrganizationIDResponse;
            kind: Unary;
            name: "ListDatasetsByOrganizationID";
        };
        renameDataset: {
            I: typeof RenameDatasetRequest;
            O: typeof RenameDatasetResponse;
            kind: Unary;
            name: "RenameDataset";
        };
    };
    typeName: "viam.app.dataset.v1.DatasetService";
}>

Type declaration

  • Readonly methods: {
        createDataset: {
            I: typeof CreateDatasetRequest;
            O: typeof CreateDatasetResponse;
            kind: Unary;
            name: "CreateDataset";
        };
        deleteDataset: {
            I: typeof DeleteDatasetRequest;
            O: typeof DeleteDatasetResponse;
            kind: Unary;
            name: "DeleteDataset";
        };
        listDatasetsByIDs: {
            I: typeof ListDatasetsByIDsRequest;
            O: typeof ListDatasetsByIDsResponse;
            kind: Unary;
            name: "ListDatasetsByIDs";
        };
        listDatasetsByOrganizationID: {
            I: typeof ListDatasetsByOrganizationIDRequest;
            O: typeof ListDatasetsByOrganizationIDResponse;
            kind: Unary;
            name: "ListDatasetsByOrganizationID";
        };
        renameDataset: {
            I: typeof RenameDatasetRequest;
            O: typeof RenameDatasetResponse;
            kind: Unary;
            name: "RenameDataset";
        };
    }
    • Readonly createDataset: {
          I: typeof CreateDatasetRequest;
          O: typeof CreateDatasetResponse;
          kind: Unary;
          name: "CreateDataset";
      }

      CreateDataset makes a new dataset.

      Generated

      from rpc viam.app.dataset.v1.DatasetService.CreateDataset

      • Readonly I: typeof CreateDatasetRequest
      • Readonly O: typeof CreateDatasetResponse
      • Readonly kind: Unary
      • Readonly name: "CreateDataset"
    • Readonly deleteDataset: {
          I: typeof DeleteDatasetRequest;
          O: typeof DeleteDatasetResponse;
          kind: Unary;
          name: "DeleteDataset";
      }

      DeleteDatasets deletes an existing dataset.

      Generated

      from rpc viam.app.dataset.v1.DatasetService.DeleteDataset

      • Readonly I: typeof DeleteDatasetRequest
      • Readonly O: typeof DeleteDatasetResponse
      • Readonly kind: Unary
      • Readonly name: "DeleteDataset"
    • Readonly listDatasetsByIDs: {
          I: typeof ListDatasetsByIDsRequest;
          O: typeof ListDatasetsByIDsResponse;
          kind: Unary;
          name: "ListDatasetsByIDs";
      }

      ListDatasetsByIDs lists all of the datasets specified by the given dataset IDs.

      Generated

      from rpc viam.app.dataset.v1.DatasetService.ListDatasetsByIDs

      • Readonly I: typeof ListDatasetsByIDsRequest
      • Readonly O: typeof ListDatasetsByIDsResponse
      • Readonly kind: Unary
      • Readonly name: "ListDatasetsByIDs"
    • Readonly listDatasetsByOrganizationID: {
          I: typeof ListDatasetsByOrganizationIDRequest;
          O: typeof ListDatasetsByOrganizationIDResponse;
          kind: Unary;
          name: "ListDatasetsByOrganizationID";
      }

      ListDatasetsByOrganizationID lists all of the datasets for an organization.

      Generated

      from rpc viam.app.dataset.v1.DatasetService.ListDatasetsByOrganizationID

      • Readonly I: typeof ListDatasetsByOrganizationIDRequest
      • Readonly O: typeof ListDatasetsByOrganizationIDResponse
      • Readonly kind: Unary
      • Readonly name: "ListDatasetsByOrganizationID"
    • Readonly renameDataset: {
          I: typeof RenameDatasetRequest;
          O: typeof RenameDatasetResponse;
          kind: Unary;
          name: "RenameDataset";
      }

      RenameDataset modifies the name of an existing dataset.

      Generated

      from rpc viam.app.dataset.v1.DatasetService.RenameDataset

      • Readonly I: typeof RenameDatasetRequest
      • Readonly O: typeof RenameDatasetResponse
      • Readonly kind: Unary
      • Readonly name: "RenameDataset"
  • Readonly typeName: "viam.app.dataset.v1.DatasetService"

Methods

  • Add BinaryData to the provided dataset.

    Parameters

    • ids: BinaryID[]

      The IDs of binary data to add to dataset

    • datasetId: string

      The ID of the dataset to be added to

    Returns Promise<void>

  • Add bounding box to an image.

    Parameters

    • id: BinaryID
    • 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

    Returns Promise<string>

    The bounding box ID

  • Add tags to binary data, specified by filter.

    Parameters

    • tags: string[]

      The tags to add to the data

    • Optional filter: Filter

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

    Returns Promise<void>

  • 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: BinaryID[]

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

    Returns Promise<void>

  • 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

    • Optional filter: Filter

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

    • Optional limit: number

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

    • Optional sortOrder: 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.

  • Get binary data using the BinaryID.

    Parameters

    • ids: BinaryID[]

      The IDs of the requested binary data

    Returns Promise<BinaryData[]>

    An array of data objects

  • Uploads the content and metadata for binary data.

    Upload binary data collected on a robot through a specific component (e.g., 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 (e.g., "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.

    • fileExtension: string

      The file extension of binary data including the period, e.g. .jpg, .png, .pcd. The backend will route the binary to its corresponding mime type based on this extension. Files with a .jpeg, .jpg, or .png extension will be saved to the images tab.

    • 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.

    • Optional tags: string[]

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

    Returns Promise<string>

    The file ID of the uploaded data

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

    Parameters

    • Optional filter: 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

  • 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>

  • 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

  • Filter and delete binary data.

    Parameters

    • Optional filter: 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

  • Delete binary data, specified by ID.

    Parameters

    • ids: BinaryID[]

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

    Returns Promise<bigint>

    The number of items deleted

  • Delete a dataset.

    Parameters

    • id: string

      The ID of the dataset.

    Returns Promise<void>

  • 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 if deleteOlderThanDays is 10, this deletes any data that was captured more than 10 days ago. If it is 0, all existing data is deleted.

    Returns Promise<bigint>

    The number of items deleted

  • 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

    • Optional startTime: Date

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

    • Optional endTime: Date

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

    Returns Promise<TabularDataPoint[]>

    An array of unified tabular data and metadata.

  • 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

  • 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"

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

    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

  • 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

  • List all of the datasets for an organization.

    Parameters

    • organizationId: string

      The ID of the organization

    Returns Promise<Dataset[]>

    The list of datasets in the organization

  • Remove BinaryData from the provided dataset.

    Parameters

    • ids: 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>

  • Remove a bounding box from an image.

    Parameters

    • binId: 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>

  • Remove tags from binary data, specified by filter.

    Parameters

    • tags: string[]

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

    • Optional filter: 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

  • 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: BinaryID[]

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

    Returns Promise<bigint>

    The number of items deleted

  • Rename a dataset.

    Parameters

    • id: string

      The ID of the dataset

    • name: string

      The new name of the dataset

    Returns Promise<void>

  • 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

    • Optional filter: Filter

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

    • Optional limit: number

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

    • Optional sortOrder: 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.

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

    Parameters

    • organizationId: string

      The ID of the organization that owns the data

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

      The MQL query to run as a list of BSON documents

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

    An array of data objects

  • 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

  • Uploads the content and metadata for tabular data.

    Upload tabular data collected on a robot through a specific component (e.g., 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 (e.g., "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.

    • Optional tags: string[]

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

    Returns Promise<string>

    The file ID of the uploaded data

  • Get a list of tags using a filter.

    Parameters

    • Optional filter: Filter

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

    Returns Promise<string[]>

    The list of tags