diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-10 15:57:38 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-10 15:57:38 -0400 |
| commit | 06298d489c5e1e9689b1ca4853fd27787057a1ca (patch) | |
| tree | f39c778afca49452da1d2fec83e96e1d6c949624 /MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs | |
| parent | 9d7b3fdda66cb4607b0461b19bc42ce10bd00e6e (diff) | |
fixes #530 - Add ability to sort movie genres/studios/people by movie or trailer count
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index f1bb56b16..f92b7da45 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -87,6 +87,13 @@ namespace MediaBrowser.Api.UserLibrary public string ImageTypes { get; set; } /// <summary> + /// What to sort the results by + /// </summary> + /// <value>The sort by.</value> + [ApiMember(Name = "SortBy", Description = "Optional. Specify one or more sort orders, comma delimeted. Options: Album, AlbumArtist, Artist, Budget, CommunityRating, CriticRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Revenue, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string SortBy { get; set; } + + /// <summary> /// Gets the filters. /// </summary> /// <returns>IEnumerable{ItemFilter}.</returns> @@ -143,5 +150,21 @@ namespace MediaBrowser.Api.UserLibrary return val.Split(',').Select(v => (ImageType)Enum.Parse(typeof(ImageType), v, true)); } + + /// <summary> + /// Gets the order by. + /// </summary> + /// <returns>IEnumerable{ItemSortBy}.</returns> + public IEnumerable<string> GetOrderBy() + { + var val = SortBy; + + if (string.IsNullOrEmpty(val)) + { + return new string[] { }; + } + + return val.Split(','); + } } } |
