BerkanYildiz / XenForo.NET

An open-source C# client library for the XenForo (2) API addon.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XenForo.NET

C# client library for the XenForo (2) API add-on.

Example

namespace XenForo.NET.Example
{
    using System;

    using XenForo.NET;

    public static class Program
    {
        public const string Url             = "https://www.weplaylegit.com/api/";

        public const string ClientId        = "<client id>";
        public const string ClientSecret    = "<client secret>";

        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        public static void Main()
        {
            XenForoConfig Config = new XenForoConfig(Url, ClientId, ClientSecret);
            XenforoApi XenForo   = new XenforoApi(Config);

            XenForo.Authenticate("<username>", "<password>");

            if (XenForo.IsAuthenticated)
            {
                // We are authenticated
				
		User User = XenForo.GetUser(Identifier: 1);

                if (User != null)
                {
                    Console.WriteLine("[*] Username : " + User.Username + ".");
                }
            }
            else
            {
                // We are not authenticated
            }

            Console.ReadKey();
        }
    }
}

Licence

This work is licensed under the MIT License.

About

An open-source C# client library for the XenForo (2) API addon.

License:MIT License


Languages

Language:C# 100.0%