@elastic/elasticsearch 8.0.0-alpha.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/README.md +13 -62
  2. package/free-report-junit.xml +13 -0
  3. package/index.d.ts +4 -3
  4. package/index.js +31 -3
  5. package/lib/api/api/async_search.js +28 -40
  6. package/lib/api/api/async_search.js.map +1 -1
  7. package/lib/api/api/autoscaling.js +13 -37
  8. package/lib/api/api/autoscaling.js.map +1 -1
  9. package/lib/api/api/bulk.d.ts +3 -3
  10. package/lib/api/api/bulk.js +6 -10
  11. package/lib/api/api/bulk.js.map +1 -1
  12. package/lib/api/api/cat.js +75 -275
  13. package/lib/api/api/cat.js.map +1 -1
  14. package/lib/api/api/ccr.js +79 -127
  15. package/lib/api/api/ccr.js.map +1 -1
  16. package/lib/api/api/clear_scroll.js +13 -7
  17. package/lib/api/api/clear_scroll.js.map +1 -1
  18. package/lib/api/api/close_point_in_time.js +13 -7
  19. package/lib/api/api/close_point_in_time.js.map +1 -1
  20. package/lib/api/api/cluster.js +85 -149
  21. package/lib/api/api/cluster.js.map +1 -1
  22. package/lib/api/api/count.js +13 -7
  23. package/lib/api/api/count.js.map +1 -1
  24. package/lib/api/api/create.js +5 -5
  25. package/lib/api/api/create.js.map +1 -1
  26. package/lib/api/api/dangling_indices.js +9 -33
  27. package/lib/api/api/dangling_indices.js.map +1 -1
  28. package/lib/api/api/delete.js +4 -12
  29. package/lib/api/api/delete.js.map +1 -1
  30. package/lib/api/api/delete_by_query.js +13 -7
  31. package/lib/api/api/delete_by_query.js.map +1 -1
  32. package/lib/api/api/delete_by_query_rethrottle.js +3 -11
  33. package/lib/api/api/delete_by_query_rethrottle.js.map +1 -1
  34. package/lib/api/api/delete_script.js +3 -11
  35. package/lib/api/api/delete_script.js.map +1 -1
  36. package/lib/api/api/enrich.js +25 -51
  37. package/lib/api/api/enrich.js.map +1 -1
  38. package/lib/api/api/eql.js +22 -40
  39. package/lib/api/api/eql.js.map +1 -1
  40. package/lib/api/api/exists.js +3 -11
  41. package/lib/api/api/exists.js.map +1 -1
  42. package/lib/api/api/exists_source.js +4 -12
  43. package/lib/api/api/exists_source.js.map +1 -1
  44. package/lib/api/api/explain.js +13 -7
  45. package/lib/api/api/explain.js.map +1 -1
  46. package/lib/api/api/features.js +6 -22
  47. package/lib/api/api/features.js.map +1 -1
  48. package/lib/api/api/field_caps.js +13 -7
  49. package/lib/api/api/field_caps.js.map +1 -1
  50. package/lib/api/api/fleet.d.ts +9 -3
  51. package/lib/api/api/fleet.js +64 -7
  52. package/lib/api/api/fleet.js.map +1 -1
  53. package/lib/api/api/get.js +3 -11
  54. package/lib/api/api/get.js.map +1 -1
  55. package/lib/api/api/get_script.js +3 -11
  56. package/lib/api/api/get_script.js.map +1 -1
  57. package/lib/api/api/get_script_context.js +3 -11
  58. package/lib/api/api/get_script_context.js.map +1 -1
  59. package/lib/api/api/get_script_languages.js +3 -11
  60. package/lib/api/api/get_script_languages.js.map +1 -1
  61. package/lib/api/api/get_source.js +3 -11
  62. package/lib/api/api/get_source.js.map +1 -1
  63. package/lib/api/api/graph.js +13 -7
  64. package/lib/api/api/graph.js.map +1 -1
  65. package/lib/api/api/ilm.d.ts +3 -3
  66. package/lib/api/api/ilm.js +73 -116
  67. package/lib/api/api/ilm.js.map +1 -1
  68. package/lib/api/api/index.js +4 -4
  69. package/lib/api/api/index.js.map +1 -1
  70. package/lib/api/api/indices.d.ts +9 -6
  71. package/lib/api/api/indices.js +320 -519
  72. package/lib/api/api/indices.js.map +1 -1
  73. package/lib/api/api/info.js +3 -11
  74. package/lib/api/api/info.js.map +1 -1
  75. package/lib/api/api/ingest.js +38 -58
  76. package/lib/api/api/ingest.js.map +1 -1
  77. package/lib/api/api/knn_search.d.ts +10 -0
  78. package/lib/api/api/knn_search.js +53 -0
  79. package/lib/api/api/knn_search.js.map +1 -0
  80. package/lib/api/api/license.d.ts +3 -3
  81. package/lib/api/api/license.js +31 -74
  82. package/lib/api/api/license.js.map +1 -1
  83. package/lib/api/api/logstash.js +10 -26
  84. package/lib/api/api/logstash.js.map +1 -1
  85. package/lib/api/api/mget.js +13 -7
  86. package/lib/api/api/mget.js.map +1 -1
  87. package/lib/api/api/migration.d.ts +6 -0
  88. package/lib/api/api/migration.js +39 -11
  89. package/lib/api/api/migration.js.map +1 -1
  90. package/lib/api/api/ml.d.ts +24 -24
  91. package/lib/api/api/ml.js +601 -626
  92. package/lib/api/api/ml.js.map +1 -1
  93. package/lib/api/api/monitoring.d.ts +3 -3
  94. package/lib/api/api/monitoring.js +4 -4
  95. package/lib/api/api/monitoring.js.map +1 -1
  96. package/lib/api/api/msearch.d.ts +3 -3
  97. package/lib/api/api/msearch.js +4 -4
  98. package/lib/api/api/msearch.js.map +1 -1
  99. package/lib/api/api/msearch_template.d.ts +3 -3
  100. package/lib/api/api/msearch_template.js +4 -4
  101. package/lib/api/api/msearch_template.js.map +1 -1
  102. package/lib/api/api/mtermvectors.js +13 -7
  103. package/lib/api/api/mtermvectors.js.map +1 -1
  104. package/lib/api/api/nodes.d.ts +6 -6
  105. package/lib/api/api/nodes.js +33 -71
  106. package/lib/api/api/nodes.js.map +1 -1
  107. package/lib/api/api/open_point_in_time.js +3 -11
  108. package/lib/api/api/open_point_in_time.js.map +1 -1
  109. package/lib/api/api/ping.js +3 -11
  110. package/lib/api/api/ping.js.map +1 -1
  111. package/lib/api/api/put_script.js +13 -7
  112. package/lib/api/api/put_script.js.map +1 -1
  113. package/lib/api/api/rank_eval.js +13 -7
  114. package/lib/api/api/rank_eval.js.map +1 -1
  115. package/lib/api/api/reindex.js +13 -7
  116. package/lib/api/api/reindex.js.map +1 -1
  117. package/lib/api/api/reindex_rethrottle.js +3 -11
  118. package/lib/api/api/reindex_rethrottle.js.map +1 -1
  119. package/lib/api/api/render_search_template.js +13 -7
  120. package/lib/api/api/render_search_template.js.map +1 -1
  121. package/lib/api/api/rollup.d.ts +3 -3
  122. package/lib/api/api/rollup.js +49 -85
  123. package/lib/api/api/rollup.js.map +1 -1
  124. package/lib/api/api/scripts_painless_execute.js +13 -7
  125. package/lib/api/api/scripts_painless_execute.js.map +1 -1
  126. package/lib/api/api/scroll.d.ts +3 -3
  127. package/lib/api/api/scroll.js +13 -7
  128. package/lib/api/api/scroll.js.map +1 -1
  129. package/lib/api/api/search.d.ts +3 -3
  130. package/lib/api/api/search.js +19 -7
  131. package/lib/api/api/search.js.map +1 -1
  132. package/lib/api/api/search_mvt.js +13 -7
  133. package/lib/api/api/search_mvt.js.map +1 -1
  134. package/lib/api/api/search_shards.js +3 -11
  135. package/lib/api/api/search_shards.js.map +1 -1
  136. package/lib/api/api/search_template.js +13 -7
  137. package/lib/api/api/search_template.js.map +1 -1
  138. package/lib/api/api/searchable_snapshots.d.ts +3 -3
  139. package/lib/api/api/searchable_snapshots.js +23 -38
  140. package/lib/api/api/searchable_snapshots.js.map +1 -1
  141. package/lib/api/api/security.d.ts +27 -27
  142. package/lib/api/api/security.js +311 -401
  143. package/lib/api/api/security.js.map +1 -1
  144. package/lib/api/api/shutdown.js +9 -33
  145. package/lib/api/api/shutdown.js.map +1 -1
  146. package/lib/api/api/slm.js +37 -95
  147. package/lib/api/api/slm.js.map +1 -1
  148. package/lib/api/api/snapshot.js +87 -125
  149. package/lib/api/api/snapshot.js.map +1 -1
  150. package/lib/api/api/sql.d.ts +9 -9
  151. package/lib/api/api/sql.js +51 -51
  152. package/lib/api/api/sql.js.map +1 -1
  153. package/lib/api/api/ssl.js +3 -11
  154. package/lib/api/api/ssl.js.map +1 -1
  155. package/lib/api/api/tasks.js +9 -33
  156. package/lib/api/api/tasks.js.map +1 -1
  157. package/lib/api/api/terms_enum.js +13 -7
  158. package/lib/api/api/terms_enum.js.map +1 -1
  159. package/lib/api/api/termvectors.js +13 -7
  160. package/lib/api/api/termvectors.js.map +1 -1
  161. package/lib/api/api/text_structure.js +4 -4
  162. package/lib/api/api/text_structure.js.map +1 -1
  163. package/lib/api/api/transform.d.ts +3 -0
  164. package/lib/api/api/transform.js +74 -78
  165. package/lib/api/api/transform.js.map +1 -1
  166. package/lib/api/api/update.js +14 -8
  167. package/lib/api/api/update.js.map +1 -1
  168. package/lib/api/api/update_by_query.js +13 -7
  169. package/lib/api/api/update_by_query.js.map +1 -1
  170. package/lib/api/api/update_by_query_rethrottle.js +3 -11
  171. package/lib/api/api/update_by_query_rethrottle.js.map +1 -1
  172. package/lib/api/api/watcher.js +63 -109
  173. package/lib/api/api/watcher.js.map +1 -1
  174. package/lib/api/api/xpack.js +6 -22
  175. package/lib/api/api/xpack.js.map +1 -1
  176. package/lib/api/index.d.ts +2 -0
  177. package/lib/api/index.js +2 -0
  178. package/lib/api/index.js.map +1 -1
  179. package/lib/api/types.d.ts +2945 -1413
  180. package/lib/api/typesWithBodyKey.d.ts +3076 -1437
  181. package/lib/{Client.d.ts → client.d.ts} +3 -4
  182. package/lib/{Client.js → client.js} +11 -6
  183. package/lib/{Client.js.map → client.js.map} +1 -1
  184. package/lib/{Helpers.d.ts → helpers.d.ts} +2 -2
  185. package/lib/{Helpers.js → helpers.js} +2 -4
  186. package/lib/helpers.js.map +1 -0
  187. package/lib/{SniffingTransport.d.ts → sniffingTransport.d.ts} +0 -0
  188. package/lib/{SniffingTransport.js → sniffingTransport.js} +1 -1
  189. package/lib/{SniffingTransport.js.map → sniffingTransport.js.map} +1 -1
  190. package/package.json +3 -3
  191. package/platinum-report-junit.xml +13 -0
  192. package/tsconfig.json +1 -1
  193. package/lib/Helpers.js.map +0 -1
package/lib/api/api/ml.js CHANGED
@@ -29,24 +29,30 @@ class Ml {
29
29
  this.transport = transport;
30
30
  }
31
31
  async closeJob(params, options) {
32
- var _a;
33
32
  const acceptedPath = ['job_id'];
34
- const acceptedQuery = ['allow_no_match', 'allow_no_jobs', 'force', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
33
+ const acceptedBody = ['allow_no_match', 'force', 'timeout'];
35
34
  const querystring = {};
36
35
  // @ts-expect-error
37
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
36
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
37
+ let body;
38
+ if (typeof userBody === 'string') {
39
+ body = userBody;
40
+ }
41
+ else {
42
+ body = userBody != null ? { ...userBody } : undefined;
43
+ }
38
44
  for (const key in params) {
39
- if (acceptedQuery.includes(key)) {
45
+ if (acceptedBody.includes(key)) {
46
+ body = body !== null && body !== void 0 ? body : {};
40
47
  // @ts-expect-error
41
- querystring[key] = params[key];
48
+ body[key] = params[key];
42
49
  }
43
50
  else if (acceptedPath.includes(key)) {
44
51
  continue;
45
52
  }
46
53
  else if (key !== 'body') {
47
- body = body !== null && body !== void 0 ? body : {};
48
54
  // @ts-expect-error
49
- body[key] = params[key];
55
+ querystring[key] = params[key];
50
56
  }
51
57
  }
52
58
  const method = 'POST';
@@ -54,24 +60,16 @@ class Ml {
54
60
  return await this.transport.request({ path, method, querystring, body }, options);
55
61
  }
56
62
  async deleteCalendar(params, options) {
57
- var _a;
58
63
  const acceptedPath = ['calendar_id'];
59
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
60
64
  const querystring = {};
61
- // @ts-expect-error
62
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
65
+ const body = undefined;
63
66
  for (const key in params) {
64
- if (acceptedQuery.includes(key)) {
65
- // @ts-expect-error
66
- querystring[key] = params[key];
67
- }
68
- else if (acceptedPath.includes(key)) {
67
+ if (acceptedPath.includes(key)) {
69
68
  continue;
70
69
  }
71
70
  else if (key !== 'body') {
72
- body = body !== null && body !== void 0 ? body : {};
73
71
  // @ts-expect-error
74
- body[key] = params[key];
72
+ querystring[key] = params[key];
75
73
  }
76
74
  }
77
75
  const method = 'DELETE';
@@ -79,24 +77,16 @@ class Ml {
79
77
  return await this.transport.request({ path, method, querystring, body }, options);
80
78
  }
81
79
  async deleteCalendarEvent(params, options) {
82
- var _a;
83
80
  const acceptedPath = ['calendar_id', 'event_id'];
84
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
85
81
  const querystring = {};
86
- // @ts-expect-error
87
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
82
+ const body = undefined;
88
83
  for (const key in params) {
89
- if (acceptedQuery.includes(key)) {
90
- // @ts-expect-error
91
- querystring[key] = params[key];
92
- }
93
- else if (acceptedPath.includes(key)) {
84
+ if (acceptedPath.includes(key)) {
94
85
  continue;
95
86
  }
96
87
  else if (key !== 'body') {
97
- body = body !== null && body !== void 0 ? body : {};
98
88
  // @ts-expect-error
99
- body[key] = params[key];
89
+ querystring[key] = params[key];
100
90
  }
101
91
  }
102
92
  const method = 'DELETE';
@@ -104,24 +94,16 @@ class Ml {
104
94
  return await this.transport.request({ path, method, querystring, body }, options);
105
95
  }
106
96
  async deleteCalendarJob(params, options) {
107
- var _a;
108
97
  const acceptedPath = ['calendar_id', 'job_id'];
109
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
110
98
  const querystring = {};
111
- // @ts-expect-error
112
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
99
+ const body = undefined;
113
100
  for (const key in params) {
114
- if (acceptedQuery.includes(key)) {
115
- // @ts-expect-error
116
- querystring[key] = params[key];
117
- }
118
- else if (acceptedPath.includes(key)) {
101
+ if (acceptedPath.includes(key)) {
119
102
  continue;
120
103
  }
121
104
  else if (key !== 'body') {
122
- body = body !== null && body !== void 0 ? body : {};
123
105
  // @ts-expect-error
124
- body[key] = params[key];
106
+ querystring[key] = params[key];
125
107
  }
126
108
  }
127
109
  const method = 'DELETE';
@@ -129,24 +111,16 @@ class Ml {
129
111
  return await this.transport.request({ path, method, querystring, body }, options);
130
112
  }
131
113
  async deleteDataFrameAnalytics(params, options) {
132
- var _a;
133
114
  const acceptedPath = ['id'];
134
- const acceptedQuery = ['force', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
135
115
  const querystring = {};
136
- // @ts-expect-error
137
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
116
+ const body = undefined;
138
117
  for (const key in params) {
139
- if (acceptedQuery.includes(key)) {
140
- // @ts-expect-error
141
- querystring[key] = params[key];
142
- }
143
- else if (acceptedPath.includes(key)) {
118
+ if (acceptedPath.includes(key)) {
144
119
  continue;
145
120
  }
146
121
  else if (key !== 'body') {
147
- body = body !== null && body !== void 0 ? body : {};
148
122
  // @ts-expect-error
149
- body[key] = params[key];
123
+ querystring[key] = params[key];
150
124
  }
151
125
  }
152
126
  const method = 'DELETE';
@@ -154,24 +128,16 @@ class Ml {
154
128
  return await this.transport.request({ path, method, querystring, body }, options);
155
129
  }
156
130
  async deleteDatafeed(params, options) {
157
- var _a;
158
131
  const acceptedPath = ['datafeed_id'];
159
- const acceptedQuery = ['force', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
160
132
  const querystring = {};
161
- // @ts-expect-error
162
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
133
+ const body = undefined;
163
134
  for (const key in params) {
164
- if (acceptedQuery.includes(key)) {
165
- // @ts-expect-error
166
- querystring[key] = params[key];
167
- }
168
- else if (acceptedPath.includes(key)) {
135
+ if (acceptedPath.includes(key)) {
169
136
  continue;
170
137
  }
171
138
  else if (key !== 'body') {
172
- body = body !== null && body !== void 0 ? body : {};
173
139
  // @ts-expect-error
174
- body[key] = params[key];
140
+ querystring[key] = params[key];
175
141
  }
176
142
  }
177
143
  const method = 'DELETE';
@@ -179,25 +145,31 @@ class Ml {
179
145
  return await this.transport.request({ path, method, querystring, body }, options);
180
146
  }
181
147
  async deleteExpiredData(params, options) {
182
- var _a;
183
148
  const acceptedPath = ['job_id'];
184
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
149
+ const acceptedBody = ['requests_per_second', 'timeout'];
185
150
  const querystring = {};
186
151
  // @ts-expect-error
187
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
152
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
153
+ let body;
154
+ if (typeof userBody === 'string') {
155
+ body = userBody;
156
+ }
157
+ else {
158
+ body = userBody != null ? { ...userBody } : undefined;
159
+ }
188
160
  params = params !== null && params !== void 0 ? params : {};
189
161
  for (const key in params) {
190
- if (acceptedQuery.includes(key)) {
162
+ if (acceptedBody.includes(key)) {
163
+ body = body !== null && body !== void 0 ? body : {};
191
164
  // @ts-expect-error
192
- querystring[key] = params[key];
165
+ body[key] = params[key];
193
166
  }
194
167
  else if (acceptedPath.includes(key)) {
195
168
  continue;
196
169
  }
197
170
  else if (key !== 'body') {
198
- body = body !== null && body !== void 0 ? body : {};
199
171
  // @ts-expect-error
200
- body[key] = params[key];
172
+ querystring[key] = params[key];
201
173
  }
202
174
  }
203
175
  let method = '';
@@ -213,24 +185,16 @@ class Ml {
213
185
  return await this.transport.request({ path, method, querystring, body }, options);
214
186
  }
215
187
  async deleteFilter(params, options) {
216
- var _a;
217
188
  const acceptedPath = ['filter_id'];
218
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
219
189
  const querystring = {};
220
- // @ts-expect-error
221
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
190
+ const body = undefined;
222
191
  for (const key in params) {
223
- if (acceptedQuery.includes(key)) {
224
- // @ts-expect-error
225
- querystring[key] = params[key];
226
- }
227
- else if (acceptedPath.includes(key)) {
192
+ if (acceptedPath.includes(key)) {
228
193
  continue;
229
194
  }
230
195
  else if (key !== 'body') {
231
- body = body !== null && body !== void 0 ? body : {};
232
196
  // @ts-expect-error
233
- body[key] = params[key];
197
+ querystring[key] = params[key];
234
198
  }
235
199
  }
236
200
  const method = 'DELETE';
@@ -238,24 +202,16 @@ class Ml {
238
202
  return await this.transport.request({ path, method, querystring, body }, options);
239
203
  }
240
204
  async deleteForecast(params, options) {
241
- var _a;
242
205
  const acceptedPath = ['job_id', 'forecast_id'];
243
- const acceptedQuery = ['allow_no_forecasts', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
244
206
  const querystring = {};
245
- // @ts-expect-error
246
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
207
+ const body = undefined;
247
208
  for (const key in params) {
248
- if (acceptedQuery.includes(key)) {
249
- // @ts-expect-error
250
- querystring[key] = params[key];
251
- }
252
- else if (acceptedPath.includes(key)) {
209
+ if (acceptedPath.includes(key)) {
253
210
  continue;
254
211
  }
255
212
  else if (key !== 'body') {
256
- body = body !== null && body !== void 0 ? body : {};
257
213
  // @ts-expect-error
258
- body[key] = params[key];
214
+ querystring[key] = params[key];
259
215
  }
260
216
  }
261
217
  let method = '';
@@ -271,24 +227,16 @@ class Ml {
271
227
  return await this.transport.request({ path, method, querystring, body }, options);
272
228
  }
273
229
  async deleteJob(params, options) {
274
- var _a;
275
230
  const acceptedPath = ['job_id'];
276
- const acceptedQuery = ['force', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
277
231
  const querystring = {};
278
- // @ts-expect-error
279
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
232
+ const body = undefined;
280
233
  for (const key in params) {
281
- if (acceptedQuery.includes(key)) {
282
- // @ts-expect-error
283
- querystring[key] = params[key];
284
- }
285
- else if (acceptedPath.includes(key)) {
234
+ if (acceptedPath.includes(key)) {
286
235
  continue;
287
236
  }
288
237
  else if (key !== 'body') {
289
- body = body !== null && body !== void 0 ? body : {};
290
238
  // @ts-expect-error
291
- body[key] = params[key];
239
+ querystring[key] = params[key];
292
240
  }
293
241
  }
294
242
  const method = 'DELETE';
@@ -296,24 +244,16 @@ class Ml {
296
244
  return await this.transport.request({ path, method, querystring, body }, options);
297
245
  }
298
246
  async deleteModelSnapshot(params, options) {
299
- var _a;
300
247
  const acceptedPath = ['job_id', 'snapshot_id'];
301
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
302
248
  const querystring = {};
303
- // @ts-expect-error
304
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
249
+ const body = undefined;
305
250
  for (const key in params) {
306
- if (acceptedQuery.includes(key)) {
307
- // @ts-expect-error
308
- querystring[key] = params[key];
309
- }
310
- else if (acceptedPath.includes(key)) {
251
+ if (acceptedPath.includes(key)) {
311
252
  continue;
312
253
  }
313
254
  else if (key !== 'body') {
314
- body = body !== null && body !== void 0 ? body : {};
315
255
  // @ts-expect-error
316
- body[key] = params[key];
256
+ querystring[key] = params[key];
317
257
  }
318
258
  }
319
259
  const method = 'DELETE';
@@ -321,24 +261,16 @@ class Ml {
321
261
  return await this.transport.request({ path, method, querystring, body }, options);
322
262
  }
323
263
  async deleteTrainedModel(params, options) {
324
- var _a;
325
264
  const acceptedPath = ['model_id'];
326
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
327
265
  const querystring = {};
328
- // @ts-expect-error
329
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
266
+ const body = undefined;
330
267
  for (const key in params) {
331
- if (acceptedQuery.includes(key)) {
332
- // @ts-expect-error
333
- querystring[key] = params[key];
334
- }
335
- else if (acceptedPath.includes(key)) {
268
+ if (acceptedPath.includes(key)) {
336
269
  continue;
337
270
  }
338
271
  else if (key !== 'body') {
339
- body = body !== null && body !== void 0 ? body : {};
340
272
  // @ts-expect-error
341
- body[key] = params[key];
273
+ querystring[key] = params[key];
342
274
  }
343
275
  }
344
276
  const method = 'DELETE';
@@ -346,24 +278,16 @@ class Ml {
346
278
  return await this.transport.request({ path, method, querystring, body }, options);
347
279
  }
348
280
  async deleteTrainedModelAlias(params, options) {
349
- var _a;
350
281
  const acceptedPath = ['model_alias', 'model_id'];
351
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
352
282
  const querystring = {};
353
- // @ts-expect-error
354
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
283
+ const body = undefined;
355
284
  for (const key in params) {
356
- if (acceptedQuery.includes(key)) {
357
- // @ts-expect-error
358
- querystring[key] = params[key];
359
- }
360
- else if (acceptedPath.includes(key)) {
285
+ if (acceptedPath.includes(key)) {
361
286
  continue;
362
287
  }
363
288
  else if (key !== 'body') {
364
- body = body !== null && body !== void 0 ? body : {};
365
289
  // @ts-expect-error
366
- body[key] = params[key];
290
+ querystring[key] = params[key];
367
291
  }
368
292
  }
369
293
  const method = 'DELETE';
@@ -371,25 +295,31 @@ class Ml {
371
295
  return await this.transport.request({ path, method, querystring, body }, options);
372
296
  }
373
297
  async estimateModelMemory(params, options) {
374
- var _a;
375
298
  const acceptedPath = [];
376
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
299
+ const acceptedBody = ['analysis_config', 'max_bucket_cardinality', 'overall_cardinality'];
377
300
  const querystring = {};
378
301
  // @ts-expect-error
379
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
302
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
303
+ let body;
304
+ if (typeof userBody === 'string') {
305
+ body = userBody;
306
+ }
307
+ else {
308
+ body = userBody != null ? { ...userBody } : undefined;
309
+ }
380
310
  params = params !== null && params !== void 0 ? params : {};
381
311
  for (const key in params) {
382
- if (acceptedQuery.includes(key)) {
312
+ if (acceptedBody.includes(key)) {
313
+ body = body !== null && body !== void 0 ? body : {};
383
314
  // @ts-expect-error
384
- querystring[key] = params[key];
315
+ body[key] = params[key];
385
316
  }
386
317
  else if (acceptedPath.includes(key)) {
387
318
  continue;
388
319
  }
389
320
  else if (key !== 'body') {
390
- body = body !== null && body !== void 0 ? body : {};
391
321
  // @ts-expect-error
392
- body[key] = params[key];
322
+ querystring[key] = params[key];
393
323
  }
394
324
  }
395
325
  const method = 'POST';
@@ -397,24 +327,30 @@ class Ml {
397
327
  return await this.transport.request({ path, method, querystring, body }, options);
398
328
  }
399
329
  async evaluateDataFrame(params, options) {
400
- var _a;
401
330
  const acceptedPath = [];
402
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
331
+ const acceptedBody = ['evaluation', 'index', 'query'];
403
332
  const querystring = {};
404
333
  // @ts-expect-error
405
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
334
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
335
+ let body;
336
+ if (typeof userBody === 'string') {
337
+ body = userBody;
338
+ }
339
+ else {
340
+ body = userBody != null ? { ...userBody } : undefined;
341
+ }
406
342
  for (const key in params) {
407
- if (acceptedQuery.includes(key)) {
343
+ if (acceptedBody.includes(key)) {
344
+ body = body !== null && body !== void 0 ? body : {};
408
345
  // @ts-expect-error
409
- querystring[key] = params[key];
346
+ body[key] = params[key];
410
347
  }
411
348
  else if (acceptedPath.includes(key)) {
412
349
  continue;
413
350
  }
414
351
  else if (key !== 'body') {
415
- body = body !== null && body !== void 0 ? body : {};
416
352
  // @ts-expect-error
417
- body[key] = params[key];
353
+ querystring[key] = params[key];
418
354
  }
419
355
  }
420
356
  const method = 'POST';
@@ -422,24 +358,31 @@ class Ml {
422
358
  return await this.transport.request({ path, method, querystring, body }, options);
423
359
  }
424
360
  async explainDataFrameAnalytics(params, options) {
425
- var _a;
426
361
  const acceptedPath = ['id'];
427
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
362
+ const acceptedBody = ['source', 'dest', 'analysis', 'description', 'model_memory_limit', 'max_num_threads', 'analyzed_fields', 'allow_lazy_start'];
428
363
  const querystring = {};
429
364
  // @ts-expect-error
430
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
365
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
366
+ let body;
367
+ if (typeof userBody === 'string') {
368
+ body = userBody;
369
+ }
370
+ else {
371
+ body = userBody != null ? { ...userBody } : undefined;
372
+ }
373
+ params = params !== null && params !== void 0 ? params : {};
431
374
  for (const key in params) {
432
- if (acceptedQuery.includes(key)) {
375
+ if (acceptedBody.includes(key)) {
376
+ body = body !== null && body !== void 0 ? body : {};
433
377
  // @ts-expect-error
434
- querystring[key] = params[key];
378
+ body[key] = params[key];
435
379
  }
436
380
  else if (acceptedPath.includes(key)) {
437
381
  continue;
438
382
  }
439
383
  else if (key !== 'body') {
440
- body = body !== null && body !== void 0 ? body : {};
441
384
  // @ts-expect-error
442
- body[key] = params[key];
385
+ querystring[key] = params[key];
443
386
  }
444
387
  }
445
388
  let method = '';
@@ -455,24 +398,30 @@ class Ml {
455
398
  return await this.transport.request({ path, method, querystring, body }, options);
456
399
  }
457
400
  async flushJob(params, options) {
458
- var _a;
459
401
  const acceptedPath = ['job_id'];
460
- const acceptedQuery = ['skip_time', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
402
+ const acceptedBody = ['advance_time', 'calc_interim', 'end', 'skip_time', 'start'];
461
403
  const querystring = {};
462
404
  // @ts-expect-error
463
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
405
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
406
+ let body;
407
+ if (typeof userBody === 'string') {
408
+ body = userBody;
409
+ }
410
+ else {
411
+ body = userBody != null ? { ...userBody } : undefined;
412
+ }
464
413
  for (const key in params) {
465
- if (acceptedQuery.includes(key)) {
414
+ if (acceptedBody.includes(key)) {
415
+ body = body !== null && body !== void 0 ? body : {};
466
416
  // @ts-expect-error
467
- querystring[key] = params[key];
417
+ body[key] = params[key];
468
418
  }
469
419
  else if (acceptedPath.includes(key)) {
470
420
  continue;
471
421
  }
472
422
  else if (key !== 'body') {
473
- body = body !== null && body !== void 0 ? body : {};
474
423
  // @ts-expect-error
475
- body[key] = params[key];
424
+ querystring[key] = params[key];
476
425
  }
477
426
  }
478
427
  const method = 'POST';
@@ -480,24 +429,30 @@ class Ml {
480
429
  return await this.transport.request({ path, method, querystring, body }, options);
481
430
  }
482
431
  async forecast(params, options) {
483
- var _a;
484
432
  const acceptedPath = ['job_id'];
485
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
433
+ const acceptedBody = ['duration', 'expires_in', 'max_model_memory'];
486
434
  const querystring = {};
487
435
  // @ts-expect-error
488
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
436
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
437
+ let body;
438
+ if (typeof userBody === 'string') {
439
+ body = userBody;
440
+ }
441
+ else {
442
+ body = userBody != null ? { ...userBody } : undefined;
443
+ }
489
444
  for (const key in params) {
490
- if (acceptedQuery.includes(key)) {
445
+ if (acceptedBody.includes(key)) {
446
+ body = body !== null && body !== void 0 ? body : {};
491
447
  // @ts-expect-error
492
- querystring[key] = params[key];
448
+ body[key] = params[key];
493
449
  }
494
450
  else if (acceptedPath.includes(key)) {
495
451
  continue;
496
452
  }
497
453
  else if (key !== 'body') {
498
- body = body !== null && body !== void 0 ? body : {};
499
454
  // @ts-expect-error
500
- body[key] = params[key];
455
+ querystring[key] = params[key];
501
456
  }
502
457
  }
503
458
  const method = 'POST';
@@ -505,24 +460,30 @@ class Ml {
505
460
  return await this.transport.request({ path, method, querystring, body }, options);
506
461
  }
507
462
  async getBuckets(params, options) {
508
- var _a;
509
463
  const acceptedPath = ['job_id', 'timestamp'];
510
- const acceptedQuery = ['from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
464
+ const acceptedBody = ['anomaly_score', 'desc', 'end', 'exclude_interim', 'expand', 'page', 'sort', 'start'];
511
465
  const querystring = {};
512
466
  // @ts-expect-error
513
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
467
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
468
+ let body;
469
+ if (typeof userBody === 'string') {
470
+ body = userBody;
471
+ }
472
+ else {
473
+ body = userBody != null ? { ...userBody } : undefined;
474
+ }
514
475
  for (const key in params) {
515
- if (acceptedQuery.includes(key)) {
476
+ if (acceptedBody.includes(key)) {
477
+ body = body !== null && body !== void 0 ? body : {};
516
478
  // @ts-expect-error
517
- querystring[key] = params[key];
479
+ body[key] = params[key];
518
480
  }
519
481
  else if (acceptedPath.includes(key)) {
520
482
  continue;
521
483
  }
522
484
  else if (key !== 'body') {
523
- body = body !== null && body !== void 0 ? body : {};
524
485
  // @ts-expect-error
525
- body[key] = params[key];
486
+ querystring[key] = params[key];
526
487
  }
527
488
  }
528
489
  let method = '';
@@ -538,24 +499,16 @@ class Ml {
538
499
  return await this.transport.request({ path, method, querystring, body }, options);
539
500
  }
540
501
  async getCalendarEvents(params, options) {
541
- var _a;
542
502
  const acceptedPath = ['calendar_id'];
543
- const acceptedQuery = ['job_id', 'end', 'from', 'start', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
544
503
  const querystring = {};
545
- // @ts-expect-error
546
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
504
+ const body = undefined;
547
505
  for (const key in params) {
548
- if (acceptedQuery.includes(key)) {
549
- // @ts-expect-error
550
- querystring[key] = params[key];
551
- }
552
- else if (acceptedPath.includes(key)) {
506
+ if (acceptedPath.includes(key)) {
553
507
  continue;
554
508
  }
555
509
  else if (key !== 'body') {
556
- body = body !== null && body !== void 0 ? body : {};
557
510
  // @ts-expect-error
558
- body[key] = params[key];
511
+ querystring[key] = params[key];
559
512
  }
560
513
  }
561
514
  const method = 'GET';
@@ -563,25 +516,31 @@ class Ml {
563
516
  return await this.transport.request({ path, method, querystring, body }, options);
564
517
  }
565
518
  async getCalendars(params, options) {
566
- var _a;
567
519
  const acceptedPath = ['calendar_id'];
568
- const acceptedQuery = ['from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
520
+ const acceptedBody = ['page'];
569
521
  const querystring = {};
570
522
  // @ts-expect-error
571
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
523
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
524
+ let body;
525
+ if (typeof userBody === 'string') {
526
+ body = userBody;
527
+ }
528
+ else {
529
+ body = userBody != null ? { ...userBody } : undefined;
530
+ }
572
531
  params = params !== null && params !== void 0 ? params : {};
573
532
  for (const key in params) {
574
- if (acceptedQuery.includes(key)) {
533
+ if (acceptedBody.includes(key)) {
534
+ body = body !== null && body !== void 0 ? body : {};
575
535
  // @ts-expect-error
576
- querystring[key] = params[key];
536
+ body[key] = params[key];
577
537
  }
578
538
  else if (acceptedPath.includes(key)) {
579
539
  continue;
580
540
  }
581
541
  else if (key !== 'body') {
582
- body = body !== null && body !== void 0 ? body : {};
583
542
  // @ts-expect-error
584
- body[key] = params[key];
543
+ querystring[key] = params[key];
585
544
  }
586
545
  }
587
546
  let method = '';
@@ -597,24 +556,30 @@ class Ml {
597
556
  return await this.transport.request({ path, method, querystring, body }, options);
598
557
  }
599
558
  async getCategories(params, options) {
600
- var _a;
601
559
  const acceptedPath = ['job_id', 'category_id'];
602
- const acceptedQuery = ['from', 'size', 'partition_field_value', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
560
+ const acceptedBody = ['page'];
603
561
  const querystring = {};
604
562
  // @ts-expect-error
605
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
563
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
564
+ let body;
565
+ if (typeof userBody === 'string') {
566
+ body = userBody;
567
+ }
568
+ else {
569
+ body = userBody != null ? { ...userBody } : undefined;
570
+ }
606
571
  for (const key in params) {
607
- if (acceptedQuery.includes(key)) {
572
+ if (acceptedBody.includes(key)) {
573
+ body = body !== null && body !== void 0 ? body : {};
608
574
  // @ts-expect-error
609
- querystring[key] = params[key];
575
+ body[key] = params[key];
610
576
  }
611
577
  else if (acceptedPath.includes(key)) {
612
578
  continue;
613
579
  }
614
580
  else if (key !== 'body') {
615
- body = body !== null && body !== void 0 ? body : {};
616
581
  // @ts-expect-error
617
- body[key] = params[key];
582
+ querystring[key] = params[key];
618
583
  }
619
584
  }
620
585
  let method = '';
@@ -630,25 +595,17 @@ class Ml {
630
595
  return await this.transport.request({ path, method, querystring, body }, options);
631
596
  }
632
597
  async getDataFrameAnalytics(params, options) {
633
- var _a;
634
598
  const acceptedPath = ['id'];
635
- const acceptedQuery = ['allow_no_match', 'from', 'size', 'exclude_generated', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
636
599
  const querystring = {};
637
- // @ts-expect-error
638
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
600
+ const body = undefined;
639
601
  params = params !== null && params !== void 0 ? params : {};
640
602
  for (const key in params) {
641
- if (acceptedQuery.includes(key)) {
642
- // @ts-expect-error
643
- querystring[key] = params[key];
644
- }
645
- else if (acceptedPath.includes(key)) {
603
+ if (acceptedPath.includes(key)) {
646
604
  continue;
647
605
  }
648
606
  else if (key !== 'body') {
649
- body = body !== null && body !== void 0 ? body : {};
650
607
  // @ts-expect-error
651
- body[key] = params[key];
608
+ querystring[key] = params[key];
652
609
  }
653
610
  }
654
611
  let method = '';
@@ -664,25 +621,17 @@ class Ml {
664
621
  return await this.transport.request({ path, method, querystring, body }, options);
665
622
  }
666
623
  async getDataFrameAnalyticsStats(params, options) {
667
- var _a;
668
624
  const acceptedPath = ['id'];
669
- const acceptedQuery = ['allow_no_match', 'from', 'size', 'verbose', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
670
625
  const querystring = {};
671
- // @ts-expect-error
672
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
626
+ const body = undefined;
673
627
  params = params !== null && params !== void 0 ? params : {};
674
628
  for (const key in params) {
675
- if (acceptedQuery.includes(key)) {
676
- // @ts-expect-error
677
- querystring[key] = params[key];
678
- }
679
- else if (acceptedPath.includes(key)) {
629
+ if (acceptedPath.includes(key)) {
680
630
  continue;
681
631
  }
682
632
  else if (key !== 'body') {
683
- body = body !== null && body !== void 0 ? body : {};
684
633
  // @ts-expect-error
685
- body[key] = params[key];
634
+ querystring[key] = params[key];
686
635
  }
687
636
  }
688
637
  let method = '';
@@ -698,25 +647,17 @@ class Ml {
698
647
  return await this.transport.request({ path, method, querystring, body }, options);
699
648
  }
700
649
  async getDatafeedStats(params, options) {
701
- var _a;
702
650
  const acceptedPath = ['datafeed_id'];
703
- const acceptedQuery = ['allow_no_datafeeds', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
704
651
  const querystring = {};
705
- // @ts-expect-error
706
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
652
+ const body = undefined;
707
653
  params = params !== null && params !== void 0 ? params : {};
708
654
  for (const key in params) {
709
- if (acceptedQuery.includes(key)) {
710
- // @ts-expect-error
711
- querystring[key] = params[key];
712
- }
713
- else if (acceptedPath.includes(key)) {
655
+ if (acceptedPath.includes(key)) {
714
656
  continue;
715
657
  }
716
658
  else if (key !== 'body') {
717
- body = body !== null && body !== void 0 ? body : {};
718
659
  // @ts-expect-error
719
- body[key] = params[key];
660
+ querystring[key] = params[key];
720
661
  }
721
662
  }
722
663
  let method = '';
@@ -732,25 +673,17 @@ class Ml {
732
673
  return await this.transport.request({ path, method, querystring, body }, options);
733
674
  }
734
675
  async getDatafeeds(params, options) {
735
- var _a;
736
676
  const acceptedPath = ['datafeed_id'];
737
- const acceptedQuery = ['allow_no_datafeeds', 'exclude_generated', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
738
677
  const querystring = {};
739
- // @ts-expect-error
740
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
678
+ const body = undefined;
741
679
  params = params !== null && params !== void 0 ? params : {};
742
680
  for (const key in params) {
743
- if (acceptedQuery.includes(key)) {
744
- // @ts-expect-error
745
- querystring[key] = params[key];
746
- }
747
- else if (acceptedPath.includes(key)) {
681
+ if (acceptedPath.includes(key)) {
748
682
  continue;
749
683
  }
750
684
  else if (key !== 'body') {
751
- body = body !== null && body !== void 0 ? body : {};
752
685
  // @ts-expect-error
753
- body[key] = params[key];
686
+ querystring[key] = params[key];
754
687
  }
755
688
  }
756
689
  let method = '';
@@ -766,25 +699,17 @@ class Ml {
766
699
  return await this.transport.request({ path, method, querystring, body }, options);
767
700
  }
768
701
  async getFilters(params, options) {
769
- var _a;
770
702
  const acceptedPath = ['filter_id'];
771
- const acceptedQuery = ['from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
772
703
  const querystring = {};
773
- // @ts-expect-error
774
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
704
+ const body = undefined;
775
705
  params = params !== null && params !== void 0 ? params : {};
776
706
  for (const key in params) {
777
- if (acceptedQuery.includes(key)) {
778
- // @ts-expect-error
779
- querystring[key] = params[key];
780
- }
781
- else if (acceptedPath.includes(key)) {
707
+ if (acceptedPath.includes(key)) {
782
708
  continue;
783
709
  }
784
710
  else if (key !== 'body') {
785
- body = body !== null && body !== void 0 ? body : {};
786
711
  // @ts-expect-error
787
- body[key] = params[key];
712
+ querystring[key] = params[key];
788
713
  }
789
714
  }
790
715
  let method = '';
@@ -800,24 +725,30 @@ class Ml {
800
725
  return await this.transport.request({ path, method, querystring, body }, options);
801
726
  }
802
727
  async getInfluencers(params, options) {
803
- var _a;
804
728
  const acceptedPath = ['job_id'];
805
- const acceptedQuery = ['desc', 'end', 'exclude_interim', 'influencer_score', 'from', 'size', 'sort', 'start', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
729
+ const acceptedBody = ['page'];
806
730
  const querystring = {};
807
731
  // @ts-expect-error
808
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
732
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
733
+ let body;
734
+ if (typeof userBody === 'string') {
735
+ body = userBody;
736
+ }
737
+ else {
738
+ body = userBody != null ? { ...userBody } : undefined;
739
+ }
809
740
  for (const key in params) {
810
- if (acceptedQuery.includes(key)) {
741
+ if (acceptedBody.includes(key)) {
742
+ body = body !== null && body !== void 0 ? body : {};
811
743
  // @ts-expect-error
812
- querystring[key] = params[key];
744
+ body[key] = params[key];
813
745
  }
814
746
  else if (acceptedPath.includes(key)) {
815
747
  continue;
816
748
  }
817
749
  else if (key !== 'body') {
818
- body = body !== null && body !== void 0 ? body : {};
819
750
  // @ts-expect-error
820
- body[key] = params[key];
751
+ querystring[key] = params[key];
821
752
  }
822
753
  }
823
754
  const method = body != null ? 'POST' : 'GET';
@@ -825,25 +756,17 @@ class Ml {
825
756
  return await this.transport.request({ path, method, querystring, body }, options);
826
757
  }
827
758
  async getJobStats(params, options) {
828
- var _a;
829
759
  const acceptedPath = ['job_id'];
830
- const acceptedQuery = ['allow_no_jobs', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
831
760
  const querystring = {};
832
- // @ts-expect-error
833
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
761
+ const body = undefined;
834
762
  params = params !== null && params !== void 0 ? params : {};
835
763
  for (const key in params) {
836
- if (acceptedQuery.includes(key)) {
837
- // @ts-expect-error
838
- querystring[key] = params[key];
839
- }
840
- else if (acceptedPath.includes(key)) {
764
+ if (acceptedPath.includes(key)) {
841
765
  continue;
842
766
  }
843
767
  else if (key !== 'body') {
844
- body = body !== null && body !== void 0 ? body : {};
845
768
  // @ts-expect-error
846
- body[key] = params[key];
769
+ querystring[key] = params[key];
847
770
  }
848
771
  }
849
772
  let method = '';
@@ -859,25 +782,17 @@ class Ml {
859
782
  return await this.transport.request({ path, method, querystring, body }, options);
860
783
  }
861
784
  async getJobs(params, options) {
862
- var _a;
863
785
  const acceptedPath = ['job_id'];
864
- const acceptedQuery = ['allow_no_match', 'allow_no_jobs', 'exclude_generated', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
865
786
  const querystring = {};
866
- // @ts-expect-error
867
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
787
+ const body = undefined;
868
788
  params = params !== null && params !== void 0 ? params : {};
869
789
  for (const key in params) {
870
- if (acceptedQuery.includes(key)) {
871
- // @ts-expect-error
872
- querystring[key] = params[key];
873
- }
874
- else if (acceptedPath.includes(key)) {
790
+ if (acceptedPath.includes(key)) {
875
791
  continue;
876
792
  }
877
793
  else if (key !== 'body') {
878
- body = body !== null && body !== void 0 ? body : {};
879
794
  // @ts-expect-error
880
- body[key] = params[key];
795
+ querystring[key] = params[key];
881
796
  }
882
797
  }
883
798
  let method = '';
@@ -892,25 +807,48 @@ class Ml {
892
807
  }
893
808
  return await this.transport.request({ path, method, querystring, body }, options);
894
809
  }
810
+ async getModelSnapshotUpgradeStats(params, options) {
811
+ const acceptedPath = ['job_id', 'snapshot_id'];
812
+ const querystring = {};
813
+ const body = undefined;
814
+ params = params !== null && params !== void 0 ? params : {};
815
+ for (const key in params) {
816
+ if (acceptedPath.includes(key)) {
817
+ continue;
818
+ }
819
+ else if (key !== 'body') {
820
+ querystring[key] = params[key];
821
+ }
822
+ }
823
+ const method = 'GET';
824
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}/_upgrade/_stats`;
825
+ return await this.transport.request({ path, method, querystring, body }, options);
826
+ }
895
827
  async getModelSnapshots(params, options) {
896
- var _a;
897
828
  const acceptedPath = ['job_id', 'snapshot_id'];
898
- const acceptedQuery = ['desc', 'from', 'size', 'sort', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
829
+ const acceptedBody = ['desc', 'end', 'page', 'sort', 'start'];
899
830
  const querystring = {};
900
831
  // @ts-expect-error
901
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
832
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
833
+ let body;
834
+ if (typeof userBody === 'string') {
835
+ body = userBody;
836
+ }
837
+ else {
838
+ body = userBody != null ? { ...userBody } : undefined;
839
+ }
902
840
  for (const key in params) {
903
- if (acceptedQuery.includes(key)) {
841
+ if (acceptedBody.includes(key)) {
842
+ body = body !== null && body !== void 0 ? body : {};
904
843
  // @ts-expect-error
905
- querystring[key] = params[key];
844
+ body[key] = params[key];
906
845
  }
907
846
  else if (acceptedPath.includes(key)) {
908
847
  continue;
909
848
  }
910
849
  else if (key !== 'body') {
911
- body = body !== null && body !== void 0 ? body : {};
912
850
  // @ts-expect-error
913
- body[key] = params[key];
851
+ querystring[key] = params[key];
914
852
  }
915
853
  }
916
854
  let method = '';
@@ -926,24 +864,30 @@ class Ml {
926
864
  return await this.transport.request({ path, method, querystring, body }, options);
927
865
  }
928
866
  async getOverallBuckets(params, options) {
929
- var _a;
930
867
  const acceptedPath = ['job_id'];
931
- const acceptedQuery = ['bucket_span', 'overall_score', 'top_n', 'end', 'start', 'exclude_interim', 'allow_no_match', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
868
+ const acceptedBody = ['allow_no_match', 'bucket_span', 'end', 'exclude_interim', 'overall_score', 'start', 'top_n'];
932
869
  const querystring = {};
933
870
  // @ts-expect-error
934
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
871
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
872
+ let body;
873
+ if (typeof userBody === 'string') {
874
+ body = userBody;
875
+ }
876
+ else {
877
+ body = userBody != null ? { ...userBody } : undefined;
878
+ }
935
879
  for (const key in params) {
936
- if (acceptedQuery.includes(key)) {
880
+ if (acceptedBody.includes(key)) {
881
+ body = body !== null && body !== void 0 ? body : {};
937
882
  // @ts-expect-error
938
- querystring[key] = params[key];
883
+ body[key] = params[key];
939
884
  }
940
885
  else if (acceptedPath.includes(key)) {
941
886
  continue;
942
887
  }
943
888
  else if (key !== 'body') {
944
- body = body !== null && body !== void 0 ? body : {};
945
889
  // @ts-expect-error
946
- body[key] = params[key];
890
+ querystring[key] = params[key];
947
891
  }
948
892
  }
949
893
  const method = body != null ? 'POST' : 'GET';
@@ -951,73 +895,48 @@ class Ml {
951
895
  return await this.transport.request({ path, method, querystring, body }, options);
952
896
  }
953
897
  async getRecords(params, options) {
954
- var _a;
955
898
  const acceptedPath = ['job_id'];
956
- const acceptedQuery = ['from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
899
+ const acceptedBody = ['desc', 'end', 'exclude_interim', 'page', 'record_score', 'sort', 'start'];
957
900
  const querystring = {};
958
901
  // @ts-expect-error
959
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
902
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
903
+ let body;
904
+ if (typeof userBody === 'string') {
905
+ body = userBody;
906
+ }
907
+ else {
908
+ body = userBody != null ? { ...userBody } : undefined;
909
+ }
960
910
  for (const key in params) {
961
- if (acceptedQuery.includes(key)) {
911
+ if (acceptedBody.includes(key)) {
912
+ body = body !== null && body !== void 0 ? body : {};
962
913
  // @ts-expect-error
963
- querystring[key] = params[key];
914
+ body[key] = params[key];
964
915
  }
965
916
  else if (acceptedPath.includes(key)) {
966
917
  continue;
967
918
  }
968
919
  else if (key !== 'body') {
969
- body = body !== null && body !== void 0 ? body : {};
970
920
  // @ts-expect-error
971
- body[key] = params[key];
921
+ querystring[key] = params[key];
972
922
  }
973
923
  }
974
924
  const method = body != null ? 'POST' : 'GET';
975
925
  const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/records`;
976
926
  return await this.transport.request({ path, method, querystring, body }, options);
977
927
  }
978
- async getTrainedModelDeploymentStats(params, options) {
979
- var _a;
980
- const acceptedPath = ['model_id'];
981
- const acceptedQuery = [];
982
- const querystring = {};
983
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
984
- params = params !== null && params !== void 0 ? params : {};
985
- for (const key in params) {
986
- if (acceptedQuery.includes(key)) {
987
- querystring[key] = params[key];
988
- }
989
- else if (acceptedPath.includes(key)) {
990
- continue;
991
- }
992
- else if (key !== 'body') {
993
- body = body !== null && body !== void 0 ? body : {};
994
- body[key] = params[key];
995
- }
996
- }
997
- const method = 'GET';
998
- const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_stats`;
999
- return await this.transport.request({ path, method, querystring, body }, options);
1000
- }
1001
928
  async getTrainedModels(params, options) {
1002
- var _a;
1003
929
  const acceptedPath = ['model_id'];
1004
- const acceptedQuery = ['allow_no_match', 'decompress_definition', 'exclude_generated', 'from', 'include', 'size', 'tags', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1005
930
  const querystring = {};
1006
- // @ts-expect-error
1007
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
931
+ const body = undefined;
1008
932
  params = params !== null && params !== void 0 ? params : {};
1009
933
  for (const key in params) {
1010
- if (acceptedQuery.includes(key)) {
1011
- // @ts-expect-error
1012
- querystring[key] = params[key];
1013
- }
1014
- else if (acceptedPath.includes(key)) {
934
+ if (acceptedPath.includes(key)) {
1015
935
  continue;
1016
936
  }
1017
937
  else if (key !== 'body') {
1018
- body = body !== null && body !== void 0 ? body : {};
1019
938
  // @ts-expect-error
1020
- body[key] = params[key];
939
+ querystring[key] = params[key];
1021
940
  }
1022
941
  }
1023
942
  let method = '';
@@ -1033,25 +952,17 @@ class Ml {
1033
952
  return await this.transport.request({ path, method, querystring, body }, options);
1034
953
  }
1035
954
  async getTrainedModelsStats(params, options) {
1036
- var _a;
1037
955
  const acceptedPath = ['model_id'];
1038
- const acceptedQuery = ['allow_no_match', 'from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1039
956
  const querystring = {};
1040
- // @ts-expect-error
1041
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
957
+ const body = undefined;
1042
958
  params = params !== null && params !== void 0 ? params : {};
1043
959
  for (const key in params) {
1044
- if (acceptedQuery.includes(key)) {
1045
- // @ts-expect-error
1046
- querystring[key] = params[key];
1047
- }
1048
- else if (acceptedPath.includes(key)) {
960
+ if (acceptedPath.includes(key)) {
1049
961
  continue;
1050
962
  }
1051
963
  else if (key !== 'body') {
1052
- body = body !== null && body !== void 0 ? body : {};
1053
964
  // @ts-expect-error
1054
- body[key] = params[key];
965
+ querystring[key] = params[key];
1055
966
  }
1056
967
  }
1057
968
  let method = '';
@@ -1067,22 +978,30 @@ class Ml {
1067
978
  return await this.transport.request({ path, method, querystring, body }, options);
1068
979
  }
1069
980
  async inferTrainedModelDeployment(params, options) {
1070
- var _a;
1071
981
  const acceptedPath = ['model_id'];
1072
- const acceptedQuery = ['timeout'];
982
+ const acceptedBody = ['docs'];
1073
983
  const querystring = {};
1074
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1075
- params = params !== null && params !== void 0 ? params : {};
984
+ // @ts-expect-error
985
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
986
+ let body;
987
+ if (typeof userBody === 'string') {
988
+ body = userBody;
989
+ }
990
+ else {
991
+ body = userBody != null ? { ...userBody } : undefined;
992
+ }
1076
993
  for (const key in params) {
1077
- if (acceptedQuery.includes(key)) {
1078
- querystring[key] = params[key];
994
+ if (acceptedBody.includes(key)) {
995
+ body = body !== null && body !== void 0 ? body : {};
996
+ // @ts-expect-error
997
+ body[key] = params[key];
1079
998
  }
1080
999
  else if (acceptedPath.includes(key)) {
1081
1000
  continue;
1082
1001
  }
1083
1002
  else if (key !== 'body') {
1084
- body = body !== null && body !== void 0 ? body : {};
1085
- body[key] = params[key];
1003
+ // @ts-expect-error
1004
+ querystring[key] = params[key];
1086
1005
  }
1087
1006
  }
1088
1007
  const method = 'POST';
@@ -1090,25 +1009,17 @@ class Ml {
1090
1009
  return await this.transport.request({ path, method, querystring, body }, options);
1091
1010
  }
1092
1011
  async info(params, options) {
1093
- var _a;
1094
1012
  const acceptedPath = [];
1095
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1096
1013
  const querystring = {};
1097
- // @ts-expect-error
1098
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1014
+ const body = undefined;
1099
1015
  params = params !== null && params !== void 0 ? params : {};
1100
1016
  for (const key in params) {
1101
- if (acceptedQuery.includes(key)) {
1102
- // @ts-expect-error
1103
- querystring[key] = params[key];
1104
- }
1105
- else if (acceptedPath.includes(key)) {
1017
+ if (acceptedPath.includes(key)) {
1106
1018
  continue;
1107
1019
  }
1108
1020
  else if (key !== 'body') {
1109
- body = body !== null && body !== void 0 ? body : {};
1110
1021
  // @ts-expect-error
1111
- body[key] = params[key];
1022
+ querystring[key] = params[key];
1112
1023
  }
1113
1024
  }
1114
1025
  const method = 'GET';
@@ -1116,24 +1027,30 @@ class Ml {
1116
1027
  return await this.transport.request({ path, method, querystring, body }, options);
1117
1028
  }
1118
1029
  async openJob(params, options) {
1119
- var _a;
1120
1030
  const acceptedPath = ['job_id'];
1121
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1031
+ const acceptedBody = ['timeout'];
1122
1032
  const querystring = {};
1123
1033
  // @ts-expect-error
1124
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1034
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1035
+ let body;
1036
+ if (typeof userBody === 'string') {
1037
+ body = userBody;
1038
+ }
1039
+ else {
1040
+ body = userBody != null ? { ...userBody } : undefined;
1041
+ }
1125
1042
  for (const key in params) {
1126
- if (acceptedQuery.includes(key)) {
1043
+ if (acceptedBody.includes(key)) {
1044
+ body = body !== null && body !== void 0 ? body : {};
1127
1045
  // @ts-expect-error
1128
- querystring[key] = params[key];
1046
+ body[key] = params[key];
1129
1047
  }
1130
1048
  else if (acceptedPath.includes(key)) {
1131
1049
  continue;
1132
1050
  }
1133
1051
  else if (key !== 'body') {
1134
- body = body !== null && body !== void 0 ? body : {};
1135
1052
  // @ts-expect-error
1136
- body[key] = params[key];
1053
+ querystring[key] = params[key];
1137
1054
  }
1138
1055
  }
1139
1056
  const method = 'POST';
@@ -1141,24 +1058,30 @@ class Ml {
1141
1058
  return await this.transport.request({ path, method, querystring, body }, options);
1142
1059
  }
1143
1060
  async postCalendarEvents(params, options) {
1144
- var _a;
1145
1061
  const acceptedPath = ['calendar_id'];
1146
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1062
+ const acceptedBody = ['events'];
1147
1063
  const querystring = {};
1148
1064
  // @ts-expect-error
1149
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1065
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1066
+ let body;
1067
+ if (typeof userBody === 'string') {
1068
+ body = userBody;
1069
+ }
1070
+ else {
1071
+ body = userBody != null ? { ...userBody } : undefined;
1072
+ }
1150
1073
  for (const key in params) {
1151
- if (acceptedQuery.includes(key)) {
1074
+ if (acceptedBody.includes(key)) {
1075
+ body = body !== null && body !== void 0 ? body : {};
1152
1076
  // @ts-expect-error
1153
- querystring[key] = params[key];
1077
+ body[key] = params[key];
1154
1078
  }
1155
1079
  else if (acceptedPath.includes(key)) {
1156
1080
  continue;
1157
1081
  }
1158
1082
  else if (key !== 'body') {
1159
- body = body !== null && body !== void 0 ? body : {};
1160
1083
  // @ts-expect-error
1161
- body[key] = params[key];
1084
+ querystring[key] = params[key];
1162
1085
  }
1163
1086
  }
1164
1087
  const method = 'POST';
@@ -1168,21 +1091,21 @@ class Ml {
1168
1091
  async postData(params, options) {
1169
1092
  var _a;
1170
1093
  const acceptedPath = ['job_id'];
1171
- const acceptedQuery = ['reset_end', 'reset_start', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1094
+ const acceptedBody = ['data'];
1172
1095
  const querystring = {};
1173
1096
  // @ts-expect-error
1174
1097
  let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1175
1098
  for (const key in params) {
1176
- if (acceptedQuery.includes(key)) {
1099
+ if (acceptedBody.includes(key)) {
1177
1100
  // @ts-expect-error
1178
- querystring[key] = params[key];
1101
+ body = params[key];
1179
1102
  }
1180
1103
  else if (acceptedPath.includes(key)) {
1181
1104
  continue;
1182
1105
  }
1183
1106
  else if (key !== 'body') {
1184
1107
  // @ts-expect-error
1185
- body = params[key];
1108
+ querystring[key] = params[key];
1186
1109
  }
1187
1110
  }
1188
1111
  const method = 'POST';
@@ -1190,25 +1113,31 @@ class Ml {
1190
1113
  return await this.transport.request({ path, method, querystring, bulkBody: body }, options);
1191
1114
  }
1192
1115
  async previewDataFrameAnalytics(params, options) {
1193
- var _a;
1194
1116
  const acceptedPath = ['id'];
1195
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1117
+ const acceptedBody = ['config'];
1196
1118
  const querystring = {};
1197
1119
  // @ts-expect-error
1198
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1120
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1121
+ let body;
1122
+ if (typeof userBody === 'string') {
1123
+ body = userBody;
1124
+ }
1125
+ else {
1126
+ body = userBody != null ? { ...userBody } : undefined;
1127
+ }
1199
1128
  params = params !== null && params !== void 0 ? params : {};
1200
1129
  for (const key in params) {
1201
- if (acceptedQuery.includes(key)) {
1130
+ if (acceptedBody.includes(key)) {
1131
+ body = body !== null && body !== void 0 ? body : {};
1202
1132
  // @ts-expect-error
1203
- querystring[key] = params[key];
1133
+ body[key] = params[key];
1204
1134
  }
1205
1135
  else if (acceptedPath.includes(key)) {
1206
1136
  continue;
1207
1137
  }
1208
1138
  else if (key !== 'body') {
1209
- body = body !== null && body !== void 0 ? body : {};
1210
1139
  // @ts-expect-error
1211
- body[key] = params[key];
1140
+ querystring[key] = params[key];
1212
1141
  }
1213
1142
  }
1214
1143
  let method = '';
@@ -1224,25 +1153,31 @@ class Ml {
1224
1153
  return await this.transport.request({ path, method, querystring, body }, options);
1225
1154
  }
1226
1155
  async previewDatafeed(params, options) {
1227
- var _a;
1228
1156
  const acceptedPath = ['datafeed_id'];
1229
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1157
+ const acceptedBody = ['datafeed_config', 'job_config'];
1230
1158
  const querystring = {};
1231
1159
  // @ts-expect-error
1232
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1160
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1161
+ let body;
1162
+ if (typeof userBody === 'string') {
1163
+ body = userBody;
1164
+ }
1165
+ else {
1166
+ body = userBody != null ? { ...userBody } : undefined;
1167
+ }
1233
1168
  params = params !== null && params !== void 0 ? params : {};
1234
1169
  for (const key in params) {
1235
- if (acceptedQuery.includes(key)) {
1170
+ if (acceptedBody.includes(key)) {
1171
+ body = body !== null && body !== void 0 ? body : {};
1236
1172
  // @ts-expect-error
1237
- querystring[key] = params[key];
1173
+ body[key] = params[key];
1238
1174
  }
1239
1175
  else if (acceptedPath.includes(key)) {
1240
1176
  continue;
1241
1177
  }
1242
1178
  else if (key !== 'body') {
1243
- body = body !== null && body !== void 0 ? body : {};
1244
1179
  // @ts-expect-error
1245
- body[key] = params[key];
1180
+ querystring[key] = params[key];
1246
1181
  }
1247
1182
  }
1248
1183
  let method = '';
@@ -1258,24 +1193,30 @@ class Ml {
1258
1193
  return await this.transport.request({ path, method, querystring, body }, options);
1259
1194
  }
1260
1195
  async putCalendar(params, options) {
1261
- var _a;
1262
1196
  const acceptedPath = ['calendar_id'];
1263
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1197
+ const acceptedBody = ['job_ids', 'description'];
1264
1198
  const querystring = {};
1265
1199
  // @ts-expect-error
1266
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1200
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1201
+ let body;
1202
+ if (typeof userBody === 'string') {
1203
+ body = userBody;
1204
+ }
1205
+ else {
1206
+ body = userBody != null ? { ...userBody } : undefined;
1207
+ }
1267
1208
  for (const key in params) {
1268
- if (acceptedQuery.includes(key)) {
1209
+ if (acceptedBody.includes(key)) {
1210
+ body = body !== null && body !== void 0 ? body : {};
1269
1211
  // @ts-expect-error
1270
- querystring[key] = params[key];
1212
+ body[key] = params[key];
1271
1213
  }
1272
1214
  else if (acceptedPath.includes(key)) {
1273
1215
  continue;
1274
1216
  }
1275
1217
  else if (key !== 'body') {
1276
- body = body !== null && body !== void 0 ? body : {};
1277
1218
  // @ts-expect-error
1278
- body[key] = params[key];
1219
+ querystring[key] = params[key];
1279
1220
  }
1280
1221
  }
1281
1222
  const method = 'PUT';
@@ -1283,24 +1224,16 @@ class Ml {
1283
1224
  return await this.transport.request({ path, method, querystring, body }, options);
1284
1225
  }
1285
1226
  async putCalendarJob(params, options) {
1286
- var _a;
1287
1227
  const acceptedPath = ['calendar_id', 'job_id'];
1288
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1289
1228
  const querystring = {};
1290
- // @ts-expect-error
1291
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1229
+ const body = undefined;
1292
1230
  for (const key in params) {
1293
- if (acceptedQuery.includes(key)) {
1294
- // @ts-expect-error
1295
- querystring[key] = params[key];
1296
- }
1297
- else if (acceptedPath.includes(key)) {
1231
+ if (acceptedPath.includes(key)) {
1298
1232
  continue;
1299
1233
  }
1300
1234
  else if (key !== 'body') {
1301
- body = body !== null && body !== void 0 ? body : {};
1302
1235
  // @ts-expect-error
1303
- body[key] = params[key];
1236
+ querystring[key] = params[key];
1304
1237
  }
1305
1238
  }
1306
1239
  const method = 'PUT';
@@ -1308,24 +1241,30 @@ class Ml {
1308
1241
  return await this.transport.request({ path, method, querystring, body }, options);
1309
1242
  }
1310
1243
  async putDataFrameAnalytics(params, options) {
1311
- var _a;
1312
1244
  const acceptedPath = ['id'];
1313
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1245
+ const acceptedBody = ['allow_lazy_start', 'analysis', 'analyzed_fields', 'description', 'dest', 'max_num_threads', 'model_memory_limit', 'source', 'headers', 'version'];
1314
1246
  const querystring = {};
1315
1247
  // @ts-expect-error
1316
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1248
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1249
+ let body;
1250
+ if (typeof userBody === 'string') {
1251
+ body = userBody;
1252
+ }
1253
+ else {
1254
+ body = userBody != null ? { ...userBody } : undefined;
1255
+ }
1317
1256
  for (const key in params) {
1318
- if (acceptedQuery.includes(key)) {
1257
+ if (acceptedBody.includes(key)) {
1258
+ body = body !== null && body !== void 0 ? body : {};
1319
1259
  // @ts-expect-error
1320
- querystring[key] = params[key];
1260
+ body[key] = params[key];
1321
1261
  }
1322
1262
  else if (acceptedPath.includes(key)) {
1323
1263
  continue;
1324
1264
  }
1325
1265
  else if (key !== 'body') {
1326
- body = body !== null && body !== void 0 ? body : {};
1327
1266
  // @ts-expect-error
1328
- body[key] = params[key];
1267
+ querystring[key] = params[key];
1329
1268
  }
1330
1269
  }
1331
1270
  const method = 'PUT';
@@ -1333,24 +1272,30 @@ class Ml {
1333
1272
  return await this.transport.request({ path, method, querystring, body }, options);
1334
1273
  }
1335
1274
  async putDatafeed(params, options) {
1336
- var _a;
1337
1275
  const acceptedPath = ['datafeed_id'];
1338
- const acceptedQuery = ['allow_no_indices', 'expand_wildcards', 'ignore_throttled', 'ignore_unavailable', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1276
+ const acceptedBody = ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size', 'headers'];
1339
1277
  const querystring = {};
1340
1278
  // @ts-expect-error
1341
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1279
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1280
+ let body;
1281
+ if (typeof userBody === 'string') {
1282
+ body = userBody;
1283
+ }
1284
+ else {
1285
+ body = userBody != null ? { ...userBody } : undefined;
1286
+ }
1342
1287
  for (const key in params) {
1343
- if (acceptedQuery.includes(key)) {
1288
+ if (acceptedBody.includes(key)) {
1289
+ body = body !== null && body !== void 0 ? body : {};
1344
1290
  // @ts-expect-error
1345
- querystring[key] = params[key];
1291
+ body[key] = params[key];
1346
1292
  }
1347
1293
  else if (acceptedPath.includes(key)) {
1348
1294
  continue;
1349
1295
  }
1350
1296
  else if (key !== 'body') {
1351
- body = body !== null && body !== void 0 ? body : {};
1352
1297
  // @ts-expect-error
1353
- body[key] = params[key];
1298
+ querystring[key] = params[key];
1354
1299
  }
1355
1300
  }
1356
1301
  const method = 'PUT';
@@ -1358,24 +1303,30 @@ class Ml {
1358
1303
  return await this.transport.request({ path, method, querystring, body }, options);
1359
1304
  }
1360
1305
  async putFilter(params, options) {
1361
- var _a;
1362
1306
  const acceptedPath = ['filter_id'];
1363
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1307
+ const acceptedBody = ['description', 'items'];
1364
1308
  const querystring = {};
1365
1309
  // @ts-expect-error
1366
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1310
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1311
+ let body;
1312
+ if (typeof userBody === 'string') {
1313
+ body = userBody;
1314
+ }
1315
+ else {
1316
+ body = userBody != null ? { ...userBody } : undefined;
1317
+ }
1367
1318
  for (const key in params) {
1368
- if (acceptedQuery.includes(key)) {
1319
+ if (acceptedBody.includes(key)) {
1320
+ body = body !== null && body !== void 0 ? body : {};
1369
1321
  // @ts-expect-error
1370
- querystring[key] = params[key];
1322
+ body[key] = params[key];
1371
1323
  }
1372
1324
  else if (acceptedPath.includes(key)) {
1373
1325
  continue;
1374
1326
  }
1375
1327
  else if (key !== 'body') {
1376
- body = body !== null && body !== void 0 ? body : {};
1377
1328
  // @ts-expect-error
1378
- body[key] = params[key];
1329
+ querystring[key] = params[key];
1379
1330
  }
1380
1331
  }
1381
1332
  const method = 'PUT';
@@ -1383,24 +1334,30 @@ class Ml {
1383
1334
  return await this.transport.request({ path, method, querystring, body }, options);
1384
1335
  }
1385
1336
  async putJob(params, options) {
1386
- var _a;
1387
1337
  const acceptedPath = ['job_id'];
1388
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1338
+ const acceptedBody = ['allow_lazy_open', 'analysis_config', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'daily_model_snapshot_retention_after_days', 'data_description', 'datafeed_config', 'description', 'groups', 'model_plot_config', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_index_name', 'results_retention_days'];
1389
1339
  const querystring = {};
1390
1340
  // @ts-expect-error
1391
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1341
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1342
+ let body;
1343
+ if (typeof userBody === 'string') {
1344
+ body = userBody;
1345
+ }
1346
+ else {
1347
+ body = userBody != null ? { ...userBody } : undefined;
1348
+ }
1392
1349
  for (const key in params) {
1393
- if (acceptedQuery.includes(key)) {
1350
+ if (acceptedBody.includes(key)) {
1351
+ body = body !== null && body !== void 0 ? body : {};
1394
1352
  // @ts-expect-error
1395
- querystring[key] = params[key];
1353
+ body[key] = params[key];
1396
1354
  }
1397
1355
  else if (acceptedPath.includes(key)) {
1398
1356
  continue;
1399
1357
  }
1400
1358
  else if (key !== 'body') {
1401
- body = body !== null && body !== void 0 ? body : {};
1402
1359
  // @ts-expect-error
1403
- body[key] = params[key];
1360
+ querystring[key] = params[key];
1404
1361
  }
1405
1362
  }
1406
1363
  const method = 'PUT';
@@ -1408,24 +1365,30 @@ class Ml {
1408
1365
  return await this.transport.request({ path, method, querystring, body }, options);
1409
1366
  }
1410
1367
  async putTrainedModel(params, options) {
1411
- var _a;
1412
1368
  const acceptedPath = ['model_id'];
1413
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1369
+ const acceptedBody = ['compressed_definition', 'definition', 'description', 'inference_config', 'input', 'metadata', 'model_type', 'model_size_bytes', 'tags'];
1414
1370
  const querystring = {};
1415
1371
  // @ts-expect-error
1416
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1372
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1373
+ let body;
1374
+ if (typeof userBody === 'string') {
1375
+ body = userBody;
1376
+ }
1377
+ else {
1378
+ body = userBody != null ? { ...userBody } : undefined;
1379
+ }
1417
1380
  for (const key in params) {
1418
- if (acceptedQuery.includes(key)) {
1381
+ if (acceptedBody.includes(key)) {
1382
+ body = body !== null && body !== void 0 ? body : {};
1419
1383
  // @ts-expect-error
1420
- querystring[key] = params[key];
1384
+ body[key] = params[key];
1421
1385
  }
1422
1386
  else if (acceptedPath.includes(key)) {
1423
1387
  continue;
1424
1388
  }
1425
1389
  else if (key !== 'body') {
1426
- body = body !== null && body !== void 0 ? body : {};
1427
1390
  // @ts-expect-error
1428
- body[key] = params[key];
1391
+ querystring[key] = params[key];
1429
1392
  }
1430
1393
  }
1431
1394
  const method = 'PUT';
@@ -1433,24 +1396,16 @@ class Ml {
1433
1396
  return await this.transport.request({ path, method, querystring, body }, options);
1434
1397
  }
1435
1398
  async putTrainedModelAlias(params, options) {
1436
- var _a;
1437
1399
  const acceptedPath = ['model_alias', 'model_id'];
1438
- const acceptedQuery = ['reassign', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1439
1400
  const querystring = {};
1440
- // @ts-expect-error
1441
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1401
+ const body = undefined;
1442
1402
  for (const key in params) {
1443
- if (acceptedQuery.includes(key)) {
1444
- // @ts-expect-error
1445
- querystring[key] = params[key];
1446
- }
1447
- else if (acceptedPath.includes(key)) {
1403
+ if (acceptedPath.includes(key)) {
1448
1404
  continue;
1449
1405
  }
1450
1406
  else if (key !== 'body') {
1451
- body = body !== null && body !== void 0 ? body : {};
1452
1407
  // @ts-expect-error
1453
- body[key] = params[key];
1408
+ querystring[key] = params[key];
1454
1409
  }
1455
1410
  }
1456
1411
  const method = 'PUT';
@@ -1458,22 +1413,30 @@ class Ml {
1458
1413
  return await this.transport.request({ path, method, querystring, body }, options);
1459
1414
  }
1460
1415
  async putTrainedModelDefinitionPart(params, options) {
1461
- var _a;
1462
1416
  const acceptedPath = ['model_id', 'part'];
1463
- const acceptedQuery = [];
1417
+ const acceptedBody = ['definition', 'total_definition_length', 'total_parts'];
1464
1418
  const querystring = {};
1465
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1466
- params = params !== null && params !== void 0 ? params : {};
1419
+ // @ts-expect-error
1420
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1421
+ let body;
1422
+ if (typeof userBody === 'string') {
1423
+ body = userBody;
1424
+ }
1425
+ else {
1426
+ body = userBody != null ? { ...userBody } : undefined;
1427
+ }
1467
1428
  for (const key in params) {
1468
- if (acceptedQuery.includes(key)) {
1469
- querystring[key] = params[key];
1429
+ if (acceptedBody.includes(key)) {
1430
+ body = body !== null && body !== void 0 ? body : {};
1431
+ // @ts-expect-error
1432
+ body[key] = params[key];
1470
1433
  }
1471
1434
  else if (acceptedPath.includes(key)) {
1472
1435
  continue;
1473
1436
  }
1474
1437
  else if (key !== 'body') {
1475
- body = body !== null && body !== void 0 ? body : {};
1476
- body[key] = params[key];
1438
+ // @ts-expect-error
1439
+ querystring[key] = params[key];
1477
1440
  }
1478
1441
  }
1479
1442
  const method = 'PUT';
@@ -1481,22 +1444,30 @@ class Ml {
1481
1444
  return await this.transport.request({ path, method, querystring, body }, options);
1482
1445
  }
1483
1446
  async putTrainedModelVocabulary(params, options) {
1484
- var _a;
1485
1447
  const acceptedPath = ['model_id'];
1486
- const acceptedQuery = [];
1448
+ const acceptedBody = ['vocabulary'];
1487
1449
  const querystring = {};
1488
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1489
- params = params !== null && params !== void 0 ? params : {};
1450
+ // @ts-expect-error
1451
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1452
+ let body;
1453
+ if (typeof userBody === 'string') {
1454
+ body = userBody;
1455
+ }
1456
+ else {
1457
+ body = userBody != null ? { ...userBody } : undefined;
1458
+ }
1490
1459
  for (const key in params) {
1491
- if (acceptedQuery.includes(key)) {
1492
- querystring[key] = params[key];
1460
+ if (acceptedBody.includes(key)) {
1461
+ body = body !== null && body !== void 0 ? body : {};
1462
+ // @ts-expect-error
1463
+ body[key] = params[key];
1493
1464
  }
1494
1465
  else if (acceptedPath.includes(key)) {
1495
1466
  continue;
1496
1467
  }
1497
1468
  else if (key !== 'body') {
1498
- body = body !== null && body !== void 0 ? body : {};
1499
- body[key] = params[key];
1469
+ // @ts-expect-error
1470
+ querystring[key] = params[key];
1500
1471
  }
1501
1472
  }
1502
1473
  const method = 'PUT';
@@ -1504,24 +1475,16 @@ class Ml {
1504
1475
  return await this.transport.request({ path, method, querystring, body }, options);
1505
1476
  }
1506
1477
  async resetJob(params, options) {
1507
- var _a;
1508
1478
  const acceptedPath = ['job_id'];
1509
- const acceptedQuery = ['wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1510
1479
  const querystring = {};
1511
- // @ts-expect-error
1512
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1480
+ const body = undefined;
1513
1481
  for (const key in params) {
1514
- if (acceptedQuery.includes(key)) {
1515
- // @ts-expect-error
1516
- querystring[key] = params[key];
1517
- }
1518
- else if (acceptedPath.includes(key)) {
1482
+ if (acceptedPath.includes(key)) {
1519
1483
  continue;
1520
1484
  }
1521
1485
  else if (key !== 'body') {
1522
- body = body !== null && body !== void 0 ? body : {};
1523
1486
  // @ts-expect-error
1524
- body[key] = params[key];
1487
+ querystring[key] = params[key];
1525
1488
  }
1526
1489
  }
1527
1490
  const method = 'POST';
@@ -1529,24 +1492,30 @@ class Ml {
1529
1492
  return await this.transport.request({ path, method, querystring, body }, options);
1530
1493
  }
1531
1494
  async revertModelSnapshot(params, options) {
1532
- var _a;
1533
1495
  const acceptedPath = ['job_id', 'snapshot_id'];
1534
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1496
+ const acceptedBody = ['delete_intervening_results'];
1535
1497
  const querystring = {};
1536
1498
  // @ts-expect-error
1537
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1499
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1500
+ let body;
1501
+ if (typeof userBody === 'string') {
1502
+ body = userBody;
1503
+ }
1504
+ else {
1505
+ body = userBody != null ? { ...userBody } : undefined;
1506
+ }
1538
1507
  for (const key in params) {
1539
- if (acceptedQuery.includes(key)) {
1508
+ if (acceptedBody.includes(key)) {
1509
+ body = body !== null && body !== void 0 ? body : {};
1540
1510
  // @ts-expect-error
1541
- querystring[key] = params[key];
1511
+ body[key] = params[key];
1542
1512
  }
1543
1513
  else if (acceptedPath.includes(key)) {
1544
1514
  continue;
1545
1515
  }
1546
1516
  else if (key !== 'body') {
1547
- body = body !== null && body !== void 0 ? body : {};
1548
1517
  // @ts-expect-error
1549
- body[key] = params[key];
1518
+ querystring[key] = params[key];
1550
1519
  }
1551
1520
  }
1552
1521
  const method = 'POST';
@@ -1554,25 +1523,17 @@ class Ml {
1554
1523
  return await this.transport.request({ path, method, querystring, body }, options);
1555
1524
  }
1556
1525
  async setUpgradeMode(params, options) {
1557
- var _a;
1558
1526
  const acceptedPath = [];
1559
- const acceptedQuery = ['enabled', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1560
1527
  const querystring = {};
1561
- // @ts-expect-error
1562
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1528
+ const body = undefined;
1563
1529
  params = params !== null && params !== void 0 ? params : {};
1564
1530
  for (const key in params) {
1565
- if (acceptedQuery.includes(key)) {
1566
- // @ts-expect-error
1567
- querystring[key] = params[key];
1568
- }
1569
- else if (acceptedPath.includes(key)) {
1531
+ if (acceptedPath.includes(key)) {
1570
1532
  continue;
1571
1533
  }
1572
1534
  else if (key !== 'body') {
1573
- body = body !== null && body !== void 0 ? body : {};
1574
1535
  // @ts-expect-error
1575
- body[key] = params[key];
1536
+ querystring[key] = params[key];
1576
1537
  }
1577
1538
  }
1578
1539
  const method = 'POST';
@@ -1580,24 +1541,16 @@ class Ml {
1580
1541
  return await this.transport.request({ path, method, querystring, body }, options);
1581
1542
  }
1582
1543
  async startDataFrameAnalytics(params, options) {
1583
- var _a;
1584
1544
  const acceptedPath = ['id'];
1585
- const acceptedQuery = ['timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1586
1545
  const querystring = {};
1587
- // @ts-expect-error
1588
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1546
+ const body = undefined;
1589
1547
  for (const key in params) {
1590
- if (acceptedQuery.includes(key)) {
1591
- // @ts-expect-error
1592
- querystring[key] = params[key];
1593
- }
1594
- else if (acceptedPath.includes(key)) {
1548
+ if (acceptedPath.includes(key)) {
1595
1549
  continue;
1596
1550
  }
1597
1551
  else if (key !== 'body') {
1598
- body = body !== null && body !== void 0 ? body : {};
1599
1552
  // @ts-expect-error
1600
- body[key] = params[key];
1553
+ querystring[key] = params[key];
1601
1554
  }
1602
1555
  }
1603
1556
  const method = 'POST';
@@ -1605,24 +1558,30 @@ class Ml {
1605
1558
  return await this.transport.request({ path, method, querystring, body }, options);
1606
1559
  }
1607
1560
  async startDatafeed(params, options) {
1608
- var _a;
1609
1561
  const acceptedPath = ['datafeed_id'];
1610
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1562
+ const acceptedBody = ['end', 'start', 'timeout'];
1611
1563
  const querystring = {};
1612
1564
  // @ts-expect-error
1613
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1565
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1566
+ let body;
1567
+ if (typeof userBody === 'string') {
1568
+ body = userBody;
1569
+ }
1570
+ else {
1571
+ body = userBody != null ? { ...userBody } : undefined;
1572
+ }
1614
1573
  for (const key in params) {
1615
- if (acceptedQuery.includes(key)) {
1574
+ if (acceptedBody.includes(key)) {
1575
+ body = body !== null && body !== void 0 ? body : {};
1616
1576
  // @ts-expect-error
1617
- querystring[key] = params[key];
1577
+ body[key] = params[key];
1618
1578
  }
1619
1579
  else if (acceptedPath.includes(key)) {
1620
1580
  continue;
1621
1581
  }
1622
1582
  else if (key !== 'body') {
1623
- body = body !== null && body !== void 0 ? body : {};
1624
1583
  // @ts-expect-error
1625
- body[key] = params[key];
1584
+ querystring[key] = params[key];
1626
1585
  }
1627
1586
  }
1628
1587
  const method = 'POST';
@@ -1630,22 +1589,16 @@ class Ml {
1630
1589
  return await this.transport.request({ path, method, querystring, body }, options);
1631
1590
  }
1632
1591
  async startTrainedModelDeployment(params, options) {
1633
- var _a;
1634
1592
  const acceptedPath = ['model_id'];
1635
- const acceptedQuery = ['timeout', 'wait_for'];
1636
1593
  const querystring = {};
1637
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1638
- params = params !== null && params !== void 0 ? params : {};
1594
+ const body = undefined;
1639
1595
  for (const key in params) {
1640
- if (acceptedQuery.includes(key)) {
1641
- querystring[key] = params[key];
1642
- }
1643
- else if (acceptedPath.includes(key)) {
1596
+ if (acceptedPath.includes(key)) {
1644
1597
  continue;
1645
1598
  }
1646
1599
  else if (key !== 'body') {
1647
- body = body !== null && body !== void 0 ? body : {};
1648
- body[key] = params[key];
1600
+ // @ts-expect-error
1601
+ querystring[key] = params[key];
1649
1602
  }
1650
1603
  }
1651
1604
  const method = 'POST';
@@ -1653,24 +1606,16 @@ class Ml {
1653
1606
  return await this.transport.request({ path, method, querystring, body }, options);
1654
1607
  }
1655
1608
  async stopDataFrameAnalytics(params, options) {
1656
- var _a;
1657
1609
  const acceptedPath = ['id'];
1658
- const acceptedQuery = ['allow_no_match', 'force', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1659
1610
  const querystring = {};
1660
- // @ts-expect-error
1661
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1611
+ const body = undefined;
1662
1612
  for (const key in params) {
1663
- if (acceptedQuery.includes(key)) {
1664
- // @ts-expect-error
1665
- querystring[key] = params[key];
1666
- }
1667
- else if (acceptedPath.includes(key)) {
1613
+ if (acceptedPath.includes(key)) {
1668
1614
  continue;
1669
1615
  }
1670
1616
  else if (key !== 'body') {
1671
- body = body !== null && body !== void 0 ? body : {};
1672
1617
  // @ts-expect-error
1673
- body[key] = params[key];
1618
+ querystring[key] = params[key];
1674
1619
  }
1675
1620
  }
1676
1621
  const method = 'POST';
@@ -1678,24 +1623,30 @@ class Ml {
1678
1623
  return await this.transport.request({ path, method, querystring, body }, options);
1679
1624
  }
1680
1625
  async stopDatafeed(params, options) {
1681
- var _a;
1682
1626
  const acceptedPath = ['datafeed_id'];
1683
- const acceptedQuery = ['allow_no_match', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1627
+ const acceptedBody = ['allow_no_match', 'force', 'timeout'];
1684
1628
  const querystring = {};
1685
1629
  // @ts-expect-error
1686
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1630
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1631
+ let body;
1632
+ if (typeof userBody === 'string') {
1633
+ body = userBody;
1634
+ }
1635
+ else {
1636
+ body = userBody != null ? { ...userBody } : undefined;
1637
+ }
1687
1638
  for (const key in params) {
1688
- if (acceptedQuery.includes(key)) {
1639
+ if (acceptedBody.includes(key)) {
1640
+ body = body !== null && body !== void 0 ? body : {};
1689
1641
  // @ts-expect-error
1690
- querystring[key] = params[key];
1642
+ body[key] = params[key];
1691
1643
  }
1692
1644
  else if (acceptedPath.includes(key)) {
1693
1645
  continue;
1694
1646
  }
1695
1647
  else if (key !== 'body') {
1696
- body = body !== null && body !== void 0 ? body : {};
1697
1648
  // @ts-expect-error
1698
- body[key] = params[key];
1649
+ querystring[key] = params[key];
1699
1650
  }
1700
1651
  }
1701
1652
  const method = 'POST';
@@ -1703,22 +1654,16 @@ class Ml {
1703
1654
  return await this.transport.request({ path, method, querystring, body }, options);
1704
1655
  }
1705
1656
  async stopTrainedModelDeployment(params, options) {
1706
- var _a;
1707
1657
  const acceptedPath = ['model_id'];
1708
- const acceptedQuery = [];
1709
1658
  const querystring = {};
1710
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1711
- params = params !== null && params !== void 0 ? params : {};
1659
+ const body = undefined;
1712
1660
  for (const key in params) {
1713
- if (acceptedQuery.includes(key)) {
1714
- querystring[key] = params[key];
1715
- }
1716
- else if (acceptedPath.includes(key)) {
1661
+ if (acceptedPath.includes(key)) {
1717
1662
  continue;
1718
1663
  }
1719
1664
  else if (key !== 'body') {
1720
- body = body !== null && body !== void 0 ? body : {};
1721
- body[key] = params[key];
1665
+ // @ts-expect-error
1666
+ querystring[key] = params[key];
1722
1667
  }
1723
1668
  }
1724
1669
  const method = 'POST';
@@ -1726,24 +1671,30 @@ class Ml {
1726
1671
  return await this.transport.request({ path, method, querystring, body }, options);
1727
1672
  }
1728
1673
  async updateDataFrameAnalytics(params, options) {
1729
- var _a;
1730
1674
  const acceptedPath = ['id'];
1731
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1675
+ const acceptedBody = ['description', 'model_memory_limit', 'max_num_threads', 'allow_lazy_start'];
1732
1676
  const querystring = {};
1733
1677
  // @ts-expect-error
1734
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1678
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1679
+ let body;
1680
+ if (typeof userBody === 'string') {
1681
+ body = userBody;
1682
+ }
1683
+ else {
1684
+ body = userBody != null ? { ...userBody } : undefined;
1685
+ }
1735
1686
  for (const key in params) {
1736
- if (acceptedQuery.includes(key)) {
1687
+ if (acceptedBody.includes(key)) {
1688
+ body = body !== null && body !== void 0 ? body : {};
1737
1689
  // @ts-expect-error
1738
- querystring[key] = params[key];
1690
+ body[key] = params[key];
1739
1691
  }
1740
1692
  else if (acceptedPath.includes(key)) {
1741
1693
  continue;
1742
1694
  }
1743
1695
  else if (key !== 'body') {
1744
- body = body !== null && body !== void 0 ? body : {};
1745
1696
  // @ts-expect-error
1746
- body[key] = params[key];
1697
+ querystring[key] = params[key];
1747
1698
  }
1748
1699
  }
1749
1700
  const method = 'POST';
@@ -1751,22 +1702,30 @@ class Ml {
1751
1702
  return await this.transport.request({ path, method, querystring, body }, options);
1752
1703
  }
1753
1704
  async updateDatafeed(params, options) {
1754
- var _a;
1755
1705
  const acceptedPath = ['datafeed_id'];
1756
- const acceptedQuery = ['ignore_unavailable', 'allow_no_indices', 'ignore_throttled', 'expand_wildcards'];
1706
+ const acceptedBody = ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size'];
1757
1707
  const querystring = {};
1758
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1759
- params = params !== null && params !== void 0 ? params : {};
1708
+ // @ts-expect-error
1709
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1710
+ let body;
1711
+ if (typeof userBody === 'string') {
1712
+ body = userBody;
1713
+ }
1714
+ else {
1715
+ body = userBody != null ? { ...userBody } : undefined;
1716
+ }
1760
1717
  for (const key in params) {
1761
- if (acceptedQuery.includes(key)) {
1762
- querystring[key] = params[key];
1718
+ if (acceptedBody.includes(key)) {
1719
+ body = body !== null && body !== void 0 ? body : {};
1720
+ // @ts-expect-error
1721
+ body[key] = params[key];
1763
1722
  }
1764
1723
  else if (acceptedPath.includes(key)) {
1765
1724
  continue;
1766
1725
  }
1767
1726
  else if (key !== 'body') {
1768
- body = body !== null && body !== void 0 ? body : {};
1769
- body[key] = params[key];
1727
+ // @ts-expect-error
1728
+ querystring[key] = params[key];
1770
1729
  }
1771
1730
  }
1772
1731
  const method = 'POST';
@@ -1774,24 +1733,30 @@ class Ml {
1774
1733
  return await this.transport.request({ path, method, querystring, body }, options);
1775
1734
  }
1776
1735
  async updateFilter(params, options) {
1777
- var _a;
1778
1736
  const acceptedPath = ['filter_id'];
1779
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1737
+ const acceptedBody = ['add_items', 'description', 'remove_items'];
1780
1738
  const querystring = {};
1781
1739
  // @ts-expect-error
1782
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1740
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1741
+ let body;
1742
+ if (typeof userBody === 'string') {
1743
+ body = userBody;
1744
+ }
1745
+ else {
1746
+ body = userBody != null ? { ...userBody } : undefined;
1747
+ }
1783
1748
  for (const key in params) {
1784
- if (acceptedQuery.includes(key)) {
1749
+ if (acceptedBody.includes(key)) {
1750
+ body = body !== null && body !== void 0 ? body : {};
1785
1751
  // @ts-expect-error
1786
- querystring[key] = params[key];
1752
+ body[key] = params[key];
1787
1753
  }
1788
1754
  else if (acceptedPath.includes(key)) {
1789
1755
  continue;
1790
1756
  }
1791
1757
  else if (key !== 'body') {
1792
- body = body !== null && body !== void 0 ? body : {};
1793
1758
  // @ts-expect-error
1794
- body[key] = params[key];
1759
+ querystring[key] = params[key];
1795
1760
  }
1796
1761
  }
1797
1762
  const method = 'POST';
@@ -1799,24 +1764,30 @@ class Ml {
1799
1764
  return await this.transport.request({ path, method, querystring, body }, options);
1800
1765
  }
1801
1766
  async updateJob(params, options) {
1802
- var _a;
1803
1767
  const acceptedPath = ['job_id'];
1804
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1768
+ const acceptedBody = ['allow_lazy_open', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'categorization_filters', 'description', 'model_plot_config', 'daily_model_snapshot_retention_after_days', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_retention_days', 'groups', 'detectors', 'per_partition_categorization'];
1805
1769
  const querystring = {};
1806
1770
  // @ts-expect-error
1807
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1771
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1772
+ let body;
1773
+ if (typeof userBody === 'string') {
1774
+ body = userBody;
1775
+ }
1776
+ else {
1777
+ body = userBody != null ? { ...userBody } : undefined;
1778
+ }
1808
1779
  for (const key in params) {
1809
- if (acceptedQuery.includes(key)) {
1780
+ if (acceptedBody.includes(key)) {
1781
+ body = body !== null && body !== void 0 ? body : {};
1810
1782
  // @ts-expect-error
1811
- querystring[key] = params[key];
1783
+ body[key] = params[key];
1812
1784
  }
1813
1785
  else if (acceptedPath.includes(key)) {
1814
1786
  continue;
1815
1787
  }
1816
1788
  else if (key !== 'body') {
1817
- body = body !== null && body !== void 0 ? body : {};
1818
1789
  // @ts-expect-error
1819
- body[key] = params[key];
1790
+ querystring[key] = params[key];
1820
1791
  }
1821
1792
  }
1822
1793
  const method = 'POST';
@@ -1824,24 +1795,30 @@ class Ml {
1824
1795
  return await this.transport.request({ path, method, querystring, body }, options);
1825
1796
  }
1826
1797
  async updateModelSnapshot(params, options) {
1827
- var _a;
1828
1798
  const acceptedPath = ['job_id', 'snapshot_id'];
1829
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1799
+ const acceptedBody = ['description', 'retain'];
1830
1800
  const querystring = {};
1831
1801
  // @ts-expect-error
1832
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1802
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1803
+ let body;
1804
+ if (typeof userBody === 'string') {
1805
+ body = userBody;
1806
+ }
1807
+ else {
1808
+ body = userBody != null ? { ...userBody } : undefined;
1809
+ }
1833
1810
  for (const key in params) {
1834
- if (acceptedQuery.includes(key)) {
1811
+ if (acceptedBody.includes(key)) {
1812
+ body = body !== null && body !== void 0 ? body : {};
1835
1813
  // @ts-expect-error
1836
- querystring[key] = params[key];
1814
+ body[key] = params[key];
1837
1815
  }
1838
1816
  else if (acceptedPath.includes(key)) {
1839
1817
  continue;
1840
1818
  }
1841
1819
  else if (key !== 'body') {
1842
- body = body !== null && body !== void 0 ? body : {};
1843
1820
  // @ts-expect-error
1844
- body[key] = params[key];
1821
+ querystring[key] = params[key];
1845
1822
  }
1846
1823
  }
1847
1824
  const method = 'POST';
@@ -1849,24 +1826,16 @@ class Ml {
1849
1826
  return await this.transport.request({ path, method, querystring, body }, options);
1850
1827
  }
1851
1828
  async upgradeJobSnapshot(params, options) {
1852
- var _a;
1853
1829
  const acceptedPath = ['job_id', 'snapshot_id'];
1854
- const acceptedQuery = ['wait_for_completion', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1855
1830
  const querystring = {};
1856
- // @ts-expect-error
1857
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1831
+ const body = undefined;
1858
1832
  for (const key in params) {
1859
- if (acceptedQuery.includes(key)) {
1860
- // @ts-expect-error
1861
- querystring[key] = params[key];
1862
- }
1863
- else if (acceptedPath.includes(key)) {
1833
+ if (acceptedPath.includes(key)) {
1864
1834
  continue;
1865
1835
  }
1866
1836
  else if (key !== 'body') {
1867
- body = body !== null && body !== void 0 ? body : {};
1868
1837
  // @ts-expect-error
1869
- body[key] = params[key];
1838
+ querystring[key] = params[key];
1870
1839
  }
1871
1840
  }
1872
1841
  const method = 'POST';
@@ -1874,25 +1843,31 @@ class Ml {
1874
1843
  return await this.transport.request({ path, method, querystring, body }, options);
1875
1844
  }
1876
1845
  async validate(params, options) {
1877
- var _a;
1878
1846
  const acceptedPath = [];
1879
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1847
+ const acceptedBody = ['job_id', 'analysis_config', 'analysis_limits', 'data_description', 'description', 'model_plot', 'model_snapshot_id', 'model_snapshot_retention_days', 'results_index_name'];
1880
1848
  const querystring = {};
1881
1849
  // @ts-expect-error
1882
- let body = (_a = params === null || params === void 0 ? void 0 : params.body) !== null && _a !== void 0 ? _a : undefined;
1850
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1851
+ let body;
1852
+ if (typeof userBody === 'string') {
1853
+ body = userBody;
1854
+ }
1855
+ else {
1856
+ body = userBody != null ? { ...userBody } : undefined;
1857
+ }
1883
1858
  params = params !== null && params !== void 0 ? params : {};
1884
1859
  for (const key in params) {
1885
- if (acceptedQuery.includes(key)) {
1860
+ if (acceptedBody.includes(key)) {
1861
+ body = body !== null && body !== void 0 ? body : {};
1886
1862
  // @ts-expect-error
1887
- querystring[key] = params[key];
1863
+ body[key] = params[key];
1888
1864
  }
1889
1865
  else if (acceptedPath.includes(key)) {
1890
1866
  continue;
1891
1867
  }
1892
1868
  else if (key !== 'body') {
1893
- body = body !== null && body !== void 0 ? body : {};
1894
1869
  // @ts-expect-error
1895
- body[key] = params[key];
1870
+ querystring[key] = params[key];
1896
1871
  }
1897
1872
  }
1898
1873
  const method = 'POST';
@@ -1902,21 +1877,21 @@ class Ml {
1902
1877
  async validateDetector(params, options) {
1903
1878
  var _a;
1904
1879
  const acceptedPath = [];
1905
- const acceptedQuery = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'];
1880
+ const acceptedBody = ['detector'];
1906
1881
  const querystring = {};
1907
1882
  // @ts-expect-error
1908
1883
  let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1909
1884
  for (const key in params) {
1910
- if (acceptedQuery.includes(key)) {
1885
+ if (acceptedBody.includes(key)) {
1911
1886
  // @ts-expect-error
1912
- querystring[key] = params[key];
1887
+ body = params[key];
1913
1888
  }
1914
1889
  else if (acceptedPath.includes(key)) {
1915
1890
  continue;
1916
1891
  }
1917
1892
  else if (key !== 'body') {
1918
1893
  // @ts-expect-error
1919
- body = params[key];
1894
+ querystring[key] = params[key];
1920
1895
  }
1921
1896
  }
1922
1897
  const method = 'POST';