Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Auto-generated code for main #2645

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15,988 changes: 15,988 additions & 0 deletions docs/reference.asciidoc

Large diffs are not rendered by default.

156 changes: 148 additions & 8 deletions src/api/api/async_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,133 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }

interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}

const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']

export default class AsyncSearch {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'async_search.delete': {
path: [
'id'
],
body: [],
query: []
},
'async_search.get': {
path: [
'id'
],
body: [],
query: [
'keep_alive',
'typed_keys',
'wait_for_completion_timeout'
]
},
'async_search.status': {
path: [
'id'
],
body: [],
query: [
'keep_alive'
]
},
'async_search.submit': {
path: [
'index'
],
body: [
'aggregations',
'aggs',
'collapse',
'explain',
'ext',
'from',
'highlight',
'track_total_hits',
'indices_boost',
'docvalue_fields',
'knn',
'min_score',
'post_filter',
'profile',
'query',
'rescore',
'script_fields',
'search_after',
'size',
'slice',
'sort',
'_source',
'fields',
'suggest',
'terminate_after',
'timeout',
'track_scores',
'version',
'seq_no_primary_term',
'stored_fields',
'pit',
'runtime_mappings',
'stats'
],
query: [
'wait_for_completion_timeout',
'keep_alive',
'keep_on_completion',
'allow_no_indices',
'allow_partial_search_results',
'analyzer',
'analyze_wildcard',
'batched_reduce_size',
'ccs_minimize_roundtrips',
'default_operator',
'df',
'docvalue_fields',
'expand_wildcards',
'explain',
'ignore_throttled',
'ignore_unavailable',
'lenient',
'max_concurrent_shard_requests',
'preference',
'request_cache',
'routing',
'search_type',
'stats',
'stored_fields',
'suggest_field',
'suggest_mode',
'suggest_size',
'suggest_text',
'terminate_after',
'timeout',
'track_total_hits',
'track_scores',
'typed_keys',
'rest_total_hits_as_int',
'version',
'_source',
'_source_excludes',
'_source_includes',
'seq_no_primary_term',
'q',
'size',
'from',
'sort'
]
}
}
}

/**
Expand All @@ -51,7 +172,10 @@ export default class AsyncSearch {
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchDeleteResponse, unknown>>
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchDeleteResponse>
async delete (this: That, params: T.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['async_search.delete']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

Expand Down Expand Up @@ -93,7 +217,10 @@ export default class AsyncSearch {
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchGetResponse<TDocument, TAggregations>, unknown>>
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchGetResponse<TDocument, TAggregations>>
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['async_search.get']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

Expand Down Expand Up @@ -135,7 +262,10 @@ export default class AsyncSearch {
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchStatusResponse, unknown>>
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchStatusResponse>
async status (this: That, params: T.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['id']
const {
path: acceptedPath
} = this.acceptedParams['async_search.status']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

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

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

Expand All @@ -205,8 +339,14 @@ export default class AsyncSearch {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
// @ts-expect-error
querystring[key] = params[key]
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

Expand Down
82 changes: 74 additions & 8 deletions src/api/api/autoscaling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,59 @@ import {
TransportResult
} from '@elastic/transport'
import * as T from '../types'
interface That { transport: Transport }

interface That {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
}

const commonQueryParams = ['error_trace', 'filter_path', 'human', 'pretty']

export default class Autoscaling {
transport: Transport
acceptedParams: Record<string, { path: string[], body: string[], query: string[] }>
constructor (transport: Transport) {
this.transport = transport
this.acceptedParams = {
'autoscaling.delete_autoscaling_policy': {
path: [
'name'
],
body: [],
query: [
'master_timeout',
'timeout'
]
},
'autoscaling.get_autoscaling_capacity': {
path: [],
body: [],
query: [
'master_timeout'
]
},
'autoscaling.get_autoscaling_policy': {
path: [
'name'
],
body: [],
query: [
'master_timeout'
]
},
'autoscaling.put_autoscaling_policy': {
path: [
'name'
],
body: [
'policy'
],
query: [
'master_timeout',
'timeout'
]
}
}
}

/**
Expand All @@ -51,7 +98,10 @@ export default class Autoscaling {
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingDeleteAutoscalingPolicyResponse, unknown>>
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<T.AutoscalingDeleteAutoscalingPolicyResponse>
async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['autoscaling.delete_autoscaling_policy']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

Expand Down Expand Up @@ -93,7 +143,10 @@ export default class Autoscaling {
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingGetAutoscalingCapacityResponse, unknown>>
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise<T.AutoscalingGetAutoscalingCapacityResponse>
async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const {
path: acceptedPath
} = this.acceptedParams['autoscaling.get_autoscaling_capacity']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

Expand Down Expand Up @@ -133,7 +186,10 @@ export default class Autoscaling {
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingGetAutoscalingPolicyResponse, unknown>>
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<T.AutoscalingGetAutoscalingPolicyResponse>
async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const {
path: acceptedPath
} = this.acceptedParams['autoscaling.get_autoscaling_policy']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

Expand Down Expand Up @@ -175,8 +231,12 @@ export default class Autoscaling {
async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AutoscalingPutAutoscalingPolicyResponse, unknown>>
async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<T.AutoscalingPutAutoscalingPolicyResponse>
async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['policy']
const {
path: acceptedPath,
body: acceptedBody,
query: acceptedQuery
} = this.acceptedParams['autoscaling.put_autoscaling_policy']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

Expand All @@ -188,8 +248,14 @@ export default class Autoscaling {
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
// @ts-expect-error
querystring[key] = params[key]
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
// @ts-expect-error
querystring[key] = params[key]
} else {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
}
}
}

Expand Down
Loading
Loading