using System.Net.Http; using CFCoreAPI.Endpoints.Categories; using CFCoreAPI.Endpoints.Files; using CFCoreAPI.Endpoints.Fingerprints; using CFCoreAPI.Endpoints.Games; using CFCoreAPI.Endpoints.Minecraft; using CFCoreAPI.Endpoints.Mods; namespace CFCoreAPI { public class CFCore { private readonly string _apiKey; public HttpClient HttpClient { get; private set; } public CFCore(string key) { this._apiKey = key; this.HttpClient = new HttpClient(); this.HttpClient.BaseAddress = new Uri("https://api.curseforge.com"); this.HttpClient.DefaultRequestHeaders.Add("x-api-key", _apiKey); this._gamesAPI = new Lazy(() => new GamesAPI(HttpClient)); this._categoriesAPI = new Lazy(() => new CategoriesAPI(HttpClient)); this._modsAPI = new Lazy(() => new ModsAPI(HttpClient)); this._filesAPI = new Lazy(() => new FilesAPI(HttpClient)); this._fingerprintAPI = new Lazy(() => new FingerprintsAPI(HttpClient)); this._minecraftAPI = new Lazy(() => new MinecraftAPI(HttpClient)); } private Lazy _gamesAPI; public GamesAPI Games => this._gamesAPI.Value; private Lazy _categoriesAPI; public CategoriesAPI Categories => this._categoriesAPI.Value; private Lazy _modsAPI; public ModsAPI Mods => this._modsAPI.Value; private Lazy _filesAPI; public FilesAPI Files => this._filesAPI.Value; private Lazy _fingerprintAPI; public FingerprintsAPI Fingerprints => this._fingerprintAPI.Value; private Lazy _minecraftAPI; public MinecraftAPI Minecraft => this._minecraftAPI.Value; } }