export type DeleteApiProjectsProjectNameOrIdArgs = {'X-Request-Id'?: string | undefined, 'X-Is-Resource-Name'?: boolean | undefined, project_name_or_id: string}; export type DeleteApiProjectsProjectNameOrIdOptions = {baseUrl?: string | undefined, basic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete project by projectID * * DELETE /projects/{project_name_or_id} */ export const deleteApiProjectsProjectNameOrId = async (args: DeleteApiProjectsProjectNameOrIdArgs, options?: DeleteApiProjectsProjectNameOrIdOptions) => { const {baseUrl = "http://localhost/api/v2.0", fetch: fetchFn = fetch, basic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Request-Id'] != null) headers.set("X-Request-Id", String(args['X-Request-Id'])) if (args['X-Is-Resource-Name'] != null) headers.set("X-Is-Resource-Name", String(args['X-Is-Resource-Name'])) if (basic !== undefined) headers.set('authorization', `Basic ${btoa(`${basic.username}:${basic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/projects/${encodeURIComponent(String(args.project_name_or_id))}${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 };