Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
244a207a17 | |||
311026fc3d | |||
ad7a05ad19 | |||
e4d4134ef2 | |||
2b9bd4dc26 | |||
0192bd4a21 | |||
498bb5a782 | |||
4fcbc53daa | |||
85d2c2cbda |
26
.vscode/launch.json
vendored
Normal file
26
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||
"name": ".NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/CFCoreAPI.Tests/bin/Debug/net6.0/CFCoreAPI.Tests.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/CFCoreAPI.Tests",
|
||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||
"console": "internalConsole",
|
||||
"stopAtEntry": false
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"Minecraft"
|
||||
]
|
||||
}
|
41
.vscode/tasks.json
vendored
Normal file
41
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/CFCoreAPI.Tests/CFCoreAPI.Tests.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/CFCoreAPI.Tests/CFCoreAPI.Tests.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/CFCoreAPI.Tests/CFCoreAPI.Tests.csproj"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
44
CFCoreAPI/CFCore.cs
Normal file
44
CFCoreAPI/CFCore.cs
Normal file
@ -0,0 +1,44 @@
|
||||
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<GamesAPI>(() => new GamesAPI(HttpClient));
|
||||
this._categoriesAPI = new Lazy<CategoriesAPI>(() => new CategoriesAPI(HttpClient));
|
||||
this._modsAPI = new Lazy<ModsAPI>(() => new ModsAPI(HttpClient));
|
||||
this._filesAPI = new Lazy<FilesAPI>(() => new FilesAPI(HttpClient));
|
||||
this._fingerprintAPI = new Lazy<FingerprintsAPI>(() => new FingerprintsAPI(HttpClient));
|
||||
this._minecraftAPI = new Lazy<MinecraftAPI>(() => new MinecraftAPI(HttpClient));
|
||||
}
|
||||
private Lazy<GamesAPI> _gamesAPI;
|
||||
public GamesAPI Games => this._gamesAPI.Value;
|
||||
private Lazy<CategoriesAPI> _categoriesAPI;
|
||||
public CategoriesAPI Categories => this._categoriesAPI.Value;
|
||||
private Lazy<ModsAPI> _modsAPI;
|
||||
public ModsAPI Mods => this._modsAPI.Value;
|
||||
private Lazy<FilesAPI> _filesAPI;
|
||||
public FilesAPI Files => this._filesAPI.Value;
|
||||
private Lazy<FingerprintsAPI> _fingerprintAPI;
|
||||
public FingerprintsAPI Fingerprints => this._fingerprintAPI.Value;
|
||||
private Lazy<MinecraftAPI> _minecraftAPI;
|
||||
public MinecraftAPI Minecraft => this._minecraftAPI.Value;
|
||||
}
|
||||
|
||||
}
|
@ -6,4 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,5 +0,0 @@
|
||||
namespace CFCoreAPI;
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
13
CFCoreAPI/Endpoints/APIBase.cs
Normal file
13
CFCoreAPI/Endpoints/APIBase.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
namespace CFCoreAPI.Endpoints
|
||||
{
|
||||
public abstract class APIBase
|
||||
{
|
||||
protected HttpClient httpClient;
|
||||
public APIBase(HttpClient httpClient)
|
||||
{
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
}
|
||||
}
|
28
CFCoreAPI/Endpoints/Categories/CategoriesAPI.cs
Normal file
28
CFCoreAPI/Endpoints/Categories/CategoriesAPI.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.Text.Json;
|
||||
using CFCoreAPI.Endpoints.Categories.Responses;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Categories
|
||||
{
|
||||
public class CategoriesAPI : APIBase
|
||||
{
|
||||
public CategoriesAPI(HttpClient httpClient) : base(httpClient)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<CategoriesResponse> GetCategories(int gameId, int? classId)
|
||||
{
|
||||
string url = "/v1/categories";
|
||||
url = QueryHelpers.AddQueryString(url, "gameId", gameId.ToString());
|
||||
if (classId != null) url = QueryHelpers.AddQueryString(url, "classId", classId.ToString());
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
|
||||
CategoriesResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = (await JsonSerializer.DeserializeAsync<CategoriesResponse>(contentStream))!;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Categories.Responses
|
||||
{
|
||||
public class CategoriesResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public CategoriesResponse(
|
||||
List<DataModel> data
|
||||
)
|
||||
{
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
public IReadOnlyList<DataModel> Data { get; }
|
||||
|
||||
public class DataModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DataModel(
|
||||
int id,
|
||||
int gameId,
|
||||
string name,
|
||||
string slug,
|
||||
string url,
|
||||
string iconUrl,
|
||||
DateTime dateModified,
|
||||
bool isClass,
|
||||
int classId,
|
||||
int parentCategoryId,
|
||||
int displayIndex
|
||||
)
|
||||
{
|
||||
this.Id = id;
|
||||
this.GameId = gameId;
|
||||
this.Name = name;
|
||||
this.Slug = slug;
|
||||
this.Url = url;
|
||||
this.IconUrl = iconUrl;
|
||||
this.DateModified = dateModified;
|
||||
this.IsClass = isClass;
|
||||
this.ClassId = classId;
|
||||
this.ParentCategoryId = parentCategoryId;
|
||||
this.DisplayIndex = displayIndex;
|
||||
}
|
||||
|
||||
public int Id { get; }
|
||||
public int GameId { get; }
|
||||
public string Name { get; }
|
||||
public string Slug { get; }
|
||||
public string Url { get; }
|
||||
public string IconUrl { get; }
|
||||
public DateTime DateModified { get; }
|
||||
public bool IsClass { get; }
|
||||
public int ClassId { get; }
|
||||
public int ParentCategoryId { get; }
|
||||
public int DisplayIndex { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
89
CFCoreAPI/Endpoints/Files/FilesAPI.cs
Normal file
89
CFCoreAPI/Endpoints/Files/FilesAPI.cs
Normal file
@ -0,0 +1,89 @@
|
||||
using System.Text.Json;
|
||||
using CFCoreAPI.Endpoints.Files.Requests;
|
||||
using CFCoreAPI.Endpoints.Files.Responses;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Files
|
||||
{
|
||||
public class FilesAPI : APIBase
|
||||
{
|
||||
public FilesAPI(HttpClient httpClient) : base(httpClient)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<ModFileResponse> GetModFileAsync(int modId, int fileId)
|
||||
{
|
||||
string url = "/v1/mods/{0}/files/{1}";
|
||||
string.Format(url, modId, fileId);
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
|
||||
ModFileResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = await JsonSerializer.DeserializeAsync<ModFileResponse>(contentStream);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<ModFilesResponse> GetModFilesAsync(int modId, string? gameVersion = null, ModLoaderType? modLoaderType = null, int? gameVersionTypeId = null, int? index = null, int? pageSize = null)
|
||||
{
|
||||
string url = "/v1/mods/{0}/files";
|
||||
string.Format(url, modId);
|
||||
if (gameVersion != null) QueryHelpers.AddQueryString(url, "gameVersion", gameVersion);
|
||||
if (modLoaderType != null) QueryHelpers.AddQueryString(url, "modLoaderType", ((int)modLoaderType.Value).ToString());
|
||||
if (gameVersionTypeId != null) QueryHelpers.AddQueryString(url, "gameVersionTypeId", gameVersionTypeId.ToString());
|
||||
if (index != null) QueryHelpers.AddQueryString(url, "index", index.ToString());
|
||||
if (pageSize != null) QueryHelpers.AddQueryString(url, "pageSize", pageSize.ToString());
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
|
||||
ModFilesResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = await JsonSerializer.DeserializeAsync<ModFilesResponse>(contentStream);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<FileResponse> GetFilesAsync(ModFilesRequest request)
|
||||
{
|
||||
string url = "/v1/mods/files";
|
||||
HttpContent content = new StringContent(JsonSerializer.Serialize(request));
|
||||
HttpResponseMessage response = await httpClient.PostAsync(url, content);
|
||||
|
||||
FileResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = await JsonSerializer.DeserializeAsync<FileResponse>(contentStream);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<StringResponse> GetModFileChangelog(int modId, int field)
|
||||
{
|
||||
string url = "/v1/mods/{0}/files/{1}/changelog";
|
||||
string.Format(url, modId, field);
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
|
||||
StringResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = await JsonSerializer.DeserializeAsync<StringResponse>(contentStream);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<StringResponse> GetModFileDownloadURL(int modId, int field)
|
||||
{
|
||||
string url = "/v1/mods/{0}/files/{1}/download-url";
|
||||
string.Format(url, modId, field);
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
|
||||
StringResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = await JsonSerializer.DeserializeAsync<StringResponse>(contentStream);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
19
CFCoreAPI/Endpoints/Files/Requests/ModFilesRequest.cs
Normal file
19
CFCoreAPI/Endpoints/Files/Requests/ModFilesRequest.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Files.Requests
|
||||
{
|
||||
public class ModFilesRequest
|
||||
{
|
||||
[JsonConstructor]
|
||||
public ModFilesRequest(
|
||||
List<int> modIds
|
||||
)
|
||||
{
|
||||
this.ModIds = modIds;
|
||||
}
|
||||
|
||||
public IReadOnlyList<int> ModIds { get; }
|
||||
}
|
||||
|
||||
|
||||
}
|
172
CFCoreAPI/Endpoints/Files/Responses/FileResponse.cs
Normal file
172
CFCoreAPI/Endpoints/Files/Responses/FileResponse.cs
Normal file
@ -0,0 +1,172 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Files.Responses
|
||||
{
|
||||
public struct FileResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public FileResponse(
|
||||
List<DataModel> data
|
||||
)
|
||||
{
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
public IReadOnlyList<DataModel> Data { get; }
|
||||
|
||||
public struct DataModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DataModel(
|
||||
int id,
|
||||
int gameId,
|
||||
int modId,
|
||||
bool isAvailable,
|
||||
string displayName,
|
||||
string fileName,
|
||||
int releaseType,
|
||||
int fileStatus,
|
||||
List<HashModel> hashes,
|
||||
DateTime fileDate,
|
||||
int fileLength,
|
||||
int downloadCount,
|
||||
string downloadUrl,
|
||||
List<string> gameVersions,
|
||||
List<SortableGameVersion> sortableGameVersions,
|
||||
List<DependencyModel> dependencies,
|
||||
bool exposeAsAlternative,
|
||||
int parentProjectFileId,
|
||||
int alternateFileId,
|
||||
bool isServerPack,
|
||||
int serverPackFileId,
|
||||
int fileFingerprint,
|
||||
List<ModuleModel> modules
|
||||
)
|
||||
{
|
||||
this.Id = id;
|
||||
this.GameId = gameId;
|
||||
this.ModId = modId;
|
||||
this.IsAvailable = isAvailable;
|
||||
this.DisplayName = displayName;
|
||||
this.FileName = fileName;
|
||||
this.ReleaseType = releaseType;
|
||||
this.FileStatus = fileStatus;
|
||||
this.Hashes = hashes;
|
||||
this.FileDate = fileDate;
|
||||
this.FileLength = fileLength;
|
||||
this.DownloadCount = downloadCount;
|
||||
this.DownloadUrl = downloadUrl;
|
||||
this.GameVersions = gameVersions;
|
||||
this.SortableGameVersions = sortableGameVersions;
|
||||
this.Dependencies = dependencies;
|
||||
this.ExposeAsAlternative = exposeAsAlternative;
|
||||
this.ParentProjectFileId = parentProjectFileId;
|
||||
this.AlternateFileId = alternateFileId;
|
||||
this.IsServerPack = isServerPack;
|
||||
this.ServerPackFileId = serverPackFileId;
|
||||
this.FileFingerprint = fileFingerprint;
|
||||
this.Modules = modules;
|
||||
}
|
||||
|
||||
public int Id { get; }
|
||||
public int GameId { get; }
|
||||
public int ModId { get; }
|
||||
public bool IsAvailable { get; }
|
||||
public string DisplayName { get; }
|
||||
public string FileName { get; }
|
||||
public int ReleaseType { get; }
|
||||
public int FileStatus { get; }
|
||||
public IReadOnlyList<HashModel> Hashes { get; }
|
||||
public DateTime FileDate { get; }
|
||||
public int FileLength { get; }
|
||||
public int DownloadCount { get; }
|
||||
public string DownloadUrl { get; }
|
||||
public IReadOnlyList<string> GameVersions { get; }
|
||||
public IReadOnlyList<SortableGameVersion> SortableGameVersions { get; }
|
||||
public IReadOnlyList<DependencyModel> Dependencies { get; }
|
||||
public bool ExposeAsAlternative { get; }
|
||||
public int ParentProjectFileId { get; }
|
||||
public int AlternateFileId { get; }
|
||||
public bool IsServerPack { get; }
|
||||
public int ServerPackFileId { get; }
|
||||
public int FileFingerprint { get; }
|
||||
public IReadOnlyList<ModuleModel> Modules { get; }
|
||||
}
|
||||
|
||||
public struct DependencyModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DependencyModel(
|
||||
int modId,
|
||||
int relationType
|
||||
)
|
||||
{
|
||||
this.ModId = modId;
|
||||
this.RelationType = relationType;
|
||||
}
|
||||
|
||||
public int ModId { get; }
|
||||
public int RelationType { get; }
|
||||
}
|
||||
|
||||
public struct HashModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public HashModel(
|
||||
string value,
|
||||
int algo
|
||||
)
|
||||
{
|
||||
this.Value = value;
|
||||
this.Algo = algo;
|
||||
}
|
||||
|
||||
public string Value { get; }
|
||||
public int Algo { get; }
|
||||
}
|
||||
|
||||
public struct ModuleModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public ModuleModel(
|
||||
string name,
|
||||
int fingerprint
|
||||
)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Fingerprint = fingerprint;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
public int Fingerprint { get; }
|
||||
}
|
||||
|
||||
public struct SortableGameVersion
|
||||
{
|
||||
[JsonConstructor]
|
||||
public SortableGameVersion(
|
||||
string gameVersionName,
|
||||
string gameVersionPadded,
|
||||
string gameVersion,
|
||||
DateTime gameVersionReleaseDate,
|
||||
int gameVersionTypeId
|
||||
)
|
||||
{
|
||||
this.GameVersionName = gameVersionName;
|
||||
this.GameVersionPadded = gameVersionPadded;
|
||||
this.GameVersion = gameVersion;
|
||||
this.GameVersionReleaseDate = gameVersionReleaseDate;
|
||||
this.GameVersionTypeId = gameVersionTypeId;
|
||||
}
|
||||
|
||||
public string GameVersionName { get; }
|
||||
public string GameVersionPadded { get; }
|
||||
public string GameVersion { get; }
|
||||
public DateTime GameVersionReleaseDate { get; }
|
||||
public int GameVersionTypeId { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
173
CFCoreAPI/Endpoints/Files/Responses/ModFileResponse.cs
Normal file
173
CFCoreAPI/Endpoints/Files/Responses/ModFileResponse.cs
Normal file
@ -0,0 +1,173 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Files.Responses
|
||||
{
|
||||
|
||||
|
||||
public struct ModFileResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public ModFileResponse(
|
||||
DataModel data
|
||||
)
|
||||
{
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
public DataModel Data { get; }
|
||||
|
||||
public struct DataModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DataModel(
|
||||
int id,
|
||||
int gameId,
|
||||
int modId,
|
||||
bool isAvailable,
|
||||
string displayName,
|
||||
string fileName,
|
||||
int releaseType,
|
||||
int fileStatus,
|
||||
List<HashModel> hashes,
|
||||
DateTime fileDate,
|
||||
int fileLength,
|
||||
int downloadCount,
|
||||
string downloadUrl,
|
||||
List<string> gameVersions,
|
||||
List<SortableGameVersionModel> sortableGameVersions,
|
||||
List<DependencyModel> dependencies,
|
||||
bool exposeAsAlternative,
|
||||
int parentProjectFileId,
|
||||
int alternateFileId,
|
||||
bool isServerPack,
|
||||
int serverPackFileId,
|
||||
int fileFingerprint,
|
||||
List<ModuleModel> modules
|
||||
)
|
||||
{
|
||||
this.Id = id;
|
||||
this.GameId = gameId;
|
||||
this.ModId = modId;
|
||||
this.IsAvailable = isAvailable;
|
||||
this.DisplayName = displayName;
|
||||
this.FileName = fileName;
|
||||
this.ReleaseType = releaseType;
|
||||
this.FileStatus = fileStatus;
|
||||
this.Hashes = hashes;
|
||||
this.FileDate = fileDate;
|
||||
this.FileLength = fileLength;
|
||||
this.DownloadCount = downloadCount;
|
||||
this.DownloadUrl = downloadUrl;
|
||||
this.GameVersions = gameVersions;
|
||||
this.SortableGameVersions = sortableGameVersions;
|
||||
this.Dependencies = dependencies;
|
||||
this.ExposeAsAlternative = exposeAsAlternative;
|
||||
this.ParentProjectFileId = parentProjectFileId;
|
||||
this.AlternateFileId = alternateFileId;
|
||||
this.IsServerPack = isServerPack;
|
||||
this.ServerPackFileId = serverPackFileId;
|
||||
this.FileFingerprint = fileFingerprint;
|
||||
this.Modules = modules;
|
||||
}
|
||||
|
||||
public int Id { get; }
|
||||
public int GameId { get; }
|
||||
public int ModId { get; }
|
||||
public bool IsAvailable { get; }
|
||||
public string DisplayName { get; }
|
||||
public string FileName { get; }
|
||||
public int ReleaseType { get; }
|
||||
public int FileStatus { get; }
|
||||
public IReadOnlyList<HashModel> Hashes { get; }
|
||||
public DateTime FileDate { get; }
|
||||
public int FileLength { get; }
|
||||
public int DownloadCount { get; }
|
||||
public string DownloadUrl { get; }
|
||||
public IReadOnlyList<string> GameVersions { get; }
|
||||
public IReadOnlyList<SortableGameVersionModel> SortableGameVersions { get; }
|
||||
public IReadOnlyList<DependencyModel> Dependencies { get; }
|
||||
public bool ExposeAsAlternative { get; }
|
||||
public int ParentProjectFileId { get; }
|
||||
public int AlternateFileId { get; }
|
||||
public bool IsServerPack { get; }
|
||||
public int ServerPackFileId { get; }
|
||||
public int FileFingerprint { get; }
|
||||
public IReadOnlyList<ModuleModel> Modules { get; }
|
||||
}
|
||||
|
||||
public struct DependencyModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DependencyModel(
|
||||
int modId,
|
||||
int relationType
|
||||
)
|
||||
{
|
||||
this.ModId = modId;
|
||||
this.RelationType = relationType;
|
||||
}
|
||||
|
||||
public int ModId { get; }
|
||||
public int RelationType { get; }
|
||||
}
|
||||
|
||||
public struct HashModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public HashModel(
|
||||
string value,
|
||||
int algo
|
||||
)
|
||||
{
|
||||
this.Value = value;
|
||||
this.Algo = algo;
|
||||
}
|
||||
|
||||
public string Value { get; }
|
||||
public int Algo { get; }
|
||||
}
|
||||
|
||||
public struct ModuleModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public ModuleModel(
|
||||
string name,
|
||||
int fingerprint
|
||||
)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Fingerprint = fingerprint;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
public int Fingerprint { get; }
|
||||
}
|
||||
public struct SortableGameVersionModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public SortableGameVersionModel(
|
||||
string gameVersionName,
|
||||
string gameVersionPadded,
|
||||
string gameVersion,
|
||||
DateTime gameVersionReleaseDate,
|
||||
int gameVersionTypeId
|
||||
)
|
||||
{
|
||||
this.GameVersionName = gameVersionName;
|
||||
this.GameVersionPadded = gameVersionPadded;
|
||||
this.GameVersion = gameVersion;
|
||||
this.GameVersionReleaseDate = gameVersionReleaseDate;
|
||||
this.GameVersionTypeId = gameVersionTypeId;
|
||||
}
|
||||
|
||||
public string GameVersionName { get; }
|
||||
public string GameVersionPadded { get; }
|
||||
public string GameVersion { get; }
|
||||
public DateTime GameVersionReleaseDate { get; }
|
||||
public int GameVersionTypeId { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
197
CFCoreAPI/Endpoints/Files/Responses/ModFilesResponse.cs
Normal file
197
CFCoreAPI/Endpoints/Files/Responses/ModFilesResponse.cs
Normal file
@ -0,0 +1,197 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Files.Responses
|
||||
{
|
||||
|
||||
|
||||
public struct ModFilesResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public ModFilesResponse(
|
||||
List<DataModel> data,
|
||||
PaginationModel pagination
|
||||
)
|
||||
{
|
||||
this.Data = data;
|
||||
this.Pagination = pagination;
|
||||
}
|
||||
|
||||
public IReadOnlyList<DataModel> Data { get; }
|
||||
public PaginationModel Pagination { get; }
|
||||
public struct DataModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DataModel(
|
||||
int id,
|
||||
int gameId,
|
||||
int modId,
|
||||
bool isAvailable,
|
||||
string displayName,
|
||||
string fileName,
|
||||
int releaseType,
|
||||
int fileStatus,
|
||||
List<HashModel> hashes,
|
||||
DateTime fileDate,
|
||||
int fileLength,
|
||||
int downloadCount,
|
||||
string downloadUrl,
|
||||
List<string> gameVersions,
|
||||
List<SortableGameVersionModel> sortableGameVersions,
|
||||
List<DependencyModel> dependencies,
|
||||
bool exposeAsAlternative,
|
||||
int parentProjectFileId,
|
||||
int alternateFileId,
|
||||
bool isServerPack,
|
||||
int serverPackFileId,
|
||||
int fileFingerprint,
|
||||
List<ModuleModel> modules
|
||||
)
|
||||
{
|
||||
this.Id = id;
|
||||
this.GameId = gameId;
|
||||
this.ModId = modId;
|
||||
this.IsAvailable = isAvailable;
|
||||
this.DisplayName = displayName;
|
||||
this.FileName = fileName;
|
||||
this.ReleaseType = releaseType;
|
||||
this.FileStatus = fileStatus;
|
||||
this.Hashes = hashes;
|
||||
this.FileDate = fileDate;
|
||||
this.FileLength = fileLength;
|
||||
this.DownloadCount = downloadCount;
|
||||
this.DownloadUrl = downloadUrl;
|
||||
this.GameVersions = gameVersions;
|
||||
this.SortableGameVersions = sortableGameVersions;
|
||||
this.Dependencies = dependencies;
|
||||
this.ExposeAsAlternative = exposeAsAlternative;
|
||||
this.ParentProjectFileId = parentProjectFileId;
|
||||
this.AlternateFileId = alternateFileId;
|
||||
this.IsServerPack = isServerPack;
|
||||
this.ServerPackFileId = serverPackFileId;
|
||||
this.FileFingerprint = fileFingerprint;
|
||||
this.Modules = modules;
|
||||
}
|
||||
|
||||
public int Id { get; }
|
||||
public int GameId { get; }
|
||||
public int ModId { get; }
|
||||
public bool IsAvailable { get; }
|
||||
public string DisplayName { get; }
|
||||
public string FileName { get; }
|
||||
public int ReleaseType { get; }
|
||||
public int FileStatus { get; }
|
||||
public IReadOnlyList<HashModel> Hashes { get; }
|
||||
public DateTime FileDate { get; }
|
||||
public int FileLength { get; }
|
||||
public int DownloadCount { get; }
|
||||
public string DownloadUrl { get; }
|
||||
public IReadOnlyList<string> GameVersions { get; }
|
||||
public IReadOnlyList<SortableGameVersionModel> SortableGameVersions { get; }
|
||||
public IReadOnlyList<DependencyModel> Dependencies { get; }
|
||||
public bool ExposeAsAlternative { get; }
|
||||
public int ParentProjectFileId { get; }
|
||||
public int AlternateFileId { get; }
|
||||
public bool IsServerPack { get; }
|
||||
public int ServerPackFileId { get; }
|
||||
public int FileFingerprint { get; }
|
||||
public IReadOnlyList<ModuleModel> Modules { get; }
|
||||
}
|
||||
|
||||
public struct DependencyModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DependencyModel(
|
||||
int modId,
|
||||
int relationType
|
||||
)
|
||||
{
|
||||
this.ModId = modId;
|
||||
this.RelationType = relationType;
|
||||
}
|
||||
|
||||
public int ModId { get; }
|
||||
public int RelationType { get; }
|
||||
}
|
||||
|
||||
public struct HashModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public HashModel(
|
||||
string value,
|
||||
int algo
|
||||
)
|
||||
{
|
||||
this.Value = value;
|
||||
this.Algo = algo;
|
||||
}
|
||||
|
||||
public string Value { get; }
|
||||
public int Algo { get; }
|
||||
}
|
||||
|
||||
public struct ModuleModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public ModuleModel(
|
||||
string name,
|
||||
int fingerprint
|
||||
)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Fingerprint = fingerprint;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
public int Fingerprint { get; }
|
||||
}
|
||||
|
||||
public struct PaginationModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public PaginationModel(
|
||||
int index,
|
||||
int pageSize,
|
||||
int resultCount,
|
||||
int totalCount
|
||||
)
|
||||
{
|
||||
this.Index = index;
|
||||
this.PageSize = pageSize;
|
||||
this.ResultCount = resultCount;
|
||||
this.TotalCount = totalCount;
|
||||
}
|
||||
|
||||
public int Index { get; }
|
||||
public int PageSize { get; }
|
||||
public int ResultCount { get; }
|
||||
public int TotalCount { get; }
|
||||
}
|
||||
public struct SortableGameVersionModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public SortableGameVersionModel(
|
||||
string gameVersionName,
|
||||
string gameVersionPadded,
|
||||
string gameVersion,
|
||||
DateTime gameVersionReleaseDate,
|
||||
int gameVersionTypeId
|
||||
)
|
||||
{
|
||||
this.GameVersionName = gameVersionName;
|
||||
this.GameVersionPadded = gameVersionPadded;
|
||||
this.GameVersion = gameVersion;
|
||||
this.GameVersionReleaseDate = gameVersionReleaseDate;
|
||||
this.GameVersionTypeId = gameVersionTypeId;
|
||||
}
|
||||
|
||||
public string GameVersionName { get; }
|
||||
public string GameVersionPadded { get; }
|
||||
public string GameVersion { get; }
|
||||
public DateTime GameVersionReleaseDate { get; }
|
||||
public int GameVersionTypeId { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
11
CFCoreAPI/Endpoints/Files/Responses/ModLoaderType.cs
Normal file
11
CFCoreAPI/Endpoints/Files/Responses/ModLoaderType.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace CFCoreAPI
|
||||
{
|
||||
public enum ModLoaderType : int
|
||||
{
|
||||
Any = 0,
|
||||
Forge = 1,
|
||||
Cauldron = 2,
|
||||
LiteLoader = 3,
|
||||
Fabric = 4
|
||||
}
|
||||
}
|
10
CFCoreAPI/Endpoints/Fingerprints/FingerprintsAPI.cs
Normal file
10
CFCoreAPI/Endpoints/Fingerprints/FingerprintsAPI.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace CFCoreAPI.Endpoints.Fingerprints
|
||||
{
|
||||
public class FingerprintsAPI : APIBase
|
||||
{
|
||||
public FingerprintsAPI(HttpClient httpClient) : base(httpClient)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
73
CFCoreAPI/Endpoints/Games/GamesAPI.cs
Normal file
73
CFCoreAPI/Endpoints/Games/GamesAPI.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System.Net.Http;
|
||||
using CFCoreAPI.Endpoints;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using CFCoreAPI.Endpoints.Games.Responses;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Games
|
||||
{
|
||||
public class GamesAPI : APIBase
|
||||
{
|
||||
public GamesAPI(HttpClient httpClient) : base(httpClient)
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: Likely should move generic calls to extension method or private helper method.
|
||||
public async Task<GamesResponse> GetGamesAsync(int? index = null, int? pageSize = null)
|
||||
{
|
||||
string url = "/v1/games";
|
||||
if (index != null) url = QueryHelpers.AddQueryString(url, "index", index.ToString());
|
||||
if (pageSize != null) url = QueryHelpers.AddQueryString(url, "pageSize", pageSize.ToString());
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
|
||||
GamesResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = await JsonSerializer.DeserializeAsync<GamesResponse>(contentStream);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<GameResponse> GetGameAsync(string gameId)
|
||||
{
|
||||
string url = "/v1/games/{0}";
|
||||
string.Format(url, gameId);
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
|
||||
GameResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = await JsonSerializer.DeserializeAsync<GameResponse>(contentStream);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<VersionsResponse> GetVersionsAsync(string gameId)
|
||||
{
|
||||
string url = "/v1/games/{0}/versions";
|
||||
string.Format(url, gameId);
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
|
||||
VersionsResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = (await JsonSerializer.DeserializeAsync<VersionsResponse>(contentStream))!;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<VersionTypesResponse> GetVersionTypesAsync(string gameId)
|
||||
{
|
||||
string url = "/v1/games/{0}/version-types";
|
||||
string.Format(url, gameId);
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
|
||||
VersionTypesResponse result;
|
||||
using (Stream contentStream = await response.Content.ReadAsStreamAsync())
|
||||
{
|
||||
result = (await JsonSerializer.DeserializeAsync<VersionTypesResponse>(contentStream))!;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
69
CFCoreAPI/Endpoints/Games/Responses/GameResponse.cs
Normal file
69
CFCoreAPI/Endpoints/Games/Responses/GameResponse.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Games.Responses
|
||||
{
|
||||
public struct GameResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public GameResponse(
|
||||
DataModel data
|
||||
)
|
||||
{
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
public DataModel Data { get; }
|
||||
|
||||
public struct AssetsModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public AssetsModel(
|
||||
string iconUrl,
|
||||
string tileUrl,
|
||||
string coverUrl
|
||||
)
|
||||
{
|
||||
this.IconUrl = iconUrl;
|
||||
this.TileUrl = tileUrl;
|
||||
this.CoverUrl = coverUrl;
|
||||
}
|
||||
|
||||
public string IconUrl { get; }
|
||||
public string TileUrl { get; }
|
||||
public string CoverUrl { get; }
|
||||
}
|
||||
|
||||
public struct DataModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DataModel(
|
||||
int id,
|
||||
string name,
|
||||
string slug,
|
||||
DateTime dateModified,
|
||||
AssetsModel assets,
|
||||
int status,
|
||||
int apiStatus
|
||||
)
|
||||
{
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.Slug = slug;
|
||||
this.DateModified = dateModified;
|
||||
this.Assets = assets;
|
||||
this.Status = status;
|
||||
this.ApiStatus = apiStatus;
|
||||
}
|
||||
|
||||
public int Id { get; }
|
||||
public string Name { get; }
|
||||
public string Slug { get; }
|
||||
public DateTime DateModified { get; }
|
||||
public AssetsModel Assets { get; }
|
||||
public int Status { get; }
|
||||
public int ApiStatus { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
95
CFCoreAPI/Endpoints/Games/Responses/GamesResponse.cs
Normal file
95
CFCoreAPI/Endpoints/Games/Responses/GamesResponse.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Games.Responses
|
||||
{
|
||||
|
||||
public struct GamesResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public GamesResponse(
|
||||
List<DataModel> data,
|
||||
PaginationModel pagination
|
||||
)
|
||||
{
|
||||
this.Data = data;
|
||||
this.Pagination = pagination;
|
||||
}
|
||||
|
||||
public IReadOnlyList<DataModel> Data { get; }
|
||||
public PaginationModel Pagination { get; }
|
||||
|
||||
public struct AssetsModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public AssetsModel(
|
||||
string iconUrl,
|
||||
string tileUrl,
|
||||
string coverUrl
|
||||
)
|
||||
{
|
||||
this.IconUrl = iconUrl;
|
||||
this.TileUrl = tileUrl;
|
||||
this.CoverUrl = coverUrl;
|
||||
}
|
||||
|
||||
public string IconUrl { get; }
|
||||
public string TileUrl { get; }
|
||||
public string CoverUrl { get; }
|
||||
}
|
||||
|
||||
public struct DataModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DataModel(
|
||||
int id,
|
||||
string name,
|
||||
string slug,
|
||||
DateTime dateModified,
|
||||
AssetsModel assets,
|
||||
int status,
|
||||
int apiStatus
|
||||
)
|
||||
{
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.Slug = slug;
|
||||
this.DateModified = dateModified;
|
||||
this.Assets = assets;
|
||||
this.Status = status;
|
||||
this.ApiStatus = apiStatus;
|
||||
}
|
||||
|
||||
public int Id { get; }
|
||||
public string Name { get; }
|
||||
public string Slug { get; }
|
||||
public DateTime DateModified { get; }
|
||||
public AssetsModel Assets { get; }
|
||||
public int Status { get; }
|
||||
public int ApiStatus { get; }
|
||||
}
|
||||
|
||||
public struct PaginationModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public PaginationModel(
|
||||
int index,
|
||||
int pageSize,
|
||||
int resultCount,
|
||||
int totalCount
|
||||
)
|
||||
{
|
||||
this.Index = index;
|
||||
this.PageSize = pageSize;
|
||||
this.ResultCount = resultCount;
|
||||
this.TotalCount = totalCount;
|
||||
}
|
||||
|
||||
public int Index { get; }
|
||||
public int PageSize { get; }
|
||||
public int ResultCount { get; }
|
||||
public int TotalCount { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
42
CFCoreAPI/Endpoints/Games/Responses/VersionTypesResponse.cs
Normal file
42
CFCoreAPI/Endpoints/Games/Responses/VersionTypesResponse.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Games.Responses
|
||||
{
|
||||
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
|
||||
|
||||
public class VersionTypesResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public VersionTypesResponse(
|
||||
List<DataModel> data
|
||||
)
|
||||
{
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
public IReadOnlyList<DataModel> Data { get; }
|
||||
public class DataModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DataModel(
|
||||
int id,
|
||||
int gameId,
|
||||
string name,
|
||||
string slug
|
||||
)
|
||||
{
|
||||
this.Id = id;
|
||||
this.GameId = gameId;
|
||||
this.Name = name;
|
||||
this.Slug = slug;
|
||||
}
|
||||
|
||||
public int Id { get; }
|
||||
public int GameId { get; }
|
||||
public string Name { get; }
|
||||
public string Slug { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
35
CFCoreAPI/Endpoints/Games/Responses/VersionsResponse.cs
Normal file
35
CFCoreAPI/Endpoints/Games/Responses/VersionsResponse.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Games.Responses
|
||||
{
|
||||
|
||||
public class VersionsResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public VersionsResponse(
|
||||
List<DataModel> data
|
||||
)
|
||||
{
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
public IReadOnlyList<DataModel> Data { get; }
|
||||
public class DataModel
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DataModel(
|
||||
int type,
|
||||
List<string> versions
|
||||
)
|
||||
{
|
||||
this.Type = type;
|
||||
this.Versions = versions;
|
||||
}
|
||||
|
||||
public int Type { get; }
|
||||
public IReadOnlyList<string> Versions { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
10
CFCoreAPI/Endpoints/Minecraft/MinecraftAPI.cs
Normal file
10
CFCoreAPI/Endpoints/Minecraft/MinecraftAPI.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace CFCoreAPI.Endpoints.Minecraft
|
||||
{
|
||||
public class MinecraftAPI : APIBase
|
||||
{
|
||||
public MinecraftAPI(HttpClient httpClient) : base(httpClient)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
10
CFCoreAPI/Endpoints/Mods/ModsAPI.cs
Normal file
10
CFCoreAPI/Endpoints/Mods/ModsAPI.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace CFCoreAPI.Endpoints.Mods
|
||||
{
|
||||
public class ModsAPI : APIBase
|
||||
{
|
||||
public ModsAPI(HttpClient httpClient) : base(httpClient)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
17
CFCoreAPI/Endpoints/Responses/StringResponse.cs
Normal file
17
CFCoreAPI/Endpoints/Responses/StringResponse.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CFCoreAPI.Endpoints.Files.Responses
|
||||
{
|
||||
public struct StringResponse
|
||||
{
|
||||
[JsonConstructor]
|
||||
public StringResponse(
|
||||
string data
|
||||
)
|
||||
{
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
public string Data { get; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user