-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathIChangesService.cs
More file actions
60 lines (51 loc) · 1.99 KB
/
IChangesService.cs
File metadata and controls
60 lines (51 loc) · 1.99 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
namespace Elastic.Documentation.Search;
/// <summary>Gateway interface for querying documentation page changes.</summary>
public interface IChangesService
{
Task<ChangesResponse> GetChangesAsync(ChangesRequest request, Cancel ctx = default);
}
/// <summary>API request for the changes feed endpoint.</summary>
public record ChangesRequest
{
public required DateTimeOffset Since { get; init; }
public int PageSize { get; init; } = ChangesDefaults.PageSize;
public string? Cursor { get; init; }
}
/// <summary>API response for the changes feed endpoint.</summary>
public record ChangesResponse
{
public required IReadOnlyList<ChangedPageDto> Pages { get; init; }
public required bool HasMore { get; init; }
public string? NextCursor { get; init; }
}
/// <summary>Internal request for the changes gateway.</summary>
public record ChangesInternalRequest
{
public required DateTimeOffset Since { get; init; }
public int PageSize { get; init; } = ChangesDefaults.PageSize;
public ChangesPageCursor? Cursor { get; init; }
}
/// <summary>Internal result from the changes gateway.</summary>
public record ChangesResult
{
public required IReadOnlyList<ChangedPageDto> Pages { get; init; }
public ChangesPageCursor? NextCursor { get; init; }
}
/// <summary>Cursor for search_after pagination over changed pages.</summary>
public record ChangesPageCursor(long ContentLastUpdatedEpochMs, string Url);
/// <summary>Shared defaults for the changes feed.</summary>
public static class ChangesDefaults
{
public const int PageSize = 100;
public const int MaxPageSize = 1000;
}
/// <summary>A single changed page in the API response.</summary>
public record ChangedPageDto
{
public required string Url { get; init; }
public required string Title { get; init; }
public required DateTimeOffset LastUpdated { get; init; }
}