diff --git a/MifielAPI/MifielAPI/ApiClient.cs b/MifielAPI/MifielAPI/ApiClient.cs index 3eb3463..4b1c8a8 100644 --- a/MifielAPI/MifielAPI/ApiClient.cs +++ b/MifielAPI/MifielAPI/ApiClient.cs @@ -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; @@ -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("")); @@ -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)