Skip to content

Add types for watcher.query_watches #601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 137 additions & 32 deletions output/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12591,7 +12591,7 @@
"namespace": "watcher.query_watches"
},
"since": "7.11.0",
"stability": "TODO",
"stability": "stable",
"urls": [
{
"methods": [
Expand Down Expand Up @@ -138573,6 +138573,70 @@
"namespace": "watcher._types"
}
},
{
"kind": "interface",
"name": {
"name": "QueryWatch",
"namespace": "watcher._types"
},
"properties": [
{
"name": "_id",
"required": true,
"type": {
"kind": "instance_of",
"type": {
"name": "Id",
"namespace": "_types"
}
}
},
{
"name": "status",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "WatchStatus",
"namespace": "watcher._types"
}
}
},
{
"name": "watch",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "Watch",
"namespace": "watcher._types"
}
}
},
{
"name": "_primary_term",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "integer",
"namespace": "_types"
}
}
},
{
"name": "_seq_no",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "SequenceNumber",
"namespace": "_types"
}
}
}
]
},
{
"kind": "enum",
"members": [
Expand Down Expand Up @@ -140777,13 +140841,64 @@
"kind": "properties",
"properties": [
{
"name": "stub_c",
"required": true,
"description": "The offset from the first result to fetch. Needs to be non-negative.",
"name": "from",
"required": false,
"serverDefault": "0",
"type": {
"kind": "instance_of",
"type": {
"name": "string",
"namespace": "internal"
"name": "integer",
"namespace": "_types"
}
}
},
{
"description": "The number of hits to return. Needs to be non-negative.",
"name": "size",
"required": false,
"serverDefault": "10",
"type": {
"kind": "instance_of",
"type": {
"name": "integer",
"namespace": "_types"
}
}
},
{
"description": "Optional, query filter watches to be returned.",
"name": "query",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "QueryContainer",
"namespace": "_types.query_dsl"
}
}
},
{
"description": "Optional sort definition.",
"name": "sort",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "Sort",
"namespace": "_global.search._types"
}
}
},
{
"description": "Optional search After to do pagination using last hit’s sort values.",
"name": "search_after",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "SortResults",
"namespace": "_global.search._types"
}
}
}
Expand All @@ -140800,39 +140915,15 @@
"name": "Request",
"namespace": "watcher.query_watches"
},
"path": [
{
"name": "stub_a",
"required": true,
"type": {
"kind": "instance_of",
"type": {
"name": "string",
"namespace": "internal"
}
}
}
],
"query": [
{
"name": "stub_b",
"required": true,
"type": {
"kind": "instance_of",
"type": {
"name": "string",
"namespace": "internal"
}
}
}
]
"path": [],
"query": []
},
{
"body": {
"kind": "properties",
"properties": [
{
"name": "stub",
"name": "count",
"required": true,
"type": {
"kind": "instance_of",
Expand All @@ -140841,6 +140932,20 @@
"namespace": "_types"
}
}
},
{
"name": "watches",
"required": true,
"type": {
"kind": "array_of",
"value": {
"kind": "instance_of",
"type": {
"name": "QueryWatch",
"namespace": "watcher._types"
}
}
}
}
]
},
Expand Down
15 changes: 5 additions & 10 deletions output/schema/validation-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -1879,12 +1879,6 @@
],
"response": []
},
"watcher.execute_watch": {
"request": [
"Endpoint has \"@stability: TODO"
],
"response": []
},
"watcher.get_watch": {
"request": [
"Endpoint has \"@stability: TODO"
Expand All @@ -1898,10 +1892,11 @@
"response": []
},
"watcher.query_watches": {
"request": [
"Endpoint has \"@stability: TODO"
],
"response": []
"request": [],
"response": [
"interface definition watcher._types:SearchInputRequestDefinition / Property 'template' / instance_of - '_global.search_template:Request' is a request and must only be used in endpoints",
"interface definition watcher._types:HttpInput / Property 'request' / instance_of - Non-leaf type cannot be used here: 'watcher._types:HttpInputRequestDefinition'"
]
},
"watcher.start": {
"request": [
Expand Down
19 changes: 15 additions & 4 deletions output/typescript/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14610,6 +14610,14 @@ export interface WatcherPagerDutyResult {

export type WatcherQuantifier = 'some' | 'all'

export interface WatcherQueryWatch {
_id: Id
status?: WatcherWatchStatus
watch?: WatcherWatch
_primary_term?: integer
_seq_no?: SequenceNumber
}

export type WatcherResponseContentType = 'json' | 'yaml' | 'text'

export interface WatcherScheduleBase {
Expand Down Expand Up @@ -14877,15 +14885,18 @@ export interface WatcherPutWatchResponse {
}

export interface WatcherQueryWatchesRequest extends RequestBase {
stub_a: string
stub_b: string
body?: {
stub_c: string
from?: integer
size?: integer
query?: QueryDslQueryContainer
sort?: SearchSort
search_after?: SearchSortResults
}
}

export interface WatcherQueryWatchesResponse {
stub: integer
count: integer
watches: WatcherQueryWatch[]
}

export interface WatcherStartRequest extends RequestBase {
Expand Down
18 changes: 16 additions & 2 deletions specification/watcher/_types/Watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
*/

import { Dictionary } from '@spec_utils/Dictionary'
import { IndexName, Metadata, VersionNumber } from '@_types/common'
import { long } from '@_types/Numeric'
import {
Id,
IndexName,
Metadata,
SequenceNumber,
VersionNumber
} from '@_types/common'
import { integer, long } from '@_types/Numeric'
import { DateString } from '@_types/Time'
import { TransformContainer } from '@_types/Transform'
import { Action, Actions } from './Action'
Expand Down Expand Up @@ -48,3 +54,11 @@ export class WatchStatus {
version: VersionNumber
execution_state?: string // TODO find execution states in export enum in server codebase
}

export class QueryWatch {
_id: Id
status?: WatchStatus
watch?: Watch
_primary_term?: integer
_seq_no?: SequenceNumber
}
28 changes: 20 additions & 8 deletions specification/watcher/query_watches/WatcherQueryWatchesRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,33 @@
* under the License.
*/

import { Sort, SortResults } from '@global/search/_types/sort'
import { RequestBase } from '@_types/Base'
import { integer } from '@_types/Numeric'
import { QueryContainer } from '@_types/query_dsl/abstractions'

/**
* @rest_spec_name watcher.query_watches
* @since 7.11.0
* @stability TODO
* @stability stable
*/
export interface Request extends RequestBase {
path_parts?: {
stub_a: string
}
query_parameters?: {
stub_b: string
}
body?: {
stub_c: string
/**
* The offset from the first result to fetch. Needs to be non-negative.
* @server_default 0
*/
from?: integer
/**
* The number of hits to return. Needs to be non-negative.
* @server_default 10
*/
size?: integer
/** Optional, query filter watches to be returned. */
query?: QueryContainer
/** Optional sort definition. */
sort?: Sort
/** Optional search After to do pagination using last hit’s sort values. */
search_after?: SortResults
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
* under the License.
*/

import { QueryWatch } from '../_types/Watch'
import { integer } from '@_types/Numeric'

export class Response {
body: { stub: integer }
body: {
count: integer
watches: QueryWatch[]
}
}