export type CreateApiSitesSiteIdArchiveArgs = {siteId: number, 'Content-Type': string}; export type CreateApiSitesSiteIdArchiveOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Archive Site. * * POST /sites/{siteId}/archive * * Also accepts auth: PersonalAccessToken */ export const createApiSitesSiteIdArchive = async (args: CreateApiSitesSiteIdArchiveArgs, options?: CreateApiSitesSiteIdArchiveOptions) => { const {baseUrl = "https://api.fergus.com", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/sites/${encodeURIComponent(String(args.siteId))}/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 };