export type CreateApiV2GrantsGrantIdArchiveArgs = {grant_id: string}; export type CreateApiV2GrantsGrantIdArchiveOptions = {baseUrl: string, LedgerUpApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Archive a grant. * * POST /v2/grants/{grant_id}/archive */ export const createApiV2GrantsGrantIdArchive = async (args: CreateApiV2GrantsGrantIdArchiveArgs, options: CreateApiV2GrantsGrantIdArchiveOptions) => { const {baseUrl, fetch: fetchFn = fetch, LedgerUpApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (LedgerUpApiKey !== undefined) headers.set("x-api-key", LedgerUpApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v2/grants/${encodeURIComponent(String(args.grant_id))}/archive${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };