Skip to main content

ito_core/
remote_task_repository.rs

1//! Remote task repository backed by the backend API.
2
3use ito_domain::errors::DomainResult;
4use ito_domain::tasks::{TaskRepository as DomainTaskRepository, TasksParseResult};
5
6use crate::backend_http::BackendHttpClient;
7
8/// Task repository implementation that reads tasks via the backend API.
9pub struct RemoteTaskRepository {
10    client: BackendHttpClient,
11}
12
13impl RemoteTaskRepository {
14    /// Create a remote-backed task repository.
15    pub(crate) fn new(client: BackendHttpClient) -> Self {
16        Self { client }
17    }
18}
19
20impl DomainTaskRepository for RemoteTaskRepository {
21    fn load_tasks(&self, change_id: &str) -> DomainResult<TasksParseResult> {
22        self.client.load_tasks_parse_result(change_id)
23    }
24}