for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Lookyman\Rundeck\Api\Endpoints\Token;
use GuzzleHttp\Promise\PromiseInterface;
use Lookyman\Rundeck\Api\Client;
use GuzzleHttp\Psr7\Request;
class Token
{
/**
* @var Client
*/
private $client;
* @param Client $client
public function __construct(Client $client)
$this->client = $client;
}
* @param string|null $user
* @return PromiseInterface
public function list(string $user = null): PromiseInterface
return $this->client->getConfiguration()->getGuzzle()->sendAsync(
new Request('GET', $this->client->getConfiguration()->getBaseUri() . '/tokens' . ($user ? sprintf('/%s', urlencode($user)) : ''))
);
* @param string $token
public function get(string $token): PromiseInterface
new Request('GET', $this->client->getConfiguration()->getBaseUri() . '/token/' . urlencode($token))
* @param string $user
public function create(string $user): PromiseInterface
new Request('POST', $this->client->getConfiguration()->getBaseUri() . '/tokens/' . urlencode($user))
public function delete(string $token): PromiseInterface
new Request('DELETE', $this->client->getConfiguration()->getBaseUri() . '/token/' . urlencode($token))