Skip to content

Commit 0ba6f9b

Browse files
committed
Merge branch 'release/0.3.0'
2 parents 9dc3e9b + 7c4cd68 commit 0ba6f9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1594
-253
lines changed

docs/Home.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ A simple PHP wrapper for Bitbucket API.
1010
* [Group privileges](group-privileges.md)
1111
* [Invitations](invitations.md)
1212
* [Privileges](privileges.md)
13-
* [Repositories](repositories.md)
13+
* [Repositories](repositories.md) (API 2.0)
1414
* [Changesets](repositories/changesets.md)
1515
* [Deploykeys](repositories/deploykeys.md)
1616
* [Events](repositories/events.md)
1717
* [Followers](repositories/followers.md)
1818
* [Issues](repositories/issues.md)
1919
* [Links](repositories/links.md)
20-
* [PullRequests](repositories/pullrequests.md)
21-
* [Repository](repositories/repository.md)
20+
* [PullRequests](repositories/pullrequests.md) (API 2.0)
21+
* [Repository](repositories/repository.md) (API 2.0)
2222
* [Services](repositories/services.md)
2323
* [Src](repositories/src.md)
2424
* [Wiki](repositories/wiki.md)
@@ -31,3 +31,7 @@ A simple PHP wrapper for Bitbucket API.
3131
* [OAuth](users/oauth.md)
3232
* [Privileges](users/privileges.md)
3333
* [SSH Keys](users/ssh-keys.md)
34+
35+
### Legend:
36+
37+
- API 2.0 = Contains methods that can be used against Bitbucket API v2.0

docs/repositories.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
----
44
The repositories namespace has a number of resources you can use to manage repository. The following resources are available on repositories:
55

6+
### Prepare:
7+
```php
8+
$repositories = new Bitbucket\API\Repositories();
9+
$repositories->setCredentials( new Bitbucket\API\Authentication\Basic($bb_user, $bb_pass) );
10+
```
11+
12+
### Get a list of repositories for an account: (API 2.0)
13+
14+
If the caller is properly authenticated and authorized, this method returns a collection containing public and private repositories.
15+
```php
16+
$repositories->all($account_name);
17+
```
18+
19+
### Get a list of all public repositories: (API 2.0)
20+
21+
Only public repositories are returned.
22+
```php
23+
$repositories->all();
24+
```
25+
26+
* [Commit(s)](repositories/commits.md) (API 2.0)
627
* [Changesets](repositories/changesets.md)
728
* [Deploykeys](repositories/deploykeys.md)
829
* [Events](repositories/events.md)

docs/repositories/commits.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## Commits
2+
3+
----
4+
Retrieve and compare information about commits.
5+
6+
### Prepare:
7+
```php
8+
$commits = new Bitbucket\API\Repositories\PullRequests();
9+
$commits->setCredentials( new Bitbucket\API\Authentication\Basic($bb_user, $bb_pass) );
10+
```
11+
12+
### Get all commits for a repository: (API 2.0)
13+
```php
14+
$commits->all($account_name, $repo_slug);
15+
```
16+
17+
### Get all commits for a single branch: (API 2.0)
18+
```php
19+
$commits->all($account_name, $repo_slug, array(
20+
'branch' => 'master' // this can also be a tag
21+
));
22+
```
23+
24+
### Get an individual commit: (API 2.0)
25+
```php
26+
$commits->get($account_name, $repo_slug, $commitSHA1);
27+
```
28+
29+
### Approve a commit: (API 2.0)
30+
```php
31+
$commits->approve($account_name, $repo_slug, $commitSHA1);
32+
```
33+
34+
### Delete a commit approval: (API 2.0)
35+
```php
36+
$commits->deleteApproval($account_name, $repo_slug, $commitSHA1);
37+
```
38+
39+
----
40+
41+
#### Related:
42+
* [Authentication](../authentication.md)
43+
* [Commit(s) comments](commits/comments.md)
44+
* [BB Wiki](https://confluence.atlassian.com/x/doA7Fw)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Commits comments
2+
3+
---
4+
Manage commits comments.
5+
6+
### Prepare:
7+
```php
8+
$commit = new Bitbucket\API\Repositories\Commits();
9+
$commit->setCredentials( new Bitbucket\API\Authentication\Basic($bb_user, $bb_pass) );
10+
```
11+
12+
### Get a list of a commit comments: (API 2.0)
13+
```php
14+
$commit->comments()->all($account_name, $repo_slug, $commitSHA1)
15+
```
16+
17+
### Get an individual commit comment: (API 2.0)
18+
```php
19+
$commit->comments()->get($account_name, $repo_slug, $commitSHA1, $commentID)
20+
```
21+
22+
----
23+
24+
#### Related:
25+
* [Authentication](../../authentication.md)
26+
* [Commit(s)](../commits.md)

docs/repositories/pullrequests.md

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,98 @@ $pull = new Bitbucket\API\Repositories\PullRequests();
99
$pull->setCredentials( new Bitbucket\API\Authentication\Basic($bb_user, $bb_pass) );
1010
```
1111

12-
### Get a list of a pull request comments:
12+
### Get all pull requests: (API 2.0)
1313
```php
14-
$pull->comments()->all($account_name, $repo_slug, 1)
14+
$pull->all($account_name, $repo_slug);
1515
```
1616

17-
### Get an individual pull request comment:
17+
### Get all merged pull requests: (API 2.0)
1818
```php
19-
$pull->comments()->get($account_name, $repo_slug, 1, 2)
19+
$pull->all($account_name, $repo_slug, array('state' => 'merged'));
2020
```
2121

22-
### Add a new comment:
22+
### Create a new pull request: (API 2.0)
2323
```php
24-
$pull->comments()->create($account_name, $repo_slug, 41, "dummy content");
24+
$pull->create('gentle', 'secret-repo', array(
25+
'title' => 'Test PR',
26+
'description' => 'Fixed readme',
27+
'source' => array(
28+
'branch' => array(
29+
'name' => 'quickfix-1'
30+
),
31+
'repository' => array(
32+
'full_name' => 'vimishor/secret-repo'
33+
)
34+
),
35+
'destination' => array(
36+
'branch' => array(
37+
'name' => 'master'
38+
)
39+
)
40+
));
2541
```
2642

27-
### Update an existing comment:
43+
### Update a pull request: (API 2.0)
2844
```php
29-
$pull->comments()->update($account_name, $repo_slug, 41, 4, "dummy content [edited]");
45+
$pull->update('gentle', 'secret-repo', 1, array(
46+
'title' => 'Test PR (updated)',
47+
'destination' => array(
48+
'branch' => array(
49+
'name' => 'master'
50+
)
51+
),
52+
));
3053
```
3154

32-
### Delete a pull request comment
55+
### Get a specific pull request: (API 2.0)
3356
```php
34-
$pull->comments()->delete($account_name, $repo_slug, 41, 4);
57+
$pull->get($account_name, $repo_slug, 1);
3558
```
3659

37-
### Get all pull requests
60+
### Get the commits for a pull request: (API 2.0)
3861
```php
39-
$pull->all($account_name, $repo_slug);
62+
$pull->commits($account_name, $repo_slug, 1);
63+
```
64+
65+
### Approve a pull request: (API 2.0)
66+
```php
67+
$pull->approve($account_name, $repo_slug, 1);
68+
```
69+
70+
### Delete a a pull request approval: (API 2.0)
71+
```php
72+
$pull->delete($account_name, $repo_slug, 1);
73+
```
74+
75+
### Get the diff for a pull request: (API 2.0)
76+
```php
77+
$pull->diff($account_name, $repo_slug, 1);
78+
```
79+
80+
### Get the log of a pull request activity: (API 2.0)
81+
If pull request ID is omitted, the entire repository's pull request activity is returned.
82+
83+
```php
84+
$pull->activity($account_name, $repo_slug, 1);
85+
```
86+
87+
### Accept and merge a pull request: (API 2.0)
88+
```php
89+
$pull->accept($account_name, $repo_slug, 1, array(
90+
'message' => 'This message will be used for merge commit.'
91+
));
92+
```
93+
94+
### Decline a pull request: (API 2.0)
95+
```php
96+
$pull->accept($account_name, $repo_slug, 1, array(
97+
'message' => 'Please update the docs to reflect new changes.'
98+
));
4099
```
41100

42101
----
43102

44103
#### Related:
45104
* [Authentication](../authentication.md)
105+
* [PullRequests comments](pullrequests/comments.md)
46106
* [BB Wiki](https://confluence.atlassian.com/display/BITBUCKET/pullrequests+Resource#pullrequestsResource-Overview)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Pull requests comments
2+
3+
---
4+
Manage pull requests comments.
5+
6+
### Prepare:
7+
```php
8+
$pull = new Bitbucket\API\Repositories\PullRequests();
9+
$pull->setCredentials( new Bitbucket\API\Authentication\Basic($bb_user, $bb_pass) );
10+
```
11+
12+
### Get a list of a pull request comments:
13+
```php
14+
$pull->comments()->all($account_name, $repo_slug, 1)
15+
```
16+
17+
### Get an individual pull request comment:
18+
```php
19+
$pull->comments()->get($account_name, $repo_slug, 1, 2)
20+
```
21+
22+
### Add a new comment:
23+
```php
24+
$pull->comments()->create($account_name, $repo_slug, 41, "dummy content");
25+
```
26+
27+
### Update an existing comment:
28+
```php
29+
$pull->comments()->update($account_name, $repo_slug, 41, 4, "dummy content [edited]");
30+
```
31+
32+
### Delete a pull request comment
33+
```php
34+
$pull->comments()->delete($account_name, $repo_slug, 41, 4);
35+
```

docs/repositories/repository.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ $repo = new Bitbucket\API\Repositories\Repository();
99
$repo->setCredentials( new Bitbucket\API\Authentication\Basic($bb_user, $bb_pass) );
1010
```
1111

12-
### Create a new repository:
12+
### Get information associated with an individual repository: (API 2.0)
13+
```php
14+
$repo->get($account_name, $repo_slug);
15+
```
16+
17+
### Create a new repository: (API 1.0)
18+
**NOTE:** API 1.0 endpoint for repository creation has been deprecated, so please use the new API 2.0 endpoint described bellow.
19+
1320
```php
1421
$repo->create($repo_slug, array(
1522
'description' => 'My super secret project.',
@@ -18,6 +25,17 @@ $repo->create($repo_slug, array(
1825
));
1926
```
2027

28+
### Create a new repository: (API 2.0)
29+
```php
30+
$repo->create($account_name, $repo_slug, array(
31+
'scm' => 'git',
32+
'description' => 'My super secret project.',
33+
'language' => 'php',
34+
'is_private' => true,
35+
'forking_policy' => 'no_public_forks',
36+
));
37+
```
38+
2139
### Update an existing repository:
2240
```php
2341
$repo->update($account_name, $repo_slug, array(
@@ -27,11 +45,21 @@ $repo->update($account_name, $repo_slug, array(
2745
));
2846
```
2947

30-
### Delete a repository:
48+
### Delete a repository: (API 2.0)
3149
```php
3250
$repo->delete($account_name, $repo_slug);
3351
```
3452

53+
### Get the list of accounts watching a repository: (API 2.0)
54+
```php
55+
$repo->watchers($account_name, $repo_slug);
56+
```
57+
58+
### Get the list of repository forks: (API 2.0)
59+
```php
60+
$repo->forks($account_name, $repo_slug);
61+
```
62+
3563
### Fork a repository:
3664
```php
3765
$repo->fork($account_name, $repo_slug, $fork_slug, array(

0 commit comments

Comments
 (0)