Artemis Artemis
Artemis Artemis

Search Results for

    Interface IWebServerService

    A service that provides access to the local Artemis web server

    Namespace: Artemis.Core.Services
    Assembly: Artemis.Core.dll
    Syntax
    public interface IWebServerService

    Properties

    PluginsModule

    Gets the plugins module containing all plugin end points

    Declaration
    PluginsModule PluginsModule { get; }
    Property Value
    Type Description
    PluginsModule

    Server

    Gets the current instance of the web server, replaced when WebServerStarting occurs.

    Declaration
    WebServer? Server { get; }
    Property Value
    Type Description
    WebServer

    Methods

    AddController<T>(PluginFeature)

    Adds a new Web API controller and restarts the web server

    Declaration
    void AddController<T>(PluginFeature feature) where T : WebApiController
    Parameters
    Type Name Description
    PluginFeature feature
    Type Parameters
    Name Description
    T

    The type of Web API controller to remove

    AddDataModelJsonEndPoint<T>(Module<T>, string)

    Adds a new endpoint that directly maps received JSON to the data model of the provided module.

    Declaration
    DataModelJsonPluginEndPoint<T> AddDataModelJsonEndPoint<T>(Module<T> module, string endPointName) where T : DataModel, new()
    Parameters
    Type Name Description
    Module<T> module

    The module whose datamodel to apply the received JSON to

    string endPointName

    The name of the end point, must be unique

    Returns
    Type Description
    DataModelJsonPluginEndPoint<T>

    The resulting end point

    Type Parameters
    Name Description
    T

    The data model type of the module

    AddJsonEndPoint<T>(PluginFeature, string, Action<T>)

    Adds a new endpoint for the given plugin feature receiving an object of type T

    Note: Object will be deserialized using JSON.

    Declaration
    JsonPluginEndPoint<T> AddJsonEndPoint<T>(PluginFeature feature, string endPointName, Action<T> requestHandler)
    Parameters
    Type Name Description
    PluginFeature feature

    The plugin feature the end point is associated with

    string endPointName

    The name of the end point, must be unique

    Action<T> requestHandler
    Returns
    Type Description
    JsonPluginEndPoint<T>

    The resulting end point

    Type Parameters
    Name Description
    T

    The type of object to be received

    AddModule(PluginFeature, Func<IWebModule>)

    Adds a new EmbedIO module and restarts the web server

    Declaration
    void AddModule(PluginFeature feature, Func<IWebModule> create)
    Parameters
    Type Name Description
    PluginFeature feature
    Func<IWebModule> create

    AddModule<T>(PluginFeature)

    Adds a new EmbedIO module and restarts the web server

    Declaration
    void AddModule<T>(PluginFeature feature) where T : IWebModule
    Parameters
    Type Name Description
    PluginFeature feature
    Type Parameters
    Name Description
    T

    The type of module to add

    AddRawEndPoint(PluginFeature, string, Func<IHttpContext, Task>)

    Adds a new endpoint for the given plugin feature that handles a raw EmbedIO.IHttpContext.

    Note: This requires that you reference the EmbedIO Nuget package.

    Declaration
    RawPluginEndPoint AddRawEndPoint(PluginFeature feature, string endPointName, Func<IHttpContext, Task> requestHandler)
    Parameters
    Type Name Description
    PluginFeature feature

    The plugin feature the end point is associated with

    string endPointName

    The name of the end point, must be unique

    Func<IHttpContext, Task> requestHandler
    Returns
    Type Description
    RawPluginEndPoint

    The resulting end point

    AddResponsiveJsonEndPoint<T>(PluginFeature, string, Func<T, object?>)

    Adds a new endpoint for the given plugin feature receiving an object of type T and returning any object.

    Note: Both will be deserialized and serialized respectively using JSON.

    Declaration
    JsonPluginEndPoint<T> AddResponsiveJsonEndPoint<T>(PluginFeature feature, string endPointName, Func<T, object?> requestHandler)
    Parameters
    Type Name Description
    PluginFeature feature

    The plugin feature the end point is associated with

    string endPointName

    The name of the end point, must be unique

    Func<T, object> requestHandler
    Returns
    Type Description
    JsonPluginEndPoint<T>

    The resulting end point

    Type Parameters
    Name Description
    T

    The type of object to be received

    AddResponsiveStringEndPoint(PluginFeature, string, Func<string, string?>)

    Adds a new endpoint for the given plugin feature receiving an a string and returning a string or null.

    Declaration
    StringPluginEndPoint AddResponsiveStringEndPoint(PluginFeature feature, string endPointName, Func<string, string?> requestHandler)
    Parameters
    Type Name Description
    PluginFeature feature

    The plugin feature the end point is associated with

    string endPointName

    The name of the end point, must be unique

    Func<string, string> requestHandler
    Returns
    Type Description
    StringPluginEndPoint

    The resulting end point

    AddStringEndPoint(PluginFeature, string, Action<string>)

    Adds a new endpoint for the given plugin feature receiving an a string.

    Declaration
    StringPluginEndPoint AddStringEndPoint(PluginFeature feature, string endPointName, Action<string> requestHandler)
    Parameters
    Type Name Description
    PluginFeature feature

    The plugin feature the end point is associated with

    string endPointName

    The name of the end point, must be unique

    Action<string> requestHandler
    Returns
    Type Description
    StringPluginEndPoint

    The resulting end point

    RemoveController<T>()

    Removes an existing Web API controller and restarts the web server

    Declaration
    void RemoveController<T>() where T : WebApiController
    Type Parameters
    Name Description
    T

    The type of Web API controller to remove

    RemoveModule(Func<IWebModule>)

    Removes a EmbedIO module and restarts the web server

    Declaration
    void RemoveModule(Func<IWebModule> create)
    Parameters
    Type Name Description
    Func<IWebModule> create

    RemoveModule<T>()

    Removes a EmbedIO module and restarts the web server

    Declaration
    void RemoveModule<T>() where T : IWebModule
    Type Parameters
    Name Description
    T

    The type of module to remove

    RemovePluginEndPoint(PluginEndPoint)

    Removes an existing endpoint

    Declaration
    void RemovePluginEndPoint(PluginEndPoint endPoint)
    Parameters
    Type Name Description
    PluginEndPoint endPoint

    The end point to remove

    Events

    WebServerStarting

    Occurs when the web server has been created and is about to start. This is the ideal place to add your own modules.

    Declaration
    event EventHandler? WebServerStarting
    Event Type
    Type Description
    EventHandler
    Content is available under the PolyForm Noncommercial License, by Artemis RGB.