Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "core/src/types"

Index

Type aliases

AutoPagingEach

AutoPagingEach<T>: (handler: AutoPagingEachHandler<T>) => Promise<void>

Type parameters

  • T

Type declaration

AutoPagingEachHandler

AutoPagingEachHandler<T>: (item: T) => (void | boolean) | Promise<void | boolean>

Type parameters

  • T

Type declaration

    • (item: T): (void | boolean) | Promise<void | boolean>
    • Parameters

      • item: T

      Returns (void | boolean) | Promise<void | boolean>

AutoPagingToArray

AutoPagingToArray<T>: (options?: AutoPagingToArrayOptions) => Promise<T[]>

Type parameters

  • T

Type declaration

CogniteExternalId

CogniteExternalId: string

External Id provided by client. Should be unique within the project.

CogniteInternalId

CogniteInternalId: number

CursorAndAsyncIterator

CursorAndAsyncIterator<T>: Promise<ListResponse<T[]>> & CogniteAsyncIterator<T>

A Promise to a response that can be awaited like normal, but at the risk of not getting all results due to API limits. In which case a nextCursor field is returned to request the next page. Helper methods are provided to abstract away the pagination.

Example using client.timeseries.list with a per-request limit of 1000:

const response = client.timeseries.list({ filter: { assetIds: [ASSET_ID] }, limit: 1000 });

You can get up to 1000 elements with normal await:

const { items, nextCursor } = await response;

You can use autoPagingToArray to get more items than the per-request limit. E.g. an array of up to 5000 items:

const timeseries = await response.autoPagingToArray({ limit: 5000 });

You may also specify { limit: Infinity } to get all results.

You can also iterate through all items (unless you break out of the loop) like so:

for await (const value of response) {
  // do something to value
}

Type parameters

  • T

IdEither

ItemsResponse

ItemsResponse<T>: ItemsWrapper<T[]>

Type parameters

  • T

LogoutUrl

LogoutUrl: string

The url to send the user to in order to log out

example

https://accounts.google.com/logout