Skip to content

Latest commit

 

History

History
173 lines (112 loc) · 11 KB

BranchRestrictionsApi.md

File metadata and controls

173 lines (112 loc) · 11 KB

{{classname}}

All URIs are relative to https://api.bitbucket.org/2.0

Method HTTP request Description
RepositoriesWorkspaceRepoSlugBranchRestrictionsGet Get /repositories/{workspace}/{repo_slug}/branch-restrictions List branch restrictions
RepositoriesWorkspaceRepoSlugBranchRestrictionsIdDelete Delete /repositories/{workspace}/{repo_slug}/branch-restrictions/{id} Delete a branch restriction rule
RepositoriesWorkspaceRepoSlugBranchRestrictionsIdGet Get /repositories/{workspace}/{repo_slug}/branch-restrictions/{id} Get a branch restriction rule
RepositoriesWorkspaceRepoSlugBranchRestrictionsIdPut Put /repositories/{workspace}/{repo_slug}/branch-restrictions/{id} Update a branch restriction rule
RepositoriesWorkspaceRepoSlugBranchRestrictionsPost Post /repositories/{workspace}/{repo_slug}/branch-restrictions Create a branch restriction rule

RepositoriesWorkspaceRepoSlugBranchRestrictionsGet

PaginatedBranchrestrictions RepositoriesWorkspaceRepoSlugBranchRestrictionsGet(ctx, repoSlug, workspace, optional) List branch restrictions

Returns a paginated list of all branch restrictions on the repository.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.
optional *BranchRestrictionsApiRepositoriesWorkspaceRepoSlugBranchRestrictionsGetOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a BranchRestrictionsApiRepositoriesWorkspaceRepoSlugBranchRestrictionsGetOpts struct

Name Type Description Notes

kind | optional.String| Branch restrictions of this type | pattern | optional.String| Branch restrictions applied to branches of this pattern | page | optional.Int32| page |

Return type

PaginatedBranchrestrictions

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepositoriesWorkspaceRepoSlugBranchRestrictionsIdDelete

RepositoriesWorkspaceRepoSlugBranchRestrictionsIdDelete(ctx, id, repoSlug, workspace) Delete a branch restriction rule

Deletes an existing branch restriction rule.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string The restriction rule's id
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

(empty response body)

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepositoriesWorkspaceRepoSlugBranchRestrictionsIdGet

Branchrestriction RepositoriesWorkspaceRepoSlugBranchRestrictionsIdGet(ctx, id, repoSlug, workspace) Get a branch restriction rule

Returns a specific branch restriction rule.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string The restriction rule's id
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

Branchrestriction

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepositoriesWorkspaceRepoSlugBranchRestrictionsIdPut

Branchrestriction RepositoriesWorkspaceRepoSlugBranchRestrictionsIdPut(ctx, body, id, repoSlug, workspace) Update a branch restriction rule

Updates an existing branch restriction rule. Fields not present in the request body are ignored. See POST for details.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body Branchrestriction The new version of the existing rule
id string The restriction rule's id
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

Branchrestriction

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepositoriesWorkspaceRepoSlugBranchRestrictionsPost

Branchrestriction RepositoriesWorkspaceRepoSlugBranchRestrictionsPost(ctx, body, repoSlug, workspace) Create a branch restriction rule

Creates a new branch restriction rule for a repository. kind describes what will be restricted. Allowed values include: push, force, delete, restrict_merges, require_tasks_to_be_completed, require_approvals_to_merge, require_default_reviewer_approvals_to_merge, require_no_changes_requested, require_passing_builds_to_merge, require_commits_behind, reset_pullrequest_approvals_on_change, smart_reset_pullrequest_approvals, reset_pullrequest_changes_requested_on_change, require_all_dependencies_merged, enforce_merge_checks, and allow_auto_merge_when_builds_pass. Different kinds of branch restrictions have different requirements: * push and restrict_merges require users and groups to be specified. Empty lists are allowed, in which case permission is denied for everybody. The restriction applies to all branches that match. There are two ways to match a branch. It is configured in branch_match_kind: 1. glob: Matches a branch against the pattern. A '*' in pattern will expand to match zero or more characters, and every other character matches itself. For example, 'foo*' will match 'foo' and 'foobar', but not 'barfoo'. '*' will match all branches. 2. branching_model: Matches a branch against the repository's branching model. The branch_type controls the type of branch to match. Allowed values include: production, development, bugfix, release, feature and hotfix. The combination of kind and match must be unique. This means that two glob restrictions in a repository cannot have the same kind and pattern. Additionally, two branching_model restrictions in a repository cannot have the same kind and branch_type. users and groups are lists of users and groups that are except from the restriction. They can only be configured in push and restrict_merges restrictions. The push restriction stops a user pushing to matching branches unless that user is in users or is a member of a group in groups. The restrict_merges stops a user merging pull requests to matching branches unless that user is in users or is a member of a group in groups. Adding new users or groups to an existing restriction should be done via PUT. Note that branch restrictions with overlapping matchers is allowed, but the resulting behavior may be surprising.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body Branchrestriction The new rule
repoSlug string This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.
workspace string This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`.

Return type

Branchrestriction

Authorization

api_key, basic, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]