QueryResult.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System;
  4. using System.Collections.Generic;
  5. namespace MediaBrowser.Model.Querying
  6. {
  7. public class QueryResult<T>
  8. {
  9. public QueryResult()
  10. {
  11. Items = Array.Empty<T>();
  12. }
  13. public QueryResult(IReadOnlyList<T> items)
  14. {
  15. Items = items;
  16. TotalRecordCount = items.Count;
  17. }
  18. public QueryResult(int? startIndex, int? totalRecordCount, IReadOnlyList<T> items)
  19. {
  20. StartIndex = startIndex ?? 0;
  21. TotalRecordCount = totalRecordCount ?? items.Count;
  22. Items = items;
  23. }
  24. /// <summary>
  25. /// Gets or sets the items.
  26. /// </summary>
  27. /// <value>The items.</value>
  28. public IReadOnlyList<T> Items { get; set; }
  29. /// <summary>
  30. /// Gets or sets the total number of records available.
  31. /// </summary>
  32. /// <value>The total record count.</value>
  33. public int TotalRecordCount { get; set; }
  34. /// <summary>
  35. /// Gets or sets the index of the first record in Items.
  36. /// </summary>
  37. /// <value>First record index.</value>
  38. public int StartIndex { get; set; }
  39. }
  40. }