diff --git a/Shippo/APIResource.cs b/Shippo/APIResource.cs index 5514dee..0c87854 100644 --- a/Shippo/APIResource.cs +++ b/Shippo/APIResource.cs @@ -1,9 +1,11 @@ -/* + +/* * Copyright 2011 - 2012 Xamarin, Inc., 2011 - 2012 Joe Dluzen * * Author(s): * Gonzalo Paniagua Javier (gonzalo@xamarin.com) * Joe Dluzen (jdluzen@gmail.com) + * Nicholas Ventimiglia (nick@simplesys.us) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +19,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + using System; -using System.Collections.Generic; using System.Collections; -using System.Globalization; using System.IO; using System.Net; using System.Text; -using System.Web; - using Newtonsoft.Json; -namespace Shippo { - public class APIResource { +namespace Shippo +{ + public class APIResource + { public static readonly string api_endpoint = "https://api.goshippo.com/v1"; static readonly string user_agent = "Shippo/v1 CSharpBindings/1.0"; public static readonly int RatesReqTimeout = 25; @@ -38,7 +39,7 @@ public class APIResource { String accessToken; // API Resource Constructor - public APIResource (string inputToken) + public ShippoApi(string inputToken) { accessToken = inputToken; TimeoutSeconds = 25; @@ -46,20 +47,21 @@ public APIResource (string inputToken) #region Shared // Setup Request handles headers, credentials etc for WebRequests - protected virtual WebRequest SetupRequest (string method, string url) + protected virtual WebRequest SetupRequest(string method, string url) { - WebRequest req = (WebRequest) WebRequest.Create (url); + WebRequest req = (WebRequest)WebRequest.Create(url); req.Method = method; - if (req is HttpWebRequest) { - ((HttpWebRequest) req).UserAgent = user_agent; + if (req is HttpWebRequest) + { + ((HttpWebRequest)req).UserAgent = user_agent; } /* ENABLE BLOCK FOR BASIC AUTH - req.Credentials = credential; - req.PreAuthenticate = true; */ + req.Credentials = credential; + req.PreAuthenticate = true; */ // Disable line below for basic auth - req.Headers.Add ("Authorization", "ShippoToken " + accessToken); + req.Headers.Add("Authorization", "ShippoToken " + accessToken); req.Timeout = TimeoutSeconds * 1000; // When Performing POST requests it is important that we set the headers to json if (method == "POST" || method == "PUT") @@ -67,49 +69,57 @@ protected virtual WebRequest SetupRequest (string method, string url) return req; } // Return response as String - static string GetResponseAsString (WebResponse response) + static string GetResponseAsString(WebResponse response) { - using (StreamReader sr = new StreamReader (response.GetResponseStream (), encoding)) { - return sr.ReadToEnd (); + using (StreamReader sr = new StreamReader(response.GetResponseStream(), encoding)) + { + return sr.ReadToEnd(); } } // GET Requests - public virtual T DoRequest (string endpoint, string method = "GET", string body = null) + public virtual T DoRequest(string endpoint, string method = "GET", string body = null) { - var json = DoRequest (endpoint, method, body); - return JsonConvert.DeserializeObject (json); + var json = DoRequest(endpoint, method, body); + return JsonConvert.DeserializeObject(json); } // GET Requests Helper - public virtual string DoRequest (string endpoint) + public virtual string DoRequest(string endpoint) { - return DoRequest (endpoint, "GET", null); + return DoRequest(endpoint, "GET", null); } // Requests Main Function - public virtual string DoRequest (string endpoint, string method, string body) + public virtual string DoRequest(string endpoint, string method, string body) { string result = null; - WebRequest req = SetupRequest (method, endpoint); - if (body != null) { - byte[] bytes = encoding.GetBytes (body.ToString ()); + WebRequest req = SetupRequest(method, endpoint); + if (body != null) + { + byte[] bytes = encoding.GetBytes(body.ToString()); req.ContentLength = bytes.Length; - using (Stream st = req.GetRequestStream ()) { - st.Write (bytes, 0, bytes.Length); + using (Stream st = req.GetRequestStream()) + { + st.Write(bytes, 0, bytes.Length); } } - try { - using (WebResponse resp = (WebResponse) req.GetResponse ()) { - result = GetResponseAsString (resp); + try + { + using (WebResponse resp = (WebResponse)req.GetResponse()) + { + result = GetResponseAsString(resp); } - } catch (WebException wexc) { - if (wexc.Response != null) { - string json_error = GetResponseAsString (wexc.Response); + } + catch (WebException wexc) + { + if (wexc.Response != null) + { + string json_error = GetResponseAsString(wexc.Response); HttpStatusCode status_code = HttpStatusCode.BadRequest; HttpWebResponse resp = wexc.Response as HttpWebResponse; if (resp != null) status_code = resp.StatusCode; - if ((int) status_code <= 500) + if ((int)status_code <= 500) throw new ShippoException(json_error, wexc); } throw; @@ -117,309 +127,390 @@ public virtual string DoRequest (string endpoint, string method, string body) return result; } - protected virtual StringBuilder UrlEncode (IUrlEncoderInfo infoInstance) + protected virtual StringBuilder UrlEncode(IUrlEncoderInfo infoInstance) { - StringBuilder str = new StringBuilder (); - infoInstance.UrlEncode (str); + StringBuilder str = new StringBuilder(); + infoInstance.UrlEncode(str); if (str.Length > 0) str.Length--; return str; } // Generate URL Encoded parameters for GET requests - public String generateURLEncodedFromHashmap (Hashtable propertyMap) + public String generateURLEncodedFromHashmap(Hashtable propertyMap) { - StringBuilder str = new StringBuilder (); - foreach (DictionaryEntry pair in propertyMap) { - str.AppendFormat ("{0}={1}&", pair.Key, pair.Value); + StringBuilder str = new StringBuilder(); + foreach (DictionaryEntry pair in propertyMap) + { + str.AppendFormat("{0}={1}&", pair.Key, pair.Value); } str.Length--; - return str.ToString (); + return str.ToString(); } // Serialize parameters into JSON for POST requests - public String serialize (Hashtable propertyMap) + public String serialize(object propertyMap) { - return JsonConvert.SerializeObject (propertyMap); + return JsonConvert.SerializeObject(propertyMap); } - #endregion #region Address - public Address CreateAddress (Hashtable parameters) + public Address CreateAddress(Hashtable parameters) { - string ep = String.Format ("{0}/addresses", api_endpoint); - return DoRequest
(ep, "POST", serialize (parameters)); + string ep = String.Format("{0}/addresses", api_endpoint); + return DoRequest
(ep, "POST", serialize(parameters)); } - - public Address RetrieveAddress (String id) + public Address CreateAddress(Address parameters) { - string ep = String.Format ("{0}/addresses/{1}", api_endpoint, id); - return DoRequest
(ep, "GET"); + string ep = String.Format("{0}/addresses", api_endpoint); + return DoRequest
(ep, "POST", serialize(parameters)); + } + public Address RetrieveAddress(String id) + { + string ep = String.Format("{0}/addresses/{1}", api_endpoint, id); + return DoRequest
(ep, "GET"); } - public Address ValidateAddress (String id) + public Address ValidateAddress(String id) { - string ep = String.Format ("{0}/addresses/{1}/validate", api_endpoint, id); - return DoRequest
(ep, "GET"); + string ep = String.Format("{0}/addresses/{1}/validate", api_endpoint, id); + return DoRequest
(ep, "GET"); } - public ShippoCollection
AllAddresss (Hashtable parameters) + public ShippoCollection
AllAddresss(Hashtable parameters) { - string ep = String.Format ("{0}/addresses?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/addresses?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion #region Parcel - public Parcel CreateParcel (Hashtable parameters) + public Parcel CreateParcel(Hashtable parameters) + { + string ep = String.Format("{0}/parcels", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); + } + + public Parcel CreateParcel(Parcel parameters) { - string ep = String.Format ("{0}/parcels", api_endpoint); - return DoRequest (ep, "POST", serialize (parameters)); + string ep = String.Format("{0}/parcels", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public Parcel RetrieveParcel (String id) + public Parcel RetrieveParcel(String id) { - string ep = String.Format ("{0}/parcels/{1}", api_endpoint, id); - return DoRequest (ep, "GET"); + string ep = String.Format("{0}/parcels/{1}", api_endpoint, id); + return DoRequest(ep, "GET"); } - public ShippoCollection AllParcels (Hashtable parameters) + public ShippoCollection AllParcels(Hashtable parameters) { - string ep = String.Format ("{0}/parcels?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/parcels?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion #region Shipment - public Shipment CreateShipment (Hashtable parameters) + public Shipment CreateShipment(Hashtable parameters) { - string ep = String.Format ("{0}/shipments", api_endpoint); - return DoRequest (ep, "POST", serialize (parameters)); + string ep = String.Format("{0}/shipments", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public Shipment RetrieveShipment (String id) + public Shipment CreateShipment(Shipment parameters) { - string ep = String.Format ("{0}/shipments/{1}", api_endpoint, id); - return DoRequest (ep, "GET"); + string ep = String.Format("{0}/shipments", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public ShippoCollection AllShipments (Hashtable parameters) + public Shipment RetrieveShipment(String id) { - string ep = String.Format ("{0}/shipments?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/shipments/{1}", api_endpoint, id); + return DoRequest(ep, "GET"); + } + + public ShippoCollection AllShipments(Hashtable parameters) + { + string ep = String.Format("{0}/shipments?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion #region Rate - public ShippoCollection CreateRate (Hashtable parameters) + public ShippoCollection CreateRate(Hashtable parameters) { - string ep = String.Format ("{0}/shipments/{1}/rates/{2}", api_endpoint, parameters ["id"], parameters ["currency_code"]); - return DoRequest> (ep, "GET"); + string ep = String.Format("{0}/shipments/{1}/rates/{2}", api_endpoint, parameters["id"], parameters["currency_code"]); + return DoRequest>(ep, "GET"); } - public ShippoCollection GetShippingRatesSync (String objectId) + public ShippoCollection GetShippingRatesSync(String objectId) { - Hashtable parameters = new Hashtable (); - parameters.Add ("id", objectId); - parameters.Add ("currency_code", ""); - return GetShippingRatesSync (parameters); + Hashtable parameters = new Hashtable(); + parameters.Add("id", objectId); + parameters.Add("currency_code", ""); + return GetShippingRatesSync(parameters); } - public ShippoCollection GetShippingRatesSync (Hashtable parameters) + public ShippoCollection GetShippingRatesSync(Hashtable parameters) { - String object_id = (String) parameters ["id"]; - Shipment shipment = RetrieveShipment (object_id); - String object_status = (String) shipment.ObjectStatus; - long startTime = DateTimeExtensions.UnixTimeNow (); + String object_id = (String)parameters["id"]; + Shipment shipment = RetrieveShipment(object_id); + String object_status = (String)shipment.ObjectStatus; + long startTime = DateTimeExtensions.UnixTimeNow(); - while (object_status.Equals ("QUEUED", StringComparison.OrdinalIgnoreCase) || object_status.Equals ("WAITING", StringComparison.OrdinalIgnoreCase)) { - if (DateTimeExtensions.UnixTimeNow () - startTime > RatesReqTimeout) { - throw new RequestTimeoutException ( + while (object_status.Equals("QUEUED", StringComparison.OrdinalIgnoreCase) || object_status.Equals("WAITING", StringComparison.OrdinalIgnoreCase)) + { + if (DateTimeExtensions.UnixTimeNow() - startTime > RatesReqTimeout) + { + throw new RequestTimeoutException( "A timeout has occured while waiting for your rates to generate. Try retreiving the Shipment object again and check if object_status is updated. If this issue persists, please contact support@goshippo.com"); } - shipment = RetrieveShipment (object_id); - object_status = (String) shipment.ObjectStatus; + shipment = RetrieveShipment(object_id); + object_status = (String)shipment.ObjectStatus; } return CreateRate(parameters); } - public Rate RetrieveRate (String id) + public Rate RetrieveRate(String id) { - string ep = String.Format ("{0}/rates/{1}", api_endpoint, id); - return DoRequest (ep, "GET"); + string ep = String.Format("{0}/rates/{1}", api_endpoint, id); + return DoRequest(ep, "GET"); } - public ShippoCollection AllRates (Hashtable parameters) + public ShippoCollection AllRates(Hashtable parameters) { - string ep = String.Format ("{0}/rates?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/rates?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion #region Transaction - public Transaction CreateTransaction (Hashtable parameters) + public Transaction CreateTransaction(Hashtable parameters) + { + string ep = String.Format("{0}/transactions", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); + } + + public Transaction CreateTransaction(Transaction parameters) { - string ep = String.Format ("{0}/transactions", api_endpoint); - return DoRequest (ep, "POST", serialize (parameters)); + string ep = String.Format("{0}/transactions", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public Transaction CreateTransactionSync (Hashtable parameters) + public Transaction CreateTransactionSync(Hashtable parameters) { - string ep = String.Format ("{0}/transactions", api_endpoint); - Transaction transaction = DoRequest (ep, "POST", serialize (parameters)); - String object_id = (String) transaction.ObjectId; - String object_status = (String) transaction.ObjectStatus; - long startTime = DateTimeExtensions.UnixTimeNow (); + string ep = String.Format("{0}/transactions", api_endpoint); + Transaction transaction = DoRequest(ep, "POST", serialize(parameters)); + String object_id = (String)transaction.ObjectId; + String object_status = (String)transaction.ObjectStatus; + long startTime = DateTimeExtensions.UnixTimeNow(); - while (object_status.Equals ("QUEUED", StringComparison.OrdinalIgnoreCase) || object_status.Equals ("WAITING", StringComparison.OrdinalIgnoreCase)) { - if (DateTimeExtensions.UnixTimeNow () - startTime > TransactionReqTimeout) { - throw new RequestTimeoutException ( + while (object_status.Equals("QUEUED", StringComparison.OrdinalIgnoreCase) || object_status.Equals("WAITING", StringComparison.OrdinalIgnoreCase)) + { + if (DateTimeExtensions.UnixTimeNow() - startTime > TransactionReqTimeout) + { + throw new RequestTimeoutException( "A timeout has occured while waiting for your label to generate. Try retreiving the Transaction object again and check if object_status is updated. If this issue persists, please contact support@goshippo.com"); } - transaction = RetrieveTransaction (object_id); - object_status = (String) transaction.ObjectStatus; + transaction = RetrieveTransaction(object_id); + object_status = (String)transaction.ObjectStatus; } return transaction; } - public Transaction RetrieveTransaction (String id) + public Transaction CreateTransactionSync(Transaction parameters) { - string ep = String.Format ("{0}/transactions/{1}", api_endpoint, id); - return DoRequest (ep, "GET"); + string ep = String.Format("{0}/transactions", api_endpoint); + Transaction transaction = DoRequest(ep, "POST", serialize(parameters)); + String object_id = (String)transaction.ObjectId; + String object_status = (String)transaction.ObjectStatus; + long startTime = DateTimeExtensions.UnixTimeNow(); + + while (object_status.Equals("QUEUED", StringComparison.OrdinalIgnoreCase) || object_status.Equals("WAITING", StringComparison.OrdinalIgnoreCase)) + { + if (DateTimeExtensions.UnixTimeNow() - startTime > TransactionReqTimeout) + { + throw new RequestTimeoutException( + "A timeout has occured while waiting for your label to generate. Try retreiving the Transaction object again and check if object_status is updated. If this issue persists, please contact support@goshippo.com"); + } + transaction = RetrieveTransaction(object_id); + object_status = (String)transaction.ObjectStatus; + } + + return transaction; + } + + public Transaction RetrieveTransaction(String id) + { + string ep = String.Format("{0}/transactions/{1}", api_endpoint, id); + return DoRequest(ep, "GET"); } - public ShippoCollection AllTransactions (Hashtable parameters) + public ShippoCollection AllTransactions(Hashtable parameters) { - string ep = String.Format ("{0}/transactions?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/transactions?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion #region CustomsItem - public CustomsItem CreateCustomsItem (Hashtable parameters) + public CustomsItem CreateCustomsItem(Hashtable parameters) { - string ep = String.Format ("{0}/customs/items", api_endpoint); - return DoRequest (ep, "POST", serialize (parameters)); + string ep = String.Format("{0}/customs/items", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public CustomsItem RetrieveCustomsItem (String id) + public CustomsItem CreateCustomsItem(CustomsItem parameters) { - string ep = String.Format ("{0}/customs/items/{1}", api_endpoint, id); - return DoRequest (ep, "GET"); + string ep = String.Format("{0}/customs/items", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public ShippoCollection AllCustomsItems (Hashtable parameters) + public CustomsItem RetrieveCustomsItem(String id) { - string ep = String.Format ("{0}/customs/items?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/customs/items/{1}", api_endpoint, id); + return DoRequest(ep, "GET"); + } + + public ShippoCollection AllCustomsItems(Hashtable parameters) + { + string ep = String.Format("{0}/customs/items?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion #region CustomsDeclaration - public CustomsDeclaration CreateCustomsDeclaration (Hashtable parameters) + public CustomsDeclaration CreateCustomsDeclaration(Hashtable parameters) + { + string ep = String.Format("{0}/customs/declarations", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); + } + + public CustomsDeclaration CreateCustomsDeclaration(CustomsDeclaration parameters) { - string ep = String.Format ("{0}/customs/declarations", api_endpoint); - return DoRequest (ep, "POST", serialize (parameters)); + string ep = String.Format("{0}/customs/declarations", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public CustomsDeclaration RetrieveCustomsDeclaration (String id) + public CustomsDeclaration RetrieveCustomsDeclaration(String id) { - string ep = String.Format ("{0}/customs/declarations/{1}", api_endpoint, id); - return DoRequest (ep, "GET"); + string ep = String.Format("{0}/customs/declarations/{1}", api_endpoint, id); + return DoRequest(ep, "GET"); } - public ShippoCollection AllCustomsDeclarations (Hashtable parameters) + public ShippoCollection AllCustomsDeclarations(Hashtable parameters) { - string ep = String.Format ("{0}/customs/declarations?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/customs/declarations?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion #region CarrierAccount - public CarrierAccount CreateCarrierAccount (Hashtable parameters) + public CarrierAccount CreateCarrierAccount(Hashtable parameters) + { + string ep = String.Format("{0}/carrier_accounts", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); + } + public CarrierAccount CreateCarrierAccount(CarrierAccount parameters) { - string ep = String.Format ("{0}/carrier_accounts", api_endpoint); - return DoRequest (ep, "POST", serialize (parameters)); + string ep = String.Format("{0}/carrier_accounts", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public CarrierAccount UpdateCarrierAccount (String object_id, Hashtable parameters) + public CarrierAccount UpdateCarrierAccount(String object_id, Hashtable parameters) { - string ep = String.Format ("{0}/carrier_accounts/{1}", api_endpoint, object_id); - return DoRequest (ep, "PUT", serialize (parameters)); + string ep = String.Format("{0}/carrier_accounts/{1}", api_endpoint, object_id); + return DoRequest(ep, "PUT", serialize(parameters)); } - public CarrierAccount RetrieveCarrierAccount (String object_id) + public CarrierAccount UpdateCarrierAccount(String object_id, CarrierAccount parameters) + { + string ep = String.Format("{0}/carrier_accounts/{1}", api_endpoint, object_id); + return DoRequest(ep, "PUT", serialize(parameters)); + } + public CarrierAccount RetrieveCarrierAccount(String object_id) { - string ep = String.Format ("{0}/carrier_accounts/{1}", api_endpoint, object_id); - return DoRequest (ep, "GET"); + string ep = String.Format("{0}/carrier_accounts/{1}", api_endpoint, object_id); + return DoRequest(ep, "GET"); } - public ShippoCollection AllCarrierAccount (Hashtable parameters) + public ShippoCollection AllCarrierAccount(Hashtable parameters) { - string ep = String.Format ("{0}/carrier_accounts?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/carrier_accounts?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion #region Refund - public Refund CreateRefund (Hashtable parameters) + public Refund CreateRefund(Hashtable parameters) { - string ep = String.Format ("{0}/refunds", api_endpoint); - return DoRequest (ep, "POST", serialize (parameters)); + string ep = String.Format("{0}/refunds", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); + } + public Refund CreateRefund(Refund parameters) + { + string ep = String.Format("{0}/refunds", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public Refund RetrieveRefund (String id) + public Refund RetrieveRefund(String id) { - string ep = String.Format ("{0}/refunds/{1}", api_endpoint, id); - return DoRequest (ep, "GET"); + string ep = String.Format("{0}/refunds/{1}", api_endpoint, id); + return DoRequest(ep, "GET"); } - public ShippoCollection AllRefunds (Hashtable parameters) + public ShippoCollection AllRefunds(Hashtable parameters) { - string ep = String.Format ("{0}/refunds?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/refunds?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion #region Manifest - public Manifest CreateManifest (Hashtable parameters) + public Manifest CreateManifest(Hashtable parameters) + { + string ep = String.Format("{0}/manifests", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); + } + + public Manifest CreateManifest(Manifest parameters) { - string ep = String.Format ("{0}/manifests", api_endpoint); - return DoRequest (ep, "POST", serialize (parameters)); + string ep = String.Format("{0}/manifests", api_endpoint); + return DoRequest(ep, "POST", serialize(parameters)); } - public Manifest RetrieveManifest (String id) + public Manifest RetrieveManifest(String id) { - string ep = String.Format ("{0}/manifests/{1}", api_endpoint, id); - return DoRequest (ep, "GET"); + string ep = String.Format("{0}/manifests/{1}", api_endpoint, id); + return DoRequest(ep, "GET"); } - public ShippoCollection AllManifests (Hashtable parameters) + public ShippoCollection AllManifests(Hashtable parameters) { - string ep = String.Format ("{0}/manifests?{1}", api_endpoint, generateURLEncodedFromHashmap (parameters)); - return DoRequest> (ep); + string ep = String.Format("{0}/manifests?{1}", api_endpoint, generateURLEncodedFromHashmap(parameters)); + return DoRequest>(ep); } #endregion