export type DeleteApiPinArgs = {type: 'space' | 'base' | 'table' | 'view' | 'dashboard' | 'workflow' | 'app', id: string}; export type DeleteApiPinOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete pin * * DELETE /pin */ export const deleteApiPin = async (args: DeleteApiPinArgs, options?: DeleteApiPinOptions) => { const {baseUrl = "https://app.teable.ai/api", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.type != null) query.append("type", String(args.type)) if (args.id != null) query.append("id", String(args.id)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/pin${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 };