1
0
mirror of synced 2024-11-28 16:26:06 +03:00
api-client-php/lib/RetailCrm/Methods/V5/Users.php
2020-12-15 13:32:52 +03:00

54 lines
1.0 KiB
PHP

<?php
/**
* PHP version 5.4
*
* Users
*
* @category RetailCrm
* @package RetailCrm
*/
namespace RetailCrm\Methods\V5;
use RetailCrm\Methods\V4\Users as Previous;
/**
* PHP version 5.4
*
* Users class
*
* @category RetailCrm
* @package RetailCrm
*/
trait Users
{
use Previous;
/**
* Change user status
*
* @param integer $id user ID
* @param string $status user status
*
* @return \RetailCrm\Response\ApiResponse
*/
public function usersStatus($id, $status)
{
$statuses = ["free", "busy", "dinner", "break"];
if (empty($status) || !in_array($status, $statuses)) {
throw new \InvalidArgumentException(
'Parameter `status` must be not empty & must be equal one of these values: free|busy|dinner|break'
);
}
/** @noinspection PhpUndefinedMethodInspection */
return $this->client->makeRequest(
"/users/$id/status",
"POST",
['status' => $status]
);
}
}