Exemple #1
0
        /// <summary>
        /// Gets the authorization info a logged in user
        /// </summary>
        /// <param name="frob"></param>
        /// <returns></returns>
        private static AuthorizedFlickrUser GetAuthorizationInfo(string frob)
        {
            AuthorizedFlickrUser flickrUser = null;

            FlickrMethod method = new FlickrMethod(ApiKey, "flickr.auth.getToken");
            method.AddParameter("frob", frob);

            XmlNode rspNode = null;
            if (method.MakeSignedRequest(SharedSecret, out rspNode))
            {
                foreach (XmlNode outputArg in rspNode.ChildNodes)
                {
                    if (outputArg.Name == "auth")
                    {
                        flickrUser = ParseAuthorizationInfo(outputArg.ChildNodes);
                    }
                }
            }

            authorizedUser = flickrUser;

            return flickrUser;
        }
Exemple #2
0
        /// <summary>
        /// Searches for photos in the given latitude/longitude range.
        /// </summary>
        /// <param name="latLong"></param>
        /// <returns></returns>
        public static FlickrPhotos SearchForPhotos(Rect latLong)
        {
            FlickrMethod method = new FlickrMethod(ApiKey, "flickr.photos.search");
            method.AddParameter("accuracy", "1");
            method.AddParameter("extras", "geo");
            string searchString = latLong.Left + "," + latLong.Top + "," +
                                  latLong.Right + "," + latLong.Bottom;

            method.AddParameter("bbox", searchString);

            FlickrPhotos photos = new FlickrPhotos(method, 50);
            photos.GetPhoto(0); // we call this to force the call to get the total # count

            return photos;
        }
Exemple #3
0
        /// <summary>
        /// Searches for photos based upon the given query string
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public static FlickrPhotos SearchForPhotos(string query)
        {
            FlickrMethod method = new FlickrMethod(ApiKey, "flickr.photos.search");
            method.AddParameter("text", query);
            method.AddParameter("sort", "relevance");

            FlickrPhotos photos = new FlickrPhotos(method, 50);
            photos.GetPhoto(0); // we call this to force the call to get the total # count

            return photos;
        }
Exemple #4
0
        /// <summary>
        /// Posts the given comments about the given photo.
        /// </summary>
        /// <param name="comments"></param>
        /// <param name="photo"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static bool PostComments(string comments, FlickrPhoto photo, AuthorizedFlickrUser user)
        {
            FlickrMethod method = new FlickrMethod(ApiKey, "flickr.photos.comments.addComment",
                                                   user.Token, SharedSecret);
            method.AddParameter("comment_text", comments);
            method.AddParameter("photo_id", photo.ID);

            XmlNode rspNode = null;
            return method.MakeRequest(out rspNode);
        }
Exemple #5
0
        /// <summary>
        /// Gets the info about the given user
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public static XmlNode GetUserInfo(string userid)
        {
            FlickrMethod method = new FlickrMethod(ApiKey, "flickr.people.getInfo");
            method.AddParameter("user_id", userid);

            XmlNode rspNode = null;
            if (method.MakeRequest(out rspNode))
            {
                return rspNode.ChildNodes[0];
            }

            return null;
        }
Exemple #6
0
        /// <summary>
        /// Gets the list of a users most recently updated photos
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static FlickrPhotos GetRecentlyUpdated(AuthorizedFlickrUser user)
        {
            FlickrMethod method = new FlickrMethod(ApiKey,
                                                   "flickr.photos.recentlyUpdated",
                                                   user.Token,
                                                   SharedSecret);

            int updateTime = 1;
            method.AddParameter("min_date", updateTime.ToString());

            FlickrPhotos photos = new FlickrPhotos(method, 50, user);
            photos.GetPhoto(0); // we call this to force the call to get the total # count

            return photos;
        }