types

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackLink struct {
	PageName string         `json:"pageName"`
	Blocks   []BlockSummary `json:"blocks"` // the specific blocks containing the link
}

BackLink represents an incoming link from another page.

type BlockEntity

type BlockEntity struct {
	ID              int            `json:"id"`
	UUID            string         `json:"uuid"`
	Content         string         `json:"content"`
	Format          string         `json:"format,omitempty"`
	Marker          string         `json:"marker,omitempty"`   // TODO, DOING, DONE, etc.
	Priority        string         `json:"priority,omitempty"` // A, B, C
	Page            *PageRef       `json:"page,omitempty"`
	Left            *BlockRef      `json:"left,omitempty"`
	Parent          *BlockRef      `json:"parent,omitempty"`
	Children        []BlockEntity  `json:"children,omitempty"`
	Properties      map[string]any `json:"properties,omitempty"`
	PropertiesOrder []string       `json:"propertiesOrder,omitempty"`
	PathRefs        []PageRef      `json:"pathRefs,omitempty"`
	Refs            []PageRef      `json:"refs,omitempty"`
	PreBlock        bool           `json:"preBlock,omitempty"`
}

BlockEntity represents a Logseq block (the atomic unit of knowledge).

type BlockInput

type BlockInput struct {
	Content    string            `json:"content" jsonschema:"Block text content"`
	Properties map[string]string `json:"properties,omitempty" jsonschema:"Block properties"`
	Children   []BlockInput      `json:"children,omitempty" jsonschema:"Nested child blocks"`
}

type BlockRef

type BlockRef struct {
	ID int `json:"id"`
}

BlockRef is a lightweight block reference.

func (*BlockRef) UnmarshalJSON

func (b *BlockRef) UnmarshalJSON(data []byte) error

UnmarshalJSON handles Logseq returning BlockRef as either {"id": N} or plain N.

type BlockSummary

type BlockSummary struct {
	UUID    string `json:"uuid"`
	Content string `json:"content"`
}

BlockSummary is a lightweight block representation for context.

type CreatePageInput

type CreatePageInput struct {
	Name       string         `json:"name" jsonschema:"Page name to create"`
	Properties map[string]any `json:"properties,omitempty" jsonschema:"Page properties as key-value pairs"`
	Blocks     []string       `json:"blocks,omitempty" jsonschema:"Initial block contents to add to the page"`
}

type DeleteBlockInput

type DeleteBlockInput struct {
	UUID string `json:"uuid" jsonschema:"UUID of block to delete"`
}

type EnrichedBlock

type EnrichedBlock struct {
	BlockEntity
	Parsed    ParsedContent  `json:"parsed"`
	Ancestors []BlockSummary `json:"ancestors,omitempty"` // path from root to this block
	Siblings  []BlockSummary `json:"siblings,omitempty"`
}

EnrichedBlock extends BlockEntity with parsed content and ancestor chain.

type EnrichedPage

type EnrichedPage struct {
	PageEntity
	Blocks        []EnrichedBlock `json:"blocks"`
	OutgoingLinks []string        `json:"outgoingLinks"` // pages this page links to
	BackLinks     []BackLink      `json:"backlinks"`     // pages that link to this page
	BlockCount    int             `json:"blockCount"`
	LinkCount     int             `json:"linkCount"`
}

EnrichedPage extends PageEntity with its full block tree and link data.

type FileInfo

type FileInfo struct {
	ID   int    `json:"id"`
	Path string `json:"path,omitempty"`
}

FileInfo contains file path data for a page.

type FindByTagInput

type FindByTagInput struct {
	Tag             string `json:"tag" jsonschema:"Tag name to search for"`
	IncludeChildren bool   `json:"includeChildren,omitempty" jsonschema:"Include child tags in hierarchy. Default: true"`
}

type FindConnectionsInput

type FindConnectionsInput struct {
	From     string `json:"from" jsonschema:"Starting page name"`
	To       string `json:"to" jsonschema:"Target page name"`
	MaxDepth int    `json:"maxDepth,omitempty" jsonschema:"Max search depth. Default: 5"`
}

type FlashcardCreateInput

type FlashcardCreateInput struct {
	Page  string `json:"page" jsonschema:"Page to create the card on"`
	Front string `json:"front" jsonschema:"Front of the card (question)"`
	Back  string `json:"back" jsonschema:"Back of the card (answer)"`
}

type FlashcardDueInput

type FlashcardDueInput struct {
	Limit int `json:"limit,omitempty" jsonschema:"Max cards to return. Default: 20"`
}

type FlashcardOverviewInput

type FlashcardOverviewInput struct{}

FlashcardOverviewInput has no required params — returns SRS statistics.

type GetBlockInput

type GetBlockInput struct {
	UUID             string `json:"uuid" jsonschema:"Block UUID to retrieve"`
	IncludeAncestors bool   `json:"includeAncestors,omitempty" jsonschema:"Include ancestor chain from root. Default: true"`
	IncludeSiblings  bool   `json:"includeSiblings,omitempty" jsonschema:"Include sibling blocks. Default: false"`
}

type GetLinksInput

type GetLinksInput struct {
	Name      string `json:"name" jsonschema:"Page name to get links for"`
	Direction string `json:"direction,omitempty" jsonschema:"Link direction: forward or backward or both. Default: both"`
}

type GetPageInput

type GetPageInput struct {
	Name  string `json:"name" jsonschema:"Page name to retrieve"`
	Depth int    `json:"depth,omitempty" jsonschema:"Max block tree depth (-1 for unlimited). Default: -1"`
}

type GetReferencesInput

type GetReferencesInput struct {
	UUID string `json:"uuid" jsonschema:"Block UUID to find references for"`
}

type GetWhiteboardInput

type GetWhiteboardInput struct {
	Name string `json:"name" jsonschema:"Whiteboard name"`
}

type GraphOverviewInput

type GraphOverviewInput struct{}

GraphOverviewInput has no required params — returns global stats.

type JournalRangeInput

type JournalRangeInput struct {
	From          string `json:"from" jsonschema:"Start date (YYYY-MM-DD)"`
	To            string `json:"to" jsonschema:"End date (YYYY-MM-DD)"`
	IncludeBlocks bool   `json:"includeBlocks,omitempty" jsonschema:"Include full block trees. Default: true"`
}

type JournalSearchInput

type JournalSearchInput struct {
	Query string `json:"query" jsonschema:"Text to search for in journal entries"`
	From  string `json:"from,omitempty" jsonschema:"Start date filter (YYYY-MM-DD)"`
	To    string `json:"to,omitempty" jsonschema:"End date filter (YYYY-MM-DD)"`
}

type KnowledgeGapsInput

type KnowledgeGapsInput struct{}

KnowledgeGapsInput has no required params — returns sparse areas.

type LinkPagesInput

type LinkPagesInput struct {
	From    string `json:"from" jsonschema:"Source page name"`
	To      string `json:"to" jsonschema:"Target page name"`
	Context string `json:"context,omitempty" jsonschema:"Description of the relationship between pages"`
}

type ListPagesInput

type ListPagesInput struct {
	Namespace   string `json:"namespace,omitempty" jsonschema:"Filter by namespace prefix (e.g. graphthulhu)"`
	HasProperty string `json:"hasProperty,omitempty" jsonschema:"Filter to pages with this property key"`
	HasTag      string `json:"hasTag,omitempty" jsonschema:"Filter to pages with this tag"`
	SortBy      string `json:"sortBy,omitempty" jsonschema:"Sort by: name or modified or created. Default: name"`
	Limit       int    `json:"limit,omitempty" jsonschema:"Max results. Default: 50"`
}

type ListWhiteboardsInput

type ListWhiteboardsInput struct{}

ListWhiteboardsInput has no required params.

type LogseqAPIRequest

type LogseqAPIRequest struct {
	Method string `json:"method"`
	Args   []any  `json:"args,omitempty"`
}

LogseqAPIRequest is the JSON body sent to the Logseq HTTP API.

type MoveBlockInput

