Skip to main content

mesa_dev/client/
content.rs

1use crate::low_level::apis::Error;
2use crate::low_level::content;
3
4use super::RepoClient;
5
6/// Client for content operations (`/{org}/{repo}/content`).
7#[derive(Clone, Debug)]
8pub struct ContentClient<'a> {
9    pub(super) repo: &'a RepoClient<'a>,
10}
11
12impl ContentClient<'_> {
13    /// Get file content or directory listing at a path.
14    ///
15    /// Uses the hand-written implementation for correct `anyOf` handling.
16    ///
17    /// # Errors
18    ///
19    /// Returns an error if the API request fails.
20    pub async fn get(
21        &self,
22        r#ref: Option<&str>,
23        path: Option<&str>,
24        depth: Option<u64>,
25    ) -> Result<content::Content, Error<content::GetContentError>> {
26        content::get_content(
27            self.repo.org.config,
28            self.repo.org.org,
29            self.repo.repo,
30            r#ref,
31            path,
32            depth,
33        )
34        .await
35    }
36}