Implemented Core client

This commit is contained in:
2024-10-23 21:00:23 +02:00
parent 3c8d5137ff
commit 83620cb450
43 changed files with 4218 additions and 2 deletions

View File

@@ -0,0 +1,47 @@
using System.Collections.Generic;
namespace AMWD.Net.Api.Cloudflare
{
/// <summary>
/// The base Cloudflare response.
/// </summary>
public class CloudflareResponse
{
/// <summary>
/// Information about the result of the request.
/// </summary>
[JsonProperty("result_info")]
public ResultInfo ResultInfo { get; set; }
/// <summary>
/// Whether the API call was successful.
/// </summary>
[JsonProperty("success")]
public bool Success { get; set; }
/// <summary>
/// Errors returned by the API call.
/// </summary>
[JsonProperty("errors")]
public IReadOnlyList<ResponseInfo> Errors { get; set; } = [];
/// <summary>
/// Messages returned by the API call.
/// </summary>
[JsonProperty("messages")]
public IReadOnlyList<ResponseInfo> Messages { get; set; } = [];
}
/// <summary>
/// The base Cloudflare response with a result.
/// </summary>
/// <typeparam name="T"></typeparam>
public class CloudflareResponse<T> : CloudflareResponse
{
/// <summary>
/// The result of the API call.
/// </summary>
[JsonProperty("result")]
public T Result { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
namespace AMWD.Net.Api.Cloudflare
{
/// <summary>
/// A Cloudflare response information.
/// </summary>
public class ResponseInfo
{
/// <summary>
/// The message code.
/// </summary>
[JsonProperty("code")]
public int Code { get; set; }
/// <summary>
/// The message.
/// </summary>
[JsonProperty("message")]
public string Message { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
namespace AMWD.Net.Api.Cloudflare
{
/// <summary>
/// Cloudflare Result Information.
/// </summary>
public class ResultInfo
{
/// <summary>
/// Total number of results for the requested service.
/// </summary>
[JsonProperty("count")]
public int Count { get; set; }
/// <summary>
/// Current page within paginated list of results.
/// </summary>
[JsonProperty("page")]
public int Page { get; set; }
/// <summary>
/// Number of results per page of results.
/// </summary>
[JsonProperty("per_page")]
public int PerPage { get; set; }
/// <summary>
/// Total results available without any search parameters.
/// </summary>
[JsonProperty("total_count")]
public int TotalCount { get; set; }
}
}