public async Task <ZsProducts> GetAllAsync(string apiBaseUrl, string authToken, string organizationId, ZsPage page = null) { apiBaseUrl.CheckConfigApiBaseUrl(); authToken.CheckConfigAuthToken(); organizationId.CheckConfigOrganizationId(); using (var httpClient = new HttpClient()) { httpClient.Configure(apiBaseUrl, organizationId, authToken); var response = await httpClient.GetAsync(page.AppendTo(ApiResources.ZsGetProductsAll)); var processResult = await response.ProcessResponse <ZsProducts>(); if (null != processResult.Error) { throw processResult.Error; } return(processResult.Data); } }
public async Task <ZsContactPersons> GetAllAsync(string apiBaseUrl, string authToken, string organizationId, string customerId, ZsPage page = null) { apiBaseUrl.CheckConfigApiBaseUrl(); authToken.CheckConfigAuthToken(); organizationId.CheckConfigOrganizationId(); using (var httpClient = new HttpClient()) { httpClient.Configure(apiBaseUrl, organizationId, authToken); var response = await httpClient.GetAsync(page.AppendTo(string.Format(CultureInfo.InvariantCulture, ApiResources.ZsGetContactPersonsAll, customerId))); var processResult = await response.ProcessResponse <ZsContactPersons>(); if (null != processResult.Error) { throw processResult.Error; } return(processResult.Data); } }
public async Task <ZsInvoices> GetAllAsync(string apiBaseUrl, string authToken, string organizationId, ZsInvoiceFilter filterType, string filterId, ZsPage page = null) { apiBaseUrl.CheckConfigApiBaseUrl(); authToken.CheckConfigAuthToken(); organizationId.CheckConfigOrganizationId(); if (string.IsNullOrWhiteSpace(filterId)) { throw new ArgumentNullException("Filter id - Subscription id or Customer id is required"); } using (var httpClient = new HttpClient()) { httpClient.Configure(apiBaseUrl, organizationId, authToken); var requestUri = new QueryStringBuilder(ApiResources.ZsGetInvoicesAll); switch (filterType) { case ZsInvoiceFilter.CustomerId: requestUri.Add("customer_id", filterId); break; case ZsInvoiceFilter.SubscriptionId: requestUri.Add("subscription_id", filterId); break; } var response = await httpClient.GetAsync(page.AppendTo(requestUri).ToString()); var processResult = await response.ProcessResponse <ZsInvoices>(); if (null != processResult.Error) { throw processResult.Error; } return(processResult.Data); } }