Files
cloudflare-php/src/Endpoints/AccountRoles.php
Phil Young fdfc656aa8 Add Account Role Listings (#198)
I want to list the roles availablew in an account so I can add a member
to the account
2021-10-13 14:40:33 +11:00

34 lines
717 B
PHP

<?php
namespace Cloudflare\API\Endpoints;
use Cloudflare\API\Adapter\Adapter;
use Cloudflare\API\Traits\BodyAccessorTrait;
use stdClass;
class AccountRoles implements API
{
use BodyAccessorTrait;
/**
* @var Adapter
*/
private $adapter;
public function __construct(Adapter $adapter)
{
$this->adapter = $adapter;
}
public function listAccountRoles(string $accountId): stdClass
{
$roles = $this->adapter->get('accounts/' . $accountId . '/roles');
$this->body = json_decode($roles->getBody());
return (object)[
'result' => $this->body->result,
'result_info' => $this->body->result_info,
];
}
}