2022-05-20 03:27:18 +00:00
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using CFCoreAPI.Endpoints.Files;
|
|
|
|
|
using CFCoreAPI.Endpoints.Games;
|
2022-05-20 03:10:12 +00:00
|
|
|
|
|
2022-05-20 03:27:18 +00:00
|
|
|
|
namespace CFCoreAPI
|
|
|
|
|
{
|
|
|
|
|
public class CFCoreAPI
|
2022-05-20 03:10:12 +00:00
|
|
|
|
{
|
2022-05-20 03:27:18 +00:00
|
|
|
|
private readonly string _apiKey;
|
|
|
|
|
public HttpClient HttpClient { get; private set; }
|
|
|
|
|
|
|
|
|
|
public CFCoreAPI(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<GamesAPI>(() => new GamesAPI(HttpClient));
|
|
|
|
|
this._filesAPI = new Lazy<FilesAPI>(() => new FilesAPI(HttpClient));
|
|
|
|
|
}
|
|
|
|
|
private Lazy<GamesAPI> _gamesAPI;
|
|
|
|
|
public GamesAPI GamesAPI => this._gamesAPI.Value;
|
|
|
|
|
private Lazy<FilesAPI> _filesAPI;
|
|
|
|
|
public FilesAPI FilesAPI => this._filesAPI.Value;
|
2022-05-20 03:10:12 +00:00
|
|
|
|
}
|
2022-05-20 03:27:18 +00:00
|
|
|
|
|
|
|
|
|
}
|