|
| 1 | +// Licensed to Elasticsearch B.V under one or more agreements. |
| 2 | +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. |
| 3 | +// See the LICENSE file in the project root for more information |
| 4 | + |
| 5 | +using System; |
| 6 | +using System.Collections.Generic; |
| 7 | +using System.Runtime.Serialization; |
| 8 | + |
| 9 | +namespace Nest |
| 10 | +{ |
| 11 | + [MapsApi("watcher.query_watches.json")] |
| 12 | + [ReadAs(typeof(QueryWatchesRequest))] |
| 13 | + public partial interface IQueryWatchesRequest |
| 14 | + { |
| 15 | + /// <summary> |
| 16 | + /// The offset from the first result to fetch. Needs to be non-negative. |
| 17 | + /// </summary> |
| 18 | + [DataMember(Name = "from")] |
| 19 | + int? From { get; set; } |
| 20 | + |
| 21 | + /// <summary> |
| 22 | + /// Optional, query filter watches to be returned. |
| 23 | + /// </summary> |
| 24 | + [DataMember(Name = "query")] |
| 25 | + QueryContainer Query { get; set; } |
| 26 | + |
| 27 | + /// <summary> |
| 28 | + /// Sort values that can be used to start returning results "after" any document in the result list. |
| 29 | + /// </summary> |
| 30 | + [DataMember(Name = "search_after")] |
| 31 | + IList<object> SearchAfter { get; set; } |
| 32 | + |
| 33 | + /// <summary> |
| 34 | + /// The number of hits to return. Defaults to 10. |
| 35 | + /// </summary> |
| 36 | + [DataMember(Name = "size")] |
| 37 | + int? Size { get; set; } |
| 38 | + |
| 39 | + /// <summary> |
| 40 | + /// Specifies how to sort the search hits. |
| 41 | + /// </summary> |
| 42 | + [DataMember(Name = "sort")] |
| 43 | + IList<ISort> Sort { get; set; } |
| 44 | + } |
| 45 | + |
| 46 | + /// <inheritdoc cref="IQueryWatchesRequest" /> |
| 47 | + public partial class QueryWatchesRequest |
| 48 | + { |
| 49 | + /// <inheritdoc /> |
| 50 | + public int? From { get; set; } |
| 51 | + |
| 52 | + /// <inheritdoc /> |
| 53 | + public QueryContainer Query { get; set; } |
| 54 | + |
| 55 | + /// <inheritdoc /> |
| 56 | + public IList<object> SearchAfter { get; set; } |
| 57 | + |
| 58 | + /// <inheritdoc /> |
| 59 | + public int? Size { get; set; } |
| 60 | + |
| 61 | + /// <inheritdoc /> |
| 62 | + public IList<ISort> Sort { get; set; } |
| 63 | + } |
| 64 | + |
| 65 | + /// <inheritdoc cref="IQueryWatchesRequest" /> |
| 66 | + public partial class QueryWatchesDescriptor |
| 67 | + { |
| 68 | + int? IQueryWatchesRequest.From { get; set; } |
| 69 | + QueryContainer IQueryWatchesRequest.Query { get; set; } |
| 70 | + IList<object> IQueryWatchesRequest.SearchAfter { get; set; } |
| 71 | + int? IQueryWatchesRequest.Size { get; set; } |
| 72 | + IList<ISort> IQueryWatchesRequest.Sort { get; set; } |
| 73 | + |
| 74 | + /// <inheritdoc cref="IQueryWatchesRequest.From" /> |
| 75 | + public QueryWatchesDescriptor From(int? from) => Assign(from, (a, v) => a.From = v); |
| 76 | + |
| 77 | + /// <inheritdoc cref="IQueryWatchesRequest.Query" /> |
| 78 | + public QueryWatchesDescriptor Query(Func<QueryContainerDescriptor<Watch>, QueryContainer> query) => |
| 79 | + Assign(query, (a, v) => a.Query = v?.Invoke(new QueryContainerDescriptor<Watch>())); |
| 80 | + |
| 81 | + /// <inheritdoc cref="IQueryWatchesRequest.SearchAfter" /> |
| 82 | + public QueryWatchesDescriptor SearchAfter(IEnumerable<object> searchAfter) => |
| 83 | + Assign(searchAfter, (a, v) => a.SearchAfter = v?.ToListOrNullIfEmpty()); |
| 84 | + |
| 85 | + /// <inheritdoc cref="IQueryWatchesRequest.SearchAfter" /> |
| 86 | + public QueryWatchesDescriptor SearchAfter(IList<object> searchAfter) => Assign(searchAfter, (a, v) => a.SearchAfter = v); |
| 87 | + |
| 88 | + /// <inheritdoc cref="IQueryWatchesRequest.SearchAfter" /> |
| 89 | + public QueryWatchesDescriptor SearchAfter(params object[] searchAfter) => Assign(searchAfter, (a, v) => a.SearchAfter = v); |
| 90 | + |
| 91 | + /// <inheritdoc cref="IQueryWatchesRequest.Size" /> |
| 92 | + public QueryWatchesDescriptor Size(int? size) => Assign(size, (a, v) => a.Size = v); |
| 93 | + |
| 94 | + /// <inheritdoc cref="IQueryWatchesRequest.Sort" /> |
| 95 | + public QueryWatchesDescriptor Sort(Func<SortDescriptor<Watch>, IPromise<IList<ISort>>> selector) => |
| 96 | + Assign(selector, (a, v) => a.Sort = v?.Invoke(new SortDescriptor<Watch>())?.Value); |
| 97 | + } |
| 98 | +} |
0 commit comments