export type DeleteApiRepositoriesRepositoryBranchesBranchImportArgs = {id: string}; export type DeleteApiRepositoriesRepositoryBranchesBranchImportOptions = {baseUrl: string, jwtToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * cancel ongoing import * * DELETE /repositories/{repository}/branches/{branch}/import * * Also accepts auth: basic_auth, cookie_auth */ export const deleteApiRepositoriesRepositoryBranchesBranchImport = async (args: DeleteApiRepositoriesRepositoryBranchesBranchImportArgs, options: DeleteApiRepositoriesRepositoryBranchesBranchImportOptions) => { const {baseUrl, fetch: fetchFn = fetch, jwtToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.id != null) query.append("id", String(args.id)) if (jwtToken !== undefined) headers.set('authorization', `Bearer ${jwtToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/repositories/${encodeURIComponent(String(args.repository))}/branches/${encodeURIComponent(String(args.branch))}/import${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };