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