/// <summary> /// This is the entry point to the Api. This will initialize an Account object from /// your plex login information. /// </summary> /// <param name="plexServerClient"></param> /// <param name="plexAccountClient"></param> /// <param name="plexLibraryClient"></param> public PlexFactory(IPlexServerClient plexServerClient, IPlexAccountClient plexAccountClient, IPlexLibraryClient plexLibraryClient) { this.plexServerClient = plexServerClient; this.plexAccountClient = plexAccountClient; this.plexLibraryClient = plexLibraryClient; }
public AccountTest(ITestOutputHelper output, PlexFixture fixture) { this.output = output; this.serviceProvider = fixture.ServiceProvider; this.config = fixture.ServiceProvider.GetService <TestConfiguration>(); this.plexAccountClient = fixture.ServiceProvider.GetService <IPlexAccountClient>(); }
/// <summary> /// Initialize PlexAccount instance. /// </summary> /// <param name="plexAccountClient">IPlexAccountClient instance.</param> /// <param name="plexServerClient">IPlexServerClient instance.</param> /// <param name="plexLibraryClient">IPlexLibraryClient instance.</param> /// <param name="authToken">Plex Auth Token.</param> /// <exception cref="ArgumentNullException"></exception> public PlexAccount(IPlexAccountClient plexAccountClient, IPlexServerClient plexServerClient, IPlexLibraryClient plexLibraryClient, string authToken) { if (string.IsNullOrEmpty(authToken)) { throw new ArgumentNullException(nameof(authToken)); } this.plexAccountClient = plexAccountClient ?? throw new ArgumentNullException(nameof(plexAccountClient)); this.plexServerClient = plexServerClient ?? throw new ArgumentNullException(nameof(plexServerClient)); this.plexLibraryClient = plexLibraryClient ?? throw new ArgumentNullException(nameof(plexLibraryClient)); var account = plexAccountClient.GetPlexAccountAsync(authToken).Result; ObjectMapper.Mapper.Map(account, this); }
/// <summary> /// Initialize PlexAccount instance. /// </summary> /// <param name="plexAccountClient">IPlexAccountClient instance.</param> /// <param name="plexServerClient">IPlexServerClient instance.</param> /// <param name="plexLibraryClient">IPlexLibraryClient instance.</param> /// <param name="username">Plex account username.</param> /// <param name="password">Plex account password.</param> /// <exception cref="ArgumentNullException"></exception> public PlexAccount(IPlexAccountClient plexAccountClient, IPlexServerClient plexServerClient, IPlexLibraryClient plexLibraryClient, string username, string password) { if (string.IsNullOrEmpty(username)) { throw new ArgumentNullException(nameof(username)); } if (string.IsNullOrEmpty(password)) { throw new ArgumentNullException(nameof(password)); } this.plexAccountClient = plexAccountClient ?? throw new ArgumentNullException(nameof(plexAccountClient)); this.plexServerClient = plexServerClient ?? throw new ArgumentNullException(nameof(plexServerClient)); this.plexLibraryClient = plexLibraryClient ?? throw new ArgumentNullException(nameof(plexLibraryClient)); var account = plexAccountClient.GetPlexAccountAsync(username, password).Result; ObjectMapper.Mapper.Map(account, this); }
public PlexLoginController(OAuthService oAuthService, IPlexAccountClient plexClient) { _oAuthService = oAuthService; _plexClient = plexClient; }