Beispiel #1
0
        public static IServiceCollection AddTransipApi(this IServiceCollection services, Action <TransipApiOptions> options)
        {
            var opt = new TransipApiOptions();

            options.Invoke(opt);

            services.AddSingleton <ITransipApi, TransipApi>((servicePrivider) => new TransipApi(opt));

            return(services);
        }
Beispiel #2
0
        public TransipBaseApi(TransipApiOptions options)
        {
            _options = options;
            ValidateOptions(_options);

            _client = new HttpClient
            {
                BaseAddress = new Uri(TransipConstants.BaseUrl)
            };

            CheckRegistryValues();
        }
Beispiel #3
0
        private void ValidateOptions(TransipApiOptions options)
        {
            if (!options.HasPrivateKeyPath)
            {
                throw new Exception("Private key path is not set");
            }

            if (!File.Exists(options.PrivateKeyPath))
            {
                throw new FileNotFoundException($"Private key file is not found in: {options.PrivateKeyPath}");
            }
        }
Beispiel #4
0
 public TransipApi(TransipApiOptions options) : base(options)
 {
 }