public static VkOAuthAccessJSON GetAccessToken(string code) { WebRequest request = WebRequest.Create(VkOAuthData.GetRequestForAccessToken(code)); WebResponse response = request.GetResponse(); using (Stream dataStream = response.GetResponseStream()) { StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); VkOAuthAccessJSON responseData = JsonConvert.DeserializeObject <VkOAuthAccessJSON>(responseFromServer); return(responseData); } }
public static RootVkFriends GetUserFriends(string userId, string accessToken) { WebRequest request = WebRequest.Create(VkOAuthData.GetRequestForUserFrineds(userId, accessToken)); WebResponse response = request.GetResponse(); using (Stream dataStream = response.GetResponseStream()) { StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); RootVkFriends responseData = JsonConvert.DeserializeObject <RootVkFriends>(responseFromServer); return(responseData); } }