public async Task <ZsSubscriptions> GetAllAsync(string apiBaseUrl, string authToken, string organizationId, ZsSubscriptionFilter filterType, string filterId) { apiBaseUrl.CheckConfigApiBaseUrl(); authToken.CheckConfigAuthToken(); organizationId.CheckConfigOrganizationId(); using (var httpClient = new HttpClient()) { httpClient.Configure(apiBaseUrl, organizationId, authToken); var requestUri = ApiResources.ZsGetSubscriptionsAll; switch (filterType) { case ZsSubscriptionFilter.CustomerId: requestUri = string.Format(CultureInfo.InvariantCulture, ApiResources.ZsGetSubscriptionsAllByCustomerId, filterId); break; } var response = await httpClient.GetAsync(requestUri); var processResult = await response.ProcessResponse <ZsSubscriptions>(); if (null != processResult.Error) { throw processResult.Error; } return(processResult.Data); } }
public async Task <ZsSubscriptions> GetAllAsync(ZsSubscriptionFilter filterType, string filterId) { this.client.Configuration.CheckConfig(); return(await this.GetAllAsync(this.client.Configuration.ApiBaseUrl, this.client.Configuration.AuthToken, this.client.Configuration.OrganizationId, filterType, filterId)); }
public async Task <ZsSubscriptions> GetAllAsync(string apiBaseUrl, string authToken, string organizationId, ZsSubscriptionFilter filterType, string filterId, ZsPage page = null) { apiBaseUrl.CheckConfigApiBaseUrl(); authToken.CheckConfigAuthToken(); organizationId.CheckConfigOrganizationId(); using (var httpClient = new HttpClient()) { httpClient.Configure(apiBaseUrl, organizationId, authToken); var requestUri = new QueryStringBuilder(ApiResources.ZsGetSubscriptionsAll); switch (filterType) { case ZsSubscriptionFilter.CustomerId: requestUri.Add("customer_id", filterId); break; } var response = await httpClient.GetAsync(page.AppendTo(requestUri).ToString()); var processResult = await response.ProcessResponse <ZsSubscriptions>(); if (null != processResult.Error) { throw processResult.Error; } return(processResult.Data); } }