export type DeleteApiApiProjectsProjectIdBranchesBranchIdArgs = {projectId: string, branchId: string | 'main'}; export type DeleteApiApiProjectsProjectIdBranchesBranchIdOptions = {baseUrl: string, personalAccessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove branch * * DELETE /api/projects/{projectId}/branches/{branchId} * * Also accepts auth: internalAuth */ export const deleteApiApiProjectsProjectIdBranchesBranchId = async (args: DeleteApiApiProjectsProjectIdBranchesBranchIdArgs, options: DeleteApiApiProjectsProjectIdBranchesBranchIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, personalAccessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (personalAccessToken !== undefined) headers.set('authorization', `Bearer ${personalAccessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/projects/${encodeURIComponent(String(args.projectId))}/branches/${encodeURIComponent(String(args.branchId))}${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 };