Table of Contents

Class KookWebhookClientExtension

Namespace
Kook.Webhook.AspNet
Assembly
Kook.Net.Webhook.AspNet.dll

提供用于与 ASP.NET 集成,注册与配置 KookAspNetWebhookClient 的扩展方法。

public static class KookWebhookClientExtension
Inheritance
KookWebhookClientExtension
Inherited Members

Methods

AddKookAspNetWebhookClient(IServiceCollection)

向指定的 IServiceCollection 添加 KOOK Webhook 客户端。

public static IServiceCollection AddKookAspNetWebhookClient(this IServiceCollection services)

Parameters

services IServiceCollection

要向其添加 KOOK ASP.NET Webhook 客户端的服务集合。

Returns

IServiceCollection

添加了 KOOK ASP.NET Webhook 客户端的服务集合。

AddKookAspNetWebhookClient(IServiceCollection, KookAspNetWebhookConfig)

向指定的 IServiceCollection 添加 KookAspNetWebhookClient 客户端。

public static IServiceCollection AddKookAspNetWebhookClient(this IServiceCollection services, KookAspNetWebhookConfig config)

Parameters

services IServiceCollection

要向其添加 KOOK ASP.NET Webhook 客户端的服务集合。

config KookAspNetWebhookConfig

用于配置 KOOK ASP.NET Webhook 客户端的配置。

Returns

IServiceCollection

添加了 KOOK ASP.NET Webhook 客户端的服务集合。

AddKookAspNetWebhookClient(IServiceCollection, Action<KookAspNetWebhookConfig>)

向指定的 IServiceCollection 添加 KookAspNetWebhookClient 客户端。

public static IServiceCollection AddKookAspNetWebhookClient(this IServiceCollection services, Action<KookAspNetWebhookConfig> configure)

Parameters

services IServiceCollection

要向其添加 KOOK ASP.NET Webhook 客户端的服务集合。

configure Action<KookAspNetWebhookConfig>

用于配置 KOOK ASP.NET Webhook 客户端的配置委托。

Returns

IServiceCollection

添加了 KOOK ASP.NET Webhook 客户端的服务集合。

UseAspNetWebhookClient(IKookClientServiceConfigurator, Action<KookAspNetWebhookConfig>)

配置 KOOK 服务以使用 ASP.NET Webhook 客户端。

public static IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig> UseAspNetWebhookClient(this IKookClientServiceConfigurator configurator, Action<KookAspNetWebhookConfig> configure)

Parameters

configurator IKookClientServiceConfigurator

KOOK 服务配置器。

configure Action<KookAspNetWebhookConfig>

用于配置 KOOK ASP.NET Webhook 客户端的配置委托。

Returns

IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig>

配置了 KOOK ASP.NET Webhook 客户端的配置器。

UseHostedClient(IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig>, TokenType, string, bool)

配置 KOOK 服务以将 ASP.NET Webhook 客户端包装为 IHostedService

[Obsolete("The KookAspNetWebhookClient itself is a hosted service, configure the token in the KookAspNetWebhookConfig.")]
public static IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig> UseHostedClient(this IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig> configurator, TokenType tokenType, string token, bool validateToken = true)

Parameters

configurator IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig>

KOOK 服务配置器。

tokenType TokenType

令牌的类型。

token string

令牌。

validateToken bool

是否验证令牌。

Returns

IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig>

配置了 ASP.NET Webhook 客户端的配置器。

UseHostedClient(IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig>, Func<IServiceProvider, TokenType>, Func<IServiceProvider, string>, Func<IServiceProvider, bool>?)

配置 KOOK 服务以将 ASP.NET Webhook 客户端包装为 IHostedService

[Obsolete("The KookAspNetWebhookClient itself is a hosted service, configure the token in the KookAspNetWebhookConfig.")]
public static IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig> UseHostedClient(this IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig> configurator, Func<IServiceProvider, TokenType> tokenType, Func<IServiceProvider, string> token, Func<IServiceProvider, bool>? validateToken = null)

Parameters

configurator IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig>

KOOK 服务配置器。

tokenType Func<IServiceProvider, TokenType>

令牌的类型。

token Func<IServiceProvider, string>

令牌。

validateToken Func<IServiceProvider, bool>

是否验证令牌。

Returns

IKookClientConfigurator<KookAspNetWebhookClient, KookAspNetWebhookConfig>

配置了 ASP.NET Webhook 客户端的配置器。

UseKookEndpoint<T>(T, string?)

IApplicationBuilder 添加 KOOK Webhook 路由端点。

public static T UseKookEndpoint<T>(this T builder, string? routePattern = null) where T : IHost, IEndpointRouteBuilder

Parameters

builder T

要向其添加 KOOK Webhook 端点的应用程序构建器。

routePattern string

用于注册 KOOK Webhook 的路由模式。

Returns

T

添加了 KOOK Webhook 端点的应用程序构建器。

Type Parameters

T