using System;
using System.Collections.Generic;
using System.Web.Script.Serialization;
namespace Retailcrm.Versions.V5
{
public partial class Client
{
///
/// Create note
///
///
///
///
public Response NotesCreate(Dictionary note, string site = "")
{
if (note.Count < 1)
{
throw new ArgumentException("Parameter `note` must contains a data");
}
return Request.MakeRequest(
"/customers/notes/create",
Request.MethodPost,
FillSite(
site,
new Dictionary
{
{ "note", new JavaScriptSerializer().Serialize(note) }
}
)
);
}
///
/// Delete note
///
///
///
public Response NotesDelete(string id)
{
return Request.MakeRequest(
$"/customers/notes/{id}/delete",
Request.MethodPost
);
}
///
/// Get notes list
///
///
///
///
///
public Response NotesList(Dictionary filter = null, int page = 1, int limit = 20)
{
Dictionary parameters = new Dictionary();
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("/customers/notes", Request.MethodGet, parameters);
}
}
}