Пример #1
0
        private List <string> GetFilesToTransfer(string ipAddress, string xmlPath)
        {
            try
            {
                NameValueCollection nvc   = new NameValueCollection();
                string filesToTransferXML = HTTPPost.HttpUploadFile("http://" + ipAddress + "/GetFilesToTransfer", xmlPath, "filesInSite.xml", nvc);
                if (filesToTransferXML != "404")
                {
                    if (!String.IsNullOrEmpty(filesToTransferXML))
                    {
                        return(ParseFilesToTransferXml(filesToTransferXML));
                    }
                }
                else
                {
                    Trace.WriteLine("404 received - no files to transfer");
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Exception in GetFilesToTransfer: " + ex.ToString());
                MessageBox.Show(ex.ToString());
            }

            return(null);
        }
Пример #2
0
        private static bool UploadFileToServer(string id, string filePath)
        {
            string fileName = System.IO.Path.GetFileName(filePath);

            LogMessage(GetTimeStamp() + " : UploadFileToServer:  id=" + id.ToString() + ", filePath=" + filePath + ", fileName=" + fileName);

            NameValueCollection nvc = new NameValueCollection();

            nvc.Add("Destination-Filename", String.Concat("content/", fileName));
            nvc.Add("Friendly-Filename", fileName);
            nvc.Add("DB-Id", id);

            try
            {
                string responseString = HTTPPost.HttpUploadFile("http://" + _bsIPAddress + "/TranscodedFile", filePath, fileName, nvc);
                if (responseString != "RECEIVED")
                {
                    LogMessage(GetTimeStamp() + " : UploadFileToServer:  HTTPPost returned " + responseString);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LogMessage("Exception in HTTPPost: " + ex.ToString());
                return(false);
            }

            LogMessage(GetTimeStamp() + " : UploadFileToServer: success");
            return(true);
        }
Пример #3
0
        private bool UploadFileToBrightSign(string sourcePath, string destinationRelativePath, string ipAddress)
        {
            Trace.WriteLine("UploadFileToBrightSign: " + sourcePath);

            //string encodedFileName = HttpUtility.UrlEncode(fileName);

            try
            {
                NameValueCollection nvc = new NameValueCollection();

                nvc.Add("Destination-Filename", destinationRelativePath);
                HTTPPost.HttpUploadFile("http://" + ipAddress + "/UploadFile", sourcePath, destinationRelativePath, nvc);

                return(true);
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Exception in UploadFileToBrightSign: " + ex.ToString());
                MessageBox.Show("Exception in UploadFileToBrightSign");
            }

            return(false);
        }
Пример #4
0
        /// <summary>
        /// Allows you to propose or make a change to a venue.      
        /// </summary>
        /// <param name="VENUE_ID">required The venue id for which an edit is being proposed</param>
        /// <param name="EditType">either edit or proposeedit</param>
        /// <param name="name">The name of the venue.</param>
        /// <param name="address">The address of the venue.</param>
        /// <param name="crossStreet">The nearest intersecting street or streets</param>
        /// <param name="city">The city name where this venue is.</param>
        /// <param name="state">The nearest state or province to the venue.</param>
        /// <param name="zip">The zip or postal code for the venue.</param>
        /// <param name="phone">The phone number of the venue.</param>
        /// <param name="ll">Latitude and longitude of the user's location, as accurate as is known.</param>
        /// <param name="primaryCategoryId">The ID of the category to which you want to assign this venue.</param>
        private static bool VenueEditor(string EditType, string VENUE_ID, string name, string address, string crossStreet, string city, string state, string zip, string phone, string ll, string primaryCategoryId, string AccessToken)
        {
            //Venue Edit and Venue ProposeEdit are essentially the same call. Edit requires Superuser privileges.

            Dictionary<string, string> Parameters = new Dictionary<string, string>();

            Parameters.Add("callback", "XXX");
            Parameters.Add("v", Version);

            #region Parameter Conditioning

            //address
            if (!address.Equals(""))
            {
                Parameters.Add("address", address);
            }

            //city
            if (!city.Equals(""))
            {
                Parameters.Add("city", city);
            }

            //crossStreet
            if (!crossStreet.Equals(""))
            {
                Parameters.Add("crossStreet", crossStreet);
            }

            //ll
            if (!ll.Equals(""))
            {
                Parameters.Add("ll", ll);
            }

            //name
            if (!name.Equals(""))
            {
                Parameters.Add("name", name);
            }

            //phone
            if (!phone.Equals(""))
            {
                Parameters.Add("phone", phone);
            }

            //primaryCategoryId
            if (!primaryCategoryId.Equals(""))
            {
                Parameters.Add("primaryCategoryId", primaryCategoryId);
            }

            //state
            if (!state.Equals(""))
            {
                Parameters.Add("state", state);
            }

            //zip
            if (!zip.Equals(""))
            {
                Parameters.Add("zip", zip);
            }

            #endregion Parameter Conditioning

            Parameters.Add("oauth_token", AccessToken);

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/venues/" + VENUE_ID + "/" + EditType), Parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            if (((Dictionary<string, object>)JSONDictionary["meta"])["code"].ToString().Equals("200"))
            {
                return true;
            }
            return false;
        }
Пример #5
0
        /// <summary>
        /// Allows you to mark a venue to-do, with optional text.     
        /// </summary>
        /// <param name="VENUE_ID">required The venue you want to mark to-do.</param>
        /// <param name="text">The text of the tip.</param>
        public static FourSquareTodo VenueMarkTodo(string VENUE_ID, string text, string AccessToken)
        {
            Dictionary<string, string> Parameters = new Dictionary<string, string>();

            Parameters.Add("callback", "XXX");
            Parameters.Add("v", Version);
            Parameters.Add("oauth_token", AccessToken);

            #region Parameter Conditioning

            //text
            if (!text.Equals(""))
            {
                Parameters.Add("text", text);
            }

            #endregion Parameter Conditioning

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/venues/" + VENUE_ID + "/marktodo"), Parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            return new FourSquareTodo(JSONDictionary);
        }
Пример #6
0
        /// <summary>
        /// Allows users to indicate a venue is incorrect in some way.      
        /// </summary>
        /// <param name="VENUE_ID">required The venue id for which an edit is being proposed.</param>
        /// <param name="problem">required One of mislocated, closed, duplicate.</param>
        public static bool VenueFlag(string VENUE_ID, string problem, string AccessToken)
        {
            Dictionary<string, string> Parameters = new Dictionary<string, string>();

            Parameters.Add("callback", "XXX");
            Parameters.Add("v", Version);
            Parameters.Add("oauth_token", AccessToken);

            #region Parameter Conditioning

            //problem
            if (!problem.Equals(""))
            {
                Parameters.Add("problem", problem);
            }

            #endregion Parameter Conditioning

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/venues/" + VENUE_ID + "/flag"), Parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            if (((Dictionary<string, object>)JSONDictionary["meta"])["code"].ToString().Equals("200"))
            {
                return true;
            }
            return false;
        }
Пример #7
0
        /// <summary>
        /// Allows users to add a new venue.  
        /// </summary>
        /// <param name="name">required the name of the venue NOTE: One of either a valid address or a geolat/geolong pair must be provided</param>
        /// <param name="address">The address of the venue.</param>
        /// <param name="crossStreet">The nearest intersecting street or streets.</param>
        /// <param name="city">The city name where this venue is.</param>
        /// <param name="state">The nearest state or province to the venue.</param>
        /// <param name="zip">The zip or postal code for the venue.</param>
        /// <param name="phone">The phone number of the venue.</param>
        /// <param name="ll">required Latitude and longitude of the venue, as accurate as is known. NOTE: One of either a valid address or a geolat/geolong pair must be provided</param>
        /// <param name="primaryCategoryId">The ID of the category to which you want to assign this venue.</param>
        public static FourSquareVenue VenueAdd(string name, string address, string crossStreet, string city, string state, string zip, string phone, string ll, string primaryCategoryId, string AccessToken)
        {
            Dictionary<string, string> Parameters = new Dictionary<string, string>();

            Parameters.Add("callback", "XXX");
            Parameters.Add("v", Version);
            Parameters.Add("oauth_token", AccessToken);

            #region Parameter Conditioning

            //address
            if (!address.Equals(""))
            {
                Parameters.Add("address", address);
            }

            //city
            if (!city.Equals(""))
            {
                Parameters.Add("city", city);
            }

            //crossStreet
            if (!crossStreet.Equals(""))
            {
                Parameters.Add("crossStreet", crossStreet);
            }

            //ll
            if (!ll.Equals(""))
            {
                Parameters.Add("ll", ll);
            }

            //name
            if (!name.Equals(""))
            {
                Parameters.Add("name", name);
            }

            //phone
            if (!phone.Equals(""))
            {
                Parameters.Add("phone", phone);
            }

            //primaryCategoryId
            if (!primaryCategoryId.Equals(""))
            {
                Parameters.Add("primaryCategoryId", primaryCategoryId);
            }

            //state
            if (!state.Equals(""))
            {
                Parameters.Add("state", state);
            }

            //zip
            if (!zip.Equals(""))
            {
                Parameters.Add("zip", zip);
            }

            #endregion Parameter Conditioning

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/venues/add"), Parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            return new FourSquareVenue(JSONDictionary);
        }
Пример #8
0
    /// <summary>
    /// Add a comment to a check-in  
    /// </summary>
    /// <param name="CHECKIN_ID">The ID of the checkin to add a comment to.</param>
    /// <param name="text">The text of the comment, up to 200 characters.</param>
    public static FourSquareComment CheckinAddComment(string CHECKIN_ID, string Text, string AccessToken)
    {
        Dictionary<string, string> parameters = new Dictionary<string, string>();

        parameters.Add("callback", "XXX");
        parameters.Add("oauth_token", AccessToken);
        parameters.Add("text", Text);

        HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/checkins/" + CHECKIN_ID + "/addcomment"), parameters);
        Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
        JSONDictionary = ExtractDictionary(JSONDictionary, "response:comment");
        FourSquareComment Comment = new FourSquareComment(JSONDictionary);
        return Comment;
    }
Пример #9
0
        /// <summary>
        /// Allows you to remove a tip from your to-do list or done list.    
        /// </summary>
        /// <param name="TIP_ID">required The tip you want to unmark.</param>
        public static FourSquareTip TipUnMark(string TIP_ID, string AccessToken)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();

            parameters.Add("callback", "XXX");
            parameters.Add("v", Version);
            parameters.Add("oauth_token", AccessToken);

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/tips/" + TIP_ID + "/unmark"), parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            return new FourSquareTip(JSONDictionary);
        }
Пример #10
0
        /// <summary>
        /// Allows you to check in to a place.
        /// </summary>
        /// <param name="venueId">The venue where the user is checking in. No venueid is needed if shouting or just providing a venue name.</param>
        /// <param name="venue">If are not shouting, but you don't have a venue ID or would rather prefer a 'venueless' checkin</param>
        /// <param name="shout">A message about your check-in. The maximum length of this field is 140 characters.</param>
        /// <param name="broadcast">Required. How much to broadcast this check-in, ranging from private (off-the-grid) to public,facebook,twitter. Can also be just public or public,facebook, for example. If no valid value is found, the default is public. Shouts cannot be private.</param>
        /// <param name="ll">Latitude and longitude of the user's location. Only specify this field if you have a GPS or other device reported location for the user at the time of check-in.</param>
        /// <param name="llAcc">Accuracy of the user's latitude and longitude, in meters.</param>
        /// <param name="alt">Altitude of the user's location, in meters.</param>
        /// <param name="altAcc">Vertical accuracy of the user's location, in meters.</param>
        public static FourSquareCheckin CheckinAdd(string venueId, string venue, string shout, string broadcast, string ll, string llAcc, string alt, string altAcc, string AccessToken)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();

            if (!alt.Equals(""))
            {
                parameters.Add("alt", alt);
            }
            if (!altAcc.Equals(""))
            {
                parameters.Add("altAcc", altAcc);
            }
            if (!broadcast.Equals(""))
            {
                parameters.Add("broadcast", broadcast);
            }
            if (!ll.Equals(""))
            {
                parameters.Add("ll", ll);
            }
            if (!llAcc.Equals(""))
            {
                parameters.Add("llAcc", llAcc);
            }
            if (!shout.Equals(""))
            {
                parameters.Add("shout", shout);
            }
            if (!venue.Equals(""))
            {
                parameters.Add("venue", venue);
            }
            if (!venueId.Equals(""))
            {
                parameters.Add("venueId", venueId);
            }
            parameters.Add("callback", "XXX");
            parameters.Add("v", Version);
            parameters.Add("oauth_token", AccessToken);

            string strURL = "https://api.foursquare.com/v2/checkins/add?oauth_token=" + AccessToken;
            strURL += "&broadcast=" + broadcast;
            strURL += "&venueId=" + venueId;
            HTTPPost POST = new HTTPPost(new Uri(strURL), parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            FourSquareCheckin CheckinResponse = new FourSquareCheckin(JSONDictionary);
            return CheckinResponse;
        }
Пример #11
0
    /// <summary>
    /// Allows you to check in to a place.
    /// </summary>
    /// <param name="venueId">The venue where the user is checking in. No venueid is needed if shouting or just providing a venue name.</param>
    /// <param name="venue">If are not shouting, but you don't have a venue ID or would rather prefer a 'venueless' checkin</param>
    /// <param name="shout">A message about your check-in. The maximum length of this field is 140 characters.</param>
    /// <param name="Broadcast">Required. How much to broadcast this check-in, ranging from private (off-the-grid) to public,facebook,twitter. Can also be just public or public,facebook, for example. If no valid value is found, the default is public. Shouts cannot be private.</param>
    /// <param name="LL">Latitude and longitude of the user's location. Only specify this field if you have a GPS or other device reported location for the user at the time of check-in.</param>
    public static FourSquareCheckin CheckinAdd(string VenueId, string Venue, string Shout, string Broadcast, string LL, string LLAcc, string Alt, string AltAcc, string AccessToken)
    {
        FourSquareCheckin CheckinResponse = new FourSquareCheckin();

        Dictionary<string, string> parameters = new Dictionary<string, string>();

        if (!Alt.Equals(""))
        {
            parameters.Add("alt", Alt);
        }
        if (!AltAcc.Equals(""))
        {
            parameters.Add("altAcc", AltAcc);
        }
        if (!Broadcast.Equals(""))
        {
            parameters.Add("broadcast", Broadcast);
        }
        if (!LL.Equals(""))
        {
            parameters.Add("ll", LL);
        }
        if (!LLAcc.Equals(""))
        {
            parameters.Add("llAcc", LLAcc);
        }
        if (!Shout.Equals(""))
        {
            parameters.Add("shout", Shout);
        }
        if (!Venue.Equals(""))
        {
            parameters.Add("venue", Venue);
        }
        if (!VenueId.Equals(""))
        {
            parameters.Add("venueId", VenueId);
        }

        parameters.Add("oauth_token", AccessToken);

        HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/checkins/add"), parameters);
        Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);

        CheckinResponse = new FourSquareCheckin(ExtractDictionary(JSONDictionary, "response:checkin"));

        foreach (object Obj in (object[])JSONDictionary["notifications"])
        {
            FourSquareNotification Notification = new FourSquareNotification((Dictionary<string, object>)Obj);
            CheckinResponse.notifications.Add(Notification);
        }
        return CheckinResponse;
    }
Пример #12
0
    /// <summary>
    /// Change a setting for the given user.    
    /// </summary>
    /// <param name="Setting">The name of a setting</param>
    /// <param name="value">required 1 for true, and 0 for false.</param>
    public static Dictionary<string, Object> Settings(FourSquareSettingOptions Setting, bool Value, string AccessToken)
    {
        Dictionary<string, Object> SettingDictionary = new Dictionary<string, Object>();

        if (!(Setting == FourSquareSettingOptions.all))
        {
            string StrValue = "0";
            if (Value)
            {
                StrValue = "1";
            }
            Dictionary<string, string> parameters = new Dictionary<string, string>();

            parameters.Add("callback", "XXX");
            parameters.Add("oauth_token", AccessToken);
            parameters.Add("value", StrValue);

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/settings/" + Setting + "/set"), parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            JSONDictionary = ExtractDictionary(JSONDictionary, "response:settings");
            foreach (object Obj in JSONDictionary)
            {
                SettingDictionary.Add((((KeyValuePair<string, object>)Obj)).Key, (((KeyValuePair<string, object>)Obj)).Value);
            }
        }
        return SettingDictionary;
    }
Пример #13
0
    /// <summary>
    /// Allows you to propose or make a change to a venue.      
    /// </summary>
    /// <param name="VENUE_ID">required The venue id for which an edit is being proposed</param>
    /// <param name="EditType">either edit or proposeedit</param>
    /// <param name="name">The name of the venue.</param>
    /// <param name="address">The address of the venue.</param>
    /// <param name="crossStreet">The nearest intersecting street or streets</param>
    /// <param name="city">The city name where this venue is.</param>
    /// <param name="state">The nearest state or province to the venue.</param>
    /// <param name="zip">The zip or postal code for the venue.</param>
    /// <param name="phone">The phone number of the venue.</param>
    /// <param name="ll">Latitude and longitude of the user's location, as accurate as is known.</param>
    /// <param name="primaryCategoryId">The ID of the category to which you want to assign this venue.</param>
    private static void VenueEditor(string EditType, string VENUE_ID, string name, string address, string crossStreet, string city, string state, string zip, string phone, string ll, string primaryCategoryId, string AccessToken)
    {
        //Venue Edit and Venue ProposeEdit are essentially the same call. Edit requires Superuser privileges.

        Dictionary<string, string> Parameters = new Dictionary<string, string>();

        Parameters.Add("callback", "XXX");
        #region Parameter Conditioning

        //address
        if (!address.Equals(""))
        {
            Parameters.Add("address", address);
        }

        //city
        if (!city.Equals(""))
        {
            Parameters.Add("city", city);
        }

        //crossStreet
        if (!crossStreet.Equals(""))
        {
            Parameters.Add("crossStreet", crossStreet);
        }

        //ll
        if (!ll.Equals(""))
        {
            Parameters.Add("ll", ll);
        }

        //name
        if (!name.Equals(""))
        {
            Parameters.Add("name", name);
        }

        //phone
        if (!phone.Equals(""))
        {
            Parameters.Add("phone", phone);
        }

        //primaryCategoryId
        if (!primaryCategoryId.Equals(""))
        {
            Parameters.Add("primaryCategoryId", primaryCategoryId);
        }

        //state
        if (!state.Equals(""))
        {
            Parameters.Add("state", state);
        }

        //zip
        if (!zip.Equals(""))
        {
            Parameters.Add("zip", zip);
        }

        Parameters.Add("v", "20110704");

        Parameters.Add("oauth_token", AccessToken);

        #endregion Parameter Conditioning

        HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/venues/" + VENUE_ID + "/" + EditType), Parameters);
        //todo: Interpret response.
    }
Пример #14
0
    /// <summary>
    /// Allows users to indicate a venue is incorrect in some way.      
    /// </summary>
    /// <param name="VENUE_ID">required The venue id for which an edit is being proposed.</param>
    /// <param name="problem">required One of mislocated, closed, duplicate.</param>
    public static void VenueFlag(string VENUE_ID, string problem, string AccessToken)
    {
        Dictionary<string, string> Parameters = new Dictionary<string, string>();

        Parameters.Add("callback", "XXX");
        Parameters.Add("oauth_token", AccessToken);

        #region Parameter Conditioning

        //problem
        if (!problem.Equals(""))
        {
            Parameters.Add("problem", problem);
        }

        #endregion Parameter Conditioning

        HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/venues/" + VENUE_ID + "/marktodo"), Parameters);
        Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
        //todo: Test response, return something.
    }
Пример #15
0
        /// <summary>
        /// Change a setting for the given user.    
        /// </summary>
        /// <param name="Setting">The name of a setting</param>
        /// <param name="value">True or False</param>
        public static FourSquareSettings Settings(string Setting, bool Value, string AccessToken)
        {
            Dictionary<string, Object> SettingDictionary = new Dictionary<string, Object>();

            string StrValue = "0";
            if (Value)
            {
                StrValue = "1";
            }
            Dictionary<string, string> parameters = new Dictionary<string, string>();

            parameters.Add("callback", "XXX");
            parameters.Add("v", Version);
            parameters.Add("oauth_token", AccessToken);

            parameters.Add("value", StrValue);

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/settings/" + Setting + "/set"), parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            FourSquareSettings Settings = new FourSquareSettings(JSONDictionary);
            return Settings;
        }
Пример #16
0
        /// <summary>
        /// Allows users to indicate a Special is improper in some way.     
        /// </summary>
        /// <param name="ID">required The id of the special being flagged</param>
        /// <param name="venueId">required The id of the venue running the special.</param>
        /// <param name="problem">required One of not_redeemable, not_valuable, other</param>
        /// <param name="text">Additional text about why the user has flagged this special</param>
        public static bool SpecialFlag(string ID, string venueId, string problem, string text, string AccessToken)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();

            parameters.Add("callback", "XXX");
            parameters.Add("v", Version);
            parameters.Add("oauth_token", AccessToken);

            parameters.Add("venueId", venueId);
            parameters.Add("problem", problem);

            if (!text.Equals(""))
            {
                parameters.Add("text", text);
            }

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/specials/" + ID + "/flag"), parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            if (((Dictionary<string, object>)JSONDictionary["meta"])["code"].ToString().Equals("200"))
            {
                return true;
            }
            return false;
        }
Пример #17
0
        /// <summary>
        /// Changes whether the acting user will receive pings (phone notifications) when the specified user checks in.  
        /// </summary>
        /// <param name="USER_ID">required The user ID of a friend.</param>
        /// <param name="Value">required True or false.</param>
        public static FourSquareUser UserSetPings(string USER_ID, bool Value, string AccessToken)
        {
            Dictionary<string, string> Parameters = new Dictionary<string, string>();

            Parameters.Add("callback", "XXX");
            Parameters.Add("v", Version);
            Parameters.Add("oauth_token", AccessToken);
            if (Value)
            {
                Parameters.Add("value", "True");
            }
            else
            {
                Parameters.Add("value", "False");
            }
            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/users/" + USER_ID + "/setpings"), Parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            return new FourSquareUser(JSONDictionary);
        }
Пример #18
0
        /// <summary>
        /// Allows you to add a new tip at a venue.     
        /// </summary>
        /// <param name="venueId">required The venue where you want to add this tip.</param>
        /// <param name="text">required The text of the tip.</param>
        /// <param name="url">A URL related to this tip.</param>
        public static FourSquareTip TipAdd(string venueId, string text, string url, string AccessToken)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();

            parameters.Add("callback", "XXX");
            parameters.Add("text", text);
            parameters.Add("url", url);
            parameters.Add("v", Version);
            parameters.Add("venueId", venueId);
            parameters.Add("oauth_token", AccessToken);

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/tips/add"), parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            return new FourSquareTip(JSONDictionary);
        }
Пример #19
0
        /// <summary>
        /// Remove commment from check-in   
        /// </summary>
        /// <param name="CHECKIN_ID">The ID of the checkin to remove a comment from.</param>
        /// <param name="commentId">The id of the comment to remove.</param>
        public static FourSquareCheckin CheckinDeleteComment(string CHECKIN_ID, string commentId, string AccessToken)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();

            parameters.Add("callback", "XXX");
            parameters.Add("commentId", commentId);
            parameters.Add("v", Version);
            parameters.Add("oauth_token", AccessToken);

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/checkins/" + CHECKIN_ID + "/deletecomment"), parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            return new FourSquareCheckin(JSONDictionary);
        }
Пример #20
0
        /// <summary>
        /// Denies a pending friend request from another user.     
        /// </summary>
        /// <param name="USER_ID">required The user ID of a pending friend.</param>
        public static FourSquareUser UserDeny(string USER_ID, string AccessToken)
        {
            Dictionary<string, string> Parameters = new Dictionary<string, string>();

            Parameters.Add("callback", "XXX");
            Parameters.Add("v", Version);
            Parameters.Add("oauth_token", AccessToken);

            HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/users/" + USER_ID + "/deny"), Parameters);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            return new FourSquareUser(JSONDictionary);
        }
Пример #21
0
    /// <summary>
    /// Allows users to add a new venue.  
    /// </summary>
    /// <param name="name">required the name of the venue NOTE: One of either a valid address or a geolat/geolong pair must be provided</param>
    /// <param name="address">The address of the venue.</param>
    /// <param name="crossStreet">The nearest intersecting street or streets.</param>
    /// <param name="city">The city name where this venue is.</param>
    /// <param name="state">The nearest state or province to the venue.</param>
    /// <param name="zip">The zip or postal code for the venue.</param>
    /// <param name="phone">The phone number of the venue.</param>
    /// <param name="ll">required Latitude and longitude of the venue, as accurate as is known. NOTE: One of either a valid address or a geolat/geolong pair must be provided</param>
    /// <param name="primaryCategoryId">The ID of the category to which you want to assign this venue.</param>
    public static FourSquareVenue VenueAdd(string name, string address, string crossStreet, string city, string state, string zip, string phone, string ll, string primaryCategoryId, string AccessToken)
    {
        Dictionary<string, string> Parameters = new Dictionary<string, string>();

        Parameters.Add("callback", "XXX");
        Parameters.Add("oauth_token", AccessToken);

        #region Parameter Conditioning

        //address
        if (!address.Equals(""))
        {
            Parameters.Add("address", address);
        }

        //city
        if (!city.Equals(""))
        {
            Parameters.Add("city", city);
        }

        //crossStreet
        if (!crossStreet.Equals(""))
        {
            Parameters.Add("crossStreet", crossStreet);
        }

        //ll
        if (!ll.Equals(""))
        {
            Parameters.Add("ll", ll);
        }

        //name
        if (!name.Equals(""))
        {
            Parameters.Add("name", name);
        }

        //phone
        if (!phone.Equals(""))
        {
            Parameters.Add("phone", phone);
        }

        //primaryCategoryId
        if (!primaryCategoryId.Equals(""))
        {
            Parameters.Add("primaryCategoryId", primaryCategoryId);
        }

        //state
        if (!state.Equals(""))
        {
            Parameters.Add("state", state);
        }

        //zip
        if (!zip.Equals(""))
        {
            Parameters.Add("zip", zip);
        }

        #endregion Parameter Conditioning

        HTTPPost POST = new HTTPPost(new Uri("https://api.foursquare.com/v2/venues/add"), Parameters);

        string SampleReply = "{\"meta\":{\"code\":200},\"response\":{\"venue\":{\"id\":\"4e12000a1f6e671dd9ec9341\",\"name\":\"McLean Park Playground\",\"contact\":{},\"location\":{\"city\":\"Richmond\",\"state\":\"BC\",\"lat\":49.17213,\"lng\":-122.973382,\"distance\":0},\"categories\":[{\"id\":\"4bf58dd8d48988d1e7941735\",\"name\":\"Playground\",\"pluralName\":\"Playgrounds\",\"icon\":\"https://foursquare.com/img/categories/parks_outdoors/playground.png\",\"parents\":[\"Great Outdoors\"],\"primary\":true}],\"verified\":false,\"stats\":{\"checkinsCount\":0,\"usersCount\":0},\"hereNow\":{\"count\":0,\"groups\":[{\"type\":\"friends\",\"name\":\"friends here\",\"count\":0,\"items\":[]},{\"type\":\"others\",\"name\":\"other people here\",\"count\":0,\"items\":[]}]},\"mayor\":{\"count\":0},\"tips\":{\"count\":0,\"groups\":[]},\"tags\":[],\"specials\":[],\"specialsNearby\":[],\"shortUrl\":\"http://4sq.com/mMoxBz\",\"timeZone\":\"America/Vancouver\",\"beenHere\":{\"count\":0},\"photos\":{\"count\":0,\"groups\":[{\"type\":\"checkin\",\"name\":\"friends' checkin photos\",\"count\":0,\"items\":[]},{\"type\":\"venue\",\"name\":\"venue photos\",\"count\":0,\"items\":[]}]},\"todos\":{\"count\":0,\"items\":[]}}}}";
        Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
        JSONDictionary = ExtractDictionary(JSONDictionary, "response:venue");
        return new FourSquareVenue(JSONDictionary);
    }