pub struct BitbucketClient { /* private fields */ }Expand description
Bitbucket API client
Implementations§
Source§impl BitbucketClient
impl BitbucketClient
Sourcepub fn new(credential: Credential) -> Result<Self>
pub fn new(credential: Credential) -> Result<Self>
Create a new authenticated client
Sourcepub fn auth_header(&self) -> String
pub fn auth_header(&self) -> String
Get the authorization header value
Sourcepub fn from_stored() -> Result<Self>
pub fn from_stored() -> Result<Self>
Create a client from stored credentials
Sourcepub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T>
pub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T>
Make a GET request
Sourcepub async fn get_with_query<T: DeserializeOwned>(
&self,
path: &str,
query: &[(&str, &str)],
) -> Result<T>
pub async fn get_with_query<T: DeserializeOwned>( &self, path: &str, query: &[(&str, &str)], ) -> Result<T>
Make a GET request with query parameters
Sourcepub async fn post<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T>
pub async fn post<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>
Make a POST request with JSON body
Sourcepub async fn post_no_response<B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<()>
pub async fn post_no_response<B: Serialize>( &self, path: &str, body: &B, ) -> Result<()>
Make a POST request without expecting a response body
Sourcepub async fn put<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T>
pub async fn put<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>
Make a PUT request with JSON body
Sourcepub async fn get_all_pages<T: DeserializeOwned>(
&self,
path: &str,
) -> Result<Vec<T>>
pub async fn get_all_pages<T: DeserializeOwned>( &self, path: &str, ) -> Result<Vec<T>>
Fetch all pages of a paginated endpoint
Source§impl BitbucketClient
impl BitbucketClient
Sourcepub async fn list_issues(
&self,
workspace: &str,
repo_slug: &str,
state: Option<IssueState>,
page: Option<u32>,
pagelen: Option<u32>,
) -> Result<Paginated<Issue>>
pub async fn list_issues( &self, workspace: &str, repo_slug: &str, state: Option<IssueState>, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<Issue>>
List issues for a repository
Sourcepub async fn get_issue(
&self,
workspace: &str,
repo_slug: &str,
issue_id: u64,
) -> Result<Issue>
pub async fn get_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<Issue>
Get a specific issue
Sourcepub async fn create_issue(
&self,
workspace: &str,
repo_slug: &str,
request: &CreateIssueRequest,
) -> Result<Issue>
pub async fn create_issue( &self, workspace: &str, repo_slug: &str, request: &CreateIssueRequest, ) -> Result<Issue>
Create a new issue
Sourcepub async fn update_issue(
&self,
workspace: &str,
repo_slug: &str,
issue_id: u64,
title: Option<&str>,
content: Option<&str>,
state: Option<IssueState>,
) -> Result<Issue>
pub async fn update_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, title: Option<&str>, content: Option<&str>, state: Option<IssueState>, ) -> Result<Issue>
Update an issue
Sourcepub async fn delete_issue(
&self,
workspace: &str,
repo_slug: &str,
issue_id: u64,
) -> Result<()>
pub async fn delete_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<()>
Delete an issue
Sourcepub async fn list_issue_comments(
&self,
workspace: &str,
repo_slug: &str,
issue_id: u64,
) -> Result<Paginated<IssueComment>>
pub async fn list_issue_comments( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<Paginated<IssueComment>>
List comments on an issue
Sourcepub async fn add_issue_comment(
&self,
workspace: &str,
repo_slug: &str,
issue_id: u64,
content: &str,
) -> Result<IssueComment>
pub async fn add_issue_comment( &self, workspace: &str, repo_slug: &str, issue_id: u64, content: &str, ) -> Result<IssueComment>
Add a comment to an issue
Sourcepub async fn vote_issue(
&self,
workspace: &str,
repo_slug: &str,
issue_id: u64,
) -> Result<()>
pub async fn vote_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<()>
Vote for an issue
Sourcepub async fn unvote_issue(
&self,
workspace: &str,
repo_slug: &str,
issue_id: u64,
) -> Result<()>
pub async fn unvote_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<()>
Remove vote from an issue
Source§impl BitbucketClient
impl BitbucketClient
Sourcepub async fn list_pipelines(
&self,
workspace: &str,
repo_slug: &str,
page: Option<u32>,
pagelen: Option<u32>,
) -> Result<Paginated<Pipeline>>
pub async fn list_pipelines( &self, workspace: &str, repo_slug: &str, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<Pipeline>>
List pipelines for a repository
Sourcepub async fn get_pipeline(
&self,
workspace: &str,
repo_slug: &str,
pipeline_uuid: &str,
) -> Result<Pipeline>
pub async fn get_pipeline( &self, workspace: &str, repo_slug: &str, pipeline_uuid: &str, ) -> Result<Pipeline>
Get a specific pipeline
Sourcepub async fn trigger_pipeline(
&self,
workspace: &str,
repo_slug: &str,
request: &TriggerPipelineRequest,
) -> Result<Pipeline>
pub async fn trigger_pipeline( &self, workspace: &str, repo_slug: &str, request: &TriggerPipelineRequest, ) -> Result<Pipeline>
Trigger a new pipeline
Sourcepub async fn stop_pipeline(
&self,
workspace: &str,
repo_slug: &str,
pipeline_uuid: &str,
) -> Result<()>
pub async fn stop_pipeline( &self, workspace: &str, repo_slug: &str, pipeline_uuid: &str, ) -> Result<()>
Stop a running pipeline
Sourcepub async fn list_pipeline_steps(
&self,
workspace: &str,
repo_slug: &str,
pipeline_uuid: &str,
) -> Result<Paginated<PipelineStep>>
pub async fn list_pipeline_steps( &self, workspace: &str, repo_slug: &str, pipeline_uuid: &str, ) -> Result<Paginated<PipelineStep>>
List steps for a pipeline
Sourcepub async fn get_pipeline_step(
&self,
workspace: &str,
repo_slug: &str,
pipeline_uuid: &str,
step_uuid: &str,
) -> Result<PipelineStep>
pub async fn get_pipeline_step( &self, workspace: &str, repo_slug: &str, pipeline_uuid: &str, step_uuid: &str, ) -> Result<PipelineStep>
Get a specific pipeline step
Source§impl BitbucketClient
impl BitbucketClient
Sourcepub async fn list_pull_requests(
&self,
workspace: &str,
repo_slug: &str,
state: Option<PullRequestState>,
page: Option<u32>,
pagelen: Option<u32>,
) -> Result<Paginated<PullRequest>>
pub async fn list_pull_requests( &self, workspace: &str, repo_slug: &str, state: Option<PullRequestState>, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<PullRequest>>
List pull requests for a repository
Sourcepub async fn get_pull_request(
&self,
workspace: &str,
repo_slug: &str,
pr_id: u64,
) -> Result<PullRequest>
pub async fn get_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<PullRequest>
Get a specific pull request
Sourcepub async fn create_pull_request(
&self,
workspace: &str,
repo_slug: &str,
request: &CreatePullRequestRequest,
) -> Result<PullRequest>
pub async fn create_pull_request( &self, workspace: &str, repo_slug: &str, request: &CreatePullRequestRequest, ) -> Result<PullRequest>
Create a new pull request
Sourcepub async fn update_pull_request(
&self,
workspace: &str,
repo_slug: &str,
pr_id: u64,
title: Option<&str>,
description: Option<&str>,
) -> Result<PullRequest>
pub async fn update_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, title: Option<&str>, description: Option<&str>, ) -> Result<PullRequest>
Update a pull request
Sourcepub async fn merge_pull_request(
&self,
workspace: &str,
repo_slug: &str,
pr_id: u64,
request: Option<&MergePullRequestRequest>,
) -> Result<PullRequest>
pub async fn merge_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, request: Option<&MergePullRequestRequest>, ) -> Result<PullRequest>
Merge a pull request
Sourcepub async fn approve_pull_request(
&self,
workspace: &str,
repo_slug: &str,
pr_id: u64,
) -> Result<()>
pub async fn approve_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<()>
Approve a pull request
Sourcepub async fn unapprove_pull_request(
&self,
workspace: &str,
repo_slug: &str,
pr_id: u64,
) -> Result<()>
pub async fn unapprove_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<()>
Unapprove a pull request
Sourcepub async fn decline_pull_request(
&self,
workspace: &str,
repo_slug: &str,
pr_id: u64,
) -> Result<PullRequest>
pub async fn decline_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<PullRequest>
Decline a pull request
Sourcepub async fn list_pr_comments(
&self,
workspace: &str,
repo_slug: &str,
pr_id: u64,
) -> Result<Paginated<PullRequestComment>>
pub async fn list_pr_comments( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<Paginated<PullRequestComment>>
List comments on a pull request
Sourcepub async fn add_pr_comment(
&self,
workspace: &str,
repo_slug: &str,
pr_id: u64,
content: &str,
) -> Result<PullRequestComment>
pub async fn add_pr_comment( &self, workspace: &str, repo_slug: &str, pr_id: u64, content: &str, ) -> Result<PullRequestComment>
Add a comment to a pull request
Source§impl BitbucketClient
impl BitbucketClient
Sourcepub async fn list_repositories(
&self,
workspace: &str,
page: Option<u32>,
pagelen: Option<u32>,
) -> Result<Paginated<Repository>>
pub async fn list_repositories( &self, workspace: &str, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<Repository>>
List repositories for a workspace
Sourcepub async fn get_repository(
&self,
workspace: &str,
repo_slug: &str,
) -> Result<Repository>
pub async fn get_repository( &self, workspace: &str, repo_slug: &str, ) -> Result<Repository>
Get a specific repository
Sourcepub async fn create_repository(
&self,
workspace: &str,
repo_slug: &str,
request: &CreateRepositoryRequest,
) -> Result<Repository>
pub async fn create_repository( &self, workspace: &str, repo_slug: &str, request: &CreateRepositoryRequest, ) -> Result<Repository>
Create a new repository
Sourcepub async fn delete_repository(
&self,
workspace: &str,
repo_slug: &str,
) -> Result<()>
pub async fn delete_repository( &self, workspace: &str, repo_slug: &str, ) -> Result<()>
Delete a repository
Sourcepub async fn fork_repository(
&self,
workspace: &str,
repo_slug: &str,
new_workspace: Option<&str>,
new_name: Option<&str>,
) -> Result<Repository>
pub async fn fork_repository( &self, workspace: &str, repo_slug: &str, new_workspace: Option<&str>, new_name: Option<&str>, ) -> Result<Repository>
Fork a repository
Trait Implementations§
Source§impl Clone for BitbucketClient
impl Clone for BitbucketClient
Source§fn clone(&self) -> BitbucketClient
fn clone(&self) -> BitbucketClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BitbucketClient
impl !RefUnwindSafe for BitbucketClient
impl Send for BitbucketClient
impl Sync for BitbucketClient
impl Unpin for BitbucketClient
impl !UnwindSafe for BitbucketClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more