Table of Contents

Class WebhookHandlerServiceCollectionExtensions

Namespace
NetCord.Hosting.AspNetCore
Assembly
NetCord.Hosting.AspNetCore.dll
public static class WebhookHandlerServiceCollectionExtensions
Inheritance
WebhookHandlerServiceCollectionExtensions
Inherited Members

Methods

AddWebhookHandler(IServiceCollection, WebhookEvent, Delegate, ServiceLifetime)

Adds an IWebhookHandler to the specified IServiceCollection.

public static IServiceCollection AddWebhookHandler(this IServiceCollection services, WebhookEvent webhookEvent, Delegate handler, ServiceLifetime lifetime = ServiceLifetime.Singleton)

Parameters

services IServiceCollection

The IServiceCollection to add the IWebhookHandler to.

webhookEvent WebhookEvent

The webhook event.

handler Delegate

The delegate that represents the handler.

lifetime ServiceLifetime

The ServiceLifetime of the IWebhookHandler.

Returns

IServiceCollection

A reference to this instance after the operation has completed.

AddWebhookHandler(IServiceCollection, Type, ServiceLifetime)

Adds an IWebhookHandler to the specified IServiceCollection.

public static IServiceCollection AddWebhookHandler(this IServiceCollection services, Type handlerType, ServiceLifetime lifetime = ServiceLifetime.Singleton)

Parameters

services IServiceCollection

The IServiceCollection to add the IWebhookHandler to.

handlerType Type

The type of the IWebhookHandler to add.

lifetime ServiceLifetime

The ServiceLifetime of the IWebhookHandler.

Returns

IServiceCollection

A reference to this instance after the operation has completed.

AddWebhookHandler<T>(IServiceCollection, ServiceLifetime)

Adds an IWebhookHandler to the specified IServiceCollection.

public static IServiceCollection AddWebhookHandler<T>(this IServiceCollection services, ServiceLifetime lifetime = ServiceLifetime.Singleton) where T : class, IWebhookHandler

Parameters

services IServiceCollection

The IServiceCollection to add the IWebhookHandler to.

lifetime ServiceLifetime

The ServiceLifetime of the IWebhookHandler.

Returns

IServiceCollection

A reference to this instance after the operation has completed.

Type Parameters

T

The type of the IWebhookHandler to add.

AddWebhookHandler<T>(IServiceCollection, WebhookEvent<T>, Delegate, ServiceLifetime)

Adds an IWebhookHandler to the specified IServiceCollection.

public static IServiceCollection AddWebhookHandler<T>(this IServiceCollection services, WebhookEvent<T> webhookEvent, Delegate handler, ServiceLifetime lifetime = ServiceLifetime.Singleton)

Parameters

services IServiceCollection

The IServiceCollection to add the IWebhookHandler to.

webhookEvent WebhookEvent<T>

The webhook event.

handler Delegate

The delegate that represents the handler.

lifetime ServiceLifetime

The ServiceLifetime of the IWebhookHandler.

Returns

IServiceCollection

A reference to this instance after the operation has completed.

Type Parameters

T

The type of the event handler argument.

AddWebhookHandler<T>(IServiceCollection, Func<IServiceProvider, T>, ServiceLifetime)

Adds an IWebhookHandler to the specified IServiceCollection.

public static IServiceCollection AddWebhookHandler<T>(this IServiceCollection services, Func<IServiceProvider, T> implementationFactory, ServiceLifetime lifetime = ServiceLifetime.Singleton) where T : class, IWebhookHandler

Parameters

services IServiceCollection

The IServiceCollection to add the IWebhookHandler to.

implementationFactory Func<IServiceProvider, T>

The factory that creates the IWebhookHandler.

lifetime ServiceLifetime

The ServiceLifetime of the IWebhookHandler.

Returns

IServiceCollection

A reference to this instance after the operation has completed.

Type Parameters

T

The type of the IWebhookHandler to add.

AddWebhookHandlers(IServiceCollection, Assembly, ServiceLifetime)

Adds all public IWebhookHandler implementations from the specified assembly to the IServiceCollection.

public static IServiceCollection AddWebhookHandlers(this IServiceCollection services, Assembly assembly, ServiceLifetime lifetime = ServiceLifetime.Singleton)

Parameters

services IServiceCollection

The IServiceCollection to add the IWebhookHandler implementations to.

assembly Assembly

The assembly to scan for IWebhookHandler implementations.

lifetime ServiceLifetime

The ServiceLifetime of the IWebhookHandler implementations.

Returns

IServiceCollection

A reference to this instance after the operation has completed.