Enable explicit nullable definition for Core
This commit is contained in:
@@ -50,6 +50,6 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the proxy information.
|
/// Gets or sets the proxy information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual IWebProxy Proxy { get; set; }
|
public virtual IWebProxy? Proxy { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
|
||||||
|
|
||||||
<NrtRevisionFormat>{semvertag:main}{!:-dev}</NrtRevisionFormat>
|
<NrtRevisionFormat>{semvertag:main}{!:-dev}</NrtRevisionFormat>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
|
||||||
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
|
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// <param name="emailAddress">The email address of the Cloudflare account.</param>
|
/// <param name="emailAddress">The email address of the Cloudflare account.</param>
|
||||||
/// <param name="apiKey">The API key of the Cloudflare account.</param>
|
/// <param name="apiKey">The API key of the Cloudflare account.</param>
|
||||||
/// <param name="clientOptions">The client options (optional).</param>
|
/// <param name="clientOptions">The client options (optional).</param>
|
||||||
public CloudflareClient(string emailAddress, string apiKey, ClientOptions clientOptions = null)
|
public CloudflareClient(string emailAddress, string apiKey, ClientOptions? clientOptions = null)
|
||||||
: this(new ApiKeyAuthentication(emailAddress, apiKey), clientOptions)
|
: this(new ApiKeyAuthentication(emailAddress, apiKey), clientOptions)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="apiToken">The API token.</param>
|
/// <param name="apiToken">The API token.</param>
|
||||||
/// <param name="clientOptions">The client options (optional).</param>
|
/// <param name="clientOptions">The client options (optional).</param>
|
||||||
public CloudflareClient(string apiToken, ClientOptions clientOptions = null)
|
public CloudflareClient(string apiToken, ClientOptions? clientOptions = null)
|
||||||
: this(new ApiTokenAuthentication(apiToken), clientOptions)
|
: this(new ApiTokenAuthentication(apiToken), clientOptions)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="authentication">The authentication information.</param>
|
/// <param name="authentication">The authentication information.</param>
|
||||||
/// <param name="clientOptions">The client options (optional).</param>
|
/// <param name="clientOptions">The client options (optional).</param>
|
||||||
public CloudflareClient(IAuthentication authentication, ClientOptions clientOptions = null)
|
public CloudflareClient(IAuthentication authentication, ClientOptions? clientOptions = null)
|
||||||
{
|
{
|
||||||
if (authentication == null)
|
if (authentication == null)
|
||||||
throw new ArgumentNullException(nameof(authentication));
|
throw new ArgumentNullException(nameof(authentication));
|
||||||
@@ -82,7 +82,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public async Task<CloudflareResponse<TResponse>> GetAsync<TResponse>(string requestPath, IQueryParameterFilter queryFilter = null, CancellationToken cancellationToken = default)
|
public async Task<CloudflareResponse<TResponse>> GetAsync<TResponse>(string requestPath, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
ValidateRequestPath(requestPath);
|
ValidateRequestPath(requestPath);
|
||||||
@@ -94,7 +94,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public async Task<CloudflareResponse<TResponse>> PostAsync<TResponse, TRequest>(string requestPath, TRequest request, IQueryParameterFilter queryFilter = null, CancellationToken cancellationToken = default)
|
public async Task<CloudflareResponse<TResponse>> PostAsync<TResponse, TRequest>(string requestPath, TRequest? request, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
ValidateRequestPath(requestPath);
|
ValidateRequestPath(requestPath);
|
||||||
@@ -107,7 +107,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public async Task<CloudflareResponse<TResponse>> PutAsync<TResponse, TRequest>(string requestPath, TRequest request, CancellationToken cancellationToken = default)
|
public async Task<CloudflareResponse<TResponse>> PutAsync<TResponse, TRequest>(string requestPath, TRequest? request, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
ValidateRequestPath(requestPath);
|
ValidateRequestPath(requestPath);
|
||||||
@@ -120,7 +120,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public async Task<CloudflareResponse<TResponse>> DeleteAsync<TResponse>(string requestPath, IQueryParameterFilter queryFilter = null, CancellationToken cancellationToken = default)
|
public async Task<CloudflareResponse<TResponse>> DeleteAsync<TResponse>(string requestPath, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
ValidateRequestPath(requestPath);
|
ValidateRequestPath(requestPath);
|
||||||
@@ -132,7 +132,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public async Task<CloudflareResponse<TResponse>> PatchAsync<TResponse, TRequest>(string requestPath, TRequest request, CancellationToken cancellationToken = default)
|
public async Task<CloudflareResponse<TResponse>> PatchAsync<TResponse, TRequest>(string requestPath, TRequest? request, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
ValidateRequestPath(requestPath);
|
ValidateRequestPath(requestPath);
|
||||||
@@ -178,7 +178,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
{
|
{
|
||||||
string version = typeof(CloudflareClient).Assembly
|
string version = typeof(CloudflareClient).Assembly
|
||||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
|
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
|
||||||
.InformationalVersion;
|
?.InformationalVersion ?? "unknown";
|
||||||
|
|
||||||
HttpMessageHandler handler;
|
HttpMessageHandler handler;
|
||||||
try
|
try
|
||||||
@@ -258,7 +258,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string BuildRequestUrl(string requestPath, IQueryParameterFilter queryFilter = null)
|
private string BuildRequestUrl(string requestPath, IQueryParameterFilter? queryFilter = null)
|
||||||
{
|
{
|
||||||
var dict = new Dictionary<string, string>();
|
var dict = new Dictionary<string, string>();
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
return $"{requestPath}?{query}";
|
return $"{requestPath}?{query}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HttpContent ConvertRequest<T>(T request)
|
private static HttpContent? ConvertRequest<T>(T request)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// Gets the <see cref="EnumMemberAttribute.Value"/> of the <see cref="Enum"/> when available, otherwise the <see cref="Enum.ToString()"/>.
|
/// Gets the <see cref="EnumMemberAttribute.Value"/> of the <see cref="Enum"/> when available, otherwise the <see cref="Enum.ToString()"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The enum value.</param>
|
/// <param name="value">The enum value.</param>
|
||||||
public static string GetEnumMemberValue(this Enum value)
|
public static string? GetEnumMemberValue(this Enum value)
|
||||||
{
|
{
|
||||||
var fieldInfo = value.GetType().GetField(value.ToString());
|
var fieldInfo = value.GetType().GetField(value.ToString());
|
||||||
if (fieldInfo == null)
|
if (fieldInfo == null)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// <param name="requestPath">The request path (extending the base URL).</param>
|
/// <param name="requestPath">The request path (extending the base URL).</param>
|
||||||
/// <param name="queryFilter">The query parameters.</param>
|
/// <param name="queryFilter">The query parameters.</param>
|
||||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||||
Task<CloudflareResponse<TResponse>> GetAsync<TResponse>(string requestPath, IQueryParameterFilter queryFilter = null, CancellationToken cancellationToken = default);
|
Task<CloudflareResponse<TResponse>> GetAsync<TResponse>(string requestPath, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes a POST request to the Cloudflare API.
|
/// Makes a POST request to the Cloudflare API.
|
||||||
@@ -33,7 +33,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// <param name="request">The request content.</param>
|
/// <param name="request">The request content.</param>
|
||||||
/// <param name="queryFilter">The query parameters.</param>
|
/// <param name="queryFilter">The query parameters.</param>
|
||||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||||
Task<CloudflareResponse<TResponse>> PostAsync<TResponse, TRequest>(string requestPath, TRequest request, IQueryParameterFilter queryFilter = null, CancellationToken cancellationToken = default);
|
Task<CloudflareResponse<TResponse>> PostAsync<TResponse, TRequest>(string requestPath, TRequest? request, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes a PUT request to the Cloudflare API.
|
/// Makes a PUT request to the Cloudflare API.
|
||||||
@@ -46,7 +46,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// <param name="requestPath">The request path (extending the base URL).</param>
|
/// <param name="requestPath">The request path (extending the base URL).</param>
|
||||||
/// <param name="request">The request content.</param>
|
/// <param name="request">The request content.</param>
|
||||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||||
Task<CloudflareResponse<TResponse>> PutAsync<TResponse, TRequest>(string requestPath, TRequest request, CancellationToken cancellationToken = default);
|
Task<CloudflareResponse<TResponse>> PutAsync<TResponse, TRequest>(string requestPath, TRequest? request, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes a DELETE request to the Cloudflare API.
|
/// Makes a DELETE request to the Cloudflare API.
|
||||||
@@ -59,7 +59,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// <param name="queryFilter">The query parameters.</param>
|
/// <param name="queryFilter">The query parameters.</param>
|
||||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<CloudflareResponse<TResponse>> DeleteAsync<TResponse>(string requestPath, IQueryParameterFilter queryFilter = null, CancellationToken cancellationToken = default);
|
Task<CloudflareResponse<TResponse>> DeleteAsync<TResponse>(string requestPath, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes a PATCH request to the Cloudflare API.
|
/// Makes a PATCH request to the Cloudflare API.
|
||||||
@@ -72,6 +72,6 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// <param name="requestPath">The request path (extending the base URL).</param>
|
/// <param name="requestPath">The request path (extending the base URL).</param>
|
||||||
/// <param name="request">The request content.</param>
|
/// <param name="request">The request content.</param>
|
||||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||||
Task<CloudflareResponse<TResponse>> PatchAsync<TResponse, TRequest>(string requestPath, TRequest request, CancellationToken cancellationToken = default);
|
Task<CloudflareResponse<TResponse>> PatchAsync<TResponse, TRequest>(string requestPath, TRequest? request, CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,12 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
// <= 32 characters
|
// <= 32 characters
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public string Id { get; set; }
|
public string? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the account.
|
/// The name of the account.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,18 +10,18 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
// <= 32 characters
|
// <= 32 characters
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public string Id { get; set; }
|
public string? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Name of the owner.
|
/// Name of the owner.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The type of owner.
|
/// The type of owner.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("type")]
|
[JsonProperty("type")]
|
||||||
public string Type { get; set; }
|
public string? Type { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// Information about the result of the request.
|
/// Information about the result of the request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("result_info")]
|
[JsonProperty("result_info")]
|
||||||
public PaginationInfo ResultInfo { get; set; }
|
public PaginationInfo? ResultInfo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the API call was successful.
|
/// Whether the API call was successful.
|
||||||
@@ -42,6 +42,6 @@ namespace AMWD.Net.Api.Cloudflare
|
|||||||
/// The result of the API call.
|
/// The result of the API call.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("result")]
|
[JsonProperty("result")]
|
||||||
public T Result { get; set; }
|
public T? Result { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,6 @@
|
|||||||
/// The message.
|
/// The message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("message")]
|
[JsonProperty("message")]
|
||||||
public string Message { get; set; }
|
public string? Message { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user