コード例 #1
0
        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();
        }
コード例 #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);
        }