Beispiel #1
0
        public void SetFriendRelationship(
            string userId,
            RelationshipAction newRelationship,
            Action ok,
            Action <Exception> error)
        {
            ValidateIsUser();

            string lowercaseRequest = newRelationship.ToString().ToLowerInvariant();

            var uuri = FourSquareWebClient.BuildFourSquareUri(
                "users/" + userId + "/" + lowercaseRequest,
                GeoMethodType.None);
            var r = new FourSquareServiceRequest
            {
                Uri        = uuri.Uri,
                PostString = string.Empty,
            };

            var token = CentralStatusManager.Instance.BeginShowEllipsisMessage("Updating friendship");

            r.CallAsync(
                (str, ex) =>
            {
                Exception exx = ex;

                try
                {
                    if (exx == null)
                    {
                        token.CompleteWithAcknowledgement("OK");

                        //var json = FourSquareDataLoaderBase.ProcessMetaAndNotificationsReturnJson(str);

                        ok();
                    }
                    else
                    {
                        token.Complete();
                    }
                }
                catch (Exception e)
                {
                    exx = e;
                }

                if (exx != null)
                {
                    error(exx);
                }
            });
        }
 /// <summary>
 /// Modify the relationship between the current user and the target user.
 /// </summary>
 /// <param name="targetUserId">Target user ID.</param>
 /// <param name="relationshipAction">Modify action: follow | unfollow | approve | ignore</param>
 /// <returns>Last state of relationship between current and target user.</returns>
 public Envelope <Relationship> ModifyRelationship(string targetUserId, RelationshipAction relationshipAction)
 {
     return(new InstagramApiService <Relationship>(RelationshipApiUri(targetUserId))
            .Post(new KeyValuePair <string, string>("action", relationshipAction.ToString())));
 }