コード例 #1
0
        /// <summary>
        /// Overloaded constructor to pass configuration.
        /// </summary>
        /// <param name="httpService">Instance of static http service to use in making web requests.</param>
        /// <param name="plexBasicHeadersConstructor">Constructor for Plex headers.</param>
        /// <param name="configuration">Media server specific configuration.</param>
        public PlexServerPreferencesProviderService(IHttpService httpService, IHeaderConstructor <PlexBasicRequestHeaders> plexBasicHeadersConstructor, PlexMediaServerConfig configuration)
        {
            _configuration = configuration
                             .ThrowIfNull(nameof(configuration))
                             .ThrowIfInvalid(nameof(configuration));

            _httpService = httpService
                           .ThrowIfNull(nameof(httpService));
            _plexBasicHeaders = plexBasicHeadersConstructor
                                .ThrowIfNull(nameof(plexBasicHeadersConstructor))
                                .ConstructRequestHeaders(configuration.BasicPlexHeaders);
        }
コード例 #2
0
 /// <summary>
 /// Overloaded constructor to pass configuration.
 /// </summary>
 /// <param name="httpService">Instance of static http service to use in making web requests.</param>
 /// <param name="plexBasicHeadersConstructor">Constructor for Plex headers.</param>
 /// <param name="basicAuthHeadersConstructor">Constructor for Plex headers.</param>
 /// <param name="configuration">Media server specific configuration.</param>
 public PlexTvAuthenticator(IHttpService httpService,
                            IHeaderConstructor <PlexBasicRequestHeaders> plexBasicHeadersConstructor,
                            IHeaderConstructor <BasicAuthRequest> basicAuthHeadersConstructor,
                            PlexMediaServerConfig configuration)
 {
     _configuration = configuration
                      .ThrowIfNull(nameof(configuration))
                      .ThrowIfInvalid(nameof(configuration));
     _httpService = httpService
                    .ThrowIfNull(nameof(httpService));
     _plexBasicHeaders = plexBasicHeadersConstructor
                         .ThrowIfNull(nameof(plexBasicHeadersConstructor))
                         .ConstructRequestHeaders(configuration.BasicPlexHeaders);
     _basicAuthConstructor = basicAuthHeadersConstructor
                             .ThrowIfNull(nameof(basicAuthHeadersConstructor));
 }