Skip to content

Commit 4b967d4

Browse files
Auto-generated API code
1 parent 8ca68a4 commit 4b967d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+27935
-1457
lines changed

Diff for: docs/reference.asciidoc

+16,070
Large diffs are not rendered by default.

Diff for: src/api/api/async_search.ts

+148-8
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,133 @@ import {
3535
TransportResult
3636
} from '@elastic/transport'
3737
import * as T from '../types'
38-
interface That { transport: Transport }
38+
39+
interface That {
40+
transport: Transport
41+
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
42+
}
43+
44+
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
3945

4046
export default class AsyncSearch {
4147
transport: Transport
48+
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
4249
constructor (transport: Transport) {
4350
this.transport = transport
51+
this.acceptedParams = {
52+
'async_search.delete': {
53+
path: [
54+
'id'
55+
],
56+
body: [],
57+
query: []
58+
},
59+
'async_search.get': {
60+
path: [
61+
'id'
62+
],
63+
body: [],
64+
query: [
65+
'keep_alive',
66+
'typed_keys',
67+
'wait_for_completion_timeout'
68+
]
69+
},
70+
'async_search.status': {
71+
path: [
72+
'id'
73+
],
74+
body: [],
75+
query: [
76+
'keep_alive'
77+
]
78+
},
79+
'async_search.submit': {
80+
path: [
81+
'index'
82+
],
83+
body: [
84+
'aggregations',
85+
'aggs',
86+
'collapse',
87+
'explain',
88+
'ext',
89+
'from',
90+
'highlight',
91+
'track_total_hits',
92+
'indices_boost',
93+
'docvalue_fields',
94+
'knn',
95+
'min_score',
96+
'post_filter',
97+
'profile',
98+
'query',
99+
'rescore',
100+
'script_fields',
101+
'search_after',
102+
'size',
103+
'slice',
104+
'sort',
105+
'_source',
106+
'fields',
107+
'suggest',
108+
'terminate_after',
109+
'timeout',
110+
'track_scores',
111+
'version',
112+
'seq_no_primary_term',
113+
'stored_fields',
114+
'pit',
115+
'runtime_mappings',
116+
'stats'
117+
],
118+
query: [
119+
'wait_for_completion_timeout',
120+
'keep_alive',
121+
'keep_on_completion',
122+
'allow_no_indices',
123+
'allow_partial_search_results',
124+
'analyzer',
125+
'analyze_wildcard',
126+
'batched_reduce_size',
127+
'ccs_minimize_roundtrips',
128+
'default_operator',
129+
'df',
130+
'docvalue_fields',
131+
'expand_wildcards',
132+
'explain',
133+
'ignore_throttled',
134+
'ignore_unavailable',
135+
'lenient',
136+
'max_concurrent_shard_requests',
137+
'preference',
138+
'request_cache',
139+
'routing',
140+
'search_type',
141+
'stats',
142+
'stored_fields',
143+
'suggest_field',
144+
'suggest_mode',
145+
'suggest_size',
146+
'suggest_text',
147+
'terminate_after',
148+
'timeout',
149+
'track_total_hits',
150+
'track_scores',
151+
'typed_keys',
152+
'rest_total_hits_as_int',
153+
'version',
154+
'_source',
155+
'_source_excludes',
156+
'_source_includes',
157+
'seq_no_primary_term',
158+
'q',
159+
'size',
160+
'from',
161+
'sort'
162+
]
163+
}
164+
}
44165
}
45166

46167
/**
@@ -51,7 +172,10 @@ export default class AsyncSearch {
51172
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchDeleteResponse, unknown>>
52173
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchDeleteResponse>
53174
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise<any> {
54-
const acceptedPath: string[] = ['id']
175+
const {
176+
path: acceptedPath
177+
} = this.acceptedParams['async_search.delete']
178+
55179
const userQuery = params?.querystring
56180
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
57181

@@ -93,7 +217,10 @@ export default class AsyncSearch {
93217
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchGetResponse<TDocument, TAggregations>, unknown>>
94218
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchGetResponse<TDocument, TAggregations>>
95219
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<any> {
96-
const acceptedPath: string[] = ['id']
220+
const {
221+
path: acceptedPath
222+
} = this.acceptedParams['async_search.get']
223+
97224
const userQuery = params?.querystring
98225
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
99226

@@ -135,7 +262,10 @@ export default class AsyncSearch {
135262
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchStatusResponse, unknown>>
136263
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchStatusResponse>
137264
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise<any> {
138-
const acceptedPath: string[] = ['id']
265+
const {
266+
path: acceptedPath
267+
} = this.acceptedParams['async_search.status']
268+
139269
const userQuery = params?.querystring
140270
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
141271

@@ -177,8 +307,12 @@ export default class AsyncSearch {
177307
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchSubmitResponse<TDocument, TAggregations>, unknown>>
178308
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchSubmitResponse<TDocument, TAggregations>>
179309
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<any> {
180-
const acceptedPath: string[] = ['index']
181-
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
310+
const {
311+
path: acceptedPath,
312+
body: acceptedBody,
313+
query: acceptedQuery
314+
} = this.acceptedParams['async_search.submit']
315+
182316
const userQuery = params?.querystring
183317
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
184318

@@ -205,8 +339,14 @@ export default class AsyncSearch {
205339
} else if (acceptedPath.includes(key)) {
206340
continue
207341
} else if (key !== 'body' && key !== 'querystring') {
208-
// @ts-expect-error
209-
querystring[key] = params[key]
342+
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
343+
// @ts-expect-error
344+
querystring[key] = params[key]
345+
} else {
346+
body = body ?? {}
347+
// @ts-expect-error
348+
body[key] = params[key]
349+
}
210350
}
211351
}
212352

Diff for: src/api/api/autoscaling.ts

+74-8
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,59 @@ import {
3535
TransportResult
3636
} from '@elastic/transport'
3737
import * as T from '../types'
38-
interface That { transport: Transport }
38+
39+
interface That {
40+
transport: Transport
41+
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
42+
}
43+
44+
const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']
3945

4046
export default class Autoscaling {
4147
transport: Transport
48+
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
4249
constructor (transport: Transport) {
4350
this.transport = transport
51+
this.acceptedParams = {
52+
'autoscaling.delete_autoscaling_policy': {
53+
path: [
54+
'name'
55+
],
56+
body: [],
57+
query: [
58+
'master_timeout',
59+
'timeout'
60+
]
61+
},
62+
'autoscaling.get_autoscaling_capacity': {
63+
path: [],
64+
body: [],
65+
query: [
66+
'master_timeout'
67+
]
68+
},
69+
'autoscaling.get_autoscaling_policy': {
70+
path: [
71+
'name'
72+
],
73+
body: [],
74+
query: [
75+
'master_timeout'
76+
]
77+
},
78+
'autoscaling.put_autoscaling_policy': {
79+
path: [
80+
'name'
81+
],
82+
body: [
83+
'policy'
84+
],
85+
query: [
86+
'master_timeout',
87+
'timeout'
88+
]
89+
}
90+
}
4491
}
4592

4693
/**
@@ -51,7 +98,10 @@ export default class Autoscaling {
5198
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingDeleteAutoscalingPolicyResponse, unknown>>
5299
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<T.AutoscalingDeleteAutoscalingPolicyResponse>
53100
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
54-
const acceptedPath: string[] = ['name']
101+
const {
102+
path: acceptedPath
103+
} = this.acceptedParams['autoscaling.delete_autoscaling_policy']
104+
55105
const userQuery = params?.querystring
56106
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
57107

@@ -93,7 +143,10 @@ export default class Autoscaling {
93143
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingGetAutoscalingCapacityResponse, unknown>>
94144
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise<T.AutoscalingGetAutoscalingCapacityResponse>
95145
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise<any> {
96-
const acceptedPath: string[] = []
146+
const {
147+
path: acceptedPath
148+
} = this.acceptedParams['autoscaling.get_autoscaling_capacity']
149+
97150
const userQuery = params?.querystring
98151
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
99152

@@ -133,7 +186,10 @@ export default class Autoscaling {
133186
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingGetAutoscalingPolicyResponse, unknown>>
134187
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<T.AutoscalingGetAutoscalingPolicyResponse>
135188
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
136-
const acceptedPath: string[] = ['name']
189+
const {
190+
path: acceptedPath
191+
} = this.acceptedParams['autoscaling.get_autoscaling_policy']
192+
137193
const userQuery = params?.querystring
138194
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
139195

@@ -175,8 +231,12 @@ export default class Autoscaling {
175231
async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingPutAutoscalingPolicyResponse, unknown>>
176232
async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<T.AutoscalingPutAutoscalingPolicyResponse>
177233
async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
178-
const acceptedPath: string[] = ['name']
179-
const acceptedBody: string[] = ['policy']
234+
const {
235+
path: acceptedPath,
236+
body: acceptedBody,
237+
query: acceptedQuery
238+
} = this.acceptedParams['autoscaling.put_autoscaling_policy']
239+
180240
const userQuery = params?.querystring
181241
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
182242

@@ -188,8 +248,14 @@ export default class Autoscaling {
188248
} else if (acceptedPath.includes(key)) {
189249
continue
190250
} else if (key !== 'body' && key !== 'querystring') {
191-
// @ts-expect-error
192-
querystring[key] = params[key]
251+
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
252+
// @ts-expect-error
253+
querystring[key] = params[key]
254+
} else {
255+
body = body ?? {}
256+
// @ts-expect-error
257+
body[key] = params[key]
258+
}
193259
}
194260
}
195261

0 commit comments

Comments
 (0)