PastesFromXML() public static method

public static PastesFromXML ( string xml ) : IEnumerable
xml string
return IEnumerable
示例#1
0
        /// <summary>
        /// Lists the currently trending pastes
        /// </summary>
        /// <returns>Enumerable of the trending pastes</returns>
        public static IEnumerable <Paste> ListTrendingPastes()
        {
            var result = Utills.PostRequest(Utills.URL_API,
                                            "api_dev_key=" + DevKey,
                                            "api_option=" + "trends");

            if (result.Contains(Utills.ERROR))
            {
                throw new PastebinException(result);
            }

            return(Utills.PastesFromXML(result));
        }
示例#2
0
        /// <summary>
        /// Lists all pastes created by user
        /// </summary>
        /// <param name="resultsLimit">limits the paste count</param>
        /// <returns>Enumerable of pastes of this user</returns>
        public IEnumerable <Paste> ListPastes(int resultsLimit = 50)
        {
            var result = Utills.PostRequest(Utills.URL_API,
                                            "api_dev_key=" + Pastebin.DevKey,
                                            "api_user_key=" + userKey,
                                            "api_results_limit=" + resultsLimit,
                                            "api_option=" + "list");

            if (result.Contains(Utills.ERROR))
            {
                throw new PastebinException(result);
            }

            return(Utills.PastesFromXML(result));
        }