api-client-dotnet/Retailcrm/Connection.cs
Alex Lushpai 72cac6d6f0
Multiversion client (#6)
* Multiversion sdk
* Remove redundant code
* More test coverage;
2017-10-30 13:51:45 +03:00

54 lines
1.3 KiB
C#

using System.Collections.Generic;
namespace Retailcrm
{
/// <summary>
/// Unversioned API Client
/// </summary>
public class Connection
{
private readonly Request _request;
/// <summary>
/// Unversioned API Client Constructor
/// </summary>
/// <param name="url"></param>
/// <param name="key"></param>
public Connection(string url, string key)
{
if ("/" != url.Substring(url.Length - 1, 1))
{
url += "/";
}
url += "api/";
_request = new Request(url, new Dictionary<string, object> { { "apiKey", key } });
}
/// <summary>
/// Get available API versions
/// </summary>
/// <returns></returns>
public Response Versions()
{
return _request.MakeRequest(
"api-versions",
Request.MethodGet
);
}
/// <summary>
/// Get available API methods
/// </summary>
/// <returns></returns>
public Response Credentials()
{
return _request.MakeRequest(
"credentials",
Request.MethodGet
);
}
}
}