steffenbrand/bamboo-api-client

There is no license information available for the latest version (v1.3.0) of this package.

Bamboo API Client

v1.3.0 2017-12-22 14:20 UTC

This package is auto-updated.

Last update: 2024-11-29 05:09:12 UTC


README

PHP client for Bamboo API (6.1.1)

Limitations

Currently only supports the following methods:

  • /rest/api/latest/result/{key} (getLatestResultByKey)
  • /rest/api/latest/plan (getPlanList)

How to install

composer require steffenbrand/bamboo-api-client

How to use

getLatestResultByKey

try {
    $client = new BambooClient(
        'http://bamboo.dev',
        'user',
        'pass'
    );
    
    $result = $client->getLatestResultByKey('MYPLAN-KEY');
    
    $result->getNumber();
    $result->getState();
    $result->getLink()->getHref();
    $result->getPlan()->getKey();
    $result->getPlan()->getName();
    $result->getPlan()->getShortKey();
    $result->getPlan()->getShortName();
    $result->getPlan()->getLink()->getHref();
} catch (BambooRequestException $e) {
    // Request might fail
} catch (\RuntimeException $e) {
    // Something could go wrong during runtime
}

getPlanList

try {
    $client = new BambooClient(
        'http://bamboo.dev',
        'user',
        'pass'
    );
    
    $result = $client->getPlanList();
    
    if (count($result) > 0) {
        foreach ($result as $plan) {
            $plan->getKey();
            $plan->getName();
            $plan->getShortKey();
            $plan->getShortName();
            $plan->getLink()->getHref();
        }
    }
} catch (BambooRequestException $e) {
    // Request might fail
} catch (\RuntimeException $e) {
    // Something could go wrong during runtime
}