public static IServiceCollection AddWebhooksClient(this IServiceCollection services, Action <WebhooksHttpClientOptions> configure = null) { var options = new WebhooksHttpClientOptions(); configure.Invoke(options); return(AddWebhooksClient(services, options)); }
public WebhooksClient(WebhooksHttpClientOptions options) { Options = options; _client = new WebhooksHttpClient(Options.PayloadSigningSecret) { BaseAddress = Options.ServerBaseUri, Timeout = Options.RequestTimeout }; }
public static IServiceCollection AddWebhooksClient(this IServiceCollection services, WebhooksHttpClientOptions options) { if (options == null) { throw new InvalidOperationException("The webhooks HTTP client options are missing. Please check your configuration."); } services.AddSingleton(options); services.AddTransient <IWebhooksClient, WebhooksClient>(); return(services); }