Skip to main content

bitbucket_cli/api/
branching_model.rs

1use anyhow::Result;
2
3use super::BitbucketClient;
4use crate::models::{BranchingModel, UpdateBranchingModelRequest};
5
6impl BitbucketClient {
7    /// Get a repository's effective branching model
8    pub async fn get_branching_model(
9        &self,
10        workspace: &str,
11        repo_slug: &str,
12    ) -> Result<BranchingModel> {
13        let path = format!("/repositories/{}/{}/branching-model", workspace, repo_slug);
14        self.get(&path).await
15    }
16
17    /// Update a repository's branching model settings
18    pub async fn update_branching_model_settings(
19        &self,
20        workspace: &str,
21        repo_slug: &str,
22        request: &UpdateBranchingModelRequest,
23    ) -> Result<BranchingModel> {
24        let path = format!(
25            "/repositories/{}/{}/branching-model/settings",
26            workspace, repo_slug
27        );
28        self.put(&path, request).await
29    }
30}