Skip to content

Commit 2c6e0dd

Browse files
committed
API generation
1 parent de27dd9 commit 2c6e0dd

File tree

11 files changed

+714
-215
lines changed

11 files changed

+714
-215
lines changed

src/api/api/bulk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ export default async function BulkApi<TDocument = unknown, TPartialDocument = un
6868
method = 'POST'
6969
path = '/_bulk'
7070
}
71-
return await this.transport.request({ path, method, querystring, bulkBody: body }, options)
71+
return await this.transport.request({ path, method, querystring, body }, options)
7272
}

src/api/api/fleet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default class Fleet {
9696
method = body != null ? 'POST' : 'GET'
9797
path = '/_fleet/_fleet_msearch'
9898
}
99-
return await this.transport.request({ path, method, querystring, bulkBody: body }, options)
99+
return await this.transport.request({ path, method, querystring, body }, options)
100100
}
101101

102102
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest | TB.FleetSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.FleetSearchResponse<TDocument>>

src/api/api/indices.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -860,19 +860,31 @@ export default class Indices {
860860
return await this.transport.request({ path, method, querystring, body }, options)
861861
}
862862

863-
async modifyDataStream (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
864-
async modifyDataStream (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
865-
async modifyDataStream (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
866-
async modifyDataStream (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
863+
async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesModifyDataStreamResponse>
864+
async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesModifyDataStreamResponse, unknown>>
865+
async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptions): Promise<T.IndicesModifyDataStreamResponse>
866+
async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptions): Promise<any> {
867867
const acceptedPath: string[] = []
868+
const acceptedBody: string[] = ['actions']
868869
const querystring: Record<string, any> = {}
869-
const body = undefined
870+
// @ts-expect-error
871+
const userBody: any = params?.body
872+
let body: Record<string, any> | string
873+
if (typeof userBody === 'string') {
874+
body = userBody
875+
} else {
876+
body = userBody != null ? { ...userBody } : undefined
877+
}
870878

871-
params = params ?? {}
872879
for (const key in params) {
873-
if (acceptedPath.includes(key)) {
880+
if (acceptedBody.includes(key)) {
881+
body = body ?? {}
882+
// @ts-expect-error
883+
body[key] = params[key]
884+
} else if (acceptedPath.includes(key)) {
874885
continue
875886
} else if (key !== 'body') {
887+
// @ts-expect-error
876888
querystring[key] = params[key]
877889
}
878890
}

src/api/api/ml.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ export default class Ml {
11631163
async inferTrainedModelDeployment (this: That, params: T.MlInferTrainedModelDeploymentRequest | TB.MlInferTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise<T.MlInferTrainedModelDeploymentResponse>
11641164
async inferTrainedModelDeployment (this: That, params: T.MlInferTrainedModelDeploymentRequest | TB.MlInferTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise<any> {
11651165
const acceptedPath: string[] = ['model_id']
1166-
const acceptedBody: string[] = ['docs']
1166+
const acceptedBody: string[] = ['docs', 'inference_config']
11671167
const querystring: Record<string, any> = {}
11681168
// @ts-expect-error
11691169
const userBody: any = params?.body
@@ -1307,7 +1307,7 @@ export default class Ml {
13071307

13081308
const method = 'POST'
13091309
const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_data`
1310-
return await this.transport.request({ path, method, querystring, bulkBody: body }, options)
1310+
return await this.transport.request({ path, method, querystring, body }, options)
13111311
}
13121312

13131313
async previewDataFrameAnalytics (this: That, params?: T.MlPreviewDataFrameAnalyticsRequest | TB.MlPreviewDataFrameAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.MlPreviewDataFrameAnalyticsResponse>

src/api/api/monitoring.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ export default class Monitoring {
6767

6868
const method = 'POST'
6969
const path = '/_monitoring/bulk'
70-
return await this.transport.request({ path, method, querystring, bulkBody: body }, options)
70+
return await this.transport.request({ path, method, querystring, body }, options)
7171
}
7272
}

src/api/api/msearch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ export default async function MsearchApi<TDocument = unknown, TAggregations = Re
6868
method = body != null ? 'POST' : 'GET'
6969
path = '/_msearch'
7070
}
71-
return await this.transport.request({ path, method, querystring, bulkBody: body }, options)
71+
return await this.transport.request({ path, method, querystring, body }, options)
7272
}

src/api/api/msearch_template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ export default async function MsearchTemplateApi<TDocument = unknown, TAggregati
6868
method = body != null ? 'POST' : 'GET'
6969
path = '/_msearch/template'
7070
}
71-
return await this.transport.request({ path, method, querystring, bulkBody: body }, options)
71+
return await this.transport.request({ path, method, querystring, body }, options)
7272
}

src/api/api/security.ts

Lines changed: 73 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,31 @@ export default class Security {
4343
this.transport = transport
4444
}
4545

46-
async activateUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
47-
async activateUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
48-
async activateUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
49-
async activateUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
46+
async activateUserProfile (this: That, params: T.SecurityActivateUserProfileRequest | TB.SecurityActivateUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SecurityActivateUserProfileResponse>
47+
async activateUserProfile (this: That, params: T.SecurityActivateUserProfileRequest | TB.SecurityActivateUserProfileRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SecurityActivateUserProfileResponse, unknown>>
48+
async activateUserProfile (this: That, params: T.SecurityActivateUserProfileRequest | TB.SecurityActivateUserProfileRequest, options?: TransportRequestOptions): Promise<T.SecurityActivateUserProfileResponse>
49+
async activateUserProfile (this: That, params: T.SecurityActivateUserProfileRequest | TB.SecurityActivateUserProfileRequest, options?: TransportRequestOptions): Promise<any> {
5050
const acceptedPath: string[] = []
51+
const acceptedBody: string[] = ['access_token', 'grant_type', 'password', 'username']
5152
const querystring: Record<string, any> = {}
52-
const body = undefined
53+
// @ts-expect-error
54+
const userBody: any = params?.body
55+
let body: Record<string, any> | string
56+
if (typeof userBody === 'string') {
57+
body = userBody
58+
} else {
59+
body = userBody != null ? { ...userBody } : undefined
60+
}
5361

54-
params = params ?? {}
5562
for (const key in params) {
56-
if (acceptedPath.includes(key)) {
63+
if (acceptedBody.includes(key)) {
64+
body = body ?? {}
65+
// @ts-expect-error
66+
body[key] = params[key]
67+
} else if (acceptedPath.includes(key)) {
5768
continue
5869
} else if (key !== 'body') {
70+
// @ts-expect-error
5971
querystring[key] = params[key]
6072
}
6173
}
@@ -436,19 +448,19 @@ export default class Security {
436448
return await this.transport.request({ path, method, querystring, body }, options)
437449
}
438450

439-
async disableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
440-
async disableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
441-
async disableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
442-
async disableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
451+
async disableUserProfile (this: That, params: T.SecurityDisableUserProfileRequest | TB.SecurityDisableUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SecurityDisableUserProfileResponse>
452+
async disableUserProfile (this: That, params: T.SecurityDisableUserProfileRequest | TB.SecurityDisableUserProfileRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SecurityDisableUserProfileResponse, unknown>>
453+
async disableUserProfile (this: That, params: T.SecurityDisableUserProfileRequest | TB.SecurityDisableUserProfileRequest, options?: TransportRequestOptions): Promise<T.SecurityDisableUserProfileResponse>
454+
async disableUserProfile (this: That, params: T.SecurityDisableUserProfileRequest | TB.SecurityDisableUserProfileRequest, options?: TransportRequestOptions): Promise<any> {
443455
const acceptedPath: string[] = ['uid']
444456
const querystring: Record<string, any> = {}
445457
const body = undefined
446458

447-
params = params ?? {}
448459
for (const key in params) {
449460
if (acceptedPath.includes(key)) {
450461
continue
451462
} else if (key !== 'body') {
463+
// @ts-expect-error
452464
querystring[key] = params[key]
453465
}
454466
}
@@ -480,19 +492,19 @@ export default class Security {
480492
return await this.transport.request({ path, method, querystring, body }, options)
481493
}
482494

483-
async enableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
484-
async enableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
485-
async enableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
486-
async enableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
495+
async enableUserProfile (this: That, params: T.SecurityEnableUserProfileRequest | TB.SecurityEnableUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SecurityEnableUserProfileResponse>
496+
async enableUserProfile (this: That, params: T.SecurityEnableUserProfileRequest | TB.SecurityEnableUserProfileRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SecurityEnableUserProfileResponse, unknown>>
497+
async enableUserProfile (this: That, params: T.SecurityEnableUserProfileRequest | TB.SecurityEnableUserProfileRequest, options?: TransportRequestOptions): Promise<T.SecurityEnableUserProfileResponse>
498+
async enableUserProfile (this: That, params: T.SecurityEnableUserProfileRequest | TB.SecurityEnableUserProfileRequest, options?: TransportRequestOptions): Promise<any> {
487499
const acceptedPath: string[] = ['uid']
488500
const querystring: Record<string, any> = {}
489501
const body = undefined
490502

491-
params = params ?? {}
492503
for (const key in params) {
493504
if (acceptedPath.includes(key)) {
494505
continue
495506
} else if (key !== 'body') {
507+
// @ts-expect-error
496508
querystring[key] = params[key]
497509
}
498510
}
@@ -830,19 +842,19 @@ export default class Security {
830842
return await this.transport.request({ path, method, querystring, body }, options)
831843
}
832844

833-
async getUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
834-
async getUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
835-
async getUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
836-
async getUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
845+
async getUserProfile (this: That, params: T.SecurityGetUserProfileRequest | TB.SecurityGetUserProfileRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SecurityGetUserProfileResponse>
846+
async getUserProfile (this: That, params: T.SecurityGetUserProfileRequest | TB.SecurityGetUserProfileRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SecurityGetUserProfileResponse, unknown>>
847+
async getUserProfile (this: That, params: T.SecurityGetUserProfileRequest | TB.SecurityGetUserProfileRequest, options?: TransportRequestOptions): Promise<T.SecurityGetUserProfileResponse>
848+
async getUserProfile (this: That, params: T.SecurityGetUserProfileRequest | TB.SecurityGetUserProfileRequest, options?: TransportRequestOptions): Promise<any> {
837849
const acceptedPath: string[] = ['uid']
838850
const querystring: Record<string, any> = {}
839851
const body = undefined
840852

841-
params = params ?? {}
842853
for (const key in params) {
843854
if (acceptedPath.includes(key)) {
844855
continue
845856
} else if (key !== 'body') {
857+
// @ts-expect-error
846858
querystring[key] = params[key]
847859
}
848860
}
@@ -1421,41 +1433,66 @@ export default class Security {
14211433
return await this.transport.request({ path, method, querystring, body }, options)
14221434
}
14231435

1424-
async searchUserProfiles (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
1425-
async searchUserProfiles (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
1426-
async searchUserProfiles (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
1427-
async searchUserProfiles (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
1436+
async suggestUserProfiles (this: That, params?: T.SecuritySuggestUserProfilesRequest | TB.SecuritySuggestUserProfilesRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SecuritySuggestUserProfilesResponse>
1437+
async suggestUserProfiles (this: That, params?: T.SecuritySuggestUserProfilesRequest | TB.SecuritySuggestUserProfilesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SecuritySuggestUserProfilesResponse, unknown>>
1438+
async suggestUserProfiles (this: That, params?: T.SecuritySuggestUserProfilesRequest | TB.SecuritySuggestUserProfilesRequest, options?: TransportRequestOptions): Promise<T.SecuritySuggestUserProfilesResponse>
1439+
async suggestUserProfiles (this: That, params?: T.SecuritySuggestUserProfilesRequest | TB.SecuritySuggestUserProfilesRequest, options?: TransportRequestOptions): Promise<any> {
14281440
const acceptedPath: string[] = []
1441+
const acceptedBody: string[] = ['name', 'size']
14291442
const querystring: Record<string, any> = {}
1430-
const body = undefined
1443+
// @ts-expect-error
1444+
const userBody: any = params?.body
1445+
let body: Record<string, any> | string
1446+
if (typeof userBody === 'string') {
1447+
body = userBody
1448+
} else {
1449+
body = userBody != null ? { ...userBody } : undefined
1450+
}
14311451

14321452
params = params ?? {}
14331453
for (const key in params) {
1434-
if (acceptedPath.includes(key)) {
1454+
if (acceptedBody.includes(key)) {
1455+
body = body ?? {}
1456+
// @ts-expect-error
1457+
body[key] = params[key]
1458+
} else if (acceptedPath.includes(key)) {
14351459
continue
14361460
} else if (key !== 'body') {
1461+
// @ts-expect-error
14371462
querystring[key] = params[key]
14381463
}
14391464
}
14401465

14411466
const method = body != null ? 'POST' : 'GET'
1442-
const path = '/_security/profile/_search'
1467+
const path = '/_security/profile/_suggest'
14431468
return await this.transport.request({ path, method, querystring, body }, options)
14441469
}
14451470

1446-
async updateUserProfileData (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
1447-
async updateUserProfileData (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
1448-
async updateUserProfileData (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
1449-
async updateUserProfileData (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
1471+
async updateUserProfileData (this: That, params: T.SecurityUpdateUserProfileDataRequest | TB.SecurityUpdateUserProfileDataRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SecurityUpdateUserProfileDataResponse>
1472+
async updateUserProfileData (this: That, params: T.SecurityUpdateUserProfileDataRequest | TB.SecurityUpdateUserProfileDataRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SecurityUpdateUserProfileDataResponse, unknown>>
1473+
async updateUserProfileData (this: That, params: T.SecurityUpdateUserProfileDataRequest | TB.SecurityUpdateUserProfileDataRequest, options?: TransportRequestOptions): Promise<T.SecurityUpdateUserProfileDataResponse>
1474+
async updateUserProfileData (this: That, params: T.SecurityUpdateUserProfileDataRequest | TB.SecurityUpdateUserProfileDataRequest, options?: TransportRequestOptions): Promise<any> {
14501475
const acceptedPath: string[] = ['uid']
1476+
const acceptedBody: string[] = ['access', 'data']
14511477
const querystring: Record<string, any> = {}
1452-
const body = undefined
1478+
// @ts-expect-error
1479+
const userBody: any = params?.body
1480+
let body: Record<string, any> | string
1481+
if (typeof userBody === 'string') {
1482+
body = userBody
1483+
} else {
1484+
body = userBody != null ? { ...userBody } : undefined
1485+
}
14531486

1454-
params = params ?? {}
14551487
for (const key in params) {
1456-
if (acceptedPath.includes(key)) {
1488+
if (acceptedBody.includes(key)) {
1489+
body = body ?? {}
1490+
// @ts-expect-error
1491+
body[key] = params[key]
1492+
} else if (acceptedPath.includes(key)) {
14571493
continue
14581494
} else if (key !== 'body') {
1495+
// @ts-expect-error
14591496
querystring[key] = params[key]
14601497
}
14611498
}

src/api/api/text_structure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ export default class TextStructure {
6767

6868
const method = 'POST'
6969
const path = '/_text_structure/find_structure'
70-
return await this.transport.request({ path, method, querystring, bulkBody: body }, options)
70+
return await this.transport.request({ path, method, querystring, body }, options)
7171
}
7272
}

0 commit comments

Comments
 (0)