grahamcampbell / laravel-bitbucket Goto Github PK
View Code? Open in Web Editor NEWA Bitbucket API bridge for Laravel
Home Page: https://gjcampbell.co.uk
License: MIT License
A Bitbucket API bridge for Laravel
Home Page: https://gjcampbell.co.uk
License: MIT License
Check please src/Auth/Authenticator/JwtAuthenticator.php:44
I guess correct would be:
$client->authenticate(Client::AUTH_JWT, $config['token']);
Command
composer require "graham-campbell/bitbucket:^8.1" "guzzlehttp/guzzle:^7.4" "http-interop/http-factory-guzzle:^1.0"
Error
Problem 1
- laravel/passport[v8.0.0, ..., 8.x-dev] require guzzlehttp/guzzle ^6.0 -> found guzzlehttp/guzzle[6.0.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.4).
- Root composer.json requires laravel/passport ^8.0 -> satisfiable by laravel/passport[v8.0.0, ..., 8.x-dev]
Hi, thank for great project, I'm working with bitbucket and this is very helpful for me.
First, I'm try authentication via basic, everything is OK. But switch to token method, I can't find where is token code (I have try App passwords code, that's similar Personal access tokens in Github but is doesn't work).
I found this doc: https://gentlero.bitbucket.io/bitbucket-api/0.8/examples/authentication.html#oauth2-authorization-code-3-legged-flow, It say require user authentication via browser to get access_token
. That seem not right way here.
For now, I write own a class OAuthAuthenticator
use client_id
, client_secret
to authentication. It's worked for me.
And seem it's good method. Maybe need a pull-request for that?
Hi Graham,
This is a very good package thank you for this.
Although the Bitbucket access token expires after 1 hour and needs a refresh token.
I tried to send a post request to refresh the token but when I do that, the access token changes.
Let's say after creating an API consumer having these:
BITBUCKET_KEY
BITBUCKET_SECRET
When I authenticate and get a BITBUCKET_ACCESS_TOKEN
, this token expires after 1 hour then I have to send another request to get an BITBUCKET_REFRESH_TOKEN
then having this BITBUCKET_REFRESH_TOKEN
sending another request will generate a new access token and the previous one won't work.
Apologies if I am missing some concept here, but it would be grateful if you could guide me.
Does not support Bitbucket Server (API v1.0)
Is there anyway to download a repository using this package? It's the last part of the puzzle I have yet to solve!
Hello,
I'm using your codes in my application built on laravel 5.5
, where I'm facing some problem, I'm trying to retrieve list of commit details for my repository and I'm unable to use the response format. I'm trying to do something like this:
$data = Bitbucket::api('Repositories\Commits')->all('***repo***user***', '***repo***name***', array(
'branch' => 'master'
));
return $data
I'm getting a response which is not in JSON format:
HTTP/1.1 200 OK
Server: nginx
Vary: Authorization
Vary: Accept-Encoding
Content-Type: application/json; charset=utf-8
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Date: Tue, 13 Feb 2018 09:21:41 GMT
X-Served-By: app-139
ETag: "7b8332218b7bc6b7c4a2f50e3ab9c45c"
X-Static-Version: 476dd7889f1a
X-Content-Type-Options: nosniff
X-Accepted-OAuth-Scopes: repository
X-Credential-Type: password
X-Render-Time: 1.31000494957
Connection: keep-alive
X-Request-Count: 141
X-Frame-Options: SAMEORIGIN
Last-Modified: Mon, 12 Feb 2018 20:17:03 GMT
X-Version: 476dd7889f1a
Content-Length: 71360
{"pagelen": 30, "values": [{"hash": "********9b580ff91967547d61*****", "repository": {"links": {"self": {"href": "https://api.bitbucket.org/2.0/repositories/********/*****"}, "html": {"href......
I've already tried return response()->json(['data' => $data], 200)
which was giving me no data. I can see headers data is also coming, if I use json_decode($data)
it is gives me error which clearly shows is not a JSON. How can I format this to a proper JSON response?
How can I get all the branches from a repo?
I can't install graham-campbell/bitbucket
, when i run:
composer require "graham-campbell/bitbucket:^9.0"
I have the following error:
- graham-campbell/bitbucket v9.0.0 requires illuminate/contracts ^8.75 || ^9.0 -> found illuminate/contracts[v8.75.0, ..., 8.x-dev, v9.0.0-beta.1, ..., 9.x-dev] but these were not loaded, likely because it conflicts with another require.
A similar situation is when trying to install with commands:
composer require "graham-campbell/bitbucket:^9.0" -W
composer require graham-campbell/bitbucket:*
composer why illuminate/contracts
returns:
graham-campbell/manager v4.7.0 requires illuminate/contracts (^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0)
laravel/framework v7.30.6 replaces illuminate/contracts (self.version)
laravel/tinker v2.4.2 requires illuminate/contracts (^6.0|^7.0|^8.0)
spatie/laravel-backup 6.11.2 requires illuminate/contracts (^5.8.15|^6.0|^7.0|^8.0)
vinkla/hashids 8.1.0 requires illuminate/contracts (^7.0)
Is there any way to use the Bitbucket Oauth 2 consume key and secret credentials with this package?
Hi.
I'm trying to understand what this package can do but it seems I have to read the whole docs and the codes first.
I think it would be helpful to document that. Actually, please do it.
Hi there,
The bitbucket rest api has a method to get tags: /rest/api/latest/projects/<project>/repos/<repo>/tags
Is there a way to call that using this package?
Many thanks for any advice.
This package is at version 1.0 at the moment, but the caret in composer.json prevents it from updating to this version. From the docs:
The ^
operator behaves very similarly but it sticks closer to semantic versioning, and will always allow non-breaking updates. For example ^1.2.3
is equivalent to >=1.2.3 <2.0.0
as none of the releases until 2.0 should break backwards compatibility. For pre-1.0 versions it also acts with safety in mind and treats ^0.3
as >=0.3.0 <0.4.0
.
This is the recommended operator for maximum interoperability when writing library code.
Example: ^1.2.3
Do you reckon we could update this package to that version?
Hi!
Can I use the package somehow with different credentials for every website user?
Thanks
Hi!
I found an issue in the API client. Whenever I try to fetch a deployments list, I'm getting the following exception:
{
"message": "Resource not found: There is no API hosted at this URL.",
"exception": "Bitbucket\\Exception\\RuntimeException",
"file": "/srv/app/vendor/bitbucket/client/src/HttpClient/Plugin/BitbucketExceptionThrower.php",
"line": 76,
"trace": [ ... ]
}
Here's how I'm trying to get the list from code:
$deployments = $this
->bitbucket
->repositories()
->workspaces($workspace)
->deployments($repository)
->list();
Technically, this code should work, but I think there might be an issue with generated URL for this specific endpoint. Here's the URL that I'm getting in code:
https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/deployments
The thing is, this URL just doesn't work without a trailing slash. I'm getting the following response when I'm trying to make a request in Postman:
GET https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/deployments
{
"type": "error",
"error": {
"message": "Resource not found",
"detail": "There is no API hosted at this URL.\n\nFor information about our API's, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/"
}
}
... and the same URL but with a trailing slash:
GET https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/deployments/
{
"page": 1,
"values": [
{
"type": "deployment",
"deployable": {
"type": "deployment_release",
"uuid": "<>",
"pipeline": {
"uuid": "<>",
"type": "pipeline"
},
...
I guess we need a fix :)
Hi there!
I've been trying to get a certain amount of repositories from BitBucket by making use of the Laravel-Bitbucket package. According to the docs, it should be possible to define the amount of results you'd like to receive on different API endpoints by calling the setPerPage() function.
When doing so with the members endpoint like in the example below, I get the specified amount of results back, as expected:
$team = Bitbucket::teams('teamname');
$members = $team->members();
$members->setPerPage(20);
$members->list();
However, when doing the exact same thing for the repositories endpoint. I keep ending up with the default amount of 10 repositories per page instead of the specified amount (20 in the example below).
$team = Bitbucket::teams('teamname');
$repositories = $team->repositories();
$repositories->setPerPage(20);
$repositories->list();
Am I doing something wrong here or is this a bug?
Could you please look into this?
Thank you in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.