export type CreateApiQueriesQueryIdStartArgs = {'Idempotency-Key'?: string | undefined, Authorization?: string | undefined, 'x-request-id'?: string | undefined, db?: string | undefined, project?: string | undefined}; export type CreateApiQueriesQueryIdStartOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * start stopped query * * POST /queries/{query_id}/start */ export const createApiQueriesQueryIdStart = async (args: CreateApiQueriesQueryIdStartArgs, options?: CreateApiQueriesQueryIdStartOptions) => { const {baseUrl = "https://api.yandex-query.cloud.yandex.net/api/fq/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Idempotency-Key'] != null) headers.set("Idempotency-Key", String(args['Idempotency-Key'])) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args['x-request-id'] != null) headers.set("x-request-id", String(args['x-request-id'])) if (args.db != null) query.append("db", String(args.db)) if (args.project != null) query.append("project", String(args.project)) const url = `${baseUrl.replace(/\/+$/, '')}/queries/${encodeURIComponent(String(args.query_id))}/start${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };