Ejemplo n.º 1
0
 /// <summary>
 /// Overloaded constructor to pass configuration.
 /// </summary>
 /// <param name="configuration">Media server specific configuration.</param>
 /// <param name="httpService">Instance of static http service to use in making web requests.</param>
 /// <param name="authenticator">Instance of static http service to use in making web requests.</param>
 /// <param name="serverSettingsProvider">Instance of Plex server settings provider.</param>
 /// <param name="mediaProvider">Instance of Plex server media provider.</param>
 public PlexMediaService(PlexMediaServerConfig configuration,
                         IHttpService httpService,
                         IPlexAuthenticator authenticator,
                         IPlexServerSettingsProvider serverSettingsProvider,
                         IPlexMediaProvider mediaProvider)
 {
     Configuration = configuration
                     .ThrowIfNull(nameof(configuration))
                     .ThrowIfInvalid(nameof(configuration));
     _httpService = httpService
                    .ThrowIfNull(nameof(httpService));
     _authenticator = authenticator
                      .ThrowIfNull(nameof(authenticator));
     _serverSettingsProvider = serverSettingsProvider
                               .ThrowIfNull(nameof(serverSettingsProvider));
     _mediaProvider = mediaProvider
                      .ThrowIfNull(nameof(mediaProvider));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Overloaded constructor to pass configuration.
 /// </summary>
 /// <param name="configuration">Media server specific configuration.</param>
 /// <param name="httpService">Instance of static http service to use in making web requests.</param>
 /// <param name="authenticator">Instance of static http service to use in making web requests.</param>
 /// <param name="serverSettingsProvider">Instance of Plex server settings provider.</param>
 /// <param name="mediaProvider">Instance of Plex server media provider.</param>
 public PlexMediaService(PlexMediaServerConfig configuration,
                         IHttpService httpService,
                         IPlexAuthenticator authenticator,
                         IPlexServerSettingsProvider serverSettingsProvider,
                         IHeaderConstructor <PlexBasicRequestHeaders> plexBasicHeadersConstructor)
 {
     Configuration = configuration
                     .ThrowIfNull(nameof(configuration))
                     .ThrowIfInvalid(nameof(configuration));
     _httpService = httpService
                    .ThrowIfNull(nameof(httpService));
     _authenticator = authenticator
                      .ThrowIfNull(nameof(authenticator));
     _serverSettingsProvider = serverSettingsProvider
                               .ThrowIfNull(nameof(serverSettingsProvider));
     _plexBasicHeaders = plexBasicHeadersConstructor
                         .ThrowIfNull(nameof(plexBasicHeadersConstructor))
                         .ConstructRequestHeaders(configuration.BasicPlexHeaders);
 }