mirror of
https://github.com/retailcrm/api-client-dotnet.git
synced 2024-11-26 14:56:06 +03:00
34 lines
945 B
C#
34 lines
945 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace Retailcrm.Versions.V5
|
|||
|
{
|
|||
|
public partial class Client
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Update user status
|
|||
|
/// </summary>
|
|||
|
/// <param name="id"></param>
|
|||
|
/// <param name="status"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public Response UsersStatus(int id, string status)
|
|||
|
{
|
|||
|
List<string> statuses = new List<string> { "free", "busy", "dinner", "break"};
|
|||
|
|
|||
|
if (!statuses.Contains(status))
|
|||
|
{
|
|||
|
throw new ArgumentException("Parameter `status` must be equal one of these values: `free|busy|dinner|break`");
|
|||
|
}
|
|||
|
|
|||
|
return Request.MakeRequest(
|
|||
|
$"/users/{id}/status",
|
|||
|
Request.MethodPost,
|
|||
|
new Dictionary<string, object>
|
|||
|
{
|
|||
|
{ "status", status }
|
|||
|
}
|
|||
|
);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|