2016-02-14 23:20:10 +05:30
|
|
|
<?php
|
|
|
|
namespace tests\codeception\api\_pages;
|
|
|
|
|
|
|
|
class OauthRoute extends BasePage {
|
|
|
|
|
2018-02-28 03:57:35 +05:30
|
|
|
public function validate(array $queryParams): void {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendGET('/oauth2/v1/validate', $queryParams);
|
2016-02-14 23:20:10 +05:30
|
|
|
}
|
|
|
|
|
2018-02-28 03:57:35 +05:30
|
|
|
public function complete(array $queryParams = [], array $postParams = []): void {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST('/oauth2/v1/complete?' . http_build_query($queryParams), $postParams);
|
2016-02-14 23:20:10 +05:30
|
|
|
}
|
|
|
|
|
2018-02-28 03:57:35 +05:30
|
|
|
public function issueToken(array $postParams = []): void {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST('/oauth2/v1/token', $postParams);
|
2016-02-23 03:19:46 +05:30
|
|
|
}
|
|
|
|
|
2018-02-28 03:57:35 +05:30
|
|
|
public function createClient(string $type, array $postParams): void {
|
|
|
|
$this->getActor()->sendPOST('/v1/oauth2/' . $type, $postParams);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function updateClient(string $clientId, array $params): void {
|
|
|
|
$this->getActor()->sendPUT('/v1/oauth2/' . $clientId, $params);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function deleteClient(string $clientId): void {
|
|
|
|
$this->getActor()->sendDELETE('/v1/oauth2/' . $clientId);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function resetClient(string $clientId, bool $regenerateSecret = false): void {
|
|
|
|
$this->getActor()->sendPOST("/v1/oauth2/$clientId/reset" . ($regenerateSecret ? '?regenerateSecret' : ''));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getClient(string $clientId): void {
|
|
|
|
$this->getActor()->sendGET("/v1/oauth2/$clientId");
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPerAccount(int $accountId): void {
|
|
|
|
$this->getActor()->sendGET("/v1/accounts/$accountId/oauth2/clients");
|
|
|
|
}
|
|
|
|
|
2016-02-14 23:20:10 +05:30
|
|
|
}
|