Files
Synapse/app/lib/src/rust/api/graph.dart
T
dasemuandClaude Sonnet 5.5 b800248d67 feat(core): hubs, tag pages and types, with ffi, history and import support
Hubs and templates are page kinds; tags are pages of kind tag linked by a TAGGED
edge; types are plain names on the page. Schema v5. Snapshots carry
synapse-kind/tags/types. Also adapts search, import and server tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 02:45:22 +01:00

235 lines
8.8 KiB
Dart

// This file is automatically generated, so please do not edit it.
// @generated by `flutter_rust_bridge`@ 2.13.0.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
import '../frb_generated.dart';
import 'dto.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
// These functions are ignored because they are not marked as `pub`: `asset_dto`, `lock`, `outline`, `page_view`, `parse_date`, `parse_day`, `parse_id`
// These functions are ignored (category: IgnoreBecauseExplicitAttribute): `shared`
// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<SynapseGraph>>
abstract class SynapseGraph implements RustOpaqueInterface {
Future<void> addAlias({required String pageId, required String alias});
Future<PageDto> addPageTag({required String pageId, required String tag});
Future<PageDto> addPageType({required String pageId, required String ty});
/// Puts a page in a hub (no-op when it already is). Fails for journals, non-hub targets,
/// the hub itself and memberships that would create a cycle.
Future<void> addToHub({required String pageId, required String hubId});
Future<List<String>> aliases({required String pageId});
/// Local file path of an asset (for `asset://<hash>` images), if present.
String? assetPath({required String hash});
/// Linked references grouped by page (most recently edited first).
Future<List<BacklinkGroup>> backlinks({required String pageId});
/// Target of a `((block ref))`.
Future<BlockRefDto?> blockRef({required String id});
/// Turns a note into a hub in one transaction: renames it to `title` (links rewritten),
/// moves its outline to a new note `keep_outline_as` (or deletes it when `None`; a blank title is an error), sets the
/// description and adds `member_ids` (invalid members are skipped).
Future<PageDto> convertToHub({
required String pageId,
required String title,
required String description,
required List<String> memberIds,
String? keepOutlineAs,
});
/// Turns a hub back into a note: description, then one `[[Member]]` block per member.
Future<PageDto> convertToNote({required String pageId});
/// Creates an empty hub. Fails when the title is taken.
Future<PageDto> createHub({
required String title,
required String description,
});
/// Creates a note in the hub, starting from a copy of the hub's template.
Future<PageDto> createPageFromTemplate({
required String hubId,
required String title,
});
/// Deletes a block and its subtree.
Future<List<BlockDto>> deleteBlock({required String id});
Future<void> deletePage({required String id});
/// Graph directory.
String dir();
/// The whole page-level graph (journals included; the UI filters). Cached until the
/// graph changes.
Future<GraphData> graphData();
/// Defaults for converting a note into a hub.
Future<HubPreviewDto> hubConversionPreview({required String pageId});
/// Id of the hub's template page (created empty when missing). Open it like any note to
/// edit the outline new notes of the hub start from.
Future<String> hubTemplate({required String hubId});
/// Every hub with its members, and the root hubs.
Future<HubsDto> hubs();
/// Tab: the block becomes the last child of its previous sibling (no-op for a first child).
Future<List<BlockDto>> indentBlock({required String id});
Future<BlockDto> insertBlock({
required String pageId,
required Place place,
required String content,
});
/// The journal of `date` (created if missing).
Future<PageData> journal({required String date});
Future<(String?, String?)> journalNeighbors({required String date});
/// Journals feed, newest first. With `before = None` it starts at today (creating today's
/// journal); otherwise at the newest journal strictly before `before`.
Future<List<PageData>> journals({String? before, required int limit});
/// Pages that are probably leftovers of Logseq: its built-ins and pages with
/// `type:: system`. Only the organisational files (`contents`, `card`, `favorites`,
/// `hls__*`) and empty pages are preselected, and never a hub: a built-in title such as
/// `todo` may hold real content.
Future<List<LegacyCandidate>> legacyCandidates();
/// Pages ordered by last update, most recent first.
Future<List<PageDto>> listPages({
required bool includeJournals,
required int limit,
required int offset,
});
/// Backspace at the start of `id`: its text is appended to `into` (the previous visible
/// block) and the block is deleted. Its children keep their visual place: they take the
/// block's slot when `into` is its parent, otherwise they become last children of `into`.
Future<List<BlockDto>> mergeBlock({required String id, required String into});
/// Moves a block with its subtree (drag and drop), possibly to another page.
Future<List<BlockDto>> moveBlock({
required String id,
required String pageId,
required Place place,
});
/// Opens (or creates) the graph stored in `dir`.
static Future<SynapseGraph> open({required String dir}) =>
RustLib.instance.api.crateApiGraphSynapseGraphOpen(dir: dir);
/// Page by title or alias, created if missing (following a `[[link]]`). Date titles open
/// the journal of that day.
Future<PageData> openPage({required String title});
/// Shift-Tab: the block moves right after its parent, adopting its following siblings as
/// children so it keeps its visual place (Logseq's default outdenting).
Future<List<BlockDto>> outdentBlock({required String id});
/// Current outline of a page.
Future<List<BlockDto>> outline({required String pageId});
Future<PageData?> page({required String id});
/// Page by title or alias, without creating it.
Future<PageData?> pageByTitle({required String title});
/// Hub and namespace context of a page.
Future<PageStructure> pageStructure({required String pageId});
/// Pages carrying a tag, most recently updated first.
Future<List<PageBrief>> pagesWithTag({required String tag});
/// Deletes pages and their blocks in one transaction. Returns how many existed.
Future<int> purgePages({required List<String> ids});
/// Stores in-memory bytes (clipboard, Android content URIs).
Future<AssetDto> putAssetBytes({
required List<int> bytes,
String? name,
String? mime,
});
/// Copies a file into the blob store (streamed).
Future<AssetDto> putAssetFile({required String path, String? mime});
/// Records navigation between pages (strengthens their synapse).
Future<void> recordVisit({String? from, required String to});
/// Notes related to `page_id` by spreading activation.
Future<List<RelatedDto>> related({
required String pageId,
required int limit,
});
Future<void> removeAlias({required String alias});
/// Takes a page out of a hub (no-op when it is not in it).
Future<void> removeFromHub({required String pageId, required String hubId});
Future<PageDto> removePageTag({required String pageId, required String tag});
Future<PageDto> removePageType({required String pageId, required String ty});
Future<PageDto> renamePage({required String id, required String newTitle});
/// Blocks whose text contains `query` (for `((` autocomplete), most recent first.
Future<List<BlockHit>> searchBlocks({
required String query,
required int limit,
});
/// Page titles and aliases matching `query`: exact, then prefix, then word-prefix, then
/// substring; shorter titles first within a tier. Empty query returns recent pages.
Future<List<TitleHit>> searchTitles({
required String query,
required int limit,
});
Future<void> setCollapsed({required String id, required bool collapsed});
Future<PageDto> setHubDescription({
required String hubId,
required String description,
});
/// Replaces the tags of a page (each title gets a tag page if it has none). Journals,
/// templates and tag pages cannot be tagged.
Future<PageDto> setPageTags({
required String pageId,
required List<String> tags,
});
/// Replaces the types of a page. Journals and templates cannot be typed.
Future<PageDto> setPageTypes({
required String pageId,
required List<String> types,
});
/// Every tag page with its number of pages, most used first.
Future<List<TagDto>> tagCatalog();
/// Timeline data for `[from, to]` (oldest first) with titles of every page it mentions.
Future<TimelineDto> timeline({required String from, required String to});
/// Today's date (graph clock) as `YYYY-MM-DD`.
String today();
/// Types in use (most used first) followed by the seeded suggestions not used yet.
Future<List<TagDto>> typeCatalog();
/// Replaces a block's Markdown (the debounced save while typing).
Future<void> updateBlock({required String id, required String content});
}