Example #1
0
        /// <summary>
        /// Allows users to add a new photo to a checkin, tip, or a venue in general.
        /// All fields are optional, but exactly one of the id fields (checkinId, tipId, venueId) must be passed in. 
        /// </summary>
        /// <param name="checkinId">the ID of a checkin owned by the user</param>
        /// <param name="tipId">the ID of a tip owned by the user</param>
        /// <param name="venueId">the ID of a venue, provided only when adding a public photo of the venue in general, rather than a private checkin or tip photo using the parameters above</param>
        /// <param name="FileName">The name of the file</param>
        /// <param name="fileStream">The FileStream to the photo. Should be an image/jpeg</param>
        /// <param name="broadcast">Whether to broadcast this photo, ranging from twitter if you want to send to twitter, facebook if you want to send to facebook, or twitter,facebook if you want to send to both.</param>
        /// <param name="ll">Latitude and longitude of the user's location.</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 FourSquarePhoto PhotoAdd(string checkinId, string tipId, string venueId, string FileName, FileStream fileStream, string broadcast, string ll, string llAcc, string alt, string altAcc, 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

            //Only one ID. Use the first one found.

            if (!checkinId.Equals(""))
            {
                Parameters.Add("checkinId", checkinId);
            }
            else
            {
                if (!tipId.Equals(""))
                {
                    Parameters.Add("tipId", tipId);
                }
                else
                {
                    Parameters.Add("venueId", venueId);
                }
            }

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

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

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

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

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

            #endregion Parameter Conditioning

            HTTPMultiPartPost POST = new HTTPMultiPartPost("https://api.foursquare.com/v2/photos/add", Parameters, FileName, fileStream);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            return new FourSquarePhoto(JSONDictionary);
        }
Example #2
0
        /// <summary>
        /// Updates the user's profile photo.  
        /// </summary>
        /// <param name="photo ">Photo under 100KB in multipart MIME encoding with content type image/jpeg, image/gif, or image/png.</param>
        public static FourSquareUser UserUpdate(string FileName, FileStream fileStream, string AccessToken)
        {
            Dictionary<string, string> Parameters = new Dictionary<string, string>();

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

            HTTPMultiPartPost POST = new HTTPMultiPartPost("https://api.foursquare.com/v2/users/self/update", Parameters, FileName, fileStream);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(POST.ResponseBody);
            return new FourSquareUser(JSONDictionary);
        }