public void ExecuteUserGetFriends_v2()
        {
            UserGetFriendsRequest request = new UserGetFriendsRequest();
            request.app_key = this.app_key;
            request.user_key = this.user_key;
            request.networks = String.Empty;

            UserGetFriendsResponse rsp = api.PostRequest<UserGetFriendsRequest, UserGetFriendsResponse>("user.getfriends", request);

            Assert.AreEqual(rsp.status, "OK");
        }
Example #2
0
        /// <summary>
        /// Returns a list of given user's friends.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>OK, list of friends. Error message on failure.</returns>
        public UserGetFriendsResponse GetFriends(UserGetFriendsRequest request)
        {
            using (var client = GetDefaultClient())
            {
                // build form data post
                HttpMultipartMimeForm form = new HttpMultipartMimeForm();
                form.Add("app_key", this.AppKey);
                form.Add("user_key", this.UserKey);
                if (!String.IsNullOrWhiteSpace(request.networks)) form.Add("networks", request.networks);

                // call method
                using (HttpResponseMessage response = client.Post("user.getfriends", form.CreateHttpContent()))
                {
                    response.EnsureStatusIsSuccessful();
                    return response.Content.ReadAsXmlSerializable<UserGetFriendsResponse>();
                }
            }
        }
        public void ExecuteUserGetFriends_v1()
        {
            UserGetFriendsRequest request = new UserGetFriendsRequest();
            request.networks = String.Empty;

            UserGetFriendsResponse rsp = api.GetFriends(request);

            Assert.AreEqual(rsp.status, "OK");
        }