Documentation
¶
Index ¶
- type Client
- func (c *Client) AppendBlockInPage(ctx context.Context, page string, content string) (*types.BlockEntity, error)
- func (c *Client) CreatePage(ctx context.Context, name string, properties map[string]any, ...) (*types.PageEntity, error)
- func (c *Client) DSLQuery(ctx context.Context, dsl string) (json.RawMessage, error)
- func (c *Client) DatascriptQuery(ctx context.Context, query string, inputs ...any) (json.RawMessage, error)
- func (c *Client) DeletePage(ctx context.Context, name string) error
- func (c *Client) GetAllPages(ctx context.Context) ([]types.PageEntity, error)
- func (c *Client) GetAllTags(ctx context.Context) ([]types.PageEntity, error)
- func (c *Client) GetBlock(ctx context.Context, uuid string, opts ...map[string]any) (*types.BlockEntity, error)
- func (c *Client) GetBlockProperties(ctx context.Context, uuid string) (map[string]any, error)
- func (c *Client) GetCurrentGraph(ctx context.Context) (*GraphInfo, error)
- func (c *Client) GetPage(ctx context.Context, nameOrID any) (*types.PageEntity, error)
- func (c *Client) GetPageBlocksTree(ctx context.Context, nameOrID any) ([]types.BlockEntity, error)
- func (c *Client) GetPageLinkedReferences(ctx context.Context, nameOrID any) (json.RawMessage, error)
- func (c *Client) GetPageProperties(ctx context.Context, nameOrID any) (map[string]any, error)
- func (c *Client) GetPagesFromNamespace(ctx context.Context, namespace string) ([]types.PageEntity, error)
- func (c *Client) HasDataScript()
- func (c *Client) InsertBatchBlock(ctx context.Context, srcBlock any, batch []map[string]any, opts map[string]any) ([]types.BlockEntity, error)
- func (c *Client) InsertBlock(ctx context.Context, srcBlock any, content string, opts map[string]any) (*types.BlockEntity, error)
- func (c *Client) MoveBlock(ctx context.Context, uuid string, targetUUID string, opts map[string]any) error
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) PrependBlockInPage(ctx context.Context, page string, content string) (*types.BlockEntity, error)
- func (c *Client) RemoveBlock(ctx context.Context, uuid string) error
- func (c *Client) RenamePage(ctx context.Context, oldName, newName string) error
- func (c *Client) UpdateBlock(ctx context.Context, uuid string, content string, opts ...map[string]any) error
- type GraphInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client communicates with the Logseq HTTP API.
func New ¶
New creates a new Logseq API client. Reads LOGSEQ_API_URL and LOGSEQ_API_TOKEN from environment if not provided.
func (*Client) AppendBlockInPage ¶
func (c *Client) AppendBlockInPage(ctx context.Context, page string, content string) (*types.BlockEntity, error)
AppendBlockInPage adds a block at the end of a page.
func (*Client) CreatePage ¶
func (c *Client) CreatePage(ctx context.Context, name string, properties map[string]any, opts map[string]any) (*types.PageEntity, error)
CreatePage creates a new page with optional properties.
func (*Client) DatascriptQuery ¶
func (c *Client) DatascriptQuery(ctx context.Context, query string, inputs ...any) (json.RawMessage, error)
DatascriptQuery executes a Datalog query against the Logseq database.
func (*Client) DeletePage ¶
DeletePage removes a page by name.
func (*Client) GetAllPages ¶
GetAllPages returns all pages in the graph.
func (*Client) GetAllTags ¶
GetAllTags returns all tags in the graph.
func (*Client) GetBlock ¶
func (c *Client) GetBlock(ctx context.Context, uuid string, opts ...map[string]any) (*types.BlockEntity, error)
GetBlock returns a block by UUID.
func (*Client) GetBlockProperties ¶
GetBlockProperties returns all properties for a block.
func (*Client) GetCurrentGraph ¶
GetCurrentGraph returns the name and filesystem path of the current graph.
func (*Client) GetPageBlocksTree ¶
GetPageBlocksTree returns the full block tree for a page.
func (*Client) GetPageLinkedReferences ¶
func (c *Client) GetPageLinkedReferences(ctx context.Context, nameOrID any) (json.RawMessage, error)
GetPageLinkedReferences returns pages that link to this page, with the blocks containing the links.
func (*Client) GetPageProperties ¶
GetPageProperties returns all properties for a page.
func (*Client) GetPagesFromNamespace ¶
func (c *Client) GetPagesFromNamespace(ctx context.Context, namespace string) ([]types.PageEntity, error)
GetPagesFromNamespace returns all pages in a namespace.
func (*Client) HasDataScript ¶ added in v0.3.0
func (c *Client) HasDataScript()
HasDataScript marks the Logseq client as supporting DataScript queries. Implements backend.HasDataScript.
func (*Client) InsertBatchBlock ¶
func (c *Client) InsertBatchBlock(ctx context.Context, srcBlock any, batch []map[string]any, opts map[string]any) ([]types.BlockEntity, error)
InsertBatchBlock inserts multiple blocks at once.
func (*Client) InsertBlock ¶
func (c *Client) InsertBlock(ctx context.Context, srcBlock any, content string, opts map[string]any) (*types.BlockEntity, error)
InsertBlock inserts a block relative to another block.
func (*Client) MoveBlock ¶
func (c *Client) MoveBlock(ctx context.Context, uuid string, targetUUID string, opts map[string]any) error
MoveBlock moves a block to a new location.
func (*Client) PrependBlockInPage ¶
func (c *Client) PrependBlockInPage(ctx context.Context, page string, content string) (*types.BlockEntity, error)
PrependBlockInPage adds a block at the start of a page.
func (*Client) RemoveBlock ¶
RemoveBlock deletes a block.
func (*Client) RenamePage ¶ added in v0.4.0
RenamePage renames a page. Logseq handles link updates automatically.