type MoveBlockInput struct {
	UUID       string `json:"uuid" jsonschema:"UUID of block to move"`
	TargetUUID string `json:"targetUuid" jsonschema:"UUID of target block"`
	Position   string `json:"position,omitempty" jsonschema:"Placement: before or after or child. Default: child"`
}

type NamespaceInfo

type NamespaceInfo struct {
	ID int `json:"id"`
}

NamespaceInfo contains namespace hierarchy data.

type PageEntity

type PageEntity struct {
	ID              int            `json:"id"`
	UUID            string         `json:"uuid"`
	Name            string         `json:"name"`
	OriginalName    string         `json:"originalName"`
	Journal         bool           `json:"journal?"`
	JournalDay      int            `json:"journalDay,omitempty"`
	Namespace       *NamespaceInfo `json:"namespace,omitempty"`
	Properties      map[string]any `json:"properties,omitempty"`
	PropertiesOrder []string       `json:"propertiesOrder,omitempty"`
	CreatedAt       int64          `json:"createdAt,omitempty"`
	UpdatedAt       int64          `json:"updatedAt,omitempty"`
	File            *FileInfo      `json:"file,omitempty"`
}

PageEntity represents a Logseq page.

type PageRef

type PageRef struct {
	ID   int    `json:"id"`
	Name string `json:"name,omitempty"`
}

PageRef is a lightweight page reference (used in block refs and path refs).

func (*PageRef) UnmarshalJSON

func (p *PageRef) UnmarshalJSON(data []byte) error

UnmarshalJSON handles Logseq returning PageRef as either {"id": N} or plain N.

type ParsedContent

type ParsedContent struct {
	Raw             string            `json:"raw"`
	Links           []string          `json:"links"`                // [[page name]]
	BlockReferences []string          `json:"blockReferences"`      // ((uuid))
	Tags            []string          `json:"tags"`                 // #tag
	Properties      map[string]string `json:"properties,omitempty"` // key:: value
	Marker          string            `json:"marker,omitempty"`     // TODO, DOING, DONE
	Priority        string            `json:"priority,omitempty"`   // [#A], [#B], [#C]
}

ParsedContent holds structured data extracted from block content.

type QueryDatalogInput

type QueryDatalogInput struct {
	Query  string `json:"query" jsonschema:"Datalog/DataScript query string"`
	Inputs []any  `json:"inputs,omitempty" jsonschema:"Query input bindings"`
}

type QueryPropertiesInput

type QueryPropertiesInput struct {
	Property string `json:"property" jsonschema:"Property key to search for"`
	Value    string `json:"value,omitempty" jsonschema:"Property value to match (omit to find all with this property)"`
	Operator string `json:"operator,omitempty" jsonschema:"Comparison: eq or contains or gt or lt. Default: eq"`
}

type SearchInput

type SearchInput struct {
	Query        string `json:"query" jsonschema:"Search text to find across all blocks"`
	ContextLines int    `json:"contextLines,omitempty" jsonschema:"Number of parent/sibling blocks for context. Default: 2"`
	Limit        int    `json:"limit,omitempty" jsonschema:"Max results. Default: 20"`
}

type TopicClustersInput

type TopicClustersInput struct{}

TopicClustersInput has no required params — returns community clusters.

type TraverseInput

type TraverseInput struct {
	From    string `json:"from" jsonschema:"Starting page name"`
	To      string `json:"to" jsonschema:"Target page name"`
	MaxHops int    `json:"maxHops,omitempty" jsonschema:"Maximum traversal depth. Default: 4"`
}

type UpdateBlockInput

type UpdateBlockInput struct {
	UUID    string `json:"uuid" jsonschema:"UUID of block to update"`
	Content string `json:"content" jsonschema:"New content for the block (replaces existing content entirely)"`
}

type UpsertBlocksInput

type UpsertBlocksInput struct {
	Page     string       `json:"page" jsonschema:"Page name to add blocks to"`
	Blocks   []BlockInput `json:"blocks" jsonschema:"Blocks to create or update"`
	Position string       `json:"position,omitempty" jsonschema:"Where to add: append or prepend. Default: append"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL