mirror of
https://github.com/retailcrm/api-client-dotnet.git
synced 2025-04-11 13:00:55 +00:00
Remove redundant code
This commit is contained in:
parent
55c649b119
commit
981754196d
33 changed files with 187 additions and 153 deletions
|
@ -1,7 +1,7 @@
|
|||
namespace Retailcrm
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm
|
||||
{
|
||||
/// <summary>
|
||||
/// Unversioned API Client
|
||||
/// </summary>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
namespace Retailcrm
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Retailcrm
|
||||
{
|
||||
/// <summary>
|
||||
/// QueryBuilder
|
||||
/// </summary>
|
||||
|
@ -27,6 +27,11 @@
|
|||
return encoder.GetUriString(argSeperator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetUriString
|
||||
/// </summary>
|
||||
/// <param name="argSeperator"></param>
|
||||
/// <returns></returns>
|
||||
private string GetUriString(string argSeperator)
|
||||
{
|
||||
return String.Join(argSeperator,
|
||||
|
@ -38,6 +43,12 @@
|
|||
}));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AddEntry
|
||||
/// </summary>
|
||||
/// <param name="prefix"></param>
|
||||
/// <param name="instance"></param>
|
||||
/// <param name="allowObjects"></param>
|
||||
private void AddEntry(string prefix, object instance, bool allowObjects)
|
||||
{
|
||||
var dictionary = instance as IDictionary;
|
||||
|
@ -61,6 +72,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add
|
||||
/// </summary>
|
||||
/// <param name="prefix"></param>
|
||||
/// <param name="datas"></param>
|
||||
private void Add(string prefix, IEnumerable<Entry> datas)
|
||||
{
|
||||
foreach (var item in datas)
|
||||
|
@ -73,19 +89,27 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry
|
||||
/// </summary>
|
||||
private struct Entry
|
||||
{
|
||||
public string Key;
|
||||
public object Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetObjectAdapter
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
private IEnumerable<Entry> GetObjectAdapter(object data)
|
||||
{
|
||||
var properties = data.GetType().GetProperties();
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
yield return new Entry()
|
||||
yield return new Entry
|
||||
{
|
||||
Key = property.Name,
|
||||
Value = property.GetValue(data)
|
||||
|
@ -93,28 +117,38 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetArrayAdapter
|
||||
/// </summary>
|
||||
/// <param name="collection"></param>
|
||||
/// <returns></returns>
|
||||
private IEnumerable<Entry> GetArrayAdapter(ICollection collection)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var item in collection)
|
||||
{
|
||||
yield return new Entry()
|
||||
yield return new Entry
|
||||
{
|
||||
Key = i.ToString(),
|
||||
Value = item,
|
||||
Value = item
|
||||
};
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// GetDictionaryAdapter
|
||||
/// </summary>
|
||||
/// <param name="collection"></param>
|
||||
/// <returns></returns>
|
||||
private IEnumerable<Entry> GetDictionaryAdapter(IDictionary collection)
|
||||
{
|
||||
foreach (DictionaryEntry item in collection)
|
||||
{
|
||||
yield return new Entry()
|
||||
yield return new Entry
|
||||
{
|
||||
Key = item.Key.ToString(),
|
||||
Value = item.Value,
|
||||
Value = item.Value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
namespace Retailcrm
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
|
||||
namespace Retailcrm
|
||||
{
|
||||
/// <summary>
|
||||
/// Request
|
||||
/// </summary>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
namespace Retailcrm
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm
|
||||
{
|
||||
/// <summary>
|
||||
/// Response
|
||||
/// </summary>
|
||||
|
@ -29,7 +30,7 @@
|
|||
|
||||
_rawResponse = responseBody;
|
||||
|
||||
var jsSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
|
||||
var jsSerializer = new JavaScriptSerializer();
|
||||
_responseData = (Dictionary<string, object>)jsSerializer.DeserializeObject(responseBody);
|
||||
}
|
||||
|
||||
|
@ -68,6 +69,5 @@
|
|||
{
|
||||
return _statusCode < 400;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
/// <summary>
|
||||
/// V3 Client
|
||||
/// </summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -87,7 +87,8 @@
|
|||
Request.MethodGet,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>() {
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "by", by }
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -85,7 +85,8 @@
|
|||
Request.MethodGet,
|
||||
FillSite(
|
||||
site,
|
||||
new Dictionary<string, object>() {
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "by", by }
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V3
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
namespace Retailcrm.Versions.V4
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using ParentClass = V3.Client;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm.Versions.V4
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using ParentClass = V4.Client;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Retailcrm.Versions.V5
|
||||
{
|
||||
public partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
namespace RetailcrmUnitTest.V4
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
namespace RetailcrmUnitTest.V5
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
|
Loading…
Add table
Reference in a new issue