2017-06-22 00:55:08 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PHP version 5.4
|
|
|
|
*
|
2017-06-22 16:42:42 +03:00
|
|
|
* Users
|
2017-06-22 00:55:08 +03:00
|
|
|
*
|
|
|
|
* @category RetailCrm
|
|
|
|
* @package RetailCrm
|
|
|
|
* @author RetailCrm <integration@retailcrm.ru>
|
|
|
|
* @license https://opensource.org/licenses/MIT MIT License
|
2019-08-30 14:10:52 +03:00
|
|
|
* @link https://help.retailcrm.ru/Developers/ApiVersion5
|
2017-06-22 00:55:08 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace RetailCrm\Methods\V5;
|
|
|
|
|
|
|
|
use RetailCrm\Methods\V4\Users as Previous;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PHP version 5.4
|
|
|
|
*
|
2017-06-22 16:42:42 +03:00
|
|
|
* Users class
|
2017-06-22 00:55:08 +03:00
|
|
|
*
|
|
|
|
* @category RetailCrm
|
|
|
|
* @package RetailCrm
|
|
|
|
* @author RetailCrm <integration@retailcrm.ru>
|
|
|
|
* @license https://opensource.org/licenses/MIT MIT License
|
2019-08-30 14:10:52 +03:00
|
|
|
* @link https://help.retailcrm.ru/Developers/ApiVersion5
|
2017-06-22 00:55:08 +03:00
|
|
|
*/
|
|
|
|
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]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|