@@ -2,6 +2,7 @@ namespace Plex.Library.ApiModels.Servers
22{
33 using System ;
44 using System . Collections . Generic ;
5+ using System . Globalization ;
56 using System . Linq ;
67 using System . Threading . Tasks ;
78 using Automapper ;
@@ -22,11 +23,21 @@ namespace Plex.Library.ApiModels.Servers
2223 using ServerApi . PlexModels . Server . Updates ;
2324 using LibraryFilter = ServerApi . PlexModels . Library . LibraryFilter ;
2425
26+ /// <summary>
27+ /// Plex Server Object
28+ /// </summary>
2529 public class Server
2630 {
2731 private readonly IPlexServerClient plexServerClient ;
2832 private readonly IPlexLibraryClient plexLibraryClient ;
2933
34+ /// <summary>
35+ ///
36+ /// </summary>
37+ /// <param name="plexServerClient">Plex Server Client</param>
38+ /// <param name="plexLibraryClient">Plex Library Client</param>
39+ /// <param name="accountServer">Account Server Object</param>
40+ /// <exception cref="ArgumentNullException">Invalid Account Server</exception>
3041 public Server ( IPlexServerClient plexServerClient , IPlexLibraryClient plexLibraryClient , AccountServer accountServer )
3142 {
3243 this . plexServerClient = plexServerClient ?? throw new ArgumentNullException ( nameof ( plexServerClient ) ) ;
@@ -39,6 +50,7 @@ public Server(IPlexServerClient plexServerClient, IPlexLibraryClient plexLibrary
3950
4051 // Map AccountServer to this Server Object (Mainly to get Access Token and Host)
4152 ObjectMapper . Mapper . Map ( accountServer , this ) ;
53+
4254 var serverModel = plexServerClient . GetPlexServerInfo ( this . AccessToken , this . Uri . ToString ( ) ) . Result ;
4355
4456 ObjectMapper . Mapper . Map ( serverModel , this ) ;
@@ -373,14 +385,15 @@ public Server(IPlexServerClient plexServerClient, IPlexLibraryClient plexLibrary
373385 /// Get Libraries
374386 /// </summary>
375387 /// <param name="filter">Library Filter (Optional)</param>
388+ /// <exception cref="ApplicationException">Invalid Library Exception</exception>
376389 /// <returns>List of Library Objects</returns>
377390 public async Task < List < LibraryBase > > Libraries ( LibraryFilter filter = null )
378391 {
379392 var libraries = new List < LibraryBase > ( ) ;
380393 var summary = await this . plexServerClient . GetLibrariesAsync ( this . AccessToken , this . Uri . ToString ( ) ) ;
381394 foreach ( var library in summary . Libraries )
382395 {
383- switch ( library . Type . ToUpper ( ) )
396+ switch ( library . Type . ToUpper ( CultureInfo . InvariantCulture ) )
384397 {
385398 case "MOVIE" :
386399 var movieLibrary = new MovieLibrary ( this . plexServerClient , this . plexLibraryClient , this ) ;
@@ -546,10 +559,8 @@ public async Task UnScrobbleItem(string ratingKey) =>
546559 /// Downloads Server Logs
547560 /// </summary>
548561 /// <returns></returns>
549- public async Task < object > DownloadLogs ( )
550- {
551- return await this . plexServerClient . GetLogs ( this . AccessToken , this . Uri . ToString ( ) ) ;
552- }
562+ public async Task < object > DownloadLogs ( ) =>
563+ await this . plexServerClient . GetLogs ( this . AccessToken , this . Uri . ToString ( ) ) ;
553564
554565 /// <summary>
555566 /// Get list of all release updates available for this Server
@@ -610,6 +621,10 @@ public async Task<TranscodeContainer> TranscodeSessions() =>
610621 public async Task < SessionContainer > Sessions ( ) =>
611622 await this . plexServerClient . GetSessionsAsync ( this . AccessToken , this . Uri . ToString ( ) ) ;
612623
624+ /// <summary>
625+ ///
626+ /// </summary>
627+ /// <returns></returns>
613628 public async Task < PlaylistContainer > Playlists ( ) =>
614629 await this . plexServerClient . GetPlaylists ( this . AccessToken , this . Uri . ToString ( ) ) ;
615630 }
0 commit comments