Esempio n. 1
0
 /// <summary>
 /// Gives details about a tip, including which users (especially friends) have marked the tip to-do or done.    
 /// </summary>
 /// <param name="TIP_ID">required ID of tip to retrieve</param>
 public static FourSquareTip Tip(string TIP_ID, string AccessToken)
 {
     HTTPGet GET = new HTTPGet();
     string EndPoint = "https://api.foursquare.com/v2/tips/" + TIP_ID + "?callback=XXX&v=" + Version + "&oauth_token=" + AccessToken;
     GET.Request(EndPoint);
     Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody);
     FourSquareTip Tip = new FourSquareTip(JSONDictionary);
     return Tip;
 }
Esempio n. 2
0
 public FourSquareTodo(Dictionary<string, object> JSONDictionary, bool Listing)
 {
     id = GetDictionaryValue(JSONDictionary, "id");
     createdAt = GetDictionaryValue(JSONDictionary, "createdAt");
     tip = new FourSquareTip(JSONDictionary);
 }
    /// <summary>
    /// Returns tips from a user.  
    /// </summary>
    /// <param name="USER_ID">Identity of the user to get friends of. Pass self to get friends of the acting user</param>
    /// <param name="Sort">One of recent, nearby, or popular. Nearby requires geolat and geolong to be provided.</param>
    /// <param name="LL">Latitude and longitude of the user's location. (Comma separated)</param>
    /// <param name="Limit">Number of results to return, up to 500.</param>
    /// <param name="Offset">Used to page through results</param>
    public static List<FourSquareTip> UserTips(string USER_ID, string Sort, string LL, int Limit, int Offset, string AccessToken)
    {
        List<FourSquareTip> Tips = new List<FourSquareTip>();

        string Query = "";

        if (!Sort.Equals(""))
        {
            if (Query.Equals(""))
            {
                Query = "?";
            }
            else
            {
                Query += "&";
            }
            Query += "sort=" + Sort;
        }

        if (!LL.Equals(""))
        {
            if (Query.Equals(""))
            {
                Query = "?";
            }
            else
            {
                Query += "&";
            }
            Query += "ll=" + LL;
        }

        if (Limit > 0)
        {
            if (Query.Equals(""))
            {
                Query = "?";
            }
            else
            {
                Query += "&";
            }
            Query += "limit=" + Limit.ToString();
        }

        if (Offset > 0)
        {
            if (Query.Equals(""))
            {
                Query = "?";
            }
            else
            {
                Query += "&";
            }
            Query += "offset=" + Offset.ToString();
        }

        if (Query.Equals(""))
        {
            Query = "?";
        }
        else
        {
            Query += "&";
        }

        HTTPGet GET = new HTTPGet();
        string EndPoint = "https://api.foursquare.com/v2/users/" + USER_ID + "/tips" + Query + "oauth_token=" + AccessToken;
        GET.Request(EndPoint);
        Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody);
        JSONDictionary = ExtractDictionary(JSONDictionary, "response:tips");
        foreach (object obj in (object[])JSONDictionary["items"])
        {
            FourSquareTip Tip = new FourSquareTip((Dictionary<string, object>)obj);
            Tips.Add(Tip);
        }
        return Tips;
    }
Esempio n. 4
0
 public FourSquareTodo(Dictionary<string, object> JSONDictionary)
     : base(JSONDictionary)
 {
     JSONDictionary = ExtractDictionary(JSONDictionary, "response:todo");
     id = GetDictionaryValue(JSONDictionary, "id");
     createdAt = GetDictionaryValue(JSONDictionary, "createdAt");
     tip = new FourSquareTip(JSONDictionary);
 }
 public FourSquareTodo(Dictionary<string, object> JSONDictionary)
 {
     JSON = JSONSerializer(JSONDictionary);
     id = GetDictionaryValue(JSONDictionary, "ID");
     createdAt = GetDictionaryValue(JSONDictionary, "createdAt");
     tip = new FourSquareTip((Dictionary<string, object>)JSONDictionary["tip"]);
 }