The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::BitbucketServer::Git::V1 - Bindings for a Bitbucket Server REST API

VERSION

version 0.600

SYNOPSIS

    my $stash = WebService::BitbucketServer->new(
        base_url    => 'https://stash.example.com/',
        username    => 'bob',
        password    => 'secret',
    );
    my $api = $stash->git;

DESCRIPTION

This is a Bitbucket Server REST API for Git::V1.

Original API documentation created by and copyright Atlassian.

ATTRIBUTES

context

Get the instance of WebService::BitbucketServer passed to "new".

METHODS

new

    $api = WebService::BitbucketServer::Git::V1->new(context => $webservice_bitbucketserver_obj);

Create a new API.

Normally you would use $webservice_bitbucketserver_obj->git instead.

can_rebase

Checks preconditions to determine whether the pull request can be rebased.

Some of the preconditions are:

  • The pull request is between Git repositories

  • The pull request is currently open

  • The pull request's "from" ref is a branch

    • In other words, the qualified ID for the "from" ref must start with refs/heads/

    • Tags, and other non-standard refs, cannot be rebased

  • The current user has an e-mail address

    • Pull requests cannot be rebased anonymously

    • git rebase records the current user as the committer for the rebased commits, which requires a name and e-mail address

  • The current user has write access to the "from" ref's repository

    • Note that in order to view a pull request a user is only required to have read access to the toRef's repository, so just because a user can see a pull request does not mean they can request a rebase

This list is not exhaustive, and the exact set of preconditions applied can be extended by third-party add-ons.

The authenticated user must have REPO_READ permission for the repository that this pull request targets to call this resource.

    GET git/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase

Parameters:

  • pullRequestId - long, default: none

    the ID of the pull request within the repository

Responses:

  • 200 - pullRequest, type: application/json

    The rebaseability status of the pull request.

  • 401 - errors, type: application/json

    The currently authenticated user has insufficient permissions to view the specified pull request.

  • 404 - errors, type: application/json

    The specified repository or pull request does not exist.

rebase

Rebases the specified pull request, rewriting the incoming commits to start from the tip commit of the pull request's target branch. This operation alters the pull request's source branch and cannot be undone.

The authenticated user must have REPO_READ permission for the repository that this pull request targets and REPO_WRITE permission for the pull request's source repository to call this resource.

    POST git/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase

Parameters:

  • pullRequestId - long, default: none

    the ID of the pull request within the repository

Responses:

  • 200 - pullRequest, type: application/json

    The merged pull request.

  • 401 - errors, type: application/json

    The currently authenticated user has insufficient permissions to view the pull request and/or to update its source branch.

  • 404 - errors, type: application/json

    The specified repository or pull request does not exist.

  • 409 - errors, type: application/json

    Any of the following error cases occurred (check the error message for more details):

    • The rebase encountered conflicts.

    • The rebase discarded all of the incoming commits and would have left the pull request empty

    • A PreRepositoryHook vetoed the rebase.

    • The specified version is out of date.

    • The specified pull request is not open.

create_tag

Creates a tag in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource.

'LIGHTWEIGHT' and 'ANNOTATED' are the two type of tags that can be created. The 'startPoint' can either be a ref or a 'commit'.

    POST git/1.0/projects/{projectKey}/repos/{repositorySlug}/tags

Responses:

  • 201 - data, type: application/json

    a JSON representation of the newly created tag

  • 400 - errors, type: application/json

    the tag was not created because the request was invalid, e.g. the provided ref name already existed in the repository, or was not a valid ref name in the repository, or the start point is invalid

  • 403 - errors, type: application/json

    The currently authenticated user has insufficient permissions to create a tag. This could be due to insufficient repository permissions.

delete_tag

Deletes a tag in the specified repository.

The authenticated user must have an effective REPO_WRITE permission to call this resource.

    DELETE git/1.0/projects/{projectKey}/repos/{repositorySlug}/tags/{name:.*}

Parameters:

  • name - string, default: none

    the name of the tag to be deleted

Responses:

  • 400 - errors, type: application/json

    the tag was not deleted because repository is either empty, or is not a git repository

  • 204 - data, type: unknown

    an empty response indicating that the tag no longer exists in the repository

  • 403 - errors, type: application/json

    The currently authenticated user has insufficient permissions to delete a tag. This could be due to insufficient repository permissions.

  • 404 - errors, type: application/json

    If the tag doesn't exist in the {@link Repository}

SEE ALSO

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/chazmcgarvey/WebService-BitbucketServer/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Charles McGarvey <ccm@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Charles McGarvey.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.