export type ValidateColumnNamesRequest = {columnNames: Array}; export type CreateApiV2StorageBranchBranchIdValidateColumnNamesArgs = {branchId: string, body: ValidateColumnNamesRequest}; export type CreateApiV2StorageBranchBranchIdValidateColumnNamesOptions = {baseUrl?: string | undefined, StorageKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Validate column names * * POST /v2/storage/branch/{branchId}/validate/column-names * * Also accepts auth: ManageKey, BearerAuth */ export const createApiV2StorageBranchBranchIdValidateColumnNames = async (args: CreateApiV2StorageBranchBranchIdValidateColumnNamesArgs, options?: CreateApiV2StorageBranchBranchIdValidateColumnNamesOptions) => { const {baseUrl = "https://connection.keboola.com", fetch: fetchFn = fetch, StorageKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (StorageKey !== undefined) headers.set("X-StorageApi-Token", StorageKey) const url = `${baseUrl.replace(/\/+$/, '')}/v2/storage/branch/${encodeURIComponent(String(args.branchId))}/validate/column-names${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };