コード例 #1
0
ファイル: Flickr_Auth.cs プロジェクト: vnisor/FlickrNet
        public string AuthGetFrob()
        {
            CheckSigned();

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

            parameters.Add("method", "flickr.auth.getFrob");

            UnknownResponse response = GetResponseNoCache <UnknownResponse>(parameters);

            return(response.GetXmlDocument().SelectSingleNode("frob/text()").Value);
        }
コード例 #2
0
        /// <summary>
        /// Returns the url to a group's page.
        /// </summary>
        /// <param name="groupId">The NSID of the group to fetch the url for.</param>
        /// <returns>An instance of the <see cref="Uri"/> class containing the URL of the group page.</returns>
        public string UrlsGetGroup(string groupId)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.urls.getGroup");
            parameters.Add("group_id", groupId);

            UnknownResponse response = GetResponseCache <UnknownResponse>(parameters);

            System.Xml.XmlNode node = response.GetXmlDocument().SelectSingleNode("*/@url");
            return(node == null ? null : node.Value.Replace("http://", "https://"));
        }
コード例 #3
0
        /// <summary>
        /// Adds a new comment to a photoset.
        /// </summary>
        /// <param name="photosetId">The ID of the photoset to add the comment to.</param>
        /// <param name="commentText">The text of the comment. Can contain some HTML.</param>
        /// <returns>The new ID of the created comment.</returns>
        public string PhotosetsCommentsAddComment(string photosetId, string commentText)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photosets.comments.addComment");
            parameters.Add("photoset_id", photosetId);
            parameters.Add("comment_text", commentText);

            UnknownResponse response = GetResponseNoCache <UnknownResponse>(parameters);

            System.Xml.XmlNode nav = response.GetXmlDocument().SelectSingleNode("*/@id");
            return(nav == null ? null : nav.Value);
        }
コード例 #4
0
        /// <summary>
        /// Returns a group NSID, given the url to a group's page or photo pool.
        /// </summary>
        /// <param name="urlToFind">The url to the group's page or photo pool.</param>
        /// <returns>The ID of the group at the specified URL on success, a null reference (Nothing in Visual Basic) if the group cannot be found.</returns>
        public string UrlsLookupGroup(string urlToFind)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.urls.lookupGroup");
            parameters.Add("api_key", apiKey);
            parameters.Add("url", urlToFind);

            UnknownResponse response = GetResponseCache <UnknownResponse>(parameters);

            System.Xml.XmlNode nav = response.GetXmlDocument().SelectSingleNode("*/@id");
            return(nav == null ? null : nav.Value.Replace("http://", "https://"));
        }
コード例 #5
0
        /// <summary>
        /// Returns the url to a user's profile.
        /// </summary>
        /// <param name="userId">The NSID of the user to fetch the url for. If omitted, the calling user is assumed.</param>
        /// <returns>An instance of the <see cref="Uri"/> class containing the URL for the users profile.</returns>
        public string UrlsGetUserProfile(string userId)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.urls.getUserProfile");
            if (userId != null && userId.Length > 0)
            {
                parameters.Add("user_id", userId);
            }

            UnknownResponse response = GetResponseCache <UnknownResponse>(parameters);

            System.Xml.XmlNode nav = response.GetXmlDocument().SelectSingleNode("*/@url");
            return(nav == null ? null : nav.Value.Replace("http://", "https://"));
        }
コード例 #6
0
ファイル: Flickr_Panda.cs プロジェクト: Rokkot/smallstuff
        /// <summary>
        /// Get a list of current 'Pandas' supported by Flickr.
        /// </summary>
        /// <returns>An array of panda names.</returns>
        public string[] PandaGetList()
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.panda.getList");

            UnknownResponse response = GetResponseCache <UnknownResponse>(parameters);

            var pandas = new List <string>();

            foreach (System.Xml.XmlNode n in response.GetXmlDocument().SelectNodes("//panda/text()"))
            {
                pandas.Add(n.Value);
            }
            return(pandas.ToArray());
        }
コード例 #7
0
ファイル: Flickr_Notes.cs プロジェクト: Rokkot/smallstuff
        /// <summary>
        /// Add a note to a picture.
        /// </summary>
        /// <param name="photoId">The photo id to add the note to.</param>
        /// <param name="noteX">The X co-ordinate of the upper left corner of the note.</param>
        /// <param name="noteY">The Y co-ordinate of the upper left corner of the note.</param>
        /// <param name="noteWidth">The width of the note.</param>
        /// <param name="noteHeight">The height of the note.</param>
        /// <param name="noteText">The text in the note.</param>
        /// <returns></returns>
        public string PhotosNotesAdd(string photoId, int noteX, int noteY, int noteWidth, int noteHeight, string noteText)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photos.notes.add");
            parameters.Add("photo_id", photoId);
            parameters.Add("note_x", noteX.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("note_y", noteY.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("note_w", noteWidth.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("note_h", noteHeight.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("note_text", noteText);

            UnknownResponse response = GetResponseCache <UnknownResponse>(parameters);

            System.Xml.XmlNode node = response.GetXmlDocument().SelectSingleNode("*/@id");
            return(node == null ? null : node.Value);
        }
コード例 #8
0
        /// <summary>
        /// Gets the currently authenticated users default safety level.
        /// </summary>
        /// <returns></returns>
        public SafetyLevel PrefsGetSafetyLevel()
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.prefs.getSafetyLevel");

            UnknownResponse response = GetResponseCache <UnknownResponse>(parameters);

            System.Xml.XmlNode nav = response.GetXmlDocument().SelectSingleNode("*/@safety_level");
            if (nav == null)
            {
                throw new ParsingException("Unable to find safety level in returned XML.");
            }

            return((SafetyLevel)int.Parse(nav.Value, System.Globalization.NumberFormatInfo.InvariantInfo));
        }
コード例 #9
0
ファイル: Flickr_Prefs.cs プロジェクト: vnisor/FlickrNet
        /// <summary>
        /// Gets the currently authenticated users default hidden from search setting.
        /// </summary>
        /// <returns></returns>
        public HiddenFromSearch PrefsGetHidden()
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.prefs.getHidden");

            UnknownResponse response = GetResponseCache <UnknownResponse>(parameters);

            System.Xml.XmlNode nav = response.GetXmlDocument().SelectSingleNode("*/@hidden");
            if (nav == null)
            {
                throw new ParsingException("Unable to find hidden preference in returned XML.");
            }

            return((HiddenFromSearch)int.Parse(nav.Value, System.Globalization.NumberFormatInfo.InvariantInfo));
        }