Git Product home page Git Product logo

bitbucket.net's People

Contributors

ipwillia avatar lvermeulen avatar lvermeulen-tobania avatar reallyliri avatar royblit avatar rscooper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bitbucket.net's Issues

support CancellationToken in requests

I have a console app using this library. Querying the list of repositories for one server takes 90 seconds. I can't cancel the command because I can't pass the CancellationToken through the methods. I looked at forking this but there were too many methods for me to update. I ended up with the following workaround. It works but took my a while to determine how to do. Maybe it would even be helpful just to link to an example like this until such time CancellationToken is supported?

        MyHttpClientHandler.CancellationToken = context.CancellationToken;
        FlurlHttp.GlobalSettings.HttpClientFactory = new MyDefaultHttpClientFactory();

        public class MyDefaultHttpClientFactory : DefaultHttpClientFactory
        {
            public override HttpMessageHandler CreateMessageHandler() => (HttpMessageHandler)new MyHttpClientHandler()
            {
                AutomaticDecompression = (DecompressionMethods.GZip | DecompressionMethods.Deflate)
            };
        }

        public class MyHttpClientHandler : HttpClientHandler
        {
            internal static CancellationToken CancellationToken;

            protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
            {
                // ignore the default token
                return base.SendAsync(request, CancellationToken);
            }

            protected override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken)
            {
                // ignore the default token
                return base.Send(request, CancellationToken);
            }
        }

Get Commit Properties in GetCommitAsync

hi,

would be great if the endpoint could already provide properties, we have this rest answer:
"properties": {
"jira-key": [
"ticket"
]
}

But the properties are missing from the Commit.

I can get the data from the comment, but then i need to run some regx to get the tickets. Would be nice to get directly the data from the endpoint.

thanks

Add support for Bitbucket Access Keys

I'd like to not have to use my bitbucket username and password for an automated script to run.
access_keys

Example code:

var _client = new BitbucketClient("https://myprivatebitbucketrepo.example.com", () => 
@"
-----BEGIN OPENSSH PRIVATE KEY-----
insert your private key here
-----END OPENSSH PRIVATE KEY-----
"
);

Add "Truncated" boolean property into Core.Projects.Line model

BrowseProjectRepositoryPath returns file content as an array of text lines.
If the text line size is more than a constant (~5000 chars), the returned text is truncated, and the "Truncated" property value is true on the model.

public class Line
{
public string Text { get; set; }
public bool? Truncated { get; set; }
}

Documentation

Hi,

This project needs some documentation. It's not clear how to use the API.

It's also not clear if this works with Bitbucket cloud.

Any plans to add alternative Bearer authentication using personal access tokens?

Loving this library, made integrating into our bit bucket server much easier. Better than Atlassian Stash.

Would like to suggest having the ability to Authenticate with Bearer tokens though.
This seems more secure than authenticating with username and password. And does not seem hard to implement.

Using WithOAuthBearerToken instead of WithBasicAuth in GetBaseUrl.

Thanks!

Add support for tasks (blocker comments) on pull requests

I'm not sure which API version introduced the change, but tasks on pull requests are now called "blocker-comments". Would it be possible to add support for those?

Per the docs here: https://docs.atlassian.com/bitbucket-server/rest/7.4.0/bitbucket-rest.html

http://example.com/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments

seems to mirror

http://example.com/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments

fairly closely.

Incorrect JSON Format When Adding Comments to PRs

When adding comments to a PR, this API call expects an achor key. This allows the comment to be applied to a line of a file in a diff.

As far as I can tell, CreatePullRequestCommentAsync doesn't format the JSON data with the anchor key, meaning that comments only get applied at the overview level.

Multi-authentication clients

As it uses Flurl the authentication is actually cached per host for at least the first request. What this means is that if I use one bitbucket client and then create a second one with other credentials it would actually use the credentials from the first one.

To be resolved I think that instead of invoking requests directly agains the string using the flurl extensions a flurl client should be used and the bitbucket client should implement IDisposable.

Bitbucket.Net changes default JSON serialization settings

this static ctor changes the default JSON serialization settings in the application.
I think this is a problem, since other code may rely on the "default" set of defaults.
I don't expect a library to change the global settings in my application..

For example, in the application I'm working on now, we have many integrations with many 3rd party APIs.
I spent more time than I would've liked trying to figure out why an integration with service X was working as expected normally, but not working only on certain servers / certain customers.
turns out that, as long as the bitbucket integration wasn't turned on, everything was great. but once we turned on integration for bitbucket AND service X, service X stopped working as expected.
that's because Bitbucket.NET changed how the requests to service X were serialized!

DeclinePullRequest is throwing 405 error

While using DeclinePullrequest Method,it is failing with status code 405.

FlurlHttpException: DELETE http://bitbucket.org/rest/api/1.0/projects/{projectkey}/repos/{slug}/pull-requests/1898/decline?version=2 failed with status code 405 ().

This is the method I have defined using the bitbucket package

`public bool DeclineUnapprovedBuildMasterPullRequests()
{
var openBuildMasterUnapprovedPullRequests = GetOpenBuildMasterPullRequests().Where(pr=> pr.Reviewers.Count(rev => rev.Approved) <PULL_APPROVAL_THRESHOLD).ToList();

        if (openBuildMasterUnapprovedPullRequests.Count > 0)
        {
            foreach (var pullRequest in openBuildMasterUnapprovedPullRequests)
            {
                
                var declinePullRequest = bitbucketClient.DeclinePullRequestAsync(settings.ProjectKey, settings.RepositorySlug, pullRequest.Id, pullRequest.Version).Result;
                if (!declinePullRequest)
                    return false;
            }
        }

        return true;
    }

`

Deletion of Branches fails with 415

Hi,

I stumbled upon a problem when deleting branches using DeleteRepoBranchAsync:

Unhandled Exception: System.AggregateException: One or more errors occurred. (DELETE https://bitbucketserver/rest/branch-utils/1.0/projects/proj/repos/repo/branches failed with status code 415 ().) ---> Flurl.Http.FlurlHttpException: DELETE https://bitbucketserver/rest/branch-utils/1.0/projects/proj/repos/repo/branches failed with status code
415 ().

Any idea why this blows up? I've got no fancy characters in the branch name and according to https://docs.atlassian.com/bitbucket-server/rest/5.9.0/bitbucket-rest.html
everything should be fine :(

Thx in advance!

Maintaining Bitbucket.Net

@lvermeulen, at the company I work for we use this library in one of our internal repos. There are some things that we would like to fix on this library. However, it doesn't appear that you spend much time actively maintaining this repo. So, could you add me as one of the maintainers of this repository please? Then I can help you maintain this library.

Mocking

Great work!

Have you thought about introducing interfaces to allow for mocking in tests? Really the only thing holding me back from using this library.

Getting comments and tasks under a comment in a pull request?

I love this library, and am trying to understand if I am just misunderstanding how it works, or if I have a feature request ;)
when I look at the json data for a pull request, there is a comments and tasks parameter array. However this library doesn't have a comments nor tasks array inside of Comment. I can't figure out how to recursively dig into the tree of comments.

Thank You, Josh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.