mirror of
https://github.com/retailcrm/api-client-dotnet.git
synced 2024-11-22 21:06:02 +03:00
72cac6d6f0
* Multiversion sdk * Remove redundant code * More test coverage;
70 lines
1.8 KiB
C#
70 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Retailcrm.Versions.V4
|
|
{
|
|
public partial class Client
|
|
{
|
|
/// <summary>
|
|
/// Get users
|
|
/// </summary>
|
|
/// <param name="filter"></param>
|
|
/// <param name="page"></param>
|
|
/// <param name="limit"></param>
|
|
/// <returns></returns>
|
|
public Response Users(Dictionary<string, object> filter = null, int page = 0, int limit = 0)
|
|
{
|
|
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
|
|
|
if (filter != null && filter.Count > 0)
|
|
{
|
|
parameters.Add("filter", filter);
|
|
}
|
|
|
|
if (page > 0)
|
|
{
|
|
parameters.Add("page", page);
|
|
}
|
|
|
|
if (limit > 0)
|
|
{
|
|
parameters.Add("limit", limit);
|
|
}
|
|
|
|
return Request.MakeRequest("/users", Request.MethodGet, parameters);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get users groups
|
|
/// </summary>
|
|
/// <param name="page"></param>
|
|
/// <param name="limit"></param>
|
|
/// <returns></returns>
|
|
public Response UsersGroups(int page = 1, int limit = 20)
|
|
{
|
|
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
|
|
|
if (page > 0)
|
|
{
|
|
parameters.Add("page", page);
|
|
}
|
|
|
|
if (limit > 0)
|
|
{
|
|
parameters.Add("limit", limit);
|
|
}
|
|
|
|
return Request.MakeRequest("/user-groups", Request.MethodGet, parameters);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get user
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public Response User(int id)
|
|
{
|
|
return Request.MakeRequest($"/users/{id}", Request.MethodGet);
|
|
}
|
|
}
|
|
}
|