Skip to content

Commit 7719216

Browse files
delvedorgithub-actions[bot]
authored andcommitted
Add types for watcher.query_watches (#601)
1 parent 0875921 commit 7719216

File tree

6 files changed

+198
-57
lines changed

6 files changed

+198
-57
lines changed

output/schema/schema.json

Lines changed: 137 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12584,7 +12584,7 @@
1258412584
"namespace": "watcher.query_watches"
1258512585
},
1258612586
"since": "7.11.0",
12587-
"stability": "TODO",
12587+
"stability": "stable",
1258812588
"urls": [
1258912589
{
1259012590
"methods": [
@@ -138809,6 +138809,70 @@
138809138809
"namespace": "watcher._types"
138810138810
}
138811138811
},
138812+
{
138813+
"kind": "interface",
138814+
"name": {
138815+
"name": "QueryWatch",
138816+
"namespace": "watcher._types"
138817+
},
138818+
"properties": [
138819+
{
138820+
"name": "_id",
138821+
"required": true,
138822+
"type": {
138823+
"kind": "instance_of",
138824+
"type": {
138825+
"name": "Id",
138826+
"namespace": "_types"
138827+
}
138828+
}
138829+
},
138830+
{
138831+
"name": "status",
138832+
"required": false,
138833+
"type": {
138834+
"kind": "instance_of",
138835+
"type": {
138836+
"name": "WatchStatus",
138837+
"namespace": "watcher._types"
138838+
}
138839+
}
138840+
},
138841+
{
138842+
"name": "watch",
138843+
"required": false,
138844+
"type": {
138845+
"kind": "instance_of",
138846+
"type": {
138847+
"name": "Watch",
138848+
"namespace": "watcher._types"
138849+
}
138850+
}
138851+
},
138852+
{
138853+
"name": "_primary_term",
138854+
"required": false,
138855+
"type": {
138856+
"kind": "instance_of",
138857+
"type": {
138858+
"name": "integer",
138859+
"namespace": "_types"
138860+
}
138861+
}
138862+
},
138863+
{
138864+
"name": "_seq_no",
138865+
"required": false,
138866+
"type": {
138867+
"kind": "instance_of",
138868+
"type": {
138869+
"name": "SequenceNumber",
138870+
"namespace": "_types"
138871+
}
138872+
}
138873+
}
138874+
]
138875+
},
138812138876
{
138813138877
"kind": "enum",
138814138878
"members": [
@@ -141013,13 +141077,64 @@
141013141077
"kind": "properties",
141014141078
"properties": [
141015141079
{
141016-
"name": "stub_c",
141017-
"required": true,
141080+
"description": "The offset from the first result to fetch. Needs to be non-negative.",
141081+
"name": "from",
141082+
"required": false,
141083+
"serverDefault": "0",
141018141084
"type": {
141019141085
"kind": "instance_of",
141020141086
"type": {
141021-
"name": "string",
141022-
"namespace": "internal"
141087+
"name": "integer",
141088+
"namespace": "_types"
141089+
}
141090+
}
141091+
},
141092+
{
141093+
"description": "The number of hits to return. Needs to be non-negative.",
141094+
"name": "size",
141095+
"required": false,
141096+
"serverDefault": "10",
141097+
"type": {
141098+
"kind": "instance_of",
141099+
"type": {
141100+
"name": "integer",
141101+
"namespace": "_types"
141102+
}
141103+
}
141104+
},
141105+
{
141106+
"description": "Optional, query filter watches to be returned.",
141107+
"name": "query",
141108+
"required": false,
141109+
"type": {
141110+
"kind": "instance_of",
141111+
"type": {
141112+
"name": "QueryContainer",
141113+
"namespace": "_types.query_dsl"
141114+
}
141115+
}
141116+
},
141117+
{
141118+
"description": "Optional sort definition.",
141119+
"name": "sort",
141120+
"required": false,
141121+
"type": {
141122+
"kind": "instance_of",
141123+
"type": {
141124+
"name": "Sort",
141125+
"namespace": "_global.search._types"
141126+
}
141127+
}
141128+
},
141129+
{
141130+
"description": "Optional search After to do pagination using last hit’s sort values.",
141131+
"name": "search_after",
141132+
"required": false,
141133+
"type": {
141134+
"kind": "instance_of",
141135+
"type": {
141136+
"name": "SortResults",
141137+
"namespace": "_global.search._types"
141023141138
}
141024141139
}
141025141140
}
@@ -141036,39 +141151,15 @@
141036141151
"name": "Request",
141037141152
"namespace": "watcher.query_watches"
141038141153
},
141039-
"path": [
141040-
{
141041-
"name": "stub_a",
141042-
"required": true,
141043-
"type": {
141044-
"kind": "instance_of",
141045-
"type": {
141046-
"name": "string",
141047-
"namespace": "internal"
141048-
}
141049-
}
141050-
}
141051-
],
141052-
"query": [
141053-
{
141054-
"name": "stub_b",
141055-
"required": true,
141056-
"type": {
141057-
"kind": "instance_of",
141058-
"type": {
141059-
"name": "string",
141060-
"namespace": "internal"
141061-
}
141062-
}
141063-
}
141064-
]
141154+
"path": [],
141155+
"query": []
141065141156
},
141066141157
{
141067141158
"body": {
141068141159
"kind": "properties",
141069141160
"properties": [
141070141161
{
141071-
"name": "stub",
141162+
"name": "count",
141072141163
"required": true,
141073141164
"type": {
141074141165
"kind": "instance_of",
@@ -141077,6 +141168,20 @@
141077141168
"namespace": "_types"
141078141169
}
141079141170
}
141171+
},
141172+
{
141173+
"name": "watches",
141174+
"required": true,
141175+
"type": {
141176+
"kind": "array_of",
141177+
"value": {
141178+
"kind": "instance_of",
141179+
"type": {
141180+
"name": "QueryWatch",
141181+
"namespace": "watcher._types"
141182+
}
141183+
}
141184+
}
141080141185
}
141081141186
]
141082141187
},

output/schema/validation-errors.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,12 +1867,6 @@
18671867
],
18681868
"response": []
18691869
},
1870-
"watcher.execute_watch": {
1871-
"request": [
1872-
"Endpoint has \"@stability: TODO"
1873-
],
1874-
"response": []
1875-
},
18761870
"watcher.get_watch": {
18771871
"request": [
18781872
"Endpoint has \"@stability: TODO"
@@ -1886,10 +1880,11 @@
18861880
"response": []
18871881
},
18881882
"watcher.query_watches": {
1889-
"request": [
1890-
"Endpoint has \"@stability: TODO"
1891-
],
1892-
"response": []
1883+
"request": [],
1884+
"response": [
1885+
"interface definition watcher._types:SearchInputRequestDefinition / Property 'template' / instance_of - '_global.search_template:Request' is a request and must only be used in endpoints",
1886+
"interface definition watcher._types:HttpInput / Property 'request' / instance_of - Non-leaf type cannot be used here: 'watcher._types:HttpInputRequestDefinition'"
1887+
]
18931888
},
18941889
"watcher.start": {
18951890
"request": [

output/typescript/types.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14641,6 +14641,14 @@ export interface WatcherPagerDutyResult {
1464114641

1464214642
export type WatcherQuantifier = 'some' | 'all'
1464314643

14644+
export interface WatcherQueryWatch {
14645+
_id: Id
14646+
status?: WatcherWatchStatus
14647+
watch?: WatcherWatch
14648+
_primary_term?: integer
14649+
_seq_no?: SequenceNumber
14650+
}
14651+
1464414652
export type WatcherResponseContentType = 'json' | 'yaml' | 'text'
1464514653

1464614654
export interface WatcherScheduleBase {
@@ -14909,15 +14917,18 @@ export interface WatcherPutWatchResponse {
1490914917
}
1491014918

1491114919
export interface WatcherQueryWatchesRequest extends RequestBase {
14912-
stub_a: string
14913-
stub_b: string
1491414920
body?: {
14915-
stub_c: string
14921+
from?: integer
14922+
size?: integer
14923+
query?: QueryDslQueryContainer
14924+
sort?: SearchSort
14925+
search_after?: SearchSortResults
1491614926
}
1491714927
}
1491814928

1491914929
export interface WatcherQueryWatchesResponse {
14920-
stub: integer
14930+
count: integer
14931+
watches: WatcherQueryWatch[]
1492114932
}
1492214933

1492314934
export interface WatcherStartRequest extends RequestBase {

specification/watcher/_types/Watch.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@
1818
*/
1919

2020
import { Dictionary } from '@spec_utils/Dictionary'
21-
import { IndexName, Metadata, VersionNumber } from '@_types/common'
22-
import { long } from '@_types/Numeric'
21+
import {
22+
Id,
23+
IndexName,
24+
Metadata,
25+
SequenceNumber,
26+
VersionNumber
27+
} from '@_types/common'
28+
import { integer, long } from '@_types/Numeric'
2329
import { DateString } from '@_types/Time'
2430
import { TransformContainer } from '@_types/Transform'
2531
import { Action, Actions } from './Action'
@@ -48,3 +54,11 @@ export class WatchStatus {
4854
version: VersionNumber
4955
execution_state?: string // TODO find execution states in export enum in server codebase
5056
}
57+
58+
export class QueryWatch {
59+
_id: Id
60+
status?: WatchStatus
61+
watch?: Watch
62+
_primary_term?: integer
63+
_seq_no?: SequenceNumber
64+
}

specification/watcher/query_watches/WatcherQueryWatchesRequest.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,33 @@
1717
* under the License.
1818
*/
1919

20+
import { Sort, SortResults } from '@global/search/_types/sort'
2021
import { RequestBase } from '@_types/Base'
22+
import { integer } from '@_types/Numeric'
23+
import { QueryContainer } from '@_types/query_dsl/abstractions'
2124

2225
/**
2326
* @rest_spec_name watcher.query_watches
2427
* @since 7.11.0
25-
* @stability TODO
28+
* @stability stable
2629
*/
2730
export interface Request extends RequestBase {
28-
path_parts?: {
29-
stub_a: string
30-
}
31-
query_parameters?: {
32-
stub_b: string
33-
}
3431
body?: {
35-
stub_c: string
32+
/**
33+
* The offset from the first result to fetch. Needs to be non-negative.
34+
* @server_default 0
35+
*/
36+
from?: integer
37+
/**
38+
* The number of hits to return. Needs to be non-negative.
39+
* @server_default 10
40+
*/
41+
size?: integer
42+
/** Optional, query filter watches to be returned. */
43+
query?: QueryContainer
44+
/** Optional sort definition. */
45+
sort?: Sort
46+
/** Optional search After to do pagination using last hit’s sort values. */
47+
search_after?: SortResults
3648
}
3749
}

specification/watcher/query_watches/WatcherQueryWatchesResponse.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
* under the License.
1818
*/
1919

20+
import { QueryWatch } from '../_types/Watch'
2021
import { integer } from '@_types/Numeric'
2122

2223
export class Response {
23-
body: { stub: integer }
24+
body: {
25+
count: integer
26+
watches: QueryWatch[]
27+
}
2428
}

0 commit comments

Comments
 (0)