Registered Games and Files CFCore endpoints to main library class.
This commit is contained in:
parent
498bb5a782
commit
0192bd4a21
@ -1,11 +1,28 @@
|
|||||||
namespace CFCoreAPI;
|
using System.Net.Http;
|
||||||
public class CFCoreAPI
|
using CFCoreAPI.Endpoints.Files;
|
||||||
|
using CFCoreAPI.Endpoints.Games;
|
||||||
|
|
||||||
|
namespace CFCoreAPI
|
||||||
{
|
{
|
||||||
private readonly string _apiKey;
|
public class CFCoreAPI
|
||||||
|
|
||||||
|
|
||||||
public CFCoreAPI(string key)
|
|
||||||
{
|
{
|
||||||
this._apiKey = key;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user