private FourSquareMultipleResponse <T> GetMultiple <T>(string endpoint, Dictionary <string, string> parameters, bool unauthenticated) where T : FourSquareEntity { string serializedParameters = ""; if (parameters != null) { serializedParameters = "&" + SerializeDictionary(parameters); } string oauthToken = ""; if (unauthenticated) { oauthToken = string.Format("client_id={0}&client_secret={1}", clientId, clientSecret); } else { oauthToken = string.Format("oauth_token={0}", accessToken); } string json = Request(string.Format("{0}{1}?{2}{3}&v={4}", apiUrl, endpoint, oauthToken, serializedParameters, apiVersion), HttpMethod.GET); FourSquareMultipleResponse <T> fourSquareResponse = JsonConvert.DeserializeObject <FourSquareMultipleResponse <T> >(json); return(fourSquareResponse); }
private FourSquareMultipleResponse <T> GetMultiple <T>(string endpoint, Dictionary <string, string> parameters, bool unauthenticated) where T : FourSquareEntity { string serializedParameters = ""; if (parameters != null) { serializedParameters = "&" + SerializeDictionary(parameters); } string oauthToken = ""; if (unauthenticated) { oauthToken = string.Format("client_id={0}&client_secret={1}", clientId, clientSecret); } else { oauthToken = string.Format("oauth_token={0}", accessToken); } string json = Request(string.Format("{0}{1}?{2}{3}&v={4}", apiUrl, endpoint, oauthToken, serializedParameters, apiVersion), HttpMethod.GET); // fix for invalid json format with "confident" property if (json.IndexOf(",\"confident") > 0) { json = json.Remove(json.IndexOf(",\"confident")).Trim() + "}}"; } // fix for invalid json format with "emptyStream" property if (json.IndexOf(",\"emptyStream") > 0) { json = json.Remove(json.IndexOf(",\"emptyStream")).Trim() + "}}"; } FourSquareMultipleResponse <T> fourSquareResponse = JsonConvert.DeserializeObject <FourSquareMultipleResponse <T> >(json); return(fourSquareResponse); }