-
Notifications
You must be signed in to change notification settings - Fork 12
/
ApiSearchResponse.cs
39 lines (33 loc) · 1.22 KB
/
ApiSearchResponse.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ReSharper disable UnusedAutoPropertyAccessor.Local
namespace DM.MovieApi.ApiResponse;
/// <summary>
/// Standard response from an API call returning a more than one result, i.e., a Search Result.
/// Single item based results are returned with an
/// <see cref="DM.MovieApi.ApiResponse.ApiQueryResponse{T}"/>.
/// </summary>
[DataContract]
public class ApiSearchResponse<T> : ApiResponseBase
{
/// <summary>
/// The list of results from the search.
/// </summary>
[DataMember( Name = "results" )]
public IReadOnlyList<T> Results { get; private set; }
/// <summary>
/// The current page number of the search result.
/// </summary>
[DataMember( Name = "page" )]
public int PageNumber { get; private set; }
/// <summary>
/// The total number of pages found from the search result.
/// </summary>
[DataMember( Name = "total_pages" )]
public int TotalPages { get; private set; }
/// <summary>
/// The total number of results from the search.
/// </summary>
[DataMember( Name = "total_results" )]
public int TotalResults { get; private set; }
public override string ToString()
=> $"Page {PageNumber} of {TotalPages} ({TotalResults} total results)";
}