public Batch RetrieveBatch(String id, uint page, ShippoEnums.ObjectResults objectResults) { string ep = String.Format("{0}/batches/{1}", api_endpoint, HttpUtility.HtmlEncode(id)); Hashtable parameters = new Hashtable(); if (page > 0) { parameters.Add("page", page); } if (objectResults != ShippoEnums.ObjectResults.none) { parameters.Add("object_results", objectResults); } if (parameters.Count != 0) { ep = String.Format("{0}?{1}", ep, generateURLEncodedFromHashmap(parameters)); } return(DoRequest <Batch>(ep, "GET")); }
public async Task <Batch> RetrieveBatch(string id, uint page, ShippoEnums.ObjectResults objectResults) { string ep = string.Format("{0}/batches/{1}", apiEndpoint, System.Net.WebUtility.HtmlEncode(id)); var queryParams = new StringBuilder(); if (page > 0) { queryParams.AppendFormat("&page={0}", page); } if (objectResults != ShippoEnums.ObjectResults.none) { queryParams.AppendFormat("&object_results={0}", objectResults); } if (queryParams.Length > 0) { string parameters = queryParams.ToString().TrimStart('&'); ep = string.Format("{0}?{1}", ep, parameters); } return(await this.apiClient.DoRequestAsync <Batch>(ep, HttpMethod.Get)); }