Beispiel #1
0
 private void Distribute(RelationshipAction action)
 {
     foreach (Core.EntityCollectionBase collection in registeredCollections.SelectMany(item => item.Value).SelectMany(item => item.Value))
     {
         action.ExecuteInMemory(collection);
     }
 }
        public static Task<Envelope<Relationship>> ChangeMyRelationshipWithUser(this InstagramClient client, string userId, RelationshipAction action)
        {
            var query = new NameValueCollection();
            query["access_token"] = client.AccessToken;

            string path = String.Concat("/v1/users/", userId, "/relationship");

            var content = new NameValueCollection();
            content["action"] = Enum.GetName(typeof(RelationshipAction), action).ToLower();

            return client.HttpPostAsync<Envelope<Relationship>>(path, query, content);
        }
Beispiel #3
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);
                }
            });
        }
Beispiel #4
0
 internal void Register(RelationshipAction action)
 {
     actions.AddLast(action);
     Distribute(action);
 }
 /// <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 RelationshipService(AccessToken).ModifyRelationship(targetUserId, relationshipAction));
 }
 /// <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())));
 }