Skip to content

DiGi.WebAPI.Classes

github-actions[bot] edited this page Jul 15, 2026 · 2 revisions

DiGi.WebAPI.Classes Namespace

Classes

ControllerInformation Class

Holds metadata about a controller, including its name, assembly information, and version.

public class ControllerInformation : DiGi.Core.Classes.SerializableObject, DiGi.WebAPI.Interfaces.IWebAPISerializableObject, DiGi.WebAPI.Interfaces.IWebAPIObject, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject

Inheritance System.Object → DiGi.Core.Classes.Object → DiGi.Core.Classes.SerializableObject → ControllerInformation

Implements IWebAPISerializableObject, IWebAPIObject, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject

Constructors

ControllerInformation(ControllerInformation) Constructor

Initializes a new instance of the ControllerInformation class by copying from another instance.

public ControllerInformation(DiGi.WebAPI.Classes.ControllerInformation? controllerInformation);

Parameters

controllerInformation ControllerInformation

The ControllerInformation to copy from.

ControllerInformation(string, string, string, string) Constructor

Initializes a new instance of the ControllerInformation class with the specified metadata.

public ControllerInformation(string? name, string? assemblyName, string? version, string? informationalVersion);

Parameters

name System.String

The controller name.

assemblyName System.String

The name of the assembly containing the controller.

version System.String

The assembly version.

informationalVersion System.String

The informational version of the assembly.

ControllerInformation(JsonObject) Constructor

Initializes a new instance of the ControllerInformation class from a JSON object.

public ControllerInformation(System.Text.Json.Nodes.JsonObject jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to deserialize from.

Properties

ControllerInformation.AssemblyName Property

Gets the name of the assembly containing the controller.

public string? AssemblyName { get; }

Property Value

System.String

ControllerInformation.InformationalVersion Property

Gets the informational version of the assembly.

public string? InformationalVersion { get; }

Property Value

System.String

ControllerInformation.Name Property

Gets the name of the controller.

public string? Name { get; }

Property Value

System.String

ControllerInformation.Version Property

Gets the version of the assembly containing the controller.

public string? Version { get; }

Property Value

System.String

InformationController Class

Provides API endpoints for retrieving controller metadata and application version information.

public class InformationController : DiGi.WebAPI.Classes.WebAPIController

Inheritance System.Object → Microsoft.AspNetCore.Mvc.ControllerBase → WebAPIController → InformationController

Constructors

InformationController(ApplicationPartManager) Constructor

Initializes a new instance of the InformationController class.

public InformationController(Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager applicationPartManager);

Parameters

applicationPartManager Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager

The application part manager used for controller discovery.

Fields

InformationController.applicationPartManager Field

Manages application parts for controller discovery.

private readonly ApplicationPartManager applicationPartManager;

Field Value

Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager

Methods

InformationController.GetControllersAsync() Method

Retrieves a list of all registered controllers in the application.

public System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.IActionResult> GetControllersAsync();

Returns

System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.IActionResult>
A JSON string containing controller information, or an empty response if no controllers are found.

InformationController.GetVersionAsync() Method

Retrieves the version of the executing assembly.

public System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.IActionResult> GetVersionAsync();

Returns

System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.IActionResult>
The assembly version as a string, or an empty response if unavailable.

Parameter Class

Abstract class for input parameters for endpoint.

public abstract class Parameter : DiGi.Core.Classes.SerializableObject

Inheritance System.Object → DiGi.Core.Classes.Object → DiGi.Core.Classes.SerializableObject → Parameter

Constructors

Parameter() Constructor

Initializes a new instance of the Parameter class.

public Parameter();

Parameter(Parameter) Constructor

Initializes a new instance of the Parameter class by copying another instance of the same type.

public Parameter(DiGi.WebAPI.Classes.Parameter parameter);

Parameters

parameter Parameter

The Parameter instance to copy from.

Parameter(JsonObject) Constructor

Initializes a new instance of the Parameter class using the specified JSON object.

public Parameter(System.Text.Json.Nodes.JsonObject jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject that contains the initialization data.

PostOptions Class

Holds configuration options for POST operations, including delay and result request settings.

public class PostOptions : DiGi.Core.Classes.SerializableOptions

Inheritance System.Object → DiGi.Core.Classes.Object → DiGi.Core.Classes.SerializableObject → DiGi.Core.Classes.SerializableOptions → PostOptions

Constructors

PostOptions() Constructor

Initializes a new instance of the PostOptions class.

public PostOptions();

PostOptions(PostOptions) Constructor

Initializes a new instance of the PostOptions class by copying from another instance.

public PostOptions(DiGi.WebAPI.Classes.PostOptions? postOptions);

Parameters

postOptions PostOptions

The PostOptions to copy from.

PostOptions(JsonObject) Constructor

Initializes a new instance of the PostOptions class from a JSON object.

public PostOptions(System.Text.Json.Nodes.JsonObject jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to deserialize from.

Properties

PostOptions.Delay Property

Gets or sets the delay duration for the POST operation.

public System.TimeSpan Delay { get; set; }

Property Value

System.TimeSpan

PostOptions.RequestResult Property

Gets or sets a value indicating whether the response result should be requested.

public bool RequestResult { get; set; }

Property Value

System.Boolean

PostResponse Class

Represents a non-generic POST response with a boolean result.

public class PostResponse : DiGi.WebAPI.Classes.PostResponse<bool>

Inheritance System.Object → DiGi.WebAPI.Classes.PostResponse<System.Boolean> → PostResponse

Constructors

PostResponse(bool) Constructor

Initializes a new instance of the PostResponse class.

public PostResponse(bool succeeded);

Parameters

succeeded System.Boolean

Whether the operation succeeded.

PostResponse<T> Class

Represents the response from a POST operation, containing the result, success status, and whether a result was requested.

public class PostResponse<T>

Type parameters

T

The type of the result contained in the response.

Inheritance System.Object → PostResponse<T>

Derived
↳ PostResponse

Constructors

PostResponse(bool) Constructor

Initializes a new instance of the PostResponse<T> class.

public PostResponse(bool succeeded);

Parameters

succeeded System.Boolean

Whether the operation succeeded.

PostResponse(bool, bool, T) Constructor

Initializes a new instance of the PostResponse<T> class.

public PostResponse(bool succeeded, bool resultRequested, T? result=default(T?));

Parameters

succeeded System.Boolean

Whether the operation succeeded.

resultRequested System.Boolean

Whether a result was requested.

result T

The result of the operation.

Properties

PostResponse<T>.Result Property

Gets the result of the POST operation.

public T? Result { get; }

Property Value

T

PostResponse<T>.ResultRequested Property

Gets a value indicating whether a result was requested from the POST operation.

public bool ResultRequested { get; }

Property Value

System.Boolean

PostResponse<T>.Succeeded Property

Gets a value indicating whether the POST operation succeeded.

public bool Succeeded { get; }

Property Value

System.Boolean

SecurityKey Class

Represents a security key with a unique identifier and creation timestamp.

public sealed class SecurityKey : DiGi.Core.Classes.GuidObject, DiGi.WebAPI.Interfaces.IWebAPIGuidObject, DiGi.Core.Interfaces.IGuidObject, DiGi.Core.Interfaces.IUniqueObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.WebAPI.Interfaces.IWebAPISerializableObject, DiGi.WebAPI.Interfaces.IWebAPIObject

Inheritance System.Object → DiGi.Core.Classes.Object → DiGi.Core.Classes.SerializableObject → DiGi.Core.Classes.UniqueObject → DiGi.Core.Classes.GuidObject → SecurityKey

Implements IWebAPIGuidObject, DiGi.Core.Interfaces.IGuidObject, DiGi.Core.Interfaces.IUniqueObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, IWebAPISerializableObject, IWebAPIObject

Constructors

SecurityKey() Constructor

Initializes a new instance of the SecurityKey class with a randomly generated key.

public SecurityKey();

SecurityKey(SecurityKey) Constructor

Initializes a new instance of the SecurityKey class by copying from another instance.

public SecurityKey(DiGi.WebAPI.Classes.SecurityKey? securityKey);

Parameters

securityKey SecurityKey

The SecurityKey to copy from.

SecurityKey(string) Constructor

Initializes a new instance of the SecurityKey class with the specified key value.

public SecurityKey(string? key);

Parameters

key System.String

The key value to use.

SecurityKey(JsonObject) Constructor

Initializes a new instance of the SecurityKey class from a JSON object.

public SecurityKey(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to deserialize from.

Properties

SecurityKey.CreatedAt Property

Gets the UTC date and time when the key was created.

public System.DateTime CreatedAt { get; private set; }

Property Value

System.DateTime

SecurityKey.Key Property

Gets the key value as a string.

public string Key { get; private set; }

Property Value

System.String

Methods

SecurityKey.GetBytes() Method

Converts the key to a byte array using ASCII encoding.

public byte[] GetBytes();

Returns

System.Byte[]
A byte array representation of the key.

SecurityKeyManager Class

Manages a collection of SecurityKey instances, including generation, retrieval, and removal of keys.

public sealed class SecurityKeyManager : DiGi.Core.Classes.SerializableObject

Inheritance System.Object → DiGi.Core.Classes.Object → DiGi.Core.Classes.SerializableObject → SecurityKeyManager

Constructors

SecurityKeyManager() Constructor

Initializes a new instance of the SecurityKeyManager class.

public SecurityKeyManager();

SecurityKeyManager(SecurityKeyManager) Constructor

Initializes a new instance of the SecurityKeyManager class by copying from another instance.

public SecurityKeyManager(DiGi.WebAPI.Classes.SecurityKeyManager securityKeyManager);

Parameters

securityKeyManager SecurityKeyManager

The SecurityKeyManager to copy from.

SecurityKeyManager(JsonObject) Constructor

Initializes a new instance of the SecurityKeyManager class from a JSON object.

public SecurityKeyManager(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to deserialize from.

Fields

SecurityKeyManager.securityKeys Field

Stores the security keys indexed by their GUID.

private Dictionary<Guid,SecurityKey> securityKeys;

Field Value

System.Collections.Generic.Dictionary<System.Guid,SecurityKey>

Properties

SecurityKeyManager.SecurityKeys Property

Gets or sets the collection of security keys.

public System.Collections.Generic.IEnumerable<DiGi.WebAPI.Classes.SecurityKey> SecurityKeys { get; set; }

Property Value

System.Collections.Generic.IEnumerable<SecurityKey>

Methods

SecurityKeyManager.Add(SecurityKey) Method

Adds a SecurityKey to the manager.

public bool Add(DiGi.WebAPI.Classes.SecurityKey? securityKey);

Parameters

securityKey SecurityKey

The security key to add.

Returns

System.Boolean
true if the key was added successfully; otherwise, false.

SecurityKeyManager.Generate() Method

Generates a new unique SecurityKey and adds it to the manager.

public DiGi.WebAPI.Classes.SecurityKey Generate();

Returns

SecurityKey
The newly generated SecurityKey.

SecurityKeyManager.GetActive(bool) Method

Gets the most recently created active security key.

public DiGi.WebAPI.Classes.SecurityKey? GetActive(bool generate=true);

Parameters

generate System.Boolean

Whether to generate a new key if none exist.

Returns

SecurityKey
The most recent SecurityKey, or null if no keys exist and generate is false.

SecurityKeyManager.Remove(Guid) Method

Removes a security key by its GUID.

public bool Remove(System.Guid guid);

Parameters

guid System.Guid

The GUID of the security key to remove.

Returns

System.Boolean
true if the key was found and removed; otherwise, false.

UrlBuilder Class

Provides a fluent API for constructing URLs with query parameters and automatic encoding.

public class UrlBuilder

Inheritance System.Object → UrlBuilder

Constructors

UrlBuilder(string) Constructor

Initializes a new instance of the UrlBuilder class with the specified base URL.

public UrlBuilder(string url);

Parameters

url System.String

The base URL to build upon.

Fields

UrlBuilder.dictionary Field

Stores the query parameters to be appended to the URL.

private readonly Dictionary<string,string> dictionary;

Field Value

System.Collections.Generic.Dictionary<System.String,System.String>

UrlBuilder.url Field

The base URL before query parameters are added.

private readonly string url;

Field Value

System.String

Properties

UrlBuilder.ParameterNames Property

Gets the names of all query parameters currently added to the URL.

public System.Collections.Generic.IEnumerable<string> ParameterNames { get; }

Property Value

System.Collections.Generic.IEnumerable<System.String>

Methods

UrlBuilder.AddParameter(string, bool) Method

Adds a boolean query parameter with automatic URL encoding.

public DiGi.WebAPI.Classes.UrlBuilder AddParameter(string name, bool value);

Parameters

name System.String

The parameter name.

value System.Boolean

The boolean value to encode.

Returns

UrlBuilder
The UrlBuilder instance for chaining.

UrlBuilder.AddParameter(string, double) Method

Adds a double query parameter with automatic URL encoding.

public DiGi.WebAPI.Classes.UrlBuilder AddParameter(string name, double value);

Parameters

name System.String

The parameter name.

value System.Double

The double value to encode.

Returns

UrlBuilder
The UrlBuilder instance for chaining.

UrlBuilder.AddParameter(string, int) Method

Adds an integer query parameter with automatic URL encoding.

public DiGi.WebAPI.Classes.UrlBuilder AddParameter(string name, int value);

Parameters

name System.String

The parameter name.

value System.Int32

The integer value to encode.

Returns

UrlBuilder
The UrlBuilder instance for chaining.

UrlBuilder.AddParameter(string, string) Method

Adds a query parameter with automatic URL encoding.

public DiGi.WebAPI.Classes.UrlBuilder AddParameter(string name, string? value);

Parameters

name System.String

The name of the query parameter.

value System.String

The value of the query parameter.

Returns

UrlBuilder
The current UrlBuilder instance.

UrlBuilder.Build() Method

Builds the final URL string.

public string Build();

Returns

System.String
The built URL string with query parameters.

UrlBuilder.ToString() Method

Returns the built URL as a string.

public override string ToString();

Returns

System.String
The complete URL with query parameters.

UrlBuilder.TryGetValue<T>(string, T) Method

Attempts to retrieve and convert a query parameter value to the specified type.

public bool TryGetValue<T>(string parameterName, out T? value);

Type parameters

T

The type to convert the parameter value to.

Parameters

parameterName System.String

The name of the query parameter to retrieve.

value T

When this method returns, contains the converted value if found, or default(T) if not found.

Returns

System.Boolean
true if the parameter exists and was successfully converted; otherwise, false.

Operators

UrlBuilder.implicit operator string(UrlBuilder) Operator

Converts the UrlBuilder to its string representation.

public static string? implicit operator string?(DiGi.WebAPI.Classes.UrlBuilder? urlBuilder);

Parameters

urlBuilder UrlBuilder

The UrlBuilder instance to convert.

Returns

System.String
The built URL string, or null if the builder is null.

WebAPIController Class

Serves as the base class for all WebAPI controllers, providing common MVC and API functionality.

public abstract class WebAPIController : Microsoft.AspNetCore.Mvc.ControllerBase, DiGi.WebAPI.Interfaces.IWebAPIController, DiGi.WebAPI.Interfaces.IWebAPIObject, DiGi.Core.Interfaces.IObject

Inheritance System.Object → Microsoft.AspNetCore.Mvc.ControllerBase → WebAPIController

Derived
↳ InformationController

Implements IWebAPIController, IWebAPIObject, DiGi.Core.Interfaces.IObject

Clone this wiki locally