Function: createThread()

createThread(args: { comments?: Pick<NewState<ThreadComment>, "body">[]; entity?: LixEntityCanonical | LixEntity; id?: string; lix: Lix; versionId?: string; }): Promise<{ id: LixGenerated<string>; metadata?: null | Record<string, any>; } & { comments: { body: unknown; id: LixGenerated<string>; parent_id?: null | string; thread_id: string; } & { body: { content: ({ children: ...[]; metadata?: ... | ...; style: string; type: "zettel_text_block"; zettel_key: string; } | { type: ...; zettel_key: ...; } & {[key: ...]: ...; })[]; type: "zettel_doc"; }; } & { lixcol_version_id: string; }[]; lixcol_version_id: string; }>

Starts a new discussion thread.

Threads allow collaborators to attach comments to a specific version or entity. Initial comments can be provided and will be inserted sequentially.

Examples

// Create a standalone thread
const thread = await createThread({ lix, comments: [{ body: "Hello" }] })
// Create a thread attached to an entity
const thread = await createThread({
  lix,
  entity: { entity_id: "para_123", schema_key: "markdown_paragraph", file_id: "README.md" },
  comments: [{ body: "This paragraph needs review" }]
})

Parameters

ParameterTypeDescription
args{ comments?: Pick<NewState<ThreadComment>, "body">[]; entity?: LixEntityCanonical | LixEntity; id?: string; lix: Lix; versionId?: string; }-
args.comments?Pick<NewState<ThreadComment>, "body">[]-
args.entity?LixEntityCanonical | LixEntityOptional entity to attach the thread to
args.id?string-
args.lixLix-
args.versionId?stringdefaults to global

Returns

Promise<{ id: LixGenerated<string>; metadata?: null | Record<string, any>; } & { comments: { body: unknown; id: LixGenerated<string>; parent_id?: null | string; thread_id: string; } & { body: { content: ({ children: ...[]; metadata?: ... | ...; style: string; type: "zettel_text_block"; zettel_key: string; } | { type: ...; zettel_key: ...; } & {[key: ...]: ...; })[]; type: "zettel_doc"; }; } & { lixcol_version_id: string; }[]; lixcol_version_id: string; }>