internal static IGrandIdBuilder UseUserAgent(this IGrandIdBuilder builder, ProductInfoHeaderValue productInfoHeaderValue)
        {
            builder.ConfigureHttpClient(httpClient =>
            {
                httpClient.DefaultRequestHeaders.UserAgent.Clear();
                httpClient.DefaultRequestHeaders.UserAgent.Add(productInfoHeaderValue);
            });

            return(builder);
        }
        private static IGrandIdBuilder UseEnvironment(this IGrandIdBuilder builder, Uri apiBaseUrl, Action <IGrandIdEnvironmentConfiguration> configuration)
        {
            var environmentConfiguration = new GrandIdEnvironmentConfiguration();

            configuration(environmentConfiguration);

            if (string.IsNullOrEmpty(environmentConfiguration.ApiKey))
            {
                throw new InvalidOperationException($"A valid '{nameof(environmentConfiguration.ApiKey)}' must be provided.'");
            }

            builder.EnableHttpClient();
            builder.ConfigureHttpClient(httpClient =>
            {
                httpClient.BaseAddress = apiBaseUrl;
            });

            builder.AddGrandIdApiClient(environmentConfiguration.ApiKey, environmentConfiguration.BankIdServiceKey);

            return(builder);
        }