text-document-frontend 0.0.11

Frontend integration layer and command wrappers for text-document
Documentation
// Generated by Qleany v1.5.1 from frontend_feature_commands.tera

//! DocumentInspection feature commands

use crate::app_context::AppContext;
use anyhow::{Context, Result};
use document_inspection::{
    BlockInfoDto, DocumentStatsDto, ExtractFragmentDto, ExtractFragmentResultDto,
    GetBlockAtPositionDto, GetTextAtPositionDto, TextAtPositionDto, document_inspection_controller,
};

pub fn get_document_stats(ctx: &AppContext) -> Result<DocumentStatsDto> {
    document_inspection_controller::get_document_stats(&ctx.db_context, &ctx.event_hub)
        .context("get_document_stats")
}

pub fn get_text_at_position(
    ctx: &AppContext,
    dto: &GetTextAtPositionDto,
) -> Result<TextAtPositionDto> {
    document_inspection_controller::get_text_at_position(&ctx.db_context, &ctx.event_hub, dto)
        .context("get_text_at_position")
}

pub fn get_block_at_position(
    ctx: &AppContext,
    dto: &GetBlockAtPositionDto,
) -> Result<BlockInfoDto> {
    document_inspection_controller::get_block_at_position(&ctx.db_context, &ctx.event_hub, dto)
        .context("get_block_at_position")
}

pub fn extract_fragment(
    ctx: &AppContext,
    dto: &ExtractFragmentDto,
) -> Result<ExtractFragmentResultDto> {
    document_inspection_controller::extract_fragment(&ctx.db_context, &ctx.event_hub, dto)
        .context("extract_fragment")
}