export type RepositoryKind = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27; export type UpdateApiRepositoriesUserRepoNameArgs = {repoName: string, body: {kind?: RepositoryKind | undefined, name?: string | undefined, display_name?: string | undefined, url?: string | undefined}}; export type UpdateApiRepositoriesUserRepoNameOptions = {baseUrl: string, ApiKeyId?: string | undefined, ApiKeySecret?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update user's repository * * PUT /repositories/user/{repoName} */ export const updateApiRepositoriesUserRepoName = async (args: UpdateApiRepositoriesUserRepoNameArgs, options: UpdateApiRepositoriesUserRepoNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyId, ApiKeySecret} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") 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/user/${encodeURIComponent(String(args.repoName))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };