Iterate over files

async AsyncCogniteClient.files.__call__(
chunk_size: int | None = None,
name: str | None = None,
mime_type: str | None = None,
metadata: dict[str, str] | None = None,
asset_ids: Sequence[int] | None = None,
asset_external_ids: SequenceNotStr[str] | None = None,
asset_subtree_ids: int | Sequence[int] | None = None,
asset_subtree_external_ids: str | SequenceNotStr[str] | None = None,
data_set_ids: int | Sequence[int] | None = None,
data_set_external_ids: str | SequenceNotStr[str] | None = None,
labels: LabelFilter | None = None,
geo_location: GeoLocationFilter | None = None,
source: str | None = None,
created_time: dict[str, Any] | TimestampRange | None = None,
last_updated_time: dict[str, Any] | TimestampRange | None = None,
source_created_time: dict[str, Any] | TimestampRange | None = None,
source_modified_time: dict[str, Any] | TimestampRange | None = None,
uploaded_time: dict[str, Any] | TimestampRange | None = None,
external_id_prefix: str | None = None,
directory_prefix: str | None = None,
uploaded: bool | None = None,
limit: int | None = None,
) AsyncIterator[FileMetadata] | AsyncIterator[FileMetadataList]

Iterate over files

Fetches file metadata objects as they are iterated over, so you keep a limited number of metadata objects in memory.

Parameters:
  • chunk_size (int | None) – Number of files to return in each chunk. Defaults to yielding one event a time.

  • name (str | None) – Name of the file.

  • mime_type (str | None) – File type. E.g. text/plain, application/pdf, ..

  • metadata (dict[str, str] | None) – Custom, application specific metadata. String key -> String value

  • asset_ids (Sequence[int] | None) – Only include files that reference these specific asset IDs.

  • asset_external_ids (SequenceNotStr[str] | None) – No description.

  • asset_subtree_ids (int | Sequence[int] | None) – Only include files that have a related asset in a subtree rooted at any of these assetIds. If the total size of the given subtrees exceeds 100,000 assets, an error will be returned.

  • asset_subtree_external_ids (str | SequenceNotStr[str] | None) – Only include files that have a related asset in a subtree rooted at any of these assetExternalIds. If the total size of the given subtrees exceeds 100,000 assets, an error will be returned.

  • data_set_ids (int | Sequence[int] | None) – Return only files in the specified data set(s) with this id / these ids.

  • data_set_external_ids (str | SequenceNotStr[str] | None) – Return only files in the specified data set(s) with this external id / these external ids.

  • labels (LabelFilter | None) – Return only the files matching the specified label(s).

  • geo_location (GeoLocationFilter | None) – Only include files matching the specified geographic relation.

  • source (str | None) – The source of this event.

  • created_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps. Possible keys are min and max, with values given as time stamps in ms.

  • last_updated_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps. Possible keys are min and max, with values given as time stamps in ms.

  • source_created_time (dict[str, Any] | TimestampRange | None) – Filter for files where the sourceCreatedTime field has been set and is within the specified range.

  • source_modified_time (dict[str, Any] | TimestampRange | None) – Filter for files where the sourceModifiedTime field has been set and is within the specified range.

  • uploaded_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps

  • external_id_prefix (str | None) – External Id provided by client. Should be unique within the project.

  • directory_prefix (str | None) – Filter by this (case-sensitive) prefix for the directory provided by the client.

  • uploaded (bool | None) – Whether or not the actual file is uploaded. This field is returned only by the API, it has no effect in a post body.

  • limit (int | None) – Maximum number of files to return. Defaults to return all items.

Yields:

FileMetadata | FileMetadataList – yields FileMetadata one by one if chunk_size is not specified, else FileMetadataList objects.