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