2016-02-24 04:04:01 +05:30
|
|
|
<?php
|
|
|
|
namespace tests\codeception\api\_pages;
|
|
|
|
|
2016-02-26 04:15:21 +05:30
|
|
|
class AccountsRoute extends BasePage {
|
2016-02-24 04:04:01 +05:30
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function get(int $accountId) {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendGET("/v1/accounts/{$accountId}");
|
2016-02-24 04:04:01 +05:30
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changePassword(int $accountId, $currentPassword = null, $newPassword = null, $newRePassword = null) {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/password", [
|
2016-02-27 03:52:09 +05:30
|
|
|
'password' => $currentPassword,
|
|
|
|
'newPassword' => $newPassword,
|
|
|
|
'newRePassword' => $newRePassword,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeUsername(int $accountId, $currentPassword = null, $newUsername = null) {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/username", [
|
2016-03-20 04:55:26 +05:30
|
|
|
'password' => $currentPassword,
|
|
|
|
'username' => $newUsername,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeEmailInitialize(int $accountId, $password = '') {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/email-verification", [
|
2016-05-23 23:57:09 +05:30
|
|
|
'password' => $password,
|
|
|
|
]);
|
2016-05-16 13:51:12 +05:30
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeEmailSubmitNewEmail(int $accountId, $key = null, $email = null) {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/new-email-verification", [
|
2016-05-17 01:39:44 +05:30
|
|
|
'key' => $key,
|
|
|
|
'email' => $email,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeEmail(int $accountId, $key = null) {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/email", [
|
2016-05-17 01:39:44 +05:30
|
|
|
'key' => $key,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function changeLanguage(int $accountId, $lang = null) {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/language", [
|
2016-05-19 03:40:05 +05:30
|
|
|
'lang' => $lang,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function acceptRules(int $accountId) {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/rules");
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTwoFactorAuthCredentials(int $accountId) {
|
|
|
|
$this->getActor()->sendGET("/v1/accounts/{$accountId}/two-factor-auth");
|
|
|
|
}
|
|
|
|
|
|
|
|
public function enableTwoFactorAuth(int $accountId, $totp = null, $password = null) {
|
|
|
|
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/two-factor-auth", [
|
|
|
|
'totp' => $totp,
|
|
|
|
'password' => $password,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function disableTwoFactorAuth(int $accountId, $totp = null, $password = null) {
|
|
|
|
$this->getActor()->sendDELETE("/v1/accounts/{$accountId}/two-factor-auth", [
|
|
|
|
'totp' => $totp,
|
|
|
|
'password' => $password,
|
|
|
|
]);
|
2016-08-06 21:52:09 +05:30
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function ban(int $accountId) {
|
2017-10-01 05:54:23 +05:30
|
|
|
$this->getActor()->sendPOST("/v1/accounts/{$accountId}/ban");
|
2017-09-19 22:36:16 +05:30
|
|
|
}
|
|
|
|
|
2017-10-01 05:54:23 +05:30
|
|
|
public function pardon(int $accountId) {
|
|
|
|
$this->getActor()->sendDELETE("/v1/accounts/{$accountId}/ban");
|
2017-09-19 22:36:16 +05:30
|
|
|
}
|
|
|
|
|
2016-02-24 04:04:01 +05:30
|
|
|
}
|