1use crate::low_level::apis::{repos_api, Error};
2use crate::models;
3
4use super::{
5 AnalyticsClient, BranchesClient, CommitsClient, ContentClient, DiffClient, LfsClient,
6 OrgClient, SyncClient, WebhooksClient,
7};
8
9#[derive(Clone, Debug)]
11pub struct RepoClient<'a> {
12 pub(super) org: &'a OrgClient<'a>,
13 pub(super) repo: &'a str,
14}
15
16impl RepoClient<'_> {
17 pub async fn get(
23 &self,
24 ) -> Result<models::PostByOrgRepos201Response, Error<repos_api::GetByOrgByRepoError>> {
25 repos_api::get_by_org_by_repo(self.org.config, self.org.org, self.repo).await
26 }
27
28 pub async fn delete(
34 &self,
35 ) -> Result<models::DeleteByOrgApiKeysById200Response, Error<repos_api::DeleteByOrgByRepoError>>
36 {
37 repos_api::delete_by_org_by_repo(self.org.config, self.org.org, self.repo).await
38 }
39
40 pub async fn update(
46 &self,
47 request: models::PatchByOrgByRepoRequest,
48 ) -> Result<models::PostByOrgRepos201Response, Error<repos_api::PatchByOrgByRepoError>> {
49 repos_api::patch_by_org_by_repo(self.org.config, self.org.org, self.repo, Some(request))
50 .await
51 }
52
53 #[must_use]
55 pub fn branches(&self) -> BranchesClient<'_> {
56 BranchesClient { repo: self }
57 }
58
59 #[must_use]
61 pub fn commits(&self) -> CommitsClient<'_> {
62 CommitsClient { repo: self }
63 }
64
65 #[must_use]
67 pub fn content(&self) -> ContentClient<'_> {
68 ContentClient { repo: self }
69 }
70
71 #[must_use]
73 pub fn diff(&self) -> DiffClient<'_> {
74 DiffClient { repo: self }
75 }
76
77 #[must_use]
79 pub fn sync(&self) -> SyncClient<'_> {
80 SyncClient { repo: self }
81 }
82
83 #[must_use]
85 pub fn webhooks(&self) -> WebhooksClient<'_> {
86 WebhooksClient { repo: self }
87 }
88
89 #[must_use]
91 pub fn lfs(&self) -> LfsClient<'_> {
92 LfsClient { repo: self }
93 }
94
95 #[must_use]
97 pub fn analytics(&self) -> AnalyticsClient<'_> {
98 AnalyticsClient { repo: self }
99 }
100}