export type DeleteApiApiReposNamespaceRepositoryCollaboratorsUsernameArgs = {namespace: string, repository: string, username: string}; export type DeleteApiApiReposNamespaceRepositoryCollaboratorsUsernameOptions = {baseUrl: string, cookieAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove Collaborator * * DELETE /api/repos/{namespace}/{repository}/collaborators/{username} */ export const deleteApiApiReposNamespaceRepositoryCollaboratorsUsername = async (args: DeleteApiApiReposNamespaceRepositoryCollaboratorsUsernameArgs, options: DeleteApiApiReposNamespaceRepositoryCollaboratorsUsernameOptions) => { const {baseUrl, fetch: fetchFn = fetch, cookieAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (cookieAuth !== undefined) cookies.push("gitarena-session=" + encodeURIComponent(cookieAuth)) const url = `${baseUrl.replace(/\/+$/, '')}/api/repos/${encodeURIComponent(String(args.namespace))}/${encodeURIComponent(String(args.repository))}/collaborators/${encodeURIComponent(String(args.username))}${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 };