public SmartyStreetsValidationService(IOptions <ValidationOptions> options)
        {
            var clientBuilder = new ClientBuilder(
                authId: options.Value.SmartyStreetsOptions.AuthId,
                authToken: options.Value.SmartyStreetsOptions.AuthToken);

            _usClient            = clientBuilder.BuildUsStreetApiClient();
            _internationalClient = clientBuilder.BuildInternationalStreetApiClient();
        }
Exemplo n.º 2
0
        private static IServiceCollection AddSmartyStreetsAddressService(
            this IServiceCollection services,
            SmartyStreetsAddressOptions options)
        {
            var clientBuilder = new ClientBuilder(options.AuthId, options.AuthToken);

            services.AddSingleton <IClient <UsLookup> >(_ => clientBuilder.BuildUsStreetApiClient());
            services.AddSingleton <IClient <InternationalLookup> >(_ => clientBuilder.BuildInternationalStreetApiClient());
            services.AddSingleton <IAddressService, SmartyStreetsAddressService>();
            return(services);
        }