BitbucketClient

Struct BitbucketClient 

Source
pub struct BitbucketClient { /* private fields */ }
Expand description

Bitbucket API client

Implementations§

Source§

impl BitbucketClient

Source

pub fn new(credential: Credential) -> Result<Self>

Create a new authenticated client

Source

pub fn auth_header(&self) -> String

Get the authorization header value

Source

pub fn from_stored() -> Result<Self>

Create a client from stored credentials

Source

pub fn base_url(&self) -> &str

Get the base API URL

Source

pub fn url(&self, path: &str) -> String

Build a URL for an API endpoint

Source

pub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T>

Make a GET request

Source

pub async fn get_with_query<T: DeserializeOwned>( &self, path: &str, query: &[(&str, &str)], ) -> Result<T>

Make a GET request with query parameters

Source

pub async fn post<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>

Make a POST request with JSON body

Source

pub async fn post_no_response<B: Serialize>( &self, path: &str, body: &B, ) -> Result<()>

Make a POST request without expecting a response body

Source

pub async fn put<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>

Make a PUT request with JSON body

Source

pub async fn delete(&self, path: &str) -> Result<()>

Make a DELETE request

Source

pub async fn get_all_pages<T: DeserializeOwned>( &self, path: &str, ) -> Result<Vec<T>>

Fetch all pages of a paginated endpoint

Source§

impl BitbucketClient

Source

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

Source

pub async fn get_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<Issue>

Get a specific issue

Source

pub async fn create_issue( &self, workspace: &str, repo_slug: &str, request: &CreateIssueRequest, ) -> Result<Issue>

Create a new issue

Source

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

Source

pub async fn delete_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<()>

Delete an issue

Source

pub async fn list_issue_comments( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<Paginated<IssueComment>>

List comments on an issue

Source

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

Source

pub async fn vote_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<()>

Vote for an issue

Source

pub async fn unvote_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<()>

Remove vote from an issue

Source

pub async fn watch_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<()>

Watch an issue

Source

pub async fn unwatch_issue( &self, workspace: &str, repo_slug: &str, issue_id: u64, ) -> Result<()>

Unwatch an issue

Source§

impl BitbucketClient

Source

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

Source

pub async fn get_pipeline( &self, workspace: &str, repo_slug: &str, pipeline_uuid: &str, ) -> Result<Pipeline>

Get a specific pipeline

Source

pub async fn trigger_pipeline( &self, workspace: &str, repo_slug: &str, request: &TriggerPipelineRequest, ) -> Result<Pipeline>

Trigger a new pipeline

Source

pub async fn stop_pipeline( &self, workspace: &str, repo_slug: &str, pipeline_uuid: &str, ) -> Result<()>

Stop a running pipeline

Source

pub async fn list_pipeline_steps( &self, workspace: &str, repo_slug: &str, pipeline_uuid: &str, ) -> Result<Paginated<PipelineStep>>

List steps for a pipeline

Source

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

pub async fn get_step_log( &self, workspace: &str, repo_slug: &str, pipeline_uuid: &str, step_uuid: &str, ) -> Result<String>

Get pipeline step log

Source

pub async fn get_pipeline_by_build_number( &self, workspace: &str, repo_slug: &str, build_number: u64, ) -> Result<Pipeline>

Get pipeline by build number

Source§

impl BitbucketClient

Source

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

Source

pub async fn get_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<PullRequest>

Get a specific pull request

Source

pub async fn create_pull_request( &self, workspace: &str, repo_slug: &str, request: &CreatePullRequestRequest, ) -> Result<PullRequest>

Create a new pull request

Source

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

Source

pub async fn merge_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, request: Option<&MergePullRequestRequest>, ) -> Result<PullRequest>

Merge a pull request

Source

pub async fn approve_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<()>

Approve a pull request

Source

pub async fn unapprove_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<()>

Unapprove a pull request

Source

pub async fn decline_pull_request( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<PullRequest>

Decline a pull request

Source

pub async fn list_pr_comments( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<Paginated<PullRequestComment>>

List comments on a pull request

Source

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

pub async fn get_pr_diff( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<String>

Get the diff for a pull request

Source§

impl BitbucketClient

Source

pub async fn list_repositories( &self, workspace: &str, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<Repository>>

List repositories for a workspace

Source

pub async fn get_repository( &self, workspace: &str, repo_slug: &str, ) -> Result<Repository>

Get a specific repository

Source

pub async fn create_repository( &self, workspace: &str, repo_slug: &str, request: &CreateRepositoryRequest, ) -> Result<Repository>

Create a new repository

Source

pub async fn delete_repository( &self, workspace: &str, repo_slug: &str, ) -> Result<()>

Delete a repository

Source

pub async fn fork_repository( &self, workspace: &str, repo_slug: &str, new_workspace: Option<&str>, new_name: Option<&str>, ) -> Result<Repository>

Fork a repository

Source

pub async fn list_branches( &self, workspace: &str, repo_slug: &str, ) -> Result<Paginated<Branch>>

List repository branches

Source

pub async fn get_main_branch( &self, workspace: &str, repo_slug: &str, ) -> Result<Branch>

Get the main branch

Trait Implementations§

Source§

impl Clone for BitbucketClient

Source§

fn clone(&self) -> BitbucketClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more