diff --git a/Retailcrm/Connection.cs b/Retailcrm/Connection.cs
index 64420f7..ea7056c 100644
--- a/Retailcrm/Connection.cs
+++ b/Retailcrm/Connection.cs
@@ -2,10 +2,18 @@
{
using System.Collections.Generic;
+ ///
+ /// Unversioned API Client
+ ///
public class Connection
{
private readonly Request _request;
-
+
+ ///
+ /// Unversioned API Client Constructor
+ ///
+ ///
+ ///
public Connection(string url, string key)
{
if ("/" != url.Substring(url.Length - 1, 1))
@@ -18,6 +26,10 @@
_request = new Request(url, new Dictionary { { "apiKey", key } });
}
+ ///
+ /// Get available API versions
+ ///
+ ///
public Response Versions()
{
return _request.MakeRequest(
@@ -26,6 +38,10 @@
);
}
+ ///
+ /// Get available API methods
+ ///
+ ///
public Response Credentials()
{
return _request.MakeRequest(
diff --git a/Retailcrm/QueryBuilder.cs b/Retailcrm/QueryBuilder.cs
index 1dc4536..cef037a 100644
--- a/Retailcrm/QueryBuilder.cs
+++ b/Retailcrm/QueryBuilder.cs
@@ -5,11 +5,20 @@
using System.Collections.Generic;
using System.Linq;
+ ///
+ /// QueryBuilder
+ ///
public class QueryBuilder
{
private readonly List> _keyValuePairs
= new List>();
+ ///
+ /// Build PHP like query string
+ ///
+ ///
+ ///
+ ///
public static string BuildQueryString(object queryData, string argSeperator = "&")
{
var encoder = new QueryBuilder();
diff --git a/Retailcrm/Request.cs b/Retailcrm/Request.cs
index f1685de..bac5dde 100644
--- a/Retailcrm/Request.cs
+++ b/Retailcrm/Request.cs
@@ -7,9 +7,18 @@
using System.Net;
using System.Text;
+ ///
+ /// Request
+ ///
public class Request
{
+ ///
+ /// Get method
+ ///
public const string MethodGet = "GET";
+ ///
+ /// Post method
+ ///
public const string MethodPost = "POST";
private const string UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
private const string ContentType = "application/x-www-form-urlencoded";
@@ -17,6 +26,12 @@
private readonly string _url;
private readonly Dictionary _defaultParameters;
+ ///
+ /// Request constructor
+ ///
+ ///
+ ///
+ ///
public Request(string apiUrl, Dictionary parameters = null)
{
if (apiUrl.IndexOf("https://", StringComparison.Ordinal) == -1)
@@ -28,6 +43,15 @@
_defaultParameters = parameters;
}
+ ///
+ /// Make request method
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public Response MakeRequest(string path, string method, Dictionary parameters = null)
{
string[] allowedMethods = { MethodGet, MethodPost };
diff --git a/Retailcrm/Response.cs b/Retailcrm/Response.cs
index 3e3a4ae..fe836eb 100644
--- a/Retailcrm/Response.cs
+++ b/Retailcrm/Response.cs
@@ -3,12 +3,21 @@
using System;
using System.Collections.Generic;
+ ///
+ /// Response
+ ///
public class Response
{
private readonly int _statusCode;
private readonly string _rawResponse;
private readonly Dictionary _responseData;
+ ///
+ /// Response constructor
+ ///
+ ///
+ ///
+ ///
public Response(int statusCode, string responseBody = null)
{
_statusCode = statusCode;
@@ -24,21 +33,37 @@
_responseData = (Dictionary)jsSerializer.DeserializeObject(responseBody);
}
+ ///
+ /// Get response status code
+ ///
+ ///
public int GetStatusCode()
{
return _statusCode;
}
+ ///
+ /// Get response body data
+ ///
+ ///
public Dictionary GetResponse()
{
return _responseData;
}
+ ///
+ /// Get raw response body
+ ///
+ ///
public string GetRawResponse()
{
return _rawResponse;
}
+ ///
+ /// Check response is successfull
+ ///
+ ///
public bool IsSuccessfull()
{
return _statusCode < 400;
diff --git a/Retailcrm/Retailcrm.csproj b/Retailcrm/Retailcrm.csproj
index a8abe9b..9322c2c 100644
--- a/Retailcrm/Retailcrm.csproj
+++ b/Retailcrm/Retailcrm.csproj
@@ -31,6 +31,9 @@
bin\Release\Retailcrm.xml
+
+ ..\..\Marwin\packages\JetBrains.Annotations.11.0.0\lib\net20\JetBrains.Annotations.dll
+
@@ -78,6 +81,7 @@
+
diff --git a/Retailcrm/Versions/V3/Client.cs b/Retailcrm/Versions/V3/Client.cs
index 0108130..f5eb81f 100644
--- a/Retailcrm/Versions/V3/Client.cs
+++ b/Retailcrm/Versions/V3/Client.cs
@@ -4,11 +4,26 @@
using System.Collections.Generic;
using System.Linq;
+ ///
+ /// V3 Client
+ ///
public partial class Client
{
+ ///
+ /// Request
+ ///
protected Request Request;
+ ///
+ /// Site code
+ ///
protected string SiteCode;
+ ///
+ /// V3 Client Constructor
+ ///
+ ///
+ ///
+ ///
public Client(string url, string key, string site = "")
{
if ("/" != url.Substring(url.Length - 1, 1))
diff --git a/Retailcrm/Versions/V3/Customers.cs b/Retailcrm/Versions/V3/Customers.cs
index a44cf7a..7c8a906 100644
--- a/Retailcrm/Versions/V3/Customers.cs
+++ b/Retailcrm/Versions/V3/Customers.cs
@@ -6,6 +6,13 @@
public partial class Client
{
+ ///
+ /// Create customer
+ ///
+ ///
+ ///
+ ///
+ ///
public Response CustomersCreate(Dictionary customer, string site = "")
{
if (customer.Count < 1)
@@ -26,6 +33,14 @@
);
}
+ ///
+ /// Update customer
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public Response CustomersUpdate(Dictionary customer, string by = "externalId", string site = "")
{
if (customer.Count < 1)
@@ -56,6 +71,13 @@
);
}
+ ///
+ /// Get customer
+ ///
+ ///
+ ///
+ ///
+ ///
public Response CustomersGet(string id, string by = "externalId", string site = "")
{
CheckIdParameter(by);
@@ -72,6 +94,13 @@
);
}
+ ///
+ /// Get customers list
+ ///
+ ///
+ ///
+ ///
+ ///
public Response CustomersList(Dictionary filter = null, int page = 0, int limit = 0)
{
Dictionary parameters = new Dictionary();
@@ -94,6 +123,11 @@
return Request.MakeRequest("/customers", Request.MethodGet, parameters);
}
+ ///
+ /// Fix external id
+ ///
+ ///
+ ///
public Response CustomersFixExternalIds(Dictionary[] ids)
{
return Request.MakeRequest(
@@ -106,6 +140,13 @@
);
}
+ ///
+ /// Upload customers
+ ///
+ ///
+ ///
+ ///
+ ///
public Response CustomersUpload(List