-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b07210
commit bdd4d7e
Showing
3 changed files
with
107 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Pagely\AtomicClient\Command\Accounts; | ||
|
||
use Pagely\AtomicClient\API\Accounts\AccountsClient; | ||
use Pagely\AtomicClient\API\AuthApi; | ||
use Pagely\AtomicClient\Command\Command; | ||
use Pagely\AtomicClient\Command\OauthCommandTrait; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
// doesn't work - needs the token to have MOAR SCOPE | ||
|
||
class ListAdminsCommand extends Command | ||
{ | ||
use OauthCommandTrait; | ||
|
||
/** | ||
* @var AccountsClient | ||
*/ | ||
protected $api; | ||
|
||
public function __construct(AuthApi $authApi, AccountsClient $apps, $name = 'account:admins:ls') | ||
{ | ||
$this->authClient = $authApi; | ||
$this->api = $apps; | ||
parent::__construct($name); | ||
} | ||
|
||
public function configure() | ||
{ | ||
parent::configure(); | ||
$this | ||
->setDescription('List admins on account') | ||
->addArgument('accountId', InputArgument::REQUIRED, 'Account ID') | ||
; | ||
$this->addOauthOptions(); | ||
} | ||
|
||
public function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$accountId = $input->getArgument('accountId'); | ||
$token = $this->token->token; | ||
|
||
$r = $this->api->getAdmins($token, $accountId); | ||
$output->writeln(json_encode(json_decode($r->getBody()->getContents()), JSON_PRETTY_PRINT)); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Pagely\AtomicClient\Command\Accounts; | ||
|
||
use Pagely\AtomicClient\API\Accounts\AccountsClient; | ||
use Pagely\AtomicClient\API\AuthApi; | ||
use Pagely\AtomicClient\Command\Command; | ||
use Pagely\AtomicClient\Command\OauthCommandTrait; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class RemoveCollabCommand extends Command | ||
{ | ||
use OauthCommandTrait; | ||
|
||
/** | ||
* @var AccountsClient | ||
*/ | ||
protected $api; | ||
|
||
public function __construct(AuthApi $authApi, AccountsClient $apps, $name = 'account:collabs:remove') | ||
{ | ||
$this->authClient = $authApi; | ||
$this->api = $apps; | ||
parent::__construct($name); | ||
} | ||
|
||
public function configure() | ||
{ | ||
parent::configure(); | ||
$this | ||
->setDescription('Remove collaborator from account') | ||
->addArgument('accountId', InputArgument::REQUIRED, 'Account ID') | ||
->addArgument('appId', InputArgument::REQUIRED, 'App ID') | ||
; | ||
$this->addOauthOptions(); | ||
} | ||
|
||
public function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$accountId = $input->getArgument('accountId'); | ||
$appId = $input->getArgument('appId'); | ||
$token = $this->token->token; | ||
|
||
$r = $this->api->removeAccess($token, $accountId, $appId); | ||
$output->writeln(json_encode(json_decode($r->getBody()->getContents()), JSON_PRETTY_PRINT)); | ||
|
||
return 0; | ||
} | ||
} |