示例#1
0
 /// <summary>
 /// Publish Note
 /// </summary>
 public JObject Publish(string title, string text)
 {
     var request = new VkRequest(VkConst.MethodExecuteBaseUri);
     request.Parameters.Add("owner_id", User.VkUserId);
     request.Parameters.Add("access_token", User.AccessToken);
     request.Parameters.Add("title", title);
     request.Parameters.Add("text", text);
     return request.Execute("notes.add");
 }
示例#2
0
 public VkUser GetUser(string appCode)
 {
     var request = new VkRequest(VkConst.BaseUriGetUser);
     request.Parameters.Add("client_id", appId);
     request.Parameters.Add("client_secret", appSecret);
     request.Parameters.Add("code", appCode);
     request.Parameters.Add("redirect_uri", redirectCallbackUrl);
     
     var response = request.Execute("access_token");
     var properties = response.Children().Cast<JProperty>();
     var token = properties.Single(x => x.Name == VkConst.JsonToken).Value.ToString();
     var userId = properties.Single(x => x.Name == VkConst.JsonUserId).Value.ToString();
     return new VkUser() { AccessToken = token, VkUserId = userId };
 }