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); } }
public async Task <ZsCustomers> GetAllAsync(string apiBaseUrl, string authToken, string organizationId, QueryStringBuilder queryStringBuilder = null) { apiBaseUrl.CheckConfigApiBaseUrl(); authToken.CheckConfigAuthToken(); organizationId.CheckConfigOrganizationId(); using (var httpClient = new HttpClient()) { httpClient.Configure(apiBaseUrl, organizationId, authToken); var response = await httpClient.GetAsync(string.Format(CultureInfo.InvariantCulture, "{0}{1}", ApiResources.ZsGetCustomersAll, null == queryStringBuilder ? string.Empty : queryStringBuilder.ToString())); var processResult = await response.ProcessResponse <ZsCustomers>(); if (null != processResult.Error) { throw processResult.Error; } return(processResult.Data); } }
public async Task <ZsCustomers> GetAllAsync(QueryStringBuilder queryStringBuilder = null) { this.client.Configuration.CheckConfig(); return(await this.GetAllAsync(this.client.Configuration.ApiBaseUrl, this.client.Configuration.AuthToken, this.client.Configuration.OrganizationId, queryStringBuilder)); }