Ejemplo n.º 1
0
        /// <summary>
        /// Recent checkins by friends 
        /// </summary>
        /// <param name="ll">Latitude and longitude of the user's location, so response can include distance. "44.3,37.2"</param>
        /// <param name="limit">Number of results to return, up to 100.</param>
        /// <param name="afterTimestamp">Seconds after which to look for checkins</param>
        public static FourSquareCheckins CheckinRecent(string LL, string Limit, string AfterTimestamp, string AccessToken)
        {
            string Query = "";

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

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

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

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

            HTTPGet GET = new HTTPGet();
            string EndPoint = "https://api.foursquare.com/v2/checkins/recent" + Query + "callback=XXX&v=" + Version + "&oauth_token=" + AccessToken;
            GET.Request(EndPoint);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody);
            FourSquareCheckins Checkins = new FourSquareCheckins(JSONDictionary);
            return Checkins;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a history of checkins for the authenticated user. 
        /// </summary>
        /// <param name="USER_ID">For now, only "self" is supported</param>
        /// <param name="Limit">For now, only "self" is supported</param>
        /// <param name="Offset">Used to page through results.</param>
        /// <param name="afterTimestamp">Retrieve the first results to follow these seconds since epoch.</param>
        /// <param name="beforeTimeStamp">Retrieve the first results prior to these seconds since epoch</param>
        public static FourSquareCheckins UserCheckins(string USER_ID, int Limit, int Offset, double afterTimestamp, double beforeTimeStamp, string AccessToken)
        {
            HTTPGet GET = new HTTPGet();
            string Query = "";

            if (USER_ID.Equals(""))
            {
                USER_ID = "self";
            }

            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 (afterTimestamp > 0)
            {
                if (Query.Equals(""))
                {
                    Query = "?";
                }
                else
                {
                    Query += "&";
                }
                Query += "afterTimestamp=" + afterTimestamp.ToString();
            }

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

            if (Query.Equals(""))
            {
                Query = "?";
            }
            else
            {
                Query += "&";
            }
            string EndPoint = "https://api.foursquare.com/v2/users/" + USER_ID + "/checkins" + Query + "callback=XXX&v=" + Version + "&oauth_token=" + AccessToken;
            GET.Request(EndPoint);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody);
            FourSquareCheckins Checkins = new FourSquareCheckins(JSONDictionary);
            return Checkins;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Provides a count of how many people are at a given venue. If the request is user authenticated, also returns a list of the users there, friends-first.    
        /// </summary>
        /// <param name="VENUE_ID">required ID of venue to retrieve</param>
        /// <param name="limit">Number of results to return, up to 500.</param>
        /// <param name="offset">Used to page through results.</param>
        /// <param name="afterTimestamp">Retrieve the first results to follow these seconds since epoch</param>
        public static FourSquareCheckins VenueHereNow(string VENUE_ID, string limit, string offset, string afterTimestamp, string AccessToken)
        {
            HTTPGet GET = new HTTPGet();
            string Query = "";

            #region Query Conditioning

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

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

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

            #endregion Query Conditioning

            string EndPoint = "https://api.foursquare.com/v2/venues/" + VENUE_ID + "/herenow" + Query + "&callback=XXX&v=" + Version + "&oauth_token=" + AccessToken;
            GET.Request(EndPoint);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody);
            FourSquareCheckins Checkins = new FourSquareCheckins(JSONDictionary);
            return Checkins;
        }