PHP Bitbucket API

Simple Bitbucket API wrapper for PHP

Users emails

An account can have one or more email addresses associated with it. Use this end point to list, change, or create an email address.

Prepare:

// @see: https://bitbucket.org/account/user/<username or team>/api
$oauth_params = array(
    'client_id'         => 'aaa',
    'client_secret'     => 'bbb'
);

$users = new \Bitbucket\API\Users();
$users->getClient()->addListener(
    new \Bitbucket\API\Http\Listener\OAuth2Listener($oauth_params)
);

Get a list of user's email addresses:

$users->emails()->all($account_name);

Gets an individual email address associated with an account:

$users->emails()->get($account_name, 'dummy@example.com');

Add a new email address to an account:

When you add an address, Bitbucket sends an activation email to the new address. After the user clicks the activation link in the email, the address active is set to true and the address is available for use. If you call this method again, Bitbucket will send a new confirmation email.

$users->emails()->create($account_name, 'dummy@example.com');

Set an email address as primary:

$users->emails()->update($account_name, 'dummy@example.com', true);

Delete an email address:

$users->emails()->delete($account_name, 'dummy@example.com');