new version && upload nuget

This commit is contained in:
Dmitry Mamontov 2015-07-23 13:37:17 +03:00
parent efbf866483
commit 8a1f19e319
3 changed files with 229 additions and 19 deletions

View File

@ -2,12 +2,23 @@
=============================
.NET-клиент для работы с [RetailCRM API](http://www.retailcrm.ru/docs/rest-api/index.html).
version: 3.0.0
version: 3.0.2
Обязательные требования
-----------------------
* [Newtonsoft.Json](http://james.newtonking.com/json)
Установка через NuGet
---------------------
Для начала требуется скачать и установить сам [NuGet](http://docs.nuget.org/consume/installing-nuget).
После этого для установки клиента требуется запустить комманду в [Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console)
``` bash
PM> Install-Package RetailCRM.ApiClient
```
Примеры использования
---------------------

View File

@ -414,6 +414,175 @@ namespace RetailCrm
);
}
/// <summary>
/// Returns filtered orders packs list
/// </summary>
/// <param name="filter"></param>
/// <param name="page"></param>
/// <param name="limit"></param>
/// <returns>ApiResponse</returns>
public ApiResponse packsList(Dictionary<string, object> filter = null, int page = 0, int limit = 0)
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
if (filter.Count > 0)
{
parameters.Add("filter", filter);
}
if (page > 0)
{
parameters.Add("page", page);
}
if (limit > 0)
{
parameters.Add("limit", limit);
}
return client.makeRequest("/orders/packs", Client.METHOD_GET, parameters);
}
/// <summary>
/// Create a order pack
/// </summary>
/// <param name="pack"></param>
/// <returns>ApiResponse</returns>
public ApiResponse packsCreate(Dictionary<string, object> pack)
{
if (pack.Count < 1)
{
throw new ArgumentException("Parameter `pack` must contains a data");
}
return client.makeRequest(
"/orders/packs/create",
Client.METHOD_POST,
new Dictionary<string, object>() {
{ "pack", JsonConvert.SerializeObject(pack) }
}
);
}
/// <summary>
/// Returns a orders history
/// </summary>
/// <param name="filter"></param>
/// <param name="page"></param>
/// <param name="limit"></param>
/// <returns>ApiResponse</returns>
public ApiResponse packsHistory(Dictionary<string, object> filter = null, int page = 0, int limit = 0)
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
if (filter.Count > 0)
{
parameters.Add("filter", filter);
}
if (page > 0)
{
parameters.Add("page", page);
}
if (limit > 0)
{
parameters.Add("limit", limit);
}
return client.makeRequest("/orders/packs/history", Client.METHOD_GET, parameters);
}
/// <summary>
/// Get order packs by id
/// </summary>
/// <param name="id"></param>
/// <returns>ApiResponse</returns>
public ApiResponse packsGet(string id)
{
return client.makeRequest("/orders/packs/" + id, Client.METHOD_GET);
}
/// <summary>
/// Delete order packs by id
/// </summary>
/// <param name="id"></param>
/// <returns>ApiResponse</returns>
public ApiResponse packsDelete(string id)
{
return client.makeRequest("/orders/packs/" + id + "/delete", Client.METHOD_POST);
}
/// <summary>
/// Edit a order packs
/// </summary>
/// <param name="id"></param>
/// <param name="pack"></param>
/// <returns>ApiResponse</returns>
public ApiResponse packsEdit(string id, Dictionary<string, object> pack)
{
if (pack.Count < 1)
{
throw new ArgumentException("Parameter `pack` must contains a data");
}
return client.makeRequest(
"/orders/packs/" + id + "/edit",
Client.METHOD_POST,
new Dictionary<string, object>() {
{ "pack", JsonConvert.SerializeObject(pack) }
}
);
}
/// <summary>
/// Returns filtered store inventories list
/// </summary>
/// <param name="filter"></param>
/// <param name="page"></param>
/// <param name="limit"></param>
/// <returns>ApiResponse</returns>
public ApiResponse inventoriesList(Dictionary<string, object> filter = null, int page = 0, int limit = 0)
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
if (filter.Count > 0)
{
parameters.Add("filter", filter);
}
if (page > 0)
{
parameters.Add("page", page);
}
if (limit > 0)
{
parameters.Add("limit", limit);
}
return client.makeRequest("/store/inventories", Client.METHOD_GET, parameters);
}
/// <summary>
/// Upload array of the store inventories
/// </summary>
/// <param name="offers"></param>
/// <param name="site"></param>
/// <returns>ApiResponse</returns>
public ApiResponse inventoriesUpload(Dictionary<string, object> offers, string site = "")
{
if (offers.Count < 1)
{
throw new ArgumentException("Parameter `offers` must contains a data");
}
return client.makeRequest(
"/store/inventories/upload",
Client.METHOD_POST,
this.fillSite(
site,
new Dictionary<string, object>() {
{ "offers", JsonConvert.SerializeObject(offers) }
}
)
);
}
/// <summary>
/// Returns deliveryServices list
/// </summary>
@ -504,6 +673,15 @@ namespace RetailCrm
return client.makeRequest("/reference/sites", Client.METHOD_GET);
}
/// <summary>
/// Returns stores list
/// </summary>
/// <returns>ApiResponse</returns>
public ApiResponse storesList()
{
return client.makeRequest("/reference/stores", Client.METHOD_GET);
}
/// <summary>
/// Edit deliveryService
/// </summary>
@ -693,6 +871,27 @@ namespace RetailCrm
);
}
/// <summary>
/// Edit stores
/// </summary>
/// <param name="store"></param>
/// <returns>ApiResponse</returns>
public ApiResponse storesEdit(Dictionary<string, object> store)
{
if (store.ContainsKey("code") == false)
{
throw new ArgumentException("Data must contain \"code\" parameter");
}
return client.makeRequest(
"/reference/stores/" + store["code"] + "/edit",
Client.METHOD_POST,
new Dictionary<string, object>() {
{ "store", JsonConvert.SerializeObject(store) }
}
);
}
/// <summary>
/// Update CRM basic statistic
/// </summary>

Binary file not shown.