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