Files
accounts/src/Accounts/Traits/UsersTrait.php
2022-10-02 23:25:42 +02:00

51 lines
933 B
PHP

<?php
declare(strict_types=1);
namespace Bitinflow\Accounts\Traits;
use Bitinflow\Accounts\ApiOperations\Get;
use Bitinflow\Accounts\Result;
trait UsersTrait
{
use Get;
/**
* Get currently authed user with Bearer Token
*
* @return Result Result object
*/
public function getAuthedUser(): Result
{
return $this->get('v3/user');
}
/**
* Creates a new user on behalf of the current user.
*
* @param array $parameters
*
* @return Result
*/
public function createUser(array $parameters): Result
{
return $this->post('v3/users', $parameters);
}
/**
* Checks if the given email exists.
*
* @param string $email
*
* @return Result
*/
public function isEmailExisting(string $email): Result
{
return $this->post('v3/users/check', [
'email' => $email,
]);
}
}