Skip to content

Function: detectAttachmentType()

detectAttachmentType(att): AttachmentType

Inspect a GenieAttachment and return the AttachmentType of payload it carries. Returns the first known sub-object that’s present; if none of the known ones are populated, falls back to the first non-bookkeeping key (forward-compat for types we don’t model yet), else "unknown".

Honors a pre-set attachment_type if one is already on the value, so this is idempotent across re-detections.

string = ...

Description

Attachment ID

AttachmentType = ...

{ description?: string; id?: string; last_updated_timestamp?: number; parameters?: object[]; query?: string; query_result_metadata?: { is_truncated?: boolean; row_count?: number; }; statement_id?: string; thoughts?: object[]; title?: string; } = ...

string = ...

Description

Description of the query

string = ...

number = ...

Description

Time when the user updated the query last

object[] = ...

string = ...

Description

AI generated SQL query

{ is_truncated?: boolean; row_count?: number; } = ...

Description

Metadata associated with the query result.

boolean = ...

Description

Indicates whether the result set is truncated.

number = ...

Description

The number of rows in the result set.

string = ...

Description

Statement Execution API statement id. Use Get status, manifest, and result first chunk to get the full result data.

object[] = ...

string = ...

Description

Name of the query

{ questions?: string[]; } = ...

Description

Follow-up questions suggested by Genie

string[] = ...

Description

The suggested follow-up questions

{ content?: string; id?: string; purpose?: GenieTextAttachmentPurpose; } = ...

string = ...

Description

AI generated message

string = ...

GenieTextAttachmentPurpose = ...

AttachmentType