Skip to content

Latest commit

 

History

History
315 lines (204 loc) · 23.9 KB

RefsApi.md

File metadata and controls

315 lines (204 loc) · 23.9 KB

{{classname}}

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

Method HTTP request Description
RepositoriesWorkspaceRepoSlugRefsBranchesGet Get /repositories/{workspace}/{repo_slug}/refs/branches List open branches
RepositoriesWorkspaceRepoSlugRefsBranchesNameDelete Delete /repositories/{workspace}/{repo_slug}/refs/branches/{name} Delete a branch
RepositoriesWorkspaceRepoSlugRefsBranchesNameGet Get /repositories/{workspace}/{repo_slug}/refs/branches/{name} Get a branch
RepositoriesWorkspaceRepoSlugRefsBranchesPost Post /repositories/{workspace}/{repo_slug}/refs/branches Create a branch
RepositoriesWorkspaceRepoSlugRefsGet Get /repositories/{workspace}/{repo_slug}/refs List branches and tags
RepositoriesWorkspaceRepoSlugRefsTagsGet Get /repositories/{workspace}/{repo_slug}/refs/tags List tags
RepositoriesWorkspaceRepoSlugRefsTagsNameDelete Delete /repositories/{workspace}/{repo_slug}/refs/tags/{name} Delete a tag
RepositoriesWorkspaceRepoSlugRefsTagsNameGet Get /repositories/{workspace}/{repo_slug}/refs/tags/{name} Get a tag
RepositoriesWorkspaceRepoSlugRefsTagsPost Post /repositories/{workspace}/{repo_slug}/refs/tags Create a tag

RepositoriesWorkspaceRepoSlugRefsBranchesGet

PaginatedBranches RepositoriesWorkspaceRepoSlugRefsBranchesGet(ctx, repoSlug, workspace, optional) List open branches

Returns a list of all open branches within the specified repository. Results will be in the order the source control manager returns them. Branches support filtering and sorting that can be used to search for specific branches. For instance, to find all branches that have "stab" in their name: curl -s https://api.bitbucket.org/2.0/repositories/atlassian/aui/refs/branches -G --data-urlencode 'q=name ~ \"stab\"' By default, results will be in the order the underlying source control system returns them and identical to the ordering one sees when running "$ git branch --list". Note that this follows simple lexical ordering of the ref names. This can be undesirable as it does apply any natural sorting semantics, meaning for instance that tags are sorted ["v10", "v11", "v9"] instead of ["v9", "v10", "v11"]. Sorting can be changed using the ?q= query parameter. When using ?q=name to explicitly sort on ref name, Bitbucket will apply natural sorting and interpret numerical values as numbers instead of strings.

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 *RefsApiRepositoriesWorkspaceRepoSlugRefsBranchesGetOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a RefsApiRepositoriesWorkspaceRepoSlugRefsBranchesGetOpts struct

Name Type Description Notes

q | optional.String| Query string to narrow down the response as per filtering and sorting. | sort | optional.String| Field by which the results should be sorted as per filtering and sorting. The `name` field is handled specially for branches in that, if specified as the sort field, it uses a natural sort order instead of the default lexicographical sort order. For example, it will return ['branch1', 'branch2', 'branch10'] instead of ['branch1', 'branch10', 'branch2']. | page | optional.Int32| page |

Return type

PaginatedBranches

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]

RepositoriesWorkspaceRepoSlugRefsBranchesNameDelete

RepositoriesWorkspaceRepoSlugRefsBranchesNameDelete(ctx, name, repoSlug, workspace) Delete a branch

Delete a branch in the specified repository. The main branch is not allowed to be deleted and will return a 400 response. The branch name should not include any prefixes (e.g. refs/heads).

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string The name of the branch.
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]

RepositoriesWorkspaceRepoSlugRefsBranchesNameGet

Branch RepositoriesWorkspaceRepoSlugRefsBranchesNameGet(ctx, name, repoSlug, workspace) Get a branch

Returns a branch object within the specified repository. This call requires authentication. Private repositories require the caller to authenticate with an account that has appropriate authorization. For Git, the branch name should not include any prefixes (e.g. refs/heads).

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string The name of the branch.
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

Branch

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]

RepositoriesWorkspaceRepoSlugRefsBranchesPost

Branch RepositoriesWorkspaceRepoSlugRefsBranchesPost(ctx, repoSlug, workspace) Create a branch

