/// <summary> /// Добавляет клиент API Облачной АТС Мегафон <see cref="IMegafonApiClient"/> /// </summary> /// <param name="services"></param> /// <param name="configure"></param> /// <returns></returns> public static IServiceCollection AddMegafonApi(this IServiceCollection services, Action <MegafonApiOptions> configure) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var options = new MegafonApiOptions(); configure(options); services.AddSingleton(options); services.AddSingleton <IMegafonApiClient, ApiClient>(); return(services); }
public ApiClient(MegafonApiOptions options, ILogger <IMegafonApiClient> logger = null) { _options = options ?? throw new ArgumentNullException(nameof(options)); _logger = logger ?? new VoidLogger <IMegafonApiClient>(); }