public GovNotifyEmailProvider(
            IHttpClientFactory httpClientFactory,
            IEmailTemplateRepository emailTemplateRepo,
            GovNotifyOptions govNotifyOptions,
            SharedOptions sharedOptions,
            ILogger <GovNotifyEmailProvider> logger,
            [KeyFilter(Filenames.EmailSendLog)] IAuditLogger emailSendLog)
            : base(sharedOptions, emailTemplateRepo, logger, emailSendLog)
        {
            Options = govNotifyOptions
                      ?? throw new ArgumentNullException("You must provide the gov notify email options",
                                                         nameof(govNotifyOptions));

            if (Enabled)
            {
                // ensure we have api keys
                if (string.IsNullOrWhiteSpace(Options.ApiKey))
                {
                    throw new NullReferenceException(
                              $"{nameof(Options.ApiKey)}: You must supply a production api key for GovNotify");
                }

                if (string.IsNullOrWhiteSpace(Options.ApiTestKey))
                {
                    throw new NullReferenceException(
                              $"{nameof(Options.ApiTestKey)}: You must supply a test api key for GovNotify");
                }
            }

            // create the clients
            var httpClient        = httpClientFactory.CreateClient(nameof(GovNotifyEmailProvider));
            var notifyHttpWrapper = new HttpClientWrapper(httpClient);

            ProductionClient = new NotificationClient(notifyHttpWrapper, Options.ApiKey);
            TestClient       = new NotificationClient(notifyHttpWrapper, Options.ApiTestKey);
        }
 public GovNotifyAPI(GovNotifyOptions options, IEventLogger customLogger)
 {
     Options      = options ?? throw new ArgumentNullException(nameof(options));
     CustomLogger = customLogger ?? throw new ArgumentNullException(nameof(customLogger));
     _client      = new NotificationClient(Options.ApiKey);
 }