Creates a new branch in the specified repository. The payload of the POST should consist of a JSON document that contains the name of the tag and the target hash. curl https://api.bitbucket.org/2.0/repositories/seanfarley/hg/refs/branches \\ -s -u seanfarley -X POST -H \"Content-Type: application/json\" \\ -d '{ \"name\" : \"smf/create-feature\", \"target\" : { \"hash\" : \"default\", } }' This call requires authentication. Private repositories require the caller to authenticate with an account that has appropriate authorization. The branch name should not include any prefixes (e.g. refs/heads). This endpoint does support using short hash prefixes for the commit hash, but it may return a 400 response if the provided prefix is ambiguous. Using a full commit hash is the preferred approach.

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}`.

Return type

Branch

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]

RepositoriesWorkspaceRepoSlugRefsGet

PaginatedRefs RepositoriesWorkspaceRepoSlugRefsGet(ctx, repoSlug, workspace, optional) List branches and tags

Returns the branches and tags in the repository. By default, results will be in the order the underlying source control system returns them and identical to the ordering one sees when running "$ git show-ref". Note that this follows simple lexical ordering of the ref names. This can be undesirable as it does apply any natural sorting semantics, meaning for instance that refs are sorted ["branch1", "branch10", "branch2", "v10", "v11", "v9"] instead of ["branch1", "branch2", "branch10", "v9", "v10", "v11"]. Sorting can be changed using the ?sort= query parameter. When using ?sort=name to explicitly sort on ref name, Bitbucket will apply natural sorting and interpret numerical values as numbers instead of strings.

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 *RefsApiRepositoriesWorkspaceRepoSlugRefsGetOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a RefsApiRepositoriesWorkspaceRepoSlugRefsGetOpts struct

Name Type Description Notes

q | optional.String| Query string to narrow down the response as per filtering and sorting. | sort | optional.String| Field by which the results should be sorted as per filtering and sorting. The `name` field is handled specially for refs in that, if specified as the sort field, it uses a natural sort order instead of the default lexicographical sort order. For example, it will return ['1.1', '1.2', '1.10'] instead of ['1.1', '1.10', '1.2']. | page | optional.Int32| page |

Return type

PaginatedRefs

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]

RepositoriesWorkspaceRepoSlugRefsTagsGet

PaginatedTags RepositoriesWorkspaceRepoSlugRefsTagsGet(ctx, repoSlug, workspace, optional) List tags

Returns the tags in the repository. By default, results will be in the order the underlying source control system returns them and identical to the ordering one sees when running "$ git tag --list". Note that this follows simple lexical ordering of the ref names. This can be undesirable as it does apply any natural sorting semantics, meaning for instance that tags are sorted ["v10", "v11", "v9"] instead of ["v9", "v10", "v11"]. Sorting can be changed using the ?sort= query parameter. When using ?sort=name to explicitly sort on ref name, Bitbucket will apply natural sorting and interpret numerical values as numbers instead of strings.

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 *RefsApiRepositoriesWorkspaceRepoSlugRefsTagsGetOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a RefsApiRepositoriesWorkspaceRepoSlugRefsTagsGetOpts struct

Name Type Description Notes

q | optional.String| Query string to narrow down the response as per filtering and sorting. | sort | optional.String| Field by which the results should be sorted as per filtering and sorting. The `name` field is handled specially for tags in that, if specified as the sort field, it uses a natural sort order instead of the default lexicographical sort order. For example, it will return ['1.1', '1.2', '1.10'] instead of ['1.1', '1.10', '1.2']. | page | optional.Int32| page |

Return type

PaginatedTags

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]

RepositoriesWorkspaceRepoSlugRefsTagsNameDelete

RepositoriesWorkspaceRepoSlugRefsTagsNameDelete(ctx, name, repoSlug, workspace) Delete a tag

Delete a tag in the specified repository. The tag name should not include any prefixes (e.g. refs/tags).

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string The name of the tag.
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]

RepositoriesWorkspaceRepoSlugRefsTagsNameGet

Tag RepositoriesWorkspaceRepoSlugRefsTagsNameGet(ctx, name, repoSlug, workspace) Get a tag

Returns the specified tag. $ curl -s https://api.bitbucket.org/2.0/repositories/seanfarley/hg/refs/tags/3.8 -G | jq . { \"name\": \"3.8\", \"links\": { \"commits\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commits/3.8\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg/refs/tags/3.8\" }, \"html\": { \"href\": \"https://bitbucket.org/seanfarley/hg/commits/tag/3.8\" } }, \"tagger\": { \"raw\": \"Matt Mackall <mpm@selenic.com>\", \"type\": \"author\", \"user\": { \"username\": \"mpmselenic\", \"nickname\": \"mpmselenic\", \"display_name\": \"Matt Mackall\", \"type\": \"user\", \"uuid\": \"{a4934530-db4c-419c-a478-9ab4964c2ee7}\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/mpmselenic\" }, \"html\": { \"href\": \"https://bitbucket.org/mpmselenic/\" }, \"avatar\": { \"href\": \"https://bitbucket.org/account/mpmselenic/avatar/32/\" } } } }, \"date\": \"2016-05-01T18:52:25+00:00\", \"message\": \"Added tag 3.8 for changeset f85de28eae32\", \"type\": \"tag\", \"target\": { \"hash\": \"f85de28eae32e7d3064b1a1321309071bbaaa069\", \"repository\": { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg\" }, \"html\": { \"href\": \"https://bitbucket.org/seanfarley/hg\" }, \"avatar\": { \"href\": \"https://bitbucket.org/seanfarley/hg/avatar/32/\" } }, \"type\": \"repository\", \"name\": \"hg\", \"full_name\": \"seanfarley/hg\", \"uuid\": \"{c75687fb-e99d-4579-9087-190dbd406d30}\" }, \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/f85de28eae32e7d3064b1a1321309071bbaaa069\" }, \"comments\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/f85de28eae32e7d3064b1a1321309071bbaaa069/comments\" }, \"patch\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg/patch/f85de28eae32e7d3064b1a1321309071bbaaa069\" }, \"html\": { \"href\": \"https://bitbucket.org/seanfarley/hg/commits/f85de28eae32e7d3064b1a1321309071bbaaa069\" }, \"diff\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg/diff/f85de28eae32e7d3064b1a1321309071bbaaa069\" }, \"approve\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/f85de28eae32e7d3064b1a1321309071bbaaa069/approve\" }, \"statuses\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/f85de28eae32e7d3064b1a1321309071bbaaa069/statuses\" } }, \"author\": { \"raw\": \"Sean Farley <sean@farley.io>\", \"type\": \"author\", \"user\": { \"username\": \"seanfarley\", \"nickname\": \"seanfarley\", \"display_name\": \"Sean Farley\", \"type\": \"user\", \"uuid\": \"{a295f8a8-5876-4d43-89b5-3ad8c6c3c51d}\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/seanfarley\" }, \"html\": { \"href\": \"https://bitbucket.org/seanfarley/\" }, \"avatar\": { \"href\": \"https://bitbucket.org/account/seanfarley/avatar/32/\" } } } }, \"parents\": [ { \"hash\": \"9a98d0e5b07fc60887f9d3d34d9ac7d536f470d2\", \"type\": \"commit\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/seanfarley/hg/commit/9a98d0e5b07fc60887f9d3d34d9ac7d536f470d2\" }, \"html\": { \"href\": \"https://bitbucket.org/seanfarley/hg/commits/9a98d0e5b07fc60887f9d3d34d9ac7d536f470d2\" } } } ], \"date\": \"2016-05-01T04:21:17+00:00\", \"message\": \"debian: alphabetize build deps\", \"type\": \"commit\" } }

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string The name of the tag.
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

Tag

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]

RepositoriesWorkspaceRepoSlugRefsTagsPost

Tag RepositoriesWorkspaceRepoSlugRefsTagsPost(ctx, body, repoSlug, workspace) Create a tag

Creates a new tag in the specified repository. The payload of the POST should consist of a JSON document that contains the name of the tag and the target hash. curl https://api.bitbucket.org/2.0/repositories/jdoe/myrepo/refs/tags \\ -s -u jdoe -X POST -H \"Content-Type: application/json\" \\ -d '{ \"name\" : \"new-tag-name\", \"target\" : { \"hash\" : \"a1b2c3d4e5f6\", } }' This endpoint does support using short hash prefixes for the commit hash, but it may return a 400 response if the provided prefix is ambiguous. Using a full commit hash is the preferred approach.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body Tag
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

Tag

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]