export type StoreFileParsingStrategy = 'fast' | 'high_quality'; export type GetApiV1IntegrationsGithubOauthAuthorizeArgs = {store_name?: (string | null) | undefined, metadata_contextualization?: boolean | undefined, file_contextualization?: boolean | undefined, ingestion_mode?: StoreFileParsingStrategy | undefined}; export type GetApiV1IntegrationsGithubOauthAuthorizeOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Install the GitHub App * * GET /v1/integrations/github/oauth/authorize */ export const getApiV1IntegrationsGithubOauthAuthorize = async (args: GetApiV1IntegrationsGithubOauthAuthorizeArgs, options?: GetApiV1IntegrationsGithubOauthAuthorizeOptions) => { const {baseUrl = "https://api.mixedbread.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.store_name != null) query.append("store_name", String(args.store_name)) if (args.metadata_contextualization != null) query.append("metadata_contextualization", String(args.metadata_contextualization)) if (args.file_contextualization != null) query.append("file_contextualization", String(args.file_contextualization)) if (args.ingestion_mode != null) query.append("ingestion_mode", String(args.ingestion_mode)) if (ApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/integrations/github/oauth/authorize${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };