private async Task <FourSquareSingleResponse <T> > GetSingle <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); } var json = await RequestGetAsync(string.Format("{0}{1}?{2}{3}&v={4}", apiUrl, endpoint, oauthToken, serializedParameters, apiVersion), null); FourSquareSingleResponse <T> fourSquareResponse = JsonConvert.DeserializeObject <FourSquareSingleResponse <T> >(json); return(fourSquareResponse); }
private FourSquareSingleResponse <T> Post <T>(string endpoint) where T : FourSquareEntity { string serializedParameters = ""; string json = Request(string.Format("{0}{1}?oauth_token={2}{3}&v={4}", apiUrl, endpoint, accessToken, serializedParameters, apiVersion), HttpMethod.POST); FourSquareSingleResponse <T> fourSquareResponse = JsonConvert.DeserializeObject <FourSquareSingleResponse <T> >(json); return(fourSquareResponse); }