Skip to content

Commit d4a05e5

Browse files
authored
Add types for watcher.query_watches (#601)
1 parent eb18f6f commit d4a05e5

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": [
@@ -138819,6 +138819,70 @@
138819138819
"namespace": "watcher._types"
138820138820
}
138821138821
},
138822+
{
138823+
"kind": "interface",
138824+
"name": {
138825+
"name": "QueryWatch",
138826+
"namespace": "watcher._types"
138827+
},
138828+
"properties": [
138829+
{
138830+
"name": "_id",
138831+
"required": true,
138832+
"type": {
138833+
"kind": "instance_of",
138834+
"type": {
138835+
"name": "Id",
138836+
"namespace": "_types"
138837+
}
138838+
}
138839+
},
138840+
{
138841+
"name": "status",
138842+
"required": false,
138843+
"type": {
138844+
"kind": "instance_of",
138845+
"type": {
138846+
"name": "WatchStatus",
138847+
"namespace": "watcher._types"
138848+
}
138849+
}
138850+
},
138851+
{
138852+
"name": "watch",
138853+
"required": false,
138854+
"type": {
138855+
"kind": "instance_of",
138856+
"type": {
138857+
"name": "Watch",
138858+
"namespace": "watcher._types"
138859+
}
138860+
}
138861+
},
138862+
{
138863+
"name": "_primary_term",
138864+
"required": false,
138865+
"type": {
138866+
"kind": "instance_of",
138867+
"type": {
138868+
"name": "integer",
138869+
"namespace": "_types"
138870+
}
138871+
}
138872+
},
138873+
{
138874+
"name": "_seq_no",
138875+
"required": false,
138876+
"type": {
138877+
"kind": "instance_of",
138878+
"type": {
138879+
"name": "SequenceNumber",
138880+
"namespace": "_types"
138881+
}
138882+
}
138883+
}
138884+
]
138885+
},
138822138886
{
138823138887
"kind": "enum",
138824138888
"members": [
@@ -141023,13 +141087,64 @@
141023141087
"kind": "properties",
141024141088
"properties": [
141025141089
{
141026-
"name": "stub_c",
141027-
"required": true,
141090+
"description": "The offset from the first result to fetch. Needs to be non-negative.",
141091+
"name": "from",
141092+
"required": false,
141093+
"serverDefault": "0",
141028141094
"type": {
141029141095
"kind": "instance_of",
141030141096
"type": {
141031-
"name": "string",
141032-
"namespace": "internal"
141097+
"name": "integer",
141098+
"namespace": "_types"
141099+
}
141100+
}
141101+
},
141102+
{
141103+
"description": "The number of hits to return. Needs to be non-negative.",
141104+
"name": "size",
141105+
"required": false,
141106+
"serverDefault": "10",
141107+
"type": {
141108+
"kind": "instance_of",
141109+
"type": {
141110+
"name": "integer",
141111+
"namespace": "_types"
141112+
}
141113+
}
141114+
},
141115+
{
141116+
"description": "Optional, query filter watches to be returned.",
141117+
"name": "query",
141118+
"required": false,
141119+
"type": {
141120+
"kind": "instance_of",
141121+
"type": {
141122+
"name": "QueryContainer",
141123+
"namespace": "_types.query_dsl"
141124+
}
141125+
}
141126+
},
141127+
{
141128+
"description": "Optional sort definition.",
141129+
"name": "sort",
141130+
"required": false,
141131+
"type": {
141132+
"kind": "instance_of",
141133+
"type": {
141134+
"name": "Sort",
141135+
"namespace": "_global.search._types"
141136+
}
141137+
}
141138+
},
141139+
{
141140+
"description": "Optional search After to do pagination using last hit’s sort values.",
141141+
"name": "search_after",
141142+
"required": false,
141143+
"type": {
141144+
"kind": "instance_of",
141145+
"type": {
141146+
"name": "SortResults",
141147+
"namespace": "_global.search._types"
141033141148
}
141034141149
}
141035141150
}
@@ -141046,39 +141161,15 @@
141046141161
"name": "Request",
141047141162
"namespace": "watcher.query_watches"
141048141163
},
141049-
"path": [
141050-
{
141051-
"name": "stub_a",
141052-
"required": true,
141053-
"type": {
141054-
"kind": "instance_of",
141055-
"type": {
141056-
"name": "string",
141057-
"namespace": "internal"
141058-
}
141059-
}
141060-
}
141061-
],
141062-
"query": [
141063-
{
141064-
"name": "stub_b",
141065-
"required": true,
141066-
"type": {
141067-
"kind": "instance_of",
141068-
"type": {
141069-
"name": "string",
141070-
"namespace": "internal"
141071-
}
141072-
}
141073-
}
141074-
]
141164+
"path": [],
141165+
"query": []
141075141166
},
141076141167
{
141077141168
"body": {
141078141169
"kind": "properties",
141079141170
"properties": [
141080141171
{
141081-
"name": "stub",
141172+
"name": "count",
141082141173
"required": true,
141083141174
"type": {
141084141175
"kind": "instance_of",
@@ -141087,6 +141178,20 @@
141087141178
"namespace": "_types"
141088141179
}
141089141180
}
141181+
},
141182+
{
141183+
"name": "watches",
141184+
"required": true,
141185+
"type": {
141186+
"kind": "array_of",
141187+
"value": {
141188+
"kind": "instance_of",
141189+
"type": {
141190+
"name": "QueryWatch",
141191+
"namespace": "watcher._types"
141192+
}
141193+
}
141194+
}
141090141195
}
141091141196
]
141092141197
},

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
@@ -14643,6 +14643,14 @@ export interface WatcherPagerDutyResult {
1464314643

1464414644
export type WatcherQuantifier = 'some' | 'all'
1464514645

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

1464814656
export interface WatcherScheduleBase {
@@ -14911,15 +14919,18 @@ export interface WatcherPutWatchResponse {
1491114919
}
1491214920

1491314921
export interface WatcherQueryWatchesRequest extends RequestBase {
14914-
stub_a: string
14915-
stub_b: string
1491614922
body?: {
14917-
stub_c: string
14923+
from?: integer
14924+
size?: integer
14925+
query?: QueryDslQueryContainer
14926+
sort?: SearchSort
14927+
search_after?: SearchSortResults
1491814928
}
1491914929
}
1492014930

1492114931
export interface WatcherQueryWatchesResponse {
14922-
stub: integer
14932+
count: integer
14933+
watches: WatcherQueryWatch[]
1492314934
}
1492414935

1492514936
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)