Skip to main content

BitbucketClient

Struct BitbucketClient 

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

Bitbucket API client

Implementations§

Source§

impl BitbucketClient

Source

pub async fn list_branch_restrictions( &self, workspace: &str, repo_slug: &str, pagelen: Option<u32>, ) -> Result<Paginated<BranchRestriction>>

List branch restriction rules on a repository

Source

pub async fn create_branch_restriction( &self, workspace: &str, repo_slug: &str, kind: &str, pattern: &str, value: Option<u64>, ) -> Result<BranchRestriction>

Create a branch restriction rule.

value is the numeric parameter required by some kinds (e.g. the approval count for require_approvals_to_merge); it is omitted from the request body when None.

Source

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

Delete a branch restriction rule by id

Source§

impl BitbucketClient

Source

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

Get a repository’s effective branching model

Source

pub async fn update_branching_model_settings( &self, workspace: &str, repo_slug: &str, request: &UpdateBranchingModelRequest, ) -> Result<BranchingModel>

Update a repository’s branching model settings

Source§

impl BitbucketClient

Source

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

Create a new authenticated client

Source

pub async fn from_stored() -> Result<Self>

Create a client from stored credentials, automatically refreshing if needed

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 post_multipart(&self, path: &str, form: Form) -> Result<()>

Make a multipart/form-data POST request, not expecting a JSON response body.

Used for endpoints like repository downloads, which accept file uploads and respond with 201 Created and an empty 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_commits( &self, workspace: &str, repo_slug: &str, revision: Option<&str>, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<CommitSummary>>

List commits in a repository, newest first.

With revision set, lists the history reachable from that branch, tag, or commit hash; otherwise lists from the default branch.

Source

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

Get a single commit by hash.

Source

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

Get a raw unified diff for a commit or revision spec.

spec is either a single revision (diff against its first parent) or a source..destination pair of revisions.

Source§

impl BitbucketClient

Source

pub async fn list_default_reviewers( &self, workspace: &str, repo_slug: &str, pagelen: Option<u32>, ) -> Result<Paginated<User>>

List a repository’s default reviewers

Source

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

Add a user to a repository’s default reviewers.

username may be a username, an account ID, or a brace-wrapped UUID. The endpoint is a bodyless PUT; an empty JSON object is sent because the client’s PUT helper always attaches a JSON body.

Source

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

Remove a user from a repository’s default reviewers

Source§

impl BitbucketClient

Source

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

List deploy keys for a repository

Source

pub async fn add_deploy_key( &self, workspace: &str, repo_slug: &str, request: &AddDeployKeyRequest, ) -> Result<DeployKey>

Add a deploy key to a repository

Source

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

Delete a deploy key from a repository

Source

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

List deployment environments for a repository

Source

pub async fn create_environment( &self, workspace: &str, repo_slug: &str, request: &CreateEnvironmentRequest, ) -> Result<Environment>

Create a deployment environment

Source

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

Delete a deployment environment

Source

pub async fn list_deployments( &self, workspace: &str, repo_slug: &str, pagelen: Option<u32>, ) -> Result<Paginated<Deployment>>

List deployments for a repository

Source

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

Get a specific deployment

Source§

impl BitbucketClient

Source

pub async fn upload_downloads( &self, workspace: &str, repo_slug: &str, files: &[(String, PathBuf)], ) -> Result<()>

Upload one or more files to a repository’s downloads area.

Uploading a file whose name matches an existing artifact replaces it.

Source

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

List all artifacts in a repository’s downloads area, following pagination next links until every page has been fetched.

Source

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

Fetch a single artifact’s raw bytes from a repository’s downloads area.

Source

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

Delete a single artifact from a repository’s downloads area.

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’s title, description and/or state.

Convenience wrapper over Self::update_issue_full kept for the existing close/reopen callers.

Source

pub async fn update_issue_full( &self, workspace: &str, repo_slug: &str, issue_id: u64, update: &IssueUpdate<'_>, ) -> Result<Issue>

Update any combination of an issue’s editable fields; unset fields are omitted from the request body and left unchanged server-side.

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, pagelen: Option<u32>, ) -> 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 update_issue_comment( &self, workspace: &str, repo_slug: &str, issue_id: u64, comment_id: u64, content: &str, ) -> Result<IssueComment>

Update the body of an existing comment on an issue.

Source

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

Delete a comment from an issue.

Source

pub async fn list_issue_changes( &self, workspace: &str, repo_slug: &str, issue_id: u64, pagelen: Option<u32>, ) -> Result<Paginated<IssueChange>>

List entries from an issue’s change log (state transitions, reassignments, …).

Source

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

List the components defined in a repository’s issue tracker, following pagination until every page has been fetched.

Source

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

List the milestones defined in a repository’s issue tracker, following pagination until every page has been fetched.

Source

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

List the versions defined in a repository’s issue tracker, following pagination until every page has been fetched.

Source

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

List the files attached to an issue, following pagination until every page has been fetched.

Source

pub async fn upload_issue_attachments( &self, workspace: &str, repo_slug: &str, issue_id: u64, files: &[(String, PathBuf)], ) -> Result<()>

Attach one or more files to an issue via a multipart upload.

Follows the repository downloads upload convention: every file goes under the “files” form field, keyed server-side by filename.

Source

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

Delete an attachment from an issue by its path (usually the filename as returned by the attachments list).

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_user_permissions( &self, workspace: &str, repo_slug: &str, pagelen: Option<u32>, ) -> Result<Paginated<UserPermission>>

List users with explicit permissions on a repository

Source

pub async fn list_group_permissions( &self, workspace: &str, repo_slug: &str, pagelen: Option<u32>, ) -> Result<Paginated<GroupPermission>>

List groups with explicit permissions on a repository

Source

pub async fn grant_user_permission( &self, workspace: &str, repo_slug: &str, selected_user: &str, permission: &str, ) -> Result<UserPermission>

Grant or update a user’s explicit permission on a repository.

selected_user may be an account ID or a brace-wrapped UUID; permission is read, write, or admin.

Source

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

Revoke a user’s explicit permission on a repository

Source

pub async fn grant_group_permission( &self, workspace: &str, repo_slug: &str, group_slug: &str, permission: &str, ) -> Result<GroupPermission>

Grant or update a group’s explicit permission on a repository.

group_slug is the workspace group’s slug; permission is read, write, or admin.

Source

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

Revoke a group’s explicit permission on a repository

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, sorted by most recent first.

Thin wrapper over Self::list_pipelines_filtered kept for the TUI and the build-number/commit lookups, which need no server-side filters.

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 list_pipelines_for_commit( &self, workspace: &str, repo_slug: &str, commit_hash: &str, scan_limit: u32, ) -> Result<Vec<Pipeline>>

List pipelines whose target commit matches commit_hash, newest first.

Bitbucket’s pipelines endpoint does not expose a server-side filter on target.commit.hash (both the ?target.commit.hash= query param and the BBQL q= filter are silently ignored as of the 2.0 API), so this fetches the most recent pipelines and filters client-side. scan_limit bounds how many of the repo’s recent pipelines are scanned and is capped at Bitbucket’s pagelen ceiling of 100; on repos that churn more than 100 pipelines between the commit landing and this call, matches older than that window will be missed.

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

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

List all pipeline variables configured on a repository.

Source

pub async fn create_pipeline_variable( &self, workspace: &str, repo_slug: &str, variable: &PipelineVariableInput, ) -> Result<PipelineVariable>

Create a new pipeline variable on a repository.

Source

pub async fn update_pipeline_variable( &self, workspace: &str, repo_slug: &str, variable_uuid: &str, variable: &PipelineVariableInput, ) -> Result<PipelineVariable>

Update an existing pipeline variable on a repository.

Source

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

Delete a pipeline variable from a repository.

Source

pub async fn list_workspace_pipeline_variables( &self, workspace: &str, ) -> Result<Vec<PipelineVariable>>

List all workspace-level pipeline variables.

Note the workspace endpoint uses pipelines-config (hyphen), unlike the repository endpoint’s pipelines_config.

Source

pub async fn create_workspace_pipeline_variable( &self, workspace: &str, variable: &PipelineVariableInput, ) -> Result<PipelineVariable>

Create a new workspace-level pipeline variable.

Source

pub async fn update_workspace_pipeline_variable( &self, workspace: &str, variable_uuid: &str, variable: &PipelineVariableInput, ) -> Result<PipelineVariable>

Update an existing workspace-level pipeline variable.

Source

pub async fn delete_workspace_pipeline_variable( &self, workspace: &str, variable_uuid: &str, ) -> Result<()>

Delete a workspace-level pipeline variable.

Source

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

List all pipeline schedules configured on a repository.

Source

pub async fn create_pipeline_schedule( &self, workspace: &str, repo_slug: &str, branch: &str, cron_pattern: &str, ) -> Result<PipelineSchedule>

Create a pipeline schedule running branch on cron_pattern.

Source

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

Delete a pipeline schedule from a repository.

Source

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

List dependency caches stored for a repository’s pipelines.

Note the caches endpoint uses pipelines-config (hyphen), unlike the variables/schedules endpoints’ pipelines_config.

Source

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

Delete a pipeline dependency cache by UUID.

Source

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

Get the repository’s pipelines configuration (enabled state).

Source

pub async fn update_pipelines_config_enabled( &self, workspace: &str, repo_slug: &str, enabled: bool, ) -> Result<PipelinesConfig>

Enable or disable pipelines on a repository.

Source

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

Set the next build number for a repository’s pipelines.

Source§

impl BitbucketClient

Source

pub async fn list_projects( &self, workspace: &str, query: Option<&str>, sort: Option<&str>, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<ProjectDetail>>

List a page of projects in a workspace.

query is a Bitbucket query (BBQL) expression passed as the q parameter, and sort names a field to sort by (prefix with - for descending).

Source

pub async fn get_project( &self, workspace: &str, key: &str, ) -> Result<ProjectDetail>

Get a single project by its key

Source

pub async fn create_project( &self, workspace: &str, request: &CreateProjectRequest, ) -> Result<ProjectDetail>

Create a new project in a workspace

Source

pub async fn update_project( &self, workspace: &str, key: &str, request: &UpdateProjectRequest, ) -> Result<ProjectDetail>

Update settings on an existing project

Source

pub async fn delete_project(&self, workspace: &str, key: &str) -> Result<()>

Delete a project. The project must not contain any repositories.

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, filtered by at most one state.

Thin wrapper over Self::list_pull_requests_filtered kept for callers (e.g. the TUI) that only need the simple form.

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, request: &UpdatePullRequestRequest, ) -> Result<PullRequest>

Update a pull request; only the fields set on request are changed.

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 request_pr_changes( &self, workspace: &str, repo_slug: &str, pr_id: u64, ) -> Result<()>

Request changes on a pull request

Source

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

Withdraw a previous request for changes on 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_recent_pr_comments( &self, workspace: &str, repo_slug: &str, pr_id: u64, max_items: usize, ) -> Result<Vec<PullRequestComment>>

List the most recent comments on a pull request, newest first.

Requests pages sorted by -created_on and stops following the pagination next links as soon as max_items comments have been collected (or the pages are exhausted), so large PRs don’t require downloading their entire comment history.

Source

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

Get a specific comment on a pull request

Source

pub async fn update_pr_comment( &self, workspace: &str, repo_slug: &str, pr_id: u64, comment_id: u64, content: &str, ) -> Result<PullRequestComment>

Update the content of an existing pull request comment

Source

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

Delete a pull request comment

Source

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

Resolve a pull request comment thread

Source

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

Reopen (unresolve) a pull request comment thread

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

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

Get the patch (mbox-style) for a pull request

Source

pub async fn list_pr_commits( &self, workspace: &str, repo_slug: &str, pr_id: u64, pagelen: Option<u32>, ) -> Result<Paginated<PrCommit>>

List one page of commits on a pull request

Source

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

List all commit statuses (builds) for a pull request’s head commit

Source

pub async fn get_pr_diffstat( &self, workspace: &str, repo_slug: &str, pr_id: u64, pagelen: Option<u32>, ) -> Result<Paginated<DiffStat>>

Get one page of the diffstat (per-file change summary) for a pull request

Source

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

List all tasks on a pull request

Source

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

Create a task on a pull request

Source

pub async fn update_pr_task( &self, workspace: &str, repo_slug: &str, pr_id: u64, task_id: u64, content: Option<&str>, state: Option<&str>, ) -> Result<PrTask>

Update a pull request task’s content and/or state (state is "RESOLVED" or "UNRESOLVED").

Source

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

Delete a pull request task

Source

pub async fn list_pr_activity( &self, workspace: &str, repo_slug: &str, pr_id: u64, pagelen: Option<u32>, ) -> Result<Paginated<PrActivity>>

List one page of the activity feed for a pull request

Source§

impl BitbucketClient

Source

pub async fn list_branches_filtered( &self, workspace: &str, repo_slug: &str, query: Option<&str>, sort: Option<&str>, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<BranchDetail>>

List branches in a repository, optionally filtered and sorted.

query is a Bitbucket filter expression (e.g. name ~ "feat") passed as q; sort is a field name, prefix with - for descending (e.g. -target.date).

Source

pub async fn create_branch( &self, workspace: &str, repo_slug: &str, name: &str, target_hash: &str, ) -> Result<BranchDetail>

Create a branch pointing at target_hash.

Source

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

Get a single branch by name.

Source

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

Delete a branch by name.

Source

pub async fn list_tags_filtered( &self, workspace: &str, repo_slug: &str, query: Option<&str>, sort: Option<&str>, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<TagDetail>>

List tags in a repository, optionally filtered and sorted.

query and sort behave as in Self::list_branches_filtered.

Source

pub async fn create_tag( &self, workspace: &str, repo_slug: &str, name: &str, target_hash: &str, message: Option<&str>, ) -> Result<TagDetail>

Create a tag pointing at target_hash. Passing a message creates an annotated tag; omitting it creates a lightweight tag.

Source

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

Get a single tag by name.

Source

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

Delete a tag by name.

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 list_repositories_filtered( &self, workspace: &str, role: Option<&str>, query: Option<&str>, sort: Option<&str>, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<Repository>>

List repositories for a workspace with optional filters.

role restricts results to repositories where the caller has at least that role (member, contributor, admin, or owner), query is a Bitbucket query (BBQL) expression passed as the q parameter, and sort names a field to sort by (prefix with - for descending).

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 update_repository( &self, workspace: &str, repo_slug: &str, request: &UpdateRepositoryRequest, ) -> Result<Repository>

Update settings on an existing 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_watchers( &self, workspace: &str, repo_slug: &str, pagelen: Option<u32>, ) -> Result<Paginated<User>>

List users watching a repository

Source

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

List forks of a repository

Source§

impl BitbucketClient

Source

pub async fn list_source( &self, workspace: &str, repo_slug: &str, git_ref: &str, path: &str, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<SourceEntry>>

List the entries of a directory at path (empty string for the repository root) as of git_ref (branch, tag, or commit hash).

Source

pub async fn get_file_raw( &self, workspace: &str, repo_slug: &str, git_ref: &str, path: &str, ) -> Result<String>

Fetch the raw contents of the file at path as of git_ref.

This is the same endpoint as Self::list_source; pointed at a file instead of a directory, it returns the file body verbatim.

Source

pub async fn get_file_history( &self, workspace: &str, repo_slug: &str, git_ref: &str, path: &str, pagelen: Option<u32>, ) -> Result<Paginated<FileHistoryEntry>>

List the commits that touched the file at path, starting from git_ref, newest first.

Source§

impl BitbucketClient

Source

pub async fn get_current_user(&self) -> Result<User>

Fetch the profile of the currently authenticated user.

Source

pub async fn get_user(&self, selected: &str) -> Result<User>

Fetch a user’s public profile.

selected may be an account ID or a UUID (including surrounding braces, which are percent-encoded for the URL path).

Source

pub async fn list_user_emails(&self) -> Result<Paginated<UserEmail>>

List the email addresses associated with the authenticated user.

Source§

impl BitbucketClient

Source

pub async fn list_webhooks( &self, workspace: &str, repo_slug: &str, pagelen: Option<u32>, ) -> Result<Paginated<Webhook>>

List webhook subscriptions on a repository

Source

pub async fn create_webhook( &self, workspace: &str, repo_slug: &str, request: &CreateWebhookRequest, ) -> Result<Webhook>

Create a webhook subscription on a repository

Source

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

Get a single webhook subscription by its UID (the brace-wrapped UUID)

Source

pub async fn update_webhook( &self, workspace: &str, repo_slug: &str, uid: &str, request: &CreateWebhookRequest, ) -> Result<Webhook>

Replace a webhook subscription.

Bitbucket’s PUT replaces the entire subscription, so request must carry the full desired state (see CreateWebhookRequest).

Source

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

Delete a webhook subscription

Source§

impl BitbucketClient

Source

pub async fn list_workspaces(&self) -> Result<Vec<Workspace>>

List all workspaces the authenticated user has access to, following pagination until every page has been fetched

Source

pub async fn list_workspaces_filtered( &self, role: Option<&str>, query: Option<&str>, sort: Option<&str>, page: Option<u32>, pagelen: Option<u32>, ) -> Result<Paginated<Workspace>>

List a single page of workspaces with optional filters.

role restricts results to workspaces where the caller has at least that role (member, collaborator, or owner), query is a Bitbucket query (BBQL) expression passed as the q parameter, and sort names a field to sort by (prefix with - for descending).

Source

pub async fn get_workspace(&self, workspace: &str) -> Result<Workspace>

Get a single workspace by slug or UUID

Source

pub async fn list_workspace_members( &self, workspace: &str, pagelen: Option<u32>, ) -> Result<Paginated<WorkspaceMembership>>

List a page of members of a workspace

Source

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

List a page of user permissions on a workspace, or — when repo_slug is given — on a single repository in that workspace.

Trait Implementations§

Source§

impl Clone for BitbucketClient

Source§

fn clone(&self) -> BitbucketClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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: Sized + 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: Sized + 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 = !

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