export type UpdateApiRepositoriesOrgOrgNameRepoNameTransferArgs = {orgName: string, repoName: string, org?: string | undefined}; export type UpdateApiRepositoriesOrgOrgNameRepoNameTransferOptions = {baseUrl: string, ApiKeyId?: string | undefined, ApiKeySecret?: string | undefined, fetch?: typeof fetch | undefined}; /** * Transfer organization's repository to a different owner * * PUT /repositories/org/{orgName}/{repoName}/transfer */ export const updateApiRepositoriesOrgOrgNameRepoNameTransfer = async (args: UpdateApiRepositoriesOrgOrgNameRepoNameTransferArgs, options: UpdateApiRepositoriesOrgOrgNameRepoNameTransferOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyId, ApiKeySecret} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.org != null) query.append("org", String(args.org)) if (ApiKeyId !== undefined) headers.set("X-API-KEY-ID", ApiKeyId) if (ApiKeySecret !== undefined) headers.set("X-API-KEY-SECRET", ApiKeySecret) const url = `${baseUrl.replace(/\/+$/, '')}/repositories/org/${encodeURIComponent(String(args.orgName))}/${encodeURIComponent(String(args.repoName))}/transfer${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 };