From 495cb45dfbd055c7ac991f58cee32a47120e675a Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 27 Jan 2021 09:58:44 +0100 Subject: [PATCH] Add new behaviors (#90) --- output/schema/schema.json | 610 ++++++++++++++---- output/typescript/types.ts | 309 +++++---- specification/specs/behaviors.ts | 16 + specification/specs/cat/CatBase.ts | 4 - .../cat/cat_aliases/CatAliasesResponse.ts | 2 +- .../cat_allocation/CatAllocationResponse.ts | 2 +- .../specs/cat/cat_count/CatCountResponse.ts | 2 +- .../CatDataFrameAnalyticsResponse.ts | 2 +- .../cat/cat_datafeeds/CatDatafeedsResponse.ts | 2 +- .../cat/cat_fielddata/CatFielddataResponse.ts | 2 +- .../specs/cat/cat_health/CatHealthResponse.ts | 2 +- .../specs/cat/cat_help/CatHelpResponse.ts | 2 +- .../cat/cat_indices/CatIndicesResponse.ts | 2 +- .../specs/cat/cat_jobs/CatJobsResponse.ts | 2 +- .../specs/cat/cat_master/CatMasterResponse.ts | 2 +- .../CatNodeAttributesResponse.ts | 2 +- .../specs/cat/cat_nodes/CatNodesResponse.ts | 2 +- .../CatPendingTasksResponse.ts | 2 +- .../cat/cat_plugins/CatPluginsResponse.ts | 2 +- .../cat/cat_recovery/CatRecoveryResponse.ts | 2 +- .../CatRepositoriesResponse.ts | 2 +- .../cat/cat_segments/CatSegmentsResponse.ts | 2 +- .../specs/cat/cat_shards/CatShardsResponse.ts | 2 +- .../cat/cat_snapshots/CatSnapshotsResponse.ts | 2 +- .../specs/cat/cat_tasks/CatTasksResponse.ts | 2 +- .../cat/cat_templates/CatTemplatesResponse.ts | 2 +- .../cat_thread_pool/CatThreadPoolResponse.ts | 2 +- .../CatTrainedModelsResponse.ts | 2 +- .../cat_transforms/CatTransformsResponse.ts | 2 +- .../specs/cluster/ping/PingResponse.ts | 2 +- .../response/HeadResponseBase.ts | 3 - .../response/ResponseBase.ts | 3 +- .../single/exists/DocumentExistsResponse.ts | 2 +- .../source_exists/SourceExistsResponse.ts | 2 +- .../alias_exists/AliasExistsResponse.ts | 2 +- .../indices_exists/IndexExistsResponse.ts | 2 +- .../types_exists/TypeExistsResponse.ts | 2 +- .../IndexTemplateExistsResponse.ts | 2 +- specification/src/api-specification.ts | 2 +- typescript-generator/index.js | 33 +- 40 files changed, 707 insertions(+), 337 deletions(-) delete mode 100644 specification/specs/common_abstractions/response/HeadResponseBase.ts diff --git a/output/schema/schema.json b/output/schema/schema.json index 1b478a8445..14be1f7216 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -6858,40 +6858,6 @@ } ] }, - { - "kind": "interface", - "name": { - "namespace": "cat", - "name": "CatResponseBase" - }, - "generics": [ - "TCatRecord" - ], - "inherits": [ - { - "type": { - "namespace": "common_abstractions.response", - "name": "ResponseBase" - } - } - ], - "properties": [ - { - "name": "records", - "type": { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "namespace": "generic", - "name": "TCatRecord" - } - } - }, - "required": true - } - ] - }, { "kind": "interface", "name": { @@ -7019,8 +6985,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -7033,6 +7007,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -7206,8 +7183,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -7220,6 +7205,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -7303,8 +7291,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -7317,6 +7313,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -7568,8 +7567,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -7582,6 +7589,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -7777,8 +7787,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -7791,6 +7809,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -7920,8 +7941,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -7934,6 +7963,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -8115,8 +8147,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -8129,6 +8169,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -8177,8 +8220,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -8191,6 +8242,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -8423,8 +8477,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -8437,6 +8499,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -9117,8 +9182,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -9131,6 +9204,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -9234,8 +9310,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -9248,6 +9332,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -9373,8 +9460,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -9387,6 +9482,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -10230,8 +10328,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -10244,6 +10350,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -10328,8 +10437,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -10342,6 +10459,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -10467,8 +10587,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -10481,6 +10609,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -10816,8 +10947,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -10830,6 +10969,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -10889,8 +11031,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -10903,6 +11053,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -11131,8 +11284,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -11145,6 +11306,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -11846,8 +12010,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -11860,6 +12032,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -12062,8 +12237,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -12076,6 +12259,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -12265,8 +12451,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -12279,6 +12473,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -12390,8 +12587,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -12404,6 +12609,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -12723,8 +12931,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -12737,6 +12953,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -12990,8 +13209,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -13004,6 +13231,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -13391,8 +13621,16 @@ "inherits": [ { "type": { - "namespace": "cat", - "name": "CatResponseBase" + "namespace": "common_abstractions.response", + "name": "ResponseBase" + } + } + ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "ArrayResponse" }, "generics": [ { @@ -13405,6 +13643,9 @@ ] } ], + "attachedBehaviors": [ + "ArrayResponse" + ], "properties": [] }, { @@ -20963,10 +21204,30 @@ { "type": { "namespace": "common_abstractions.response", - "name": "EmptyResponseBase" + "name": "ResponseBase" } } ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + }, + "generics": [ + { + "kind": "instance_of", + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + } + } + ] + } + ], + "attachedBehaviors": [ + "EmptyResponseBase" + ], "properties": [] }, { @@ -22891,34 +23152,6 @@ } ] }, - { - "kind": "interface", - "name": { - "namespace": "common_abstractions.response", - "name": "EmptyResponseBase" - }, - "inherits": [ - { - "type": { - "namespace": "common_abstractions.response", - "name": "ResponseBase" - } - } - ], - "properties": [ - { - "name": "exists", - "type": { - "kind": "instance_of", - "type": { - "namespace": "internal", - "name": "boolean" - } - }, - "required": true - } - ] - }, { "kind": "interface", "name": { @@ -29898,10 +30131,30 @@ { "type": { "namespace": "common_abstractions.response", - "name": "EmptyResponseBase" + "name": "ResponseBase" } } ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + }, + "generics": [ + { + "kind": "instance_of", + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + } + } + ] + } + ], + "attachedBehaviors": [ + "EmptyResponseBase" + ], "properties": [] }, { @@ -30856,10 +31109,30 @@ { "type": { "namespace": "common_abstractions.response", - "name": "EmptyResponseBase" + "name": "ResponseBase" } } ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + }, + "generics": [ + { + "kind": "instance_of", + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + } + } + ] + } + ], + "attachedBehaviors": [ + "EmptyResponseBase" + ], "properties": [] }, { @@ -32355,10 +32628,30 @@ { "type": { "namespace": "common_abstractions.response", - "name": "EmptyResponseBase" + "name": "ResponseBase" } } ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + }, + "generics": [ + { + "kind": "instance_of", + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + } + } + ] + } + ], + "attachedBehaviors": [ + "EmptyResponseBase" + ], "properties": [] }, { @@ -34228,10 +34521,30 @@ { "type": { "namespace": "common_abstractions.response", - "name": "EmptyResponseBase" + "name": "ResponseBase" } } ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + }, + "generics": [ + { + "kind": "instance_of", + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + } + } + ] + } + ], + "attachedBehaviors": [ + "EmptyResponseBase" + ], "properties": [] }, { @@ -35276,10 +35589,30 @@ { "type": { "namespace": "common_abstractions.response", - "name": "EmptyResponseBase" + "name": "ResponseBase" } } ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + }, + "generics": [ + { + "kind": "instance_of", + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + } + } + ] + } + ], + "attachedBehaviors": [ + "EmptyResponseBase" + ], "properties": [] }, { @@ -35925,10 +36258,30 @@ { "type": { "namespace": "common_abstractions.response", - "name": "EmptyResponseBase" + "name": "ResponseBase" } } ], + "behaviors": [ + { + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + }, + "generics": [ + { + "kind": "instance_of", + "type": { + "namespace": "internal", + "name": "EmptyResponseBase" + } + } + ] + } + ], + "attachedBehaviors": [ + "EmptyResponseBase" + ], "properties": [] }, { @@ -44569,6 +44922,17 @@ } } }, + { + "kind": "interface", + "name": { + "namespace": "internal", + "name": "ArrayResponse" + }, + "generics": [ + "TRecord" + ], + "properties": [] + }, { "kind": "type_alias", "name": { @@ -44647,6 +45011,14 @@ } } }, + { + "kind": "interface", + "name": { + "namespace": "internal", + "name": "EmptyResponseBase" + }, + "properties": [] + }, { "kind": "interface", "name": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index de459e347f..00a32a00c8 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -1454,7 +1454,7 @@ export type TransformType = 'batch' | 'continuous' export type ClusterStatus = 'green' | 'yellow' | 'red' -export interface NodesResponseBase extends ResponseBase { +export interface NodesResponseBase { _nodes: NodeStatistics } @@ -1492,7 +1492,7 @@ export interface ClusterAllocationExplainRequest extends RequestBase { } } -export interface ClusterAllocationExplainResponse extends ResponseBase { +export interface ClusterAllocationExplainResponse { allocate_explanation?: string allocation_delay?: string allocation_delay_in_millis?: long @@ -1594,7 +1594,7 @@ export interface ClusterHealthRequest extends RequestBase { wait_for_status?: WaitForStatus } -export interface ClusterHealthResponse extends ResponseBase { +export interface ClusterHealthResponse { active_primary_shards: integer active_shards: integer active_shards_percent_as_number: double @@ -1639,7 +1639,7 @@ export interface ClusterPendingTasksRequest extends RequestBase { master_timeout?: Time } -export interface ClusterPendingTasksResponse extends ResponseBase { +export interface ClusterPendingTasksResponse { tasks: Array } @@ -1684,7 +1684,7 @@ export interface ClusterRerouteRequest extends RequestBase { } } -export interface ClusterRerouteResponse extends ResponseBase { +export interface ClusterRerouteResponse { explanations: Array state: Array } @@ -1700,7 +1700,7 @@ export interface ClusterGetSettingsRequest extends RequestBase { timeout?: Time } -export interface ClusterGetSettingsResponse extends ResponseBase { +export interface ClusterGetSettingsResponse { persistent: Record transient: Record } @@ -1715,7 +1715,7 @@ export interface ClusterPutSettingsRequest extends RequestBase { } } -export interface ClusterPutSettingsResponse extends ResponseBase { +export interface ClusterPutSettingsResponse { acknowledged: boolean persistent: Record transient: Record @@ -1734,7 +1734,7 @@ export interface ClusterStateRequest extends RequestBase { wait_for_timeout?: Time } -export interface ClusterStateResponse extends ResponseBase { +export interface ClusterStateResponse { cluster_name: string cluster_uuid: string master_node: string @@ -1915,7 +1915,7 @@ export interface NodesHotThreadsRequest extends RequestBase { timeout?: Time } -export interface NodesHotThreadsResponse extends ResponseBase { +export interface NodesHotThreadsResponse { hot_threads: Array } @@ -2321,7 +2321,7 @@ export interface RemoteInfoResponse extends DictionaryResponseBase nodes: Record } @@ -2347,7 +2347,7 @@ export interface GetTaskRequest extends RequestBase { wait_for_completion?: boolean } -export interface GetTaskResponse extends ResponseBase { +export interface GetTaskResponse { completed: boolean task: TaskInfo } @@ -2376,7 +2376,7 @@ export interface ListTasksRequest extends RequestBase { wait_for_completion?: boolean } -export interface ListTasksResponse extends ResponseBase { +export interface ListTasksResponse { node_failures: Array nodes: Record } @@ -2474,7 +2474,7 @@ export interface RequestBase { source_query_string?: string } -export interface AcknowledgedResponseBase extends ResponseBase { +export interface AcknowledgedResponseBase { acknowledged: boolean } @@ -2503,10 +2503,7 @@ export interface IndicesResponseBase extends AcknowledgedResponseBase { _shards: ShardStatistics } -export interface ResponseBase { -} - -export interface ShardsOperationResponseBase extends ResponseBase { +export interface ShardsOperationResponseBase { _shards: ShardStatistics } @@ -2777,7 +2774,7 @@ export interface BulkRequest extends RequestBase { body: Array } -export interface BulkResponse extends ResponseBase { +export interface BulkResponse { errors: boolean items: Array took: long @@ -2888,7 +2885,7 @@ export interface DeleteByQueryRequest extends RequestBase { } } -export interface DeleteByQueryResponse extends ResponseBase { +export interface DeleteByQueryResponse { batches: long deleted: long failures: Array @@ -2952,7 +2949,7 @@ export interface MultiGetHit { _version: long } -export interface MultiGetResponse extends ResponseBase { +export interface MultiGetResponse { docs: Array> } @@ -2992,7 +2989,7 @@ export interface MultiTermVectorsRequest extends RequestBase { } } -export interface MultiTermVectorsResponse extends ResponseBase { +export interface MultiTermVectorsResponse { docs: Array } @@ -3023,7 +3020,7 @@ export interface ReindexRequest extends RequestBase { } } -export interface ReindexResponse extends ResponseBase { +export interface ReindexResponse { batches: long created: long failures: Array @@ -3074,7 +3071,7 @@ export interface ReindexRethrottleRequest extends RequestBase { requests_per_second?: long } -export interface ReindexRethrottleResponse extends ResponseBase { +export interface ReindexRethrottleResponse { nodes: Record } @@ -3149,7 +3146,7 @@ export interface UpdateByQueryRequest extends RequestBase { } } -export interface UpdateByQueryResponse extends ResponseBase { +export interface UpdateByQueryResponse { batches: long failures: Array noops: long @@ -3168,7 +3165,7 @@ export interface UpdateByQueryRethrottleRequest extends RequestBase { requests_per_second?: long } -export interface WriteResponseBase extends ResponseBase { +export interface WriteResponseBase { _id: string _index: string _primary_term: long @@ -3249,7 +3246,7 @@ export interface GetRequest extends RequestBase { _source?: boolean | string | Array } -export interface GetResponse extends ResponseBase { +export interface GetResponse { _index: string fields?: Record found: boolean @@ -3298,7 +3295,7 @@ export interface SourceRequest extends RequestBase { version_type?: VersionType } -export interface SourceResponse extends ResponseBase { +export interface SourceResponse { body: TDocument } @@ -3362,7 +3359,7 @@ export interface TermVectorsRequest extends RequestBase { } } -export interface TermVectorsResponse extends ResponseBase { +export interface TermVectorsResponse { found: boolean _id: string _index: string @@ -3483,7 +3480,7 @@ export interface DeleteAliasRequest extends RequestBase { timeout?: Time } -export interface DeleteAliasResponse extends ResponseBase { +export interface DeleteAliasResponse { } export interface GetAliasRequest extends RequestBase { @@ -3516,7 +3513,7 @@ export interface PutAliasRequest extends RequestBase { } } -export interface PutAliasResponse extends ResponseBase { +export interface PutAliasResponse { } export interface AnalyzeDetail { @@ -3547,7 +3544,7 @@ export interface AnalyzeRequest extends RequestBase { } } -export interface AnalyzeResponse extends ResponseBase { +export interface AnalyzeResponse { detail?: AnalyzeDetail tokens?: Array } @@ -4063,7 +4060,7 @@ export interface SegmentsRequest extends RequestBase { verbose?: boolean } -export interface SegmentsResponse extends ResponseBase { +export interface SegmentsResponse { indices: Record _shards: ShardStatistics } @@ -4093,7 +4090,7 @@ export interface IndicesShardStoresRequest extends RequestBase { status?: Array } -export interface IndicesShardStoresResponse extends ResponseBase { +export interface IndicesShardStoresResponse { indices: Record } @@ -4160,7 +4157,7 @@ export interface IndicesStatsRequest extends RequestBase { types?: TypeNames } -export interface IndicesStatsResponse extends ResponseBase { +export interface IndicesStatsResponse { indices?: Record _shards: ShardStatistics _all: IndicesStats @@ -4387,7 +4384,7 @@ export interface ReloadSearchAnalyzersRequest extends RequestBase { ignore_unavailable?: boolean } -export interface ReloadSearchAnalyzersResponse extends ResponseBase { +export interface ReloadSearchAnalyzersResponse { reload_details: Array _shards: ShardStatistics } @@ -4520,7 +4517,7 @@ export interface GetPipelineResponse extends DictionaryResponseBase } @@ -4809,7 +4806,7 @@ export interface SimulatePipelineRequest extends RequestBase { } } -export interface SimulatePipelineResponse extends ResponseBase { +export interface SimulatePipelineResponse { docs: Array } @@ -5007,7 +5004,7 @@ export interface ExecutePainlessScriptRequest extends RequestBase { } } -export interface ExecutePainlessScriptResponse extends ResponseBase { +export interface ExecutePainlessScriptResponse { result: TResult } @@ -5022,7 +5019,7 @@ export interface GetScriptRequest extends RequestBase { master_timeout?: Time } -export interface GetScriptResponse extends ResponseBase { +export interface GetScriptResponse { script: StoredScript } @@ -5049,7 +5046,7 @@ export interface CleanupRepositoryRequest extends RequestBase { timeout?: Time } -export interface CleanupRepositoryResponse extends ResponseBase { +export interface CleanupRepositoryResponse { results: CleanupRepositoryResults } @@ -5086,7 +5083,7 @@ export interface GetRepositoryRequest extends RequestBase { master_timeout?: Time } -export interface GetRepositoryResponse extends ResponseBase { +export interface GetRepositoryResponse { repositories: Record } @@ -5100,7 +5097,7 @@ export interface VerifyRepositoryRequest extends RequestBase { timeout?: Time } -export interface VerifyRepositoryResponse extends ResponseBase { +export interface VerifyRepositoryResponse { nodes: Record } @@ -5122,7 +5119,7 @@ export interface RestoreRequest extends RequestBase { } } -export interface RestoreResponse extends ResponseBase { +export interface RestoreResponse { snapshot: SnapshotRestore } @@ -5171,7 +5168,7 @@ export interface GetSnapshotRequest extends RequestBase { verbose?: boolean } -export interface GetSnapshotResponse extends ResponseBase { +export interface GetSnapshotResponse { snapshots: Array } @@ -5189,7 +5186,7 @@ export interface SnapshotRequest extends RequestBase { } } -export interface SnapshotResponse extends ResponseBase { +export interface SnapshotResponse { accepted: boolean snapshot: SnapshotInfo } @@ -5239,7 +5236,7 @@ export interface SnapshotStatusRequest extends RequestBase { master_timeout?: Time } -export interface SnapshotStatusResponse extends ResponseBase { +export interface SnapshotStatusResponse { snapshots: Array } @@ -5876,7 +5873,7 @@ export interface CountRequest extends RequestBase { } } -export interface CountResponse extends ResponseBase { +export interface CountResponse { count: long _shards: ShardStatistics } @@ -5902,7 +5899,7 @@ export interface ExplainRequest extends RequestBase { } } -export interface ExplainResponse extends ResponseBase { +export interface ExplainResponse { explanation: ExplanationDetail get: InlineGet matched: boolean @@ -5946,7 +5943,7 @@ export interface FieldCapabilitiesRequest extends RequestBase { include_unmapped?: boolean } -export interface FieldCapabilitiesResponse extends ResponseBase { +export interface FieldCapabilitiesResponse { fields: Record> } @@ -5965,7 +5962,7 @@ export interface MultiSearchRequest extends RequestBase { } } -export interface MultiSearchResponse extends ResponseBase { +export interface MultiSearchResponse { responses: Array> } @@ -5989,7 +5986,7 @@ export interface ClearScrollRequest extends RequestBase { } } -export interface ClearScrollResponse extends ResponseBase { +export interface ClearScrollResponse { } export interface ScrollRequest extends RequestBase { @@ -6086,7 +6083,7 @@ export interface SearchRequest extends RequestBase { } } -export interface SearchResponse extends ResponseBase { +export interface SearchResponse { took: long timed_out: boolean _shards: ShardStatistics @@ -6128,7 +6125,7 @@ export interface SearchShardsRequest extends RequestBase { routing?: Routing } -export interface SearchShardsResponse extends ResponseBase { +export interface SearchShardsResponse { nodes: Record shards: Array> } @@ -6164,7 +6161,7 @@ export interface RenderSearchTemplateRequest extends RequestBase { } } -export interface RenderSearchTemplateResponse extends ResponseBase { +export interface RenderSearchTemplateResponse { template_output: LazyDocument } @@ -6596,7 +6593,7 @@ export interface ValidateQueryRequest extends RequestBase { } } -export interface ValidateQueryResponse extends ResponseBase { +export interface ValidateQueryResponse { explanations: Array _shards: ShardStatistics valid: boolean @@ -6625,7 +6622,7 @@ export interface AsyncSearchGetRequest extends RequestBase { } } -export interface AsyncSearchGetResponse extends ResponseBase { +export interface AsyncSearchGetResponse { } export interface AsyncSearchSubmitRequest extends RequestBase { @@ -6685,7 +6682,7 @@ export interface AsyncSearchSubmitRequest extends RequestBase { } } -export interface AsyncSearchSubmitResponse extends ResponseBase { +export interface AsyncSearchSubmitResponse { } export interface CreateAutoFollowPatternRequest extends RequestBase { @@ -6737,7 +6734,7 @@ export interface GetAutoFollowPatternRequest extends RequestBase { name?: Name } -export interface GetAutoFollowPatternResponse extends ResponseBase { +export interface GetAutoFollowPatternResponse { patterns: Record } @@ -6774,7 +6771,7 @@ export interface CreateFollowIndexRequest extends RequestBase { } } -export interface CreateFollowIndexResponse extends ResponseBase { +export interface CreateFollowIndexResponse { follow_index_created: boolean follow_index_shards_acked: boolean index_following_started: boolean @@ -6827,7 +6824,7 @@ export interface FollowIndexStatsRequest extends RequestBase { index: Indices } -export interface FollowIndexStatsResponse extends ResponseBase { +export interface FollowIndexStatsResponse { indices: Array } @@ -6858,7 +6855,7 @@ export interface FollowInfoRequest extends RequestBase { index: Indices } -export interface FollowInfoResponse extends ResponseBase { +export interface FollowInfoResponse { follower_indices: Array } @@ -6872,7 +6869,7 @@ export interface ForgetFollowerIndexRequest extends RequestBase { } } -export interface ForgetFollowerIndexResponse extends ResponseBase { +export interface ForgetFollowerIndexResponse { _shards: ShardStatistics } @@ -6930,7 +6927,7 @@ export interface CcrFollowStats { export interface CcrStatsRequest extends RequestBase { } -export interface CcrStatsResponse extends ResponseBase { +export interface CcrStatsResponse { auto_follow_stats: CcrAutoFollowStats follow_stats: CcrFollowStats } @@ -6969,7 +6966,7 @@ export interface ExecuteEnrichPolicyRequest extends RequestBase { wait_for_completion?: boolean } -export interface ExecuteEnrichPolicyResponse extends ResponseBase { +export interface ExecuteEnrichPolicyResponse { status: ExecuteEnrichPolicyStatus task_id: TaskId } @@ -6982,7 +6979,7 @@ export interface GetEnrichPolicyRequest extends RequestBase { name?: Names } -export interface GetEnrichPolicyResponse extends ResponseBase { +export interface GetEnrichPolicyResponse { policies: Array } @@ -7008,7 +7005,7 @@ export interface CoordinatorStats { export interface EnrichStatsRequest extends RequestBase { } -export interface EnrichStatsResponse extends ResponseBase { +export interface EnrichStatsResponse { coordinator_stats: Array executing_policies: Array } @@ -7031,7 +7028,7 @@ export interface GraphExploreRequest extends RequestBase { } } -export interface GraphExploreResponse extends ResponseBase { +export interface GraphExploreResponse { connections: Array failures: Array timed_out: boolean @@ -7117,7 +7114,7 @@ export interface ExplainLifecycleRequest extends RequestBase { only_managed?: boolean } -export interface ExplainLifecycleResponse extends ResponseBase { +export interface ExplainLifecycleResponse { indices: Record } @@ -7155,7 +7152,7 @@ export interface LifecyclePolicy { export interface GetIlmStatusRequest extends RequestBase { } -export interface GetIlmStatusResponse extends ResponseBase { +export interface GetIlmStatusResponse { operation_mode: LifecycleOperationMode } @@ -7192,7 +7189,7 @@ export interface RemovePolicyRequest extends RequestBase { index: IndexName } -export interface RemovePolicyResponse extends ResponseBase { +export interface RemovePolicyResponse { failed_indexes: Array has_failures: boolean } @@ -7269,7 +7266,7 @@ export interface XPackInfoRequest extends RequestBase { categories?: Array } -export interface XPackInfoResponse extends ResponseBase { +export interface XPackInfoResponse { build: XPackBuildInformation features: XPackFeatures license: MinimalLicenseInformation @@ -7451,7 +7448,7 @@ export interface XPackUsageRequest extends RequestBase { master_timeout?: Time } -export interface XPackUsageResponse extends ResponseBase { +export interface XPackUsageResponse { watcher: AlertingUsage ccr: CcrUsage data_frame: XPackUsage @@ -7475,13 +7472,13 @@ export interface XPackUsageResponse extends ResponseBase { export interface DeleteLicenseRequest extends RequestBase { } -export interface DeleteLicenseResponse extends ResponseBase { +export interface DeleteLicenseResponse { } export interface GetBasicLicenseStatusRequest extends RequestBase { } -export interface GetBasicLicenseStatusResponse extends ResponseBase { +export interface GetBasicLicenseStatusResponse { eligible_to_start_basic: boolean } @@ -7490,7 +7487,7 @@ export interface GetLicenseRequest extends RequestBase { local?: boolean } -export interface GetLicenseResponse extends ResponseBase { +export interface GetLicenseResponse { license: LicenseInformation } @@ -7528,7 +7525,7 @@ export type LicenseType = 'missing' | 'trial' | 'basic' | 'standard' | 'dev' | ' export interface GetTrialLicenseStatusRequest extends RequestBase { } -export interface GetTrialLicenseStatusResponse extends ResponseBase { +export interface GetTrialLicenseStatusResponse { eligible_to_start_trial: boolean } @@ -7544,7 +7541,7 @@ export interface PostLicenseRequest extends RequestBase { } } -export interface PostLicenseResponse extends ResponseBase { +export interface PostLicenseResponse { acknowledge: LicenseAcknowledgement acknowledged: boolean license_status: LicenseStatus @@ -7577,7 +7574,7 @@ export interface CloseJobRequest extends RequestBase { timeout?: Time } -export interface CloseJobResponse extends ResponseBase { +export interface CloseJobResponse { closed: boolean } @@ -7648,7 +7645,7 @@ export interface DeleteCalendarJobRequest extends RequestBase { job_id: Id } -export interface DeleteCalendarJobResponse extends ResponseBase { +export interface DeleteCalendarJobResponse { calendar_id: string description: string job_ids: Array @@ -7665,7 +7662,7 @@ export interface DeleteDatafeedResponse extends AcknowledgedResponseBase { export interface DeleteExpiredDataRequest extends RequestBase { } -export interface DeleteExpiredDataResponse extends ResponseBase { +export interface DeleteExpiredDataResponse { deleted: boolean } @@ -7711,7 +7708,7 @@ export interface EstimateModelMemoryRequest extends RequestBase { } } -export interface EstimateModelMemoryResponse extends ResponseBase { +export interface EstimateModelMemoryResponse { model_memory_estimate: string } @@ -7726,7 +7723,7 @@ export interface FlushJobRequest extends RequestBase { } } -export interface FlushJobResponse extends ResponseBase { +export interface FlushJobResponse { flushed: boolean } @@ -7755,7 +7752,7 @@ export interface GetAnomalyRecordsRequest extends RequestBase { } } -export interface GetAnomalyRecordsResponse extends ResponseBase { +export interface GetAnomalyRecordsResponse { count: long records: Array } @@ -7775,7 +7772,7 @@ export interface GetBucketsRequest extends RequestBase { } } -export interface GetBucketsResponse extends ResponseBase { +export interface GetBucketsResponse { buckets: Array count: long } @@ -7791,7 +7788,7 @@ export interface GetCalendarEventsRequest extends RequestBase { } } -export interface GetCalendarEventsResponse extends ResponseBase { +export interface GetCalendarEventsResponse { count: integer events: Array } @@ -7809,7 +7806,7 @@ export interface GetCalendarsRequest extends RequestBase { } } -export interface GetCalendarsResponse extends ResponseBase { +export interface GetCalendarsResponse { calendars: Array count: long } @@ -7822,7 +7819,7 @@ export interface GetCategoriesRequest extends RequestBase { } } -export interface GetCategoriesResponse extends ResponseBase { +export interface GetCategoriesResponse { categories: Array count: long } @@ -7832,7 +7829,7 @@ export interface GetDatafeedStatsRequest extends RequestBase { allow_no_datafeeds?: boolean } -export interface GetDatafeedStatsResponse extends ResponseBase { +export interface GetDatafeedStatsResponse { count: long datafeeds: Array } @@ -7842,7 +7839,7 @@ export interface GetDatafeedsRequest extends RequestBase { allow_no_datafeeds?: boolean } -export interface GetDatafeedsResponse extends ResponseBase { +export interface GetDatafeedsResponse { count: long datafeeds: Array } @@ -7859,7 +7856,7 @@ export interface GetFiltersRequest extends RequestBase { size?: integer } -export interface GetFiltersResponse extends ResponseBase { +export interface GetFiltersResponse { count: long filters: Array } @@ -7877,7 +7874,7 @@ export interface GetInfluencersRequest extends RequestBase { } } -export interface GetInfluencersResponse extends ResponseBase { +export interface GetInfluencersResponse { count: long influencers: Array } @@ -7887,7 +7884,7 @@ export interface GetJobStatsRequest extends RequestBase { allow_no_jobs?: boolean } -export interface GetJobStatsResponse extends ResponseBase { +export interface GetJobStatsResponse { count: long jobs: Array } @@ -7897,7 +7894,7 @@ export interface GetJobsRequest extends RequestBase { allow_no_jobs?: boolean } -export interface GetJobsResponse extends ResponseBase { +export interface GetJobsResponse { count: long jobs: Array } @@ -7914,7 +7911,7 @@ export interface GetModelSnapshotsRequest extends RequestBase { } } -export interface GetModelSnapshotsResponse extends ResponseBase { +export interface GetModelSnapshotsResponse { count: long model_snapshots: Array } @@ -7932,7 +7929,7 @@ export interface GetOverallBucketsRequest extends RequestBase { } } -export interface GetOverallBucketsResponse extends ResponseBase { +export interface GetOverallBucketsResponse { count: long overall_buckets: Array } @@ -8222,7 +8219,7 @@ export interface Limits { export interface MachineLearningInfoRequest extends RequestBase { } -export interface MachineLearningInfoResponse extends ResponseBase { +export interface MachineLearningInfoResponse { defaults: Defaults limits: Limits upgrade_mode: boolean @@ -8235,7 +8232,7 @@ export interface OpenJobRequest extends RequestBase { } } -export interface OpenJobResponse extends ResponseBase { +export interface OpenJobResponse { opened: boolean } @@ -8246,7 +8243,7 @@ export interface PostCalendarEventsRequest extends RequestBase { } } -export interface PostCalendarEventsResponse extends ResponseBase { +export interface PostCalendarEventsResponse { events: Array } @@ -8267,7 +8264,7 @@ export interface PostJobDataRequest extends RequestBase { } } -export interface PostJobDataResponse extends ResponseBase { +export interface PostJobDataResponse { bucket_count: long earliest_record_timestamp: Date empty_bucket_count: long @@ -8289,7 +8286,7 @@ export interface PreviewDatafeedRequest extends RequestBase { datafeed_id: Id } -export interface PreviewDatafeedResponse extends ResponseBase { +export interface PreviewDatafeedResponse { data: Array } @@ -8300,7 +8297,7 @@ export interface PutCalendarRequest extends RequestBase { } } -export interface PutCalendarResponse extends ResponseBase { +export interface PutCalendarResponse { calendar_id: string description: string job_ids: Array @@ -8311,7 +8308,7 @@ export interface PutCalendarJobRequest extends RequestBase { job_id: Id } -export interface PutCalendarJobResponse extends ResponseBase { +export interface PutCalendarJobResponse { calendar_id: string description: string job_ids: Array @@ -8337,7 +8334,7 @@ export interface PutDatafeedRequest extends RequestBase { } } -export interface PutDatafeedResponse extends ResponseBase { +export interface PutDatafeedResponse { aggregations: Record chunking_config: ChunkingConfig datafeed_id: string @@ -8359,7 +8356,7 @@ export interface PutFilterRequest extends RequestBase { } } -export interface PutFilterResponse extends ResponseBase { +export interface PutFilterResponse { description: string filter_id: string items: Array @@ -8381,7 +8378,7 @@ export interface PutJobRequest extends RequestBase { } } -export interface PutJobResponse extends ResponseBase { +export interface PutJobResponse { allow_lazy_open: boolean analysis_config: AnalysisConfig analysis_limits: AnalysisLimits @@ -8407,7 +8404,7 @@ export interface RevertModelSnapshotRequest extends RequestBase { } } -export interface RevertModelSnapshotResponse extends ResponseBase { +export interface RevertModelSnapshotResponse { model: ModelSnapshot } @@ -8428,7 +8425,7 @@ export interface StartDatafeedRequest extends RequestBase { } } -export interface StartDatafeedResponse extends ResponseBase { +export interface StartDatafeedResponse { started: boolean } @@ -8441,7 +8438,7 @@ export interface StopDatafeedRequest extends RequestBase { } } -export interface StopDatafeedResponse extends ResponseBase { +export interface StopDatafeedResponse { stopped: boolean } @@ -8465,7 +8462,7 @@ export interface UpdateDatafeedRequest extends RequestBase { } } -export interface UpdateDatafeedResponse extends ResponseBase { +export interface UpdateDatafeedResponse { aggregations: Record chunking_config: ChunkingConfig datafeed_id: string @@ -8488,7 +8485,7 @@ export interface UpdateFilterRequest extends RequestBase { } } -export interface UpdateFilterResponse extends ResponseBase { +export interface UpdateFilterResponse { description: string filter_id: string items: Array @@ -8509,7 +8506,7 @@ export interface UpdateJobRequest extends RequestBase { } } -export interface UpdateJobResponse extends ResponseBase { +export interface UpdateJobResponse { } export interface UpdateModelSnapshotRequest extends RequestBase { @@ -8560,7 +8557,7 @@ export interface DeprecationInfoRequest extends RequestBase { index?: IndexName } -export interface DeprecationInfoResponse extends ResponseBase { +export interface DeprecationInfoResponse { cluster_settings: Array index_settings: Record> node_settings: Array @@ -8630,7 +8627,7 @@ export interface GetRollupJobRequest extends RequestBase { id?: Id } -export interface GetRollupJobResponse extends ResponseBase { +export interface GetRollupJobResponse { jobs: Array } @@ -8714,14 +8711,14 @@ export interface RollupSearchRequest extends RequestBase { } } -export interface RollupSearchResponse extends ResponseBase { +export interface RollupSearchResponse { } export interface StartRollupJobRequest extends RequestBase { id: Id } -export interface StartRollupJobResponse extends ResponseBase { +export interface StartRollupJobResponse { started: boolean } @@ -8731,7 +8728,7 @@ export interface StopRollupJobRequest extends RequestBase { wait_for_completion?: boolean } -export interface StopRollupJobResponse extends ResponseBase { +export interface StopRollupJobResponse { stopped: boolean } @@ -8758,7 +8755,7 @@ export interface CreateApiKeyRequest extends RequestBase { } } -export interface CreateApiKeyResponse extends ResponseBase { +export interface CreateApiKeyResponse { api_key: string expiration: Date id: string @@ -8783,7 +8780,7 @@ export interface GetApiKeyRequest extends RequestBase { username?: string } -export interface GetApiKeyResponse extends ResponseBase { +export interface GetApiKeyResponse { api_keys: Array } @@ -8797,7 +8794,7 @@ export interface InvalidateApiKeyRequest extends RequestBase { } } -export interface InvalidateApiKeyResponse extends ResponseBase { +export interface InvalidateApiKeyResponse { error_count: integer error_details: Array invalidated_api_keys: Array @@ -8807,7 +8804,7 @@ export interface InvalidateApiKeyResponse extends ResponseBase { export interface AuthenticateRequest extends RequestBase { } -export interface AuthenticateResponse extends ResponseBase { +export interface AuthenticateResponse { authentication_realm: RealmInfo email: string full_name: string @@ -8827,7 +8824,7 @@ export interface ClearCachedRealmsRequest extends RequestBase { usernames?: Array } -export interface ClearCachedRealmsResponse extends ResponseBase { +export interface ClearCachedRealmsResponse { cluster_name: string nodes: Record } @@ -8848,7 +8845,7 @@ export interface FoundUserPrivilege { export interface GetBuiltinPrivilegesRequest extends RequestBase { } -export interface GetBuiltinPrivilegesResponse extends ResponseBase { +export interface GetBuiltinPrivilegesResponse { cluster: Array index: Array } @@ -8879,7 +8876,7 @@ export interface FieldSecuritySettings { export interface GetUserPrivilegesRequest extends RequestBase { } -export interface GetUserPrivilegesResponse extends ResponseBase { +export interface GetUserPrivilegesResponse { applications: Array cluster: Array global: Array @@ -8925,7 +8922,7 @@ export interface HasPrivilegesRequest extends RequestBase { } } -export interface HasPrivilegesResponse extends ResponseBase { +export interface HasPrivilegesResponse { application: Record> cluster: Record has_all_requested: boolean @@ -8972,7 +8969,7 @@ export interface DeleteRoleMappingRequest extends RequestBase { refresh?: Refresh } -export interface DeleteRoleMappingResponse extends ResponseBase { +export interface DeleteRoleMappingResponse { found: boolean } @@ -9002,7 +8999,7 @@ export interface PutRoleMappingRequest extends RequestBase { } } -export interface PutRoleMappingResponse extends ResponseBase { +export interface PutRoleMappingResponse { created: boolean role_mapping: PutRoleMappingStatus } @@ -9018,7 +9015,7 @@ export interface ClearCachedRolesRequest extends RequestBase { name: Names } -export interface ClearCachedRolesResponse extends ResponseBase { +export interface ClearCachedRolesResponse { cluster_name: string nodes: Record } @@ -9028,7 +9025,7 @@ export interface DeleteRoleRequest extends RequestBase { refresh?: Refresh } -export interface DeleteRoleResponse extends ResponseBase { +export interface DeleteRoleResponse { found: boolean } @@ -9072,7 +9069,7 @@ export interface PutRoleRequest extends RequestBase { } } -export interface PutRoleResponse extends ResponseBase { +export interface PutRoleResponse { role: PutRoleStatus } @@ -9088,7 +9085,7 @@ export interface ChangePasswordRequest extends RequestBase { } } -export interface ChangePasswordResponse extends ResponseBase { +export interface ChangePasswordResponse { } export interface DeleteUserRequest extends RequestBase { @@ -9096,7 +9093,7 @@ export interface DeleteUserRequest extends RequestBase { refresh?: Refresh } -export interface DeleteUserResponse extends ResponseBase { +export interface DeleteUserResponse { found: boolean } @@ -9105,7 +9102,7 @@ export interface DisableUserRequest extends RequestBase { refresh?: Refresh } -export interface DisableUserResponse extends ResponseBase { +export interface DisableUserResponse { } export interface EnableUserRequest extends RequestBase { @@ -9113,7 +9110,7 @@ export interface EnableUserRequest extends RequestBase { refresh?: Refresh } -export interface EnableUserResponse extends ResponseBase { +export interface EnableUserResponse { } export interface GetUserRequest extends RequestBase { @@ -9140,7 +9137,7 @@ export interface GetUserAccessTokenRequest extends RequestBase { } } -export interface GetUserAccessTokenResponse extends ResponseBase { +export interface GetUserAccessTokenResponse { access_token: string expires_in: long scope: string @@ -9150,7 +9147,7 @@ export interface GetUserAccessTokenResponse extends ResponseBase { export interface InvalidateUserAccessTokenRequest extends RequestBase { } -export interface InvalidateUserAccessTokenResponse extends ResponseBase { +export interface InvalidateUserAccessTokenResponse { error_count: long error_details: Array invalidated_tokens: long @@ -9170,7 +9167,7 @@ export interface PutUserRequest extends RequestBase { } } -export interface PutUserResponse extends ResponseBase { +export interface PutUserResponse { created: boolean } @@ -9227,7 +9224,7 @@ export interface ExecuteSnapshotLifecycleRequest extends RequestBase { policy_id: Name } -export interface ExecuteSnapshotLifecycleResponse extends ResponseBase { +export interface ExecuteSnapshotLifecycleResponse { snapshot_name: string } @@ -9247,7 +9244,7 @@ export interface GetSnapshotLifecycleResponse extends DictionaryResponseBase cursor: string rows: Array> @@ -9338,7 +9335,7 @@ export interface TranslateSqlRequest extends RequestBase { } } -export interface TranslateSqlResponse extends ResponseBase { +export interface TranslateSqlResponse { result: SearchRequest } @@ -9355,7 +9352,7 @@ export interface ClusterCertificateInformation { export interface GetCertificatesRequest extends RequestBase { } -export interface GetCertificatesResponse extends ResponseBase { +export interface GetCertificatesResponse { certificates: Array } @@ -9393,7 +9390,7 @@ export interface GetTransformRequest extends RequestBase { size?: integer } -export interface GetTransformResponse extends ResponseBase { +export interface GetTransformResponse { count: long transforms: Array } @@ -9405,7 +9402,7 @@ export interface GetTransformStatsRequest extends RequestBase { size?: long } -export interface GetTransformStatsResponse extends ResponseBase { +export interface GetTransformStatsResponse { count: long transforms: Array } @@ -9492,7 +9489,7 @@ export interface PreviewTransformRequest extends RequestBase { } } -export interface PreviewTransformResponse extends ResponseBase { +export interface PreviewTransformResponse { generated_dest_index: IndexState preview: Array } @@ -9545,7 +9542,7 @@ export interface UpdateTransformRequest extends RequestBase { } } -export interface UpdateTransformResponse extends ResponseBase { +export interface UpdateTransformResponse { create_time: long create_time_date_time: Date description: string @@ -9581,7 +9578,7 @@ export interface AcknowledgeWatchRequest extends RequestBase { action_id?: Names } -export interface AcknowledgeWatchResponse extends ResponseBase { +export interface AcknowledgeWatchResponse { status: WatchStatus } @@ -9697,7 +9694,7 @@ export interface ActivateWatchRequest extends RequestBase { watch_id: Name } -export interface ActivateWatchResponse extends ResponseBase { +export interface ActivateWatchResponse { status: ActivationStatus } @@ -9747,7 +9744,7 @@ export interface DeactivateWatchRequest extends RequestBase { watch_id: Name } -export interface DeactivateWatchResponse extends ResponseBase { +export interface DeactivateWatchResponse { status: ActivationStatus } @@ -9755,7 +9752,7 @@ export interface DeleteWatchRequest extends RequestBase { id: Name } -export interface DeleteWatchResponse extends ResponseBase { +export interface DeleteWatchResponse { found: boolean _id: string _version: integer @@ -9777,7 +9774,7 @@ export interface ExecuteWatchRequest extends RequestBase { } } -export interface ExecuteWatchResponse extends ResponseBase { +export interface ExecuteWatchResponse { _id: string watch_record: WatchRecord } @@ -9923,7 +9920,7 @@ export interface GetWatchRequest extends RequestBase { id: Name } -export interface GetWatchResponse extends ResponseBase { +export interface GetWatchResponse { found: boolean _id: string status: WatchStatus @@ -10026,7 +10023,7 @@ export interface PutWatchRequest extends RequestBase { } } -export interface PutWatchResponse extends ResponseBase { +export interface PutWatchResponse { created: boolean _id: string _primary_term: long @@ -10160,7 +10157,7 @@ export interface WatcherStatsRequest extends RequestBase { emit_stacktraces?: boolean } -export interface WatcherStatsResponse extends ResponseBase { +export interface WatcherStatsResponse { cluster_name: string manually_stopped: boolean stats: Array diff --git a/specification/specs/behaviors.ts b/specification/specs/behaviors.ts index b390f97acb..aa47d6d360 100644 --- a/specification/specs/behaviors.ts +++ b/specification/specs/behaviors.ts @@ -15,3 +15,19 @@ * @behavior Defines a trait that any unknown property for the class should be typed to TValue */ interface AdditionalProperties {} + +/** + * A response formatted as an array of records. + * Some languages can't represent this easily and need to wrap the + * array inside an object. + * @behavior Defines a trait that the response should be an array of records typed to TRecord + */ +interface ArrayResponse {} + +/** + * HEAD APIs can have a different behavior based on the language, + * the response body is always empty to it's up to language generators + * to define how those should be represented. + * @behavior Defines a trait that the response is empty + */ +interface EmptyResponseBase {} diff --git a/specification/specs/cat/CatBase.ts b/specification/specs/cat/CatBase.ts index 536cc368b2..e22cf4b477 100644 --- a/specification/specs/cat/CatBase.ts +++ b/specification/specs/cat/CatBase.ts @@ -7,7 +7,3 @@ class CatRequestBase extends RequestBase { s?: string[]; v?: boolean; } - -class CatResponseBase extends ResponseBase { - records: TCatRecord[]; -} diff --git a/specification/specs/cat/cat_aliases/CatAliasesResponse.ts b/specification/specs/cat/cat_aliases/CatAliasesResponse.ts index 6fff2f5217..cbef5df80b 100644 --- a/specification/specs/cat/cat_aliases/CatAliasesResponse.ts +++ b/specification/specs/cat/cat_aliases/CatAliasesResponse.ts @@ -1 +1 @@ -class CatAliasesResponse extends CatResponseBase {} +class CatAliasesResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_allocation/CatAllocationResponse.ts b/specification/specs/cat/cat_allocation/CatAllocationResponse.ts index ca667460ef..99c583391c 100644 --- a/specification/specs/cat/cat_allocation/CatAllocationResponse.ts +++ b/specification/specs/cat/cat_allocation/CatAllocationResponse.ts @@ -1 +1 @@ -class CatAllocationResponse extends CatResponseBase {} +class CatAllocationResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_count/CatCountResponse.ts b/specification/specs/cat/cat_count/CatCountResponse.ts index 3f848685a3..477b08393a 100644 --- a/specification/specs/cat/cat_count/CatCountResponse.ts +++ b/specification/specs/cat/cat_count/CatCountResponse.ts @@ -1 +1 @@ -class CatCountResponse extends CatResponseBase {} +class CatCountResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_data_frame_analytics/CatDataFrameAnalyticsResponse.ts b/specification/specs/cat/cat_data_frame_analytics/CatDataFrameAnalyticsResponse.ts index 953af6fccb..09235b7881 100644 --- a/specification/specs/cat/cat_data_frame_analytics/CatDataFrameAnalyticsResponse.ts +++ b/specification/specs/cat/cat_data_frame_analytics/CatDataFrameAnalyticsResponse.ts @@ -1 +1 @@ -class CatDataFrameAnalyticsResponse extends CatResponseBase {} +class CatDataFrameAnalyticsResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_datafeeds/CatDatafeedsResponse.ts b/specification/specs/cat/cat_datafeeds/CatDatafeedsResponse.ts index ba02e34121..97679a7045 100644 --- a/specification/specs/cat/cat_datafeeds/CatDatafeedsResponse.ts +++ b/specification/specs/cat/cat_datafeeds/CatDatafeedsResponse.ts @@ -1 +1 @@ -class CatDatafeedsResponse extends CatResponseBase {} +class CatDatafeedsResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_fielddata/CatFielddataResponse.ts b/specification/specs/cat/cat_fielddata/CatFielddataResponse.ts index 720a753e79..91666de461 100644 --- a/specification/specs/cat/cat_fielddata/CatFielddataResponse.ts +++ b/specification/specs/cat/cat_fielddata/CatFielddataResponse.ts @@ -1 +1 @@ -class CatFielddataResponse extends CatResponseBase {} +class CatFielddataResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_health/CatHealthResponse.ts b/specification/specs/cat/cat_health/CatHealthResponse.ts index fbae5c2cdf..524a6207d6 100644 --- a/specification/specs/cat/cat_health/CatHealthResponse.ts +++ b/specification/specs/cat/cat_health/CatHealthResponse.ts @@ -1 +1 @@ -class CatHealthResponse extends CatResponseBase {} +class CatHealthResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_help/CatHelpResponse.ts b/specification/specs/cat/cat_help/CatHelpResponse.ts index ad438bdbea..4e113d6542 100644 --- a/specification/specs/cat/cat_help/CatHelpResponse.ts +++ b/specification/specs/cat/cat_help/CatHelpResponse.ts @@ -1 +1 @@ -class CatHelpResponse extends CatResponseBase {} +class CatHelpResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_indices/CatIndicesResponse.ts b/specification/specs/cat/cat_indices/CatIndicesResponse.ts index e08d638bdc..3eb5d4af5a 100644 --- a/specification/specs/cat/cat_indices/CatIndicesResponse.ts +++ b/specification/specs/cat/cat_indices/CatIndicesResponse.ts @@ -1 +1 @@ -class CatIndicesResponse extends CatResponseBase {} +class CatIndicesResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_jobs/CatJobsResponse.ts b/specification/specs/cat/cat_jobs/CatJobsResponse.ts index 78ad42e015..6bdc18f7af 100644 --- a/specification/specs/cat/cat_jobs/CatJobsResponse.ts +++ b/specification/specs/cat/cat_jobs/CatJobsResponse.ts @@ -1 +1 @@ -class CatJobsResponse extends CatResponseBase {} +class CatJobsResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_master/CatMasterResponse.ts b/specification/specs/cat/cat_master/CatMasterResponse.ts index a6c8e7938e..8b5576f9ce 100644 --- a/specification/specs/cat/cat_master/CatMasterResponse.ts +++ b/specification/specs/cat/cat_master/CatMasterResponse.ts @@ -1 +1 @@ -class CatMasterResponse extends CatResponseBase {} +class CatMasterResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_node_attributes/CatNodeAttributesResponse.ts b/specification/specs/cat/cat_node_attributes/CatNodeAttributesResponse.ts index 7424221ef4..293299247a 100644 --- a/specification/specs/cat/cat_node_attributes/CatNodeAttributesResponse.ts +++ b/specification/specs/cat/cat_node_attributes/CatNodeAttributesResponse.ts @@ -1 +1 @@ -class CatNodeAttributesResponse extends CatResponseBase {} +class CatNodeAttributesResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_nodes/CatNodesResponse.ts b/specification/specs/cat/cat_nodes/CatNodesResponse.ts index a39177952b..d98cfe6e18 100644 --- a/specification/specs/cat/cat_nodes/CatNodesResponse.ts +++ b/specification/specs/cat/cat_nodes/CatNodesResponse.ts @@ -1 +1 @@ -class CatNodesResponse extends CatResponseBase {} +class CatNodesResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_pending_tasks/CatPendingTasksResponse.ts b/specification/specs/cat/cat_pending_tasks/CatPendingTasksResponse.ts index d3b60d58b6..a19c26bba6 100644 --- a/specification/specs/cat/cat_pending_tasks/CatPendingTasksResponse.ts +++ b/specification/specs/cat/cat_pending_tasks/CatPendingTasksResponse.ts @@ -1 +1 @@ -class CatPendingTasksResponse extends CatResponseBase {} +class CatPendingTasksResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_plugins/CatPluginsResponse.ts b/specification/specs/cat/cat_plugins/CatPluginsResponse.ts index 01ded9a54b..b03648b7b2 100644 --- a/specification/specs/cat/cat_plugins/CatPluginsResponse.ts +++ b/specification/specs/cat/cat_plugins/CatPluginsResponse.ts @@ -1 +1 @@ -class CatPluginsResponse extends CatResponseBase {} +class CatPluginsResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_recovery/CatRecoveryResponse.ts b/specification/specs/cat/cat_recovery/CatRecoveryResponse.ts index cbf8fa29f8..4258abc35e 100644 --- a/specification/specs/cat/cat_recovery/CatRecoveryResponse.ts +++ b/specification/specs/cat/cat_recovery/CatRecoveryResponse.ts @@ -1 +1 @@ -class CatRecoveryResponse extends CatResponseBase {} +class CatRecoveryResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_repositories/CatRepositoriesResponse.ts b/specification/specs/cat/cat_repositories/CatRepositoriesResponse.ts index 6ed4dfde0f..db6425348e 100644 --- a/specification/specs/cat/cat_repositories/CatRepositoriesResponse.ts +++ b/specification/specs/cat/cat_repositories/CatRepositoriesResponse.ts @@ -1 +1 @@ -class CatRepositoriesResponse extends CatResponseBase {} +class CatRepositoriesResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_segments/CatSegmentsResponse.ts b/specification/specs/cat/cat_segments/CatSegmentsResponse.ts index 18118ce119..a8f0e0d3a4 100644 --- a/specification/specs/cat/cat_segments/CatSegmentsResponse.ts +++ b/specification/specs/cat/cat_segments/CatSegmentsResponse.ts @@ -1 +1 @@ -class CatSegmentsResponse extends CatResponseBase {} +class CatSegmentsResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_shards/CatShardsResponse.ts b/specification/specs/cat/cat_shards/CatShardsResponse.ts index 318923a73e..314bf54f4f 100644 --- a/specification/specs/cat/cat_shards/CatShardsResponse.ts +++ b/specification/specs/cat/cat_shards/CatShardsResponse.ts @@ -1 +1 @@ -class CatShardsResponse extends CatResponseBase {} +class CatShardsResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_snapshots/CatSnapshotsResponse.ts b/specification/specs/cat/cat_snapshots/CatSnapshotsResponse.ts index a1cbb11f26..26fef8d7d7 100644 --- a/specification/specs/cat/cat_snapshots/CatSnapshotsResponse.ts +++ b/specification/specs/cat/cat_snapshots/CatSnapshotsResponse.ts @@ -1 +1 @@ -class CatSnapshotsResponse extends CatResponseBase {} +class CatSnapshotsResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_tasks/CatTasksResponse.ts b/specification/specs/cat/cat_tasks/CatTasksResponse.ts index b4d68c284b..7c7e5cdbff 100644 --- a/specification/specs/cat/cat_tasks/CatTasksResponse.ts +++ b/specification/specs/cat/cat_tasks/CatTasksResponse.ts @@ -1 +1 @@ -class CatTasksResponse extends CatResponseBase {} +class CatTasksResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_templates/CatTemplatesResponse.ts b/specification/specs/cat/cat_templates/CatTemplatesResponse.ts index 58d02ccb10..78eeb37612 100644 --- a/specification/specs/cat/cat_templates/CatTemplatesResponse.ts +++ b/specification/specs/cat/cat_templates/CatTemplatesResponse.ts @@ -1 +1 @@ -class CatTemplatesResponse extends CatResponseBase {} +class CatTemplatesResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_thread_pool/CatThreadPoolResponse.ts b/specification/specs/cat/cat_thread_pool/CatThreadPoolResponse.ts index 457d456f88..8e5b3d4392 100644 --- a/specification/specs/cat/cat_thread_pool/CatThreadPoolResponse.ts +++ b/specification/specs/cat/cat_thread_pool/CatThreadPoolResponse.ts @@ -1 +1 @@ -class CatThreadPoolResponse extends CatResponseBase {} +class CatThreadPoolResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_trained_models/CatTrainedModelsResponse.ts b/specification/specs/cat/cat_trained_models/CatTrainedModelsResponse.ts index 7d82b05a36..fa0e86297d 100644 --- a/specification/specs/cat/cat_trained_models/CatTrainedModelsResponse.ts +++ b/specification/specs/cat/cat_trained_models/CatTrainedModelsResponse.ts @@ -1 +1 @@ -class CatTrainedModelsResponse extends CatResponseBase {} +class CatTrainedModelsResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cat/cat_transforms/CatTransformsResponse.ts b/specification/specs/cat/cat_transforms/CatTransformsResponse.ts index 77a066e78d..d03e84abe6 100644 --- a/specification/specs/cat/cat_transforms/CatTransformsResponse.ts +++ b/specification/specs/cat/cat_transforms/CatTransformsResponse.ts @@ -1 +1 @@ -class CatTransformsResponse extends CatResponseBase {} +class CatTransformsResponse extends ResponseBase implements ArrayResponse {} diff --git a/specification/specs/cluster/ping/PingResponse.ts b/specification/specs/cluster/ping/PingResponse.ts index 432ed401aa..0c4e6ccede 100644 --- a/specification/specs/cluster/ping/PingResponse.ts +++ b/specification/specs/cluster/ping/PingResponse.ts @@ -1 +1 @@ -class PingResponse extends EmptyResponseBase {} +class PingResponse extends ResponseBase implements EmptyResponseBase {} diff --git a/specification/specs/common_abstractions/response/HeadResponseBase.ts b/specification/specs/common_abstractions/response/HeadResponseBase.ts deleted file mode 100644 index cf5cf8154b..0000000000 --- a/specification/specs/common_abstractions/response/HeadResponseBase.ts +++ /dev/null @@ -1,3 +0,0 @@ -class EmptyResponseBase extends ResponseBase { - exists: boolean -} diff --git a/specification/specs/common_abstractions/response/ResponseBase.ts b/specification/specs/common_abstractions/response/ResponseBase.ts index d1b84884de..de1ea2aa46 100644 --- a/specification/specs/common_abstractions/response/ResponseBase.ts +++ b/specification/specs/common_abstractions/response/ResponseBase.ts @@ -1,4 +1,3 @@ class ResponseBase { - // error: MainError; - // status: integer; + // Do not add properties to this base class. } diff --git a/specification/specs/document/single/exists/DocumentExistsResponse.ts b/specification/specs/document/single/exists/DocumentExistsResponse.ts index 12ae066b7b..5b32766cb8 100644 --- a/specification/specs/document/single/exists/DocumentExistsResponse.ts +++ b/specification/specs/document/single/exists/DocumentExistsResponse.ts @@ -1 +1 @@ -class DocumentExistsResponse extends EmptyResponseBase {} +class DocumentExistsResponse extends ResponseBase implements EmptyResponseBase {} diff --git a/specification/specs/document/single/source_exists/SourceExistsResponse.ts b/specification/specs/document/single/source_exists/SourceExistsResponse.ts index 045bbcda1a..68f390f417 100644 --- a/specification/specs/document/single/source_exists/SourceExistsResponse.ts +++ b/specification/specs/document/single/source_exists/SourceExistsResponse.ts @@ -1 +1 @@ -class SourceExistsResponse extends EmptyResponseBase {} +class SourceExistsResponse extends ResponseBase implements EmptyResponseBase {} diff --git a/specification/specs/indices/alias_management/alias_exists/AliasExistsResponse.ts b/specification/specs/indices/alias_management/alias_exists/AliasExistsResponse.ts index 6f0449bc71..955c08f7cb 100644 --- a/specification/specs/indices/alias_management/alias_exists/AliasExistsResponse.ts +++ b/specification/specs/indices/alias_management/alias_exists/AliasExistsResponse.ts @@ -1 +1 @@ -class AliasExistsResponse extends EmptyResponseBase {} +class AliasExistsResponse extends ResponseBase implements EmptyResponseBase {} diff --git a/specification/specs/indices/index_management/indices_exists/IndexExistsResponse.ts b/specification/specs/indices/index_management/indices_exists/IndexExistsResponse.ts index b2622f9249..80d87647c8 100644 --- a/specification/specs/indices/index_management/indices_exists/IndexExistsResponse.ts +++ b/specification/specs/indices/index_management/indices_exists/IndexExistsResponse.ts @@ -1 +1 @@ -class IndexExistsResponse extends EmptyResponseBase {} +class IndexExistsResponse extends ResponseBase implements EmptyResponseBase {} diff --git a/specification/specs/indices/index_management/types_exists/TypeExistsResponse.ts b/specification/specs/indices/index_management/types_exists/TypeExistsResponse.ts index 3f7e662a9c..6b52015dc8 100644 --- a/specification/specs/indices/index_management/types_exists/TypeExistsResponse.ts +++ b/specification/specs/indices/index_management/types_exists/TypeExistsResponse.ts @@ -1 +1 @@ -class TypeExistsResponse extends EmptyResponseBase {} +class TypeExistsResponse extends ResponseBase implements EmptyResponseBase {} diff --git a/specification/specs/indices/index_settings/index_templates/index_template_exists/IndexTemplateExistsResponse.ts b/specification/specs/indices/index_settings/index_templates/index_template_exists/IndexTemplateExistsResponse.ts index f045cc2fce..c5a547a298 100644 --- a/specification/specs/indices/index_settings/index_templates/index_template_exists/IndexTemplateExistsResponse.ts +++ b/specification/specs/indices/index_settings/index_templates/index_template_exists/IndexTemplateExistsResponse.ts @@ -1 +1 @@ -class IndexTemplateExistsResponse extends EmptyResponseBase {} +class IndexTemplateExistsResponse extends ResponseBase implements EmptyResponseBase {} diff --git a/specification/src/api-specification.ts b/specification/src/api-specification.ts index 382a59a10e..e441254c10 100644 --- a/specification/src/api-specification.ts +++ b/specification/src/api-specification.ts @@ -34,7 +34,7 @@ export class Specification { } } - const knownBehaviors = ["AdditionalProperties"] + const knownBehaviors = ["AdditionalProperties", 'ArrayResponse', 'EmptyResponseBase'] const specVisitor = new TypeReader(this.program) const types = [].concat(specVisitor.interfaces).concat(specVisitor.enums) // resolve inherits by creating the proper pointers to instances, pretty hairy but it works diff --git a/typescript-generator/index.js b/typescript-generator/index.js index c8b94351a1..e9bcc9a16c 100644 --- a/typescript-generator/index.js +++ b/typescript-generator/index.js @@ -23,7 +23,8 @@ let definitions = `/* */\n\n` const skip = [ - 'CatResponseBase', + 'ResponseBase', + 'ArrayResponse', 'EmptyResponseBase', 'AdditionalProperties' ] @@ -159,6 +160,8 @@ function createAlias (type) { function buildInherits (type) { if (!Array.isArray(type.inherits)) return '' + // ResponseBase will always be empty + if (type.inherits[0].type.name === 'ResponseBase') return '' return ` extends ${type.inherits.map(buildInheritType).join(', ')}` function buildInheritType (type) { @@ -185,15 +188,9 @@ function cleanPropertyName (name) { } function isSpecialInterface (type) { - if (/^Cat.*Response$/g.test(type.name.name)) { - return true - } if (Array.isArray(type.attachedBehaviors)) { return type.attachedBehaviors.length > 0 } - if (Array.isArray(type.inherits) && type.inherits[0].type.name === 'EmptyResponseBase') { - return true - } switch (type.name.name) { case 'DictionaryResponseBase': return true @@ -230,16 +227,19 @@ function serializeAdditionalPropertiesType (type) { } function serializeSpecialInterface (type) { - if (/^Cat.*Response$/g.test(type.name.name)) { - return buildCatResponse(type) - } if (Array.isArray(type.attachedBehaviors)) { if (type.attachedBehaviors.includes('AdditionalProperties')) { return serializeAdditionalPropertiesType(type) } - } - if (Array.isArray(type.inherits) && type.inherits[0].type.name === 'EmptyResponseBase') { - return `export type ${type.name.name} = boolean\n` + if (type.attachedBehaviors.includes('ArrayResponse')) { + // In the input spec the Cat* responses are represented as an object + // that contains a `records` key, which is an array of the inherited generic. + // What ES actually sends back, is an array of the inherited generic. + return `export type ${type.name.name} = ${type.behaviors[0].generics[0].type.name}[]\n` + } + if (type.attachedBehaviors.includes('EmptyResponseBase')) { + return `export type ${type.name.name} = boolean\n` + } } switch (type.name.name) { @@ -263,10 +263,3 @@ function buildIndexer (type) { return t === 'AggregateName' ? 'string' : t } } - -// In the input spec the Cat* responses are represented as an object -// that contains a `records` key, which is an array of the inherited generic. -// What ES actually sends back, is an array of the inherited generic. -function buildCatResponse (type) { - return `export type ${type.name.name} = ${type.inherits[0].generics[0].type.name}[]\n` -}