Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions MifielAPI/MifielAPI/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class ApiClient
{
public string AppId { get; set; }
public string AppSecret { get; set; }
public string CompanyId { get; set; }
private string _apiVersion = "/api/v1/";
private CultureInfo _usCulture = new CultureInfo("en-US");
private string url;
Expand All @@ -34,6 +35,14 @@ public ApiClient(string appId, string appSecret)
Url = "https://www.mifiel.com";
}

public ApiClient(string appId, string appSecret, string companyId)
{
AppId = appId;
AppSecret = appSecret;
Url = "https://www.mifiel.com";
CompanyId = companyId;
}

public HttpContent Get(string path)
{
return SendRequest(Rest.HttpMethod.GET, path, new StringContent(""));
Expand Down Expand Up @@ -114,6 +123,11 @@ private void SetAuthentication(Rest.HttpMethod httpMethod, string path, HttpRequ

requestMessage.Headers.Add("Authorization", authorizationHeader);
requestMessage.Headers.Add("Date", date);

if (!String.IsNullOrEmpty(CompanyId))
{
requestMessage.Headers.Add("MF-COMPANY", CompanyId);
}
}

private string GetSignature(Rest.HttpMethod httpMethod, string path, string contentMd5, string date, string contentType)
Expand Down