Exemple #1
0
        /// <summary>
        /// Returns a list of private messages from the specified inbox type.
        /// Note that it will return up to 25 messages, depending on the specified page.
        /// </summary>
        public List <PrivateMessageInformation> GetPrivateMessages(InboxType box = InboxType.Inbox, int page = 1)
        {
            PrivateMessageContainer container = GetPrivateMessageContainer(box, page);

            return(container.PMs);
        }
Exemple #2
0
        /// <summary>
        /// Returns a list of private messages from the specified inbox type.
        /// Note that it will return up to 25 messages, depending on the specified page.
        /// This variant runs asychronously.
        /// </summary>
        public async Task <List <PrivateMessageInformation> > GetPrivateMessagesAsync(InboxType box = InboxType.Inbox, int page = 1)
        {
            PrivateMessageContainer container = await GetPrivateMessageContainerAsync(box, page);

            return(container.PMs);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Initializing API...");
            HF_API api = new HF_API("", "HF-Sharp");

            // Use this if you're running your program on a server or VPN.
            // The parameter passed to 'BypassCaptchaSystem' should be a 2Captcha API Key.

            /*Console.WriteLine("Bypassing captcha system...");
             * api.BypassCaptchaSystem("");*/

            Console.WriteLine("\nTesting GetVersion...");
            Console.WriteLine("Completed. Version #" + api.GetVersion());

            Console.WriteLine("\nTesting GetUserInformation...");
            UserInformation user = api.GetUserInformation(3241222);

            Console.WriteLine("username: "******"\nTesting GetCategoryInformation...");
            CategoryInformation category = api.GetCategoryInformation(151);

            Console.WriteLine("category name: " + category.Name);

            Console.WriteLine("\nTesting GetForumInformation...");
            ForumInformation forum = api.GetForumInformation(208);

            Console.WriteLine("forum name: " + forum.Name);

            Console.WriteLine("\nTesting GetThreadInformation...");
            ThreadInformation thread = api.GetThreadInformation(5665556);

            Console.WriteLine("thread name: " + thread.Subject);

            Console.WriteLine("\nTesting GetPostInformation...");
            PostInformation post = api.GetPostInformation(58564495);

            Console.WriteLine("post message: " + post.Message);

            Console.WriteLine("\nTesting GetPrivateMessageContainer...");
            PrivateMessageContainer privateMessageContainer = api.GetPrivateMessageContainer();

            Console.WriteLine("box information: " + privateMessageContainer.ContainerName + ", " + privateMessageContainer.PageInfo.TotalMessages + " messages");

            Console.WriteLine("\nTesting GetPrivateMessages...");
            List <PrivateMessageInformation> messages = api.GetPrivateMessages();

            Console.WriteLine("got messages: " + messages.Count + " total, first id: " + messages[0].ID);

            Console.WriteLine("\nTesting GetPrivateMessage...");
            PrivateMessage message = api.GetPrivateMessage(messages[0].ID);

            Console.WriteLine("got message: from " + message.FromUsername + ", to " + message.ToUsername + ", subject = " + message.Subject);

            Console.WriteLine("\nTesting GetGroupInformation...");
            GroupInformation group = api.GetGroupInformation(52);

            Console.WriteLine("group: " + group.Name + ", owner: " + group.Owner.Username);

            Console.ReadKey();
        }