/// <summary>
        /// <para>
        /// Add MailChimp WebHook configuration and services to the specified <paramref name="builder"/>. See
        /// <see href="https://developer.mailchimp.com/documentation/mailchimp/guides/about-webhooks/"/> for additional
        /// details about MailChimp WebHook requests.
        /// </para>
        /// <para>
        /// The '<c>WebHooks:MailChimp:SecretKey:default</c>' configuration value contains the secret key for MailChimp
        /// WebHook URIs of the form '<c>https://{host}/api/webhooks/incoming/mailchimp</c>'.
        /// '<c>WebHooks:MailChimp:SecretKey:{id}</c>' configuration values contain secret keys for MailChimp WebHook
        /// URIs of the form '<c>https://{host}/api/webhooks/incoming/mailchimp/{id}</c>'.
        /// </para>
        /// </summary>
        /// <param name="builder">The <see cref="IMvcCoreBuilder" /> to configure.</param>
        /// <returns>The <paramref name="builder"/>.</returns>
        public static IMvcCoreBuilder AddMailChimpWebHooks(this IMvcCoreBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            MailChimpServiceCollectionSetup.AddMailChimpServices(builder.Services);

            return(builder.AddWebHooks());
        }
Пример #2
0
        /// <summary>
        /// Add WebHook configuration and services to the specified <paramref name="builder"/>.
        /// </summary>
        /// <param name="builder">The <see cref="IMvcCoreBuilder" /> to configure.</param>
        /// <param name="connectionString">The connecion string</param>
        /// <param name="configureOptions">Configure Options</param>
        /// <returns>The <paramref name="builder"/>.</returns>
        public static IMvcCoreBuilder AddWebHooksWithSqlStorage(this IMvcCoreBuilder builder, string connectionString, Action <WebHookSettings> configureOptions)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.AddWebHooks(configureOptions);
            WebHookServiceCollectionSetup.AddWebHookServicesWithSqlBackend(builder.Services, connectionString);
            return(builder);
        }
Пример #3
0
        /// <summary>
        /// Add MailChimp WebHook configuration and services to the specified <paramref name="builder"/>.
        /// </summary>
        /// <param name="builder">The <see cref="IMvcCoreBuilder" /> to configure.</param>
        /// <returns>The <paramref name="builder"/>.</returns>
        public static IMvcCoreBuilder AddMailChimpWebHooks(this IMvcCoreBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton <IWebHookMetadata, MailChimpMetadata>());

            return(builder.AddWebHooks());
        }
Пример #4
0
        /// <summary>
        /// Add WebHook configuration and services to the specified <paramref name="builder"/>.
        /// </summary>
        /// <param name="builder">The <see cref="IMvcCoreBuilder" /> to configure.</param>
        /// <param name="setupAction">
        /// An <see cref="Action{WebHookOptions}"/> to configure the provided <see cref="WebHookOptions"/>.
        /// </param>
        /// <returns>The <paramref name="builder"/>.</returns>
        public static IMvcCoreBuilder AddWebHooks(this IMvcCoreBuilder builder, Action <WebHookOptions> setupAction)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            builder.AddWebHooks();
            builder.Services.Configure(setupAction);

            return(builder);
        }