onyx-tasks/apps/flutter/lib/src/rust/api.dart

261 lines
7.7 KiB
Dart

// This file is automatically generated, so please do not edit it.
// @generated by `flutter_rust_bridge`@ 2.11.1.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
import 'frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
// These functions are ignored because they are not marked as `pub`: `config_to_bridge`, `ensure_repo`, `list_to_bridge`, `task_to_bridge`, `with_state`
// These types are ignored because they are neither used by any `pub` functions nor (for structs and enums) marked `#[frb(unignore)]`: `AppState`
/// Initialize the bridge. Must be called once at app startup.
Future<BridgeConfig> initApp() => RustLib.instance.api.crateApiInitApp();
Future<BridgeConfig> getConfig() => RustLib.instance.api.crateApiGetConfig();
Future<void> addWorkspace({required String name, required String path}) =>
RustLib.instance.api.crateApiAddWorkspace(name: name, path: path);
Future<void> setCurrentWorkspace({required String name}) =>
RustLib.instance.api.crateApiSetCurrentWorkspace(name: name);
Future<void> removeWorkspace({required String name}) =>
RustLib.instance.api.crateApiRemoveWorkspace(name: name);
Future<List<BridgeTaskList>> getLists() =>
RustLib.instance.api.crateApiGetLists();
Future<BridgeTaskList> createList({required String name}) =>
RustLib.instance.api.crateApiCreateList(name: name);
Future<void> deleteList({required String listId}) =>
RustLib.instance.api.crateApiDeleteList(listId: listId);
Future<List<BridgeTask>> listTasks({required String listId}) =>
RustLib.instance.api.crateApiListTasks(listId: listId);
Future<BridgeTask> createTask(
{required String listId, required String title}) =>
RustLib.instance.api.crateApiCreateTask(listId: listId, title: title);
Future<BridgeTask> toggleTask(
{required String listId, required String taskId}) =>
RustLib.instance.api.crateApiToggleTask(listId: listId, taskId: taskId);
Future<void> updateTask(
{required String listId,
required String taskId,
required String title,
required String description}) =>
RustLib.instance.api.crateApiUpdateTask(
listId: listId, taskId: taskId, title: title, description: description);
Future<void> deleteTask({required String listId, required String taskId}) =>
RustLib.instance.api.crateApiDeleteTask(listId: listId, taskId: taskId);
Future<void> reorderTask(
{required String listId,
required String taskId,
required BigInt newPosition}) =>
RustLib.instance.api.crateApiReorderTask(
listId: listId, taskId: taskId, newPosition: newPosition);
Future<void> setWebdavConfig(
{required String workspaceName, required String webdavUrl}) =>
RustLib.instance.api.crateApiSetWebdavConfig(
workspaceName: workspaceName, webdavUrl: webdavUrl);
Future<void> storeWebdavCredentials(
{required String domain,
required String username,
required String password}) =>
RustLib.instance.api.crateApiStoreWebdavCredentials(
domain: domain, username: username, password: password);
Future<BridgeSyncResult> syncWorkspaceBridge(
{required String workspacePath,
required String webdavUrl,
required String username,
required String password}) =>
RustLib.instance.api.crateApiSyncWorkspaceBridge(
workspacePath: workspacePath,
webdavUrl: webdavUrl,
username: username,
password: password);
/// Flat app config for FFI transport.
class BridgeConfig {
final List<BridgeWorkspace> workspaces;
final String? currentWorkspace;
const BridgeConfig({
required this.workspaces,
this.currentWorkspace,
});
@override
int get hashCode => workspaces.hashCode ^ currentWorkspace.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is BridgeConfig &&
runtimeType == other.runtimeType &&
workspaces == other.workspaces &&
currentWorkspace == other.currentWorkspace;
}
/// Sync result for FFI transport.
class BridgeSyncResult {
final int uploaded;
final int downloaded;
final int deletedLocal;
final int deletedRemote;
final int conflicts;
final List<String> errors;
const BridgeSyncResult({
required this.uploaded,
required this.downloaded,
required this.deletedLocal,
required this.deletedRemote,
required this.conflicts,
required this.errors,
});
@override
int get hashCode =>
uploaded.hashCode ^
downloaded.hashCode ^
deletedLocal.hashCode ^
deletedRemote.hashCode ^
conflicts.hashCode ^
errors.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is BridgeSyncResult &&
runtimeType == other.runtimeType &&
uploaded == other.uploaded &&
downloaded == other.downloaded &&
deletedLocal == other.deletedLocal &&
deletedRemote == other.deletedRemote &&
conflicts == other.conflicts &&
errors == other.errors;
}
/// Flat task struct for FFI transport.
class BridgeTask {
final String id;
final String title;
final String description;
final String status;
final String? dueDate;
final String createdAt;
final String updatedAt;
final String? parentId;
const BridgeTask({
required this.id,
required this.title,
required this.description,
required this.status,
this.dueDate,
required this.createdAt,
required this.updatedAt,
this.parentId,
});
@override
int get hashCode =>
id.hashCode ^
title.hashCode ^
description.hashCode ^
status.hashCode ^
dueDate.hashCode ^
createdAt.hashCode ^
updatedAt.hashCode ^
parentId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is BridgeTask &&
runtimeType == other.runtimeType &&
id == other.id &&
title == other.title &&
description == other.description &&
status == other.status &&
dueDate == other.dueDate &&
createdAt == other.createdAt &&
updatedAt == other.updatedAt &&
parentId == other.parentId;
}
/// Flat list struct for FFI transport.
class BridgeTaskList {
final String id;
final String title;
final String createdAt;
final String updatedAt;
final bool groupByDueDate;
const BridgeTaskList({
required this.id,
required this.title,
required this.createdAt,
required this.updatedAt,
required this.groupByDueDate,
});
@override
int get hashCode =>
id.hashCode ^
title.hashCode ^
createdAt.hashCode ^
updatedAt.hashCode ^
groupByDueDate.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is BridgeTaskList &&
runtimeType == other.runtimeType &&
id == other.id &&
title == other.title &&
createdAt == other.createdAt &&
updatedAt == other.updatedAt &&
groupByDueDate == other.groupByDueDate;
}
/// Flat workspace config for FFI transport.
class BridgeWorkspace {
final String name;
final String path;
final String? webdavUrl;
final String? lastSync;
const BridgeWorkspace({
required this.name,
required this.path,
this.webdavUrl,
this.lastSync,
});
@override
int get hashCode =>
name.hashCode ^ path.hashCode ^ webdavUrl.hashCode ^ lastSync.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is BridgeWorkspace &&
runtimeType == other.runtimeType &&
name == other.name &&
path == other.path &&
webdavUrl == other.webdavUrl &&
lastSync == other.lastSync;
}