Skip to content

Commit a7cc711

Browse files
committed
Merge branch 'feature/docs-update' into develop
2 parents f7777aa + 1d4beb4 commit a7cc711

Some content is hidden

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

45 files changed

+731
-271
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Simple Bitbucket API wrapper for PHP >= 5.3.2.
2626
2727
## Documentation
2828
29-
See the `docs` directory for more detailed documentation.
29+
See [http://gentlero.bitbucket.org/bitbucket-api/](http://gentlero.bitbucket.org/bitbucket-api/) for more detailed documentation.
3030
3131
## License
3232

docs/Home.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

docs/authentication.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

docs/examples/authentication.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
layout: default
3+
permalink: /examples/authentication.html
4+
title: Authentication
5+
---
6+
7+
# Authentication
8+
9+
Although you can access any public data without authentication, you need to authenticate before you can access certain features like
10+
(_but not limited to_) accessing data from a private repository, or give access to a repository.
11+
Bitbucket provides Basic and OAuth authentication.
12+
13+
### Basic authentication
14+
To use basic authentication, you need to attach `BasicAuthListener` to http client with your username and password.
15+
16+
```php
17+
$user = new Bitbucket\API\User();
18+
$user->getClient()->addListener(
19+
new Bitbucket\API\Http\Listener\BasicAuthListener($bb_user, $bb_pass)
20+
);
21+
22+
// now you can access protected endpoints as $bb_user
23+
$response = $user->get();
24+
```
25+
26+
### OAuth authorization
27+
This library comes with a `OAuthListener` which will sign all requests for you. All you need to do is to attach the listener to
28+
http client with oauth credentials before making a request.
29+
30+
```php
31+
// OAuth 1-legged example
32+
// You can create a new consumer at: https://bitbucket.org/account/user/<username or team>/api
33+
$oauth_params = array(
34+
'oauth_consumer_key' => 'aaa',
35+
'oauth_consumer_secret' => 'bbb'
36+
);
37+
38+
$user = new Bitbucket\API\User;
39+
$user->getClient()->addListener(
40+
new Bitbucket\API\Http\Listener\OAuthListener($oauth_params)
41+
);
42+
43+
// now you can access protected endpoints as consumer owner
44+
$response = $user->get();
45+
```
46+
47+
----
48+
49+
#### Related:
50+
* [Authentication @ BB Wiki](https://confluence.atlassian.com/display/BITBUCKET/Use+the+Bitbucket+REST+APIs#UsetheBitbucketRESTAPIs-Authentication)
51+
* [OAuth on Bitbucket @ BB Wiki](https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket)
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,58 @@
1-
## Group Privileges
1+
---
2+
layout: default
3+
permalink: /examples/group-privileges.html
4+
title: Group Privileges
5+
---
6+
7+
# Group Privileges
28

3-
----
49
Manages a group's repository permissions.
510

611
### Prepare
12+
713
```php
814
$privileges = new Bitbucket\API\User();
915
$privileges->setCredentials( new Bitbucket\API\Authentication\Basic($bb_user, $bb_pass) );
1016
```
1117

1218
### Get a list of privileged groups
19+
1320
```php
1421
$groups = $privileges->groups($account_name);
1522
```
1623

1724
### Get a list of privileged groups for a repository
25+
1826
```php
1927
$groups = $privileges->repository($account_name, $repo_slug);
2028
```
2129

2230
### Gets the privileges of a group on a repository.
31+
2332
```php
2433
$group = $privileges->group($account_name, $repo_slug, $group_owner, $group_slug);
2534
```
2635

2736
### Get a list of the repositories on which a particular privilege group appears.
37+
2838
```php
2939
$repos = $privileges->repositories($account_name, $group_owner, $group_slug);
3040
```
3141

3242
### Grant group privileges on a repository.
43+
3344
```php
3445
$privileges->grant($account_name, $repo_slug, $group_owner, $group_slug, 'read');
3546
```
3647

3748
### Delete group privileges from a repository
49+
3850
```php
3951
$privileges->delete($account_name, $repo_slug, $group_owner, $group_slug);
4052
```
4153

4254
----
4355

4456
#### Related:
45-
* [Authentication](authentication.md)
57+
* [Authentication]({{ site.url }}/examples/authentication.html)
4658
* [BB Wiki](https://confluence.atlassian.com/display/BITBUCKET/group-privileges+Endpoint#group-privilegesEndpoint-Overview)

docs/groups.md renamed to docs/examples/groups.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
## Groups
1+
---
2+
layout: default
3+
permalink: /examples/groups.html
4+
title: Groups
5+
---
6+
7+
# Groups
28

3-
----
49
Provides functionality for querying information about groups, creating new ones, updating memberships, and deleting them.
510

611
### Prepare:
@@ -42,6 +47,6 @@ $groups->delete($account_name, 'testers');
4247
----
4348

4449
#### Related:
45-
* [Authentication](authentication.md)
46-
* [Group members](groups/members.md)
50+
* [Authentication](authentication.html)
51+
* [Group members](groups/members.html)
4752
* [BB Wiki](https://confluence.atlassian.com/display/BITBUCKET/groups+Endpoint)

docs/groups/members.md renamed to docs/examples/groups/members.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
## Group members
1+
---
2+
layout: default
3+
permalink: /examples/groups/members.html
4+
title: Group members
5+
---
26

3-
----
4-
Manage group members.
7+
# Group members
8+
9+
Manage members of a group.
510

611
### Prepare:
712
```php
@@ -27,6 +32,6 @@ $group->members()->delete($account_name, 'developers', 'miriam');
2732
----
2833

2934
#### Related:
30-
* [Authentication](authentication.md)
31-
* [Groups](../groups.md)
35+
* [Authentication]({{ site.url }}/examples/authentication.html)
36+
* [Groups]({{ site.url }}/examples/groups.html)
3237
* [BB Wiki](https://confluence.atlassian.com/display/BITBUCKET/groups+Endpoint)

docs/examples/index.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
layout: default
3+
permalink: /examples/
4+
title: Examples
5+
---
6+
7+
# Usage examples
8+
9+
**TIP:** Although all examples from this documentation are instantiating each class, a single point of entry is also available:
10+
11+
```php
12+
$bitbucket = new \Bitbucket\API\Api();
13+
$bitbucket->getClient()->addListener(
14+
new \Bitbucket\API\Http\Listener\BasicAuthListener('username', 'password')
15+
);
16+
17+
/** @var \Bitbucket\API\User $user */
18+
$user = $bitbucket->api('User');
19+
20+
/** @var \Bitbucket\API\Repositories\Issues $issues */
21+
$issues = $bitbucket->api('Repositories\Issues');
22+
```
23+
24+
### Available examples
25+
26+
- [Authentication](authentication.html)
27+
- [Group privileges](group-privileges.html)
28+
- [Groups](groups.html)
29+
- [Invitations](invitations.html)
30+
- [Privileges](privileges.html)
31+
- [Repositories](repositories.html)
32+
- [Branch restrictions](repositories/branch-restrictions.html)
33+
- [Changesets](repositories/changesets.html)
34+
- [Comments](repositories/changesets/comments.html)
35+
- [Commits](repositories/commits.html)
36+
- [Comments](repositories/commits/comments.html)
37+
- [Deploy keys](repositories/deploy-keys.html)
38+
- [Events](repositories/events.html)
39+
- [Followers](repositories/followers.html)
40+
- [Issues](repositories/issues.html)
41+
- [Comments](repositories/issues/comments.html)
42+
- [Components](repositories/issues/components.html)
43+
- [Milestones](repositories/issues/milestones.html)
44+
- [Versions](repositories/issues/versions.html)
45+
- [Links](repositories/links.html)
46+
- [Pull requests](repositories/pull-requests.html)
47+
- [Comments](repositories/pull-requests/comments.html)
48+
- [Repository](repositories/repository.html)
49+
- [Services](repositories/services.html)
50+
- [Src](repositories/src.html)
51+
- [Wiki](repositories/wiki.html)
52+
- [Teams](teams.html)
53+
- [User](user.html)
54+
- [Repositories](user/repositories.html)
55+
- [Users](users.html)
56+
- [Account](users/account.html)
57+
- [Emails](users/emails.html)
58+
- [Invitations](users/invitations.html)
59+
- [OAuth](users/oauth.html)
60+
- [Privileges](users/privileges.html)
61+
- [SSH keys](users/ssh-keys.html)
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
## Invitations
1+
---
2+
layout: default
3+
permalink: /examples/invitations.html
4+
title: Invitations
5+
---
6+
7+
# Invitations
28

3-
----
49
Allows repository administrators to send email invitations to grant read, write, or admin privileges to a repository.
510

611
### Prepare:
12+
713
```php
814
$invitation = new Bitbucket\API\Invitations();
915
$invitation->setCredentials( new Bitbucket\API\Authentication\Basic($bb_user, $bb_pass) );
1016
```
1117

1218
### Send invitation:
19+
1320
```php
1421
$invitation->send($account_name, $repo_slug, 'user@example.com', 'read');
1522
```
1623

1724
----
1825

1926
#### Related:
20-
* [Authentication](authentication.md)
27+
* [Authentication]({{ site.url }}/examples/authentication.html)
2128
* [BB Wiki](https://confluence.atlassian.com/display/BITBUCKET/invitations+Endpoint#invitationsEndpoint-Overview)

0 commit comments

Comments
 (0)