Ejemplo n.º 1
0
 /// <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;
 }
Ejemplo n.º 2
0
 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>();
 }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
 public PlexLoginController(OAuthService oAuthService, IPlexAccountClient plexClient)
 {
     _oAuthService = oAuthService;
     _plexClient   = plexClient;
 }