@twinfinity/core
    Preparing search index...

    Class TwinClient

    Implements

    Index

    Constructors

    Methods

    • Executes a batch of asset operations (upsert, delete, restore) atomically. All operations succeed or all are rolled back.

      Parameters

      • twinId: string
      • operations: AssetBatchOperation[]

        Array of batch operations (max 1000).

      • Optionalsignal: AbortSignal

      Returns Promise<AssetBatchResponse>

      On validation failure (400).

      On insufficient permissions (403).

      On conflict (409) or not found (404). The error's response has per-item results with reverted statuses.

    • Retrieves multiple assets by ID in a single request.

      Parameters

      • twinId: string
      • ids: string[]

        Array of asset IDs (max 1000).

      • Optionalsignal: AbortSignal

      Returns Promise<AssetBatchGetResponse>

      On validation failure (400).

    • Parameters

      • twinId: string
      • assets: AssetPost[]
      • Optionalsignal: AbortSignal

      Returns Promise<AssetGet[]>

      On invalid request body (400). The error's errorBody has structured detail.

    • Creates a new twin or updates an existing one (upsert). Provide etag in the twin body to update.

      Parameters

      • twinId: string
      • twin: TwinPut
      • Optionalsignal: AbortSignal

      Returns Promise<TwinGet>

      On invalid request body (400).

      On etag mismatch (409). The error's currentTwin contains the server's current state.

    • Parameters

      • twinId: string
      • fileId: string
      • twinFile: TwinFilePut
      • Optionalsignal: AbortSignal

      Returns Promise<TwinFileGet>

      On invalid request body (400).

      On etag mismatch (409). The error's currentTwinFile contains the server's current state.

    • Parameters

      • twinId: string
      • fileId: string
      • twinFile: unknown
      • Optionalsignal: AbortSignal

      Returns Promise<Response>

    • Parameters

      • twinId: string
      • twin: unknown
      • Optionalsignal: AbortSignal

      Returns Promise<Response>

    • Parameters

      • twinId: string
      • assetId: string
      • etag: string
      • Optionalsignal: AbortSignal

      Returns Promise<AssetGet>

      When the asset does not exist (404).

      On etag mismatch (409). The error's currentAsset contains the server's current state.

    • Parameters

      • twinId: string
      • etag: string
      • Optionalsignal: AbortSignal

      Returns Promise<TwinGet>

      When the twin does not exist (404).

      On etag mismatch (409). The error's currentTwin contains the server's current state.

    • Parameters

      • twinId: string
      • fileId: string
      • deleteRequest: TwinFileDelete
      • Optionalsignal: AbortSignal

      Returns Promise<TwinFileGet>

      When the file does not exist (404).

      On etag mismatch (409). The error's currentTwinFile contains the server's current state.

      On invalid request (400).

    • Parameters

      • twinId: string
      • assetId: string
      • Optionalsignal: AbortSignal

      Returns Promise<AssetGet>

      When the asset does not exist (404).

    • Parameters

      • twinId: string
      • twinVersion: number
      • processorId: string
      • Optionaloffset: number
      • Optionallimit: number
      • Optionalsignal: AbortSignal

      Returns Promise<PaginatedResponse<TwinProcessorEvent>>

      On invalid query parameters (400).

      When the processor does not exist for this twin version (404).

    • Parameters

      • twin: string | { id: string; version: number }

        Twin ID string, or {id, version} to fetch a specific version.

      • Optionalsignal: AbortSignal

      Returns Promise<TwinGet>

      When the twin or version does not exist (404).

    • Parameters

      • twinId: string
      • fileId: string
      • Optionalsignal: AbortSignal

      Returns Promise<TwinFileGet>

      When the file does not exist (404).

      On invalid request (400).

    • Parameters

      • twinId: string
      • fileId: string
      • Optionalsignal: AbortSignal

      Returns Promise<Blob>

      When the file does not exist (404).

    • Parameters

      • twinId: string
      • fileId: string
      • version: number
      • Optionalsignal: AbortSignal

      Returns Promise<TwinFileGet>

      When the file or version does not exist (404).

    • Parameters

      • twinId: string
      • fileId: string
      • version: number
      • Optionalsignal: AbortSignal

      Returns Promise<Blob>

      When the file or version does not exist (404).

    • Parameters

      • twinId: string
      • twinVersion: number
      • Optionaloffset: number
      • Optionallimit: number
      • Optionalsignal: AbortSignal

      Returns Promise<PaginatedResponse<TwinProcessorEvent>>

      On invalid query parameters (400).

      When the twin or version does not exist (404).

    • Fetches all twins by auto-paginating through listTwins. Caps at 1000 pages.

      Parameters

      • OptionalrelatedTo: string

        Filter twins by container ID.

      • Optionalsignal: AbortSignal

      Returns Promise<ListTwinItem[]>

    • Parameters

      • twinId: string
      • Optionaloffset: number
      • Optionallimit: number
      • Optionaloptions: { includeDeleted?: boolean }
      • Optionalsignal: AbortSignal

      Returns Promise<PaginatedResponse<AssetListItem>>

      On invalid query parameters (400).

      When the twin does not exist (404).

    • Parameters

      • OptionalrelatedTo: string

        Filter twins by container ID.

      • Optionalpage: string
      • Optionallimit: number
      • Optionalsignal: AbortSignal

      Returns Promise<PaginatedResponse<ListTwinItem>>

      On invalid query parameters (400).

    • Parameters

      • id: string
      • Optionaloptions: { includeDeleted?: boolean; limit?: number; page: undefined | string }
      • Optionalsignal: AbortSignal

      Returns Promise<PaginatedResponse<ListTwinItem>>

      On invalid query parameters (400).

    • Parameters

      • twinId: string
      • assetId: string
      • etag: string

      Returns Promise<AssetGet>

      When the asset does not exist (404).

      On etag mismatch (409). The error's currentAsset contains the server's current state.

    • Parameters

      • twinId: string
      • etag: string
      • Optionalsignal: AbortSignal

      Returns Promise<TwinGet>

      When the twin does not exist (404).

      On etag mismatch (409). The error's currentTwin contains the server's current state.

    • Parameters

      • twinId: string
      • fileId: string
      • etag: string
      • Optionalsignal: AbortSignal

      Returns Promise<TwinFileGet>

      When the file does not exist (404).

      On etag mismatch (409). The error's currentTwinFile contains the server's current state.

      On invalid request (400).

    • Parameters

      • twinId: string
      • assetId: string
      • asset: AssetPut
      • Optionalsignal: AbortSignal

      Returns Promise<AssetGet>

      On invalid request body (400). The error's errorBody has structured detail.

      On etag mismatch (409). The error's currentAsset contains the server's current state.