From b98e25a07e9b487a65019dc53b28d9337bafd1d4 Mon Sep 17 00:00:00 2001 From: chaosinnovator Date: Tue, 10 Dec 2019 09:30:44 -0800 Subject: [PATCH] Add StartIndex result to /Items API query --- MediaBrowser.Api/UserLibrary/ItemsService.cs | 8 ++++++-- MediaBrowser.Model/Querying/QueryResult.cs | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index b4a302648..1cddcb9c3 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -127,6 +127,7 @@ namespace MediaBrowser.Api.UserLibrary var result = new QueryResult { + StartIndex = request.StartIndex.GetValueOrDefault(), TotalRecordCount = itemsResult.TotalRecordCount, Items = returnItems }; @@ -177,6 +178,7 @@ namespace MediaBrowser.Api.UserLibrary return new QueryResult { + StartIndex = request.StartIndex.GetValueOrDefault(), TotalRecordCount = result.TotalRecordCount, Items = dtoList }; @@ -237,7 +239,8 @@ namespace MediaBrowser.Api.UserLibrary return new QueryResult { Items = Array.Empty(), - TotalRecordCount = 0 + TotalRecordCount = 0, + StartIndex = 0 }; } @@ -250,7 +253,8 @@ namespace MediaBrowser.Api.UserLibrary return new QueryResult { Items = itemsArray, - TotalRecordCount = itemsArray.Length + TotalRecordCount = itemsArray.Length, + StartIndex = 0 }; } diff --git a/MediaBrowser.Model/Querying/QueryResult.cs b/MediaBrowser.Model/Querying/QueryResult.cs index c007a45d6..221645afb 100644 --- a/MediaBrowser.Model/Querying/QueryResult.cs +++ b/MediaBrowser.Model/Querying/QueryResult.cs @@ -17,6 +17,12 @@ namespace MediaBrowser.Model.Querying /// The total record count. public int TotalRecordCount { get; set; } + /// + /// The index of the first record in Items. + /// + /// First record index. + public int StartIndex { get; set; } + public QueryResult() { Items = Array.Empty();