Skip to main content

cima_rs/endpoints/
supply_problems.rs

1use crate::api_client::CimaClient;
2use crate::models::SupplyProblem;
3use anyhow::{Context, Result};
4
5impl CimaClient {
6    /// Get all current supply problems
7    ///
8    /// Returns a paginated response with all active supply problems.
9    pub async fn get_all_supply_problems(
10        &self,
11    ) -> Result<crate::models::PaginatedResponse<SupplyProblem>> {
12        self.get("psuministro")
13            .await
14            .context("Failed to get all supply problems")
15    }
16
17    /// Get supply problems for a specific presentation by national code
18    ///
19    /// Returns a paginated response with supply problems for the specified CN
20    pub async fn get_supply_problems(
21        &self,
22        national_code: &str,
23    ) -> Result<crate::models::PaginatedResponse<SupplyProblem>> {
24        let endpoint = format!("psuministro/{}", national_code);
25        self.get(&endpoint)
26            .await
27            .context("Failed to get supply problems for national code")
28    }
29}