export type CreateApiApiLicenseApplyLicenseArgs = {params: string, licenseText?: string | undefined}; export type CreateApiApiLicenseApplyLicenseOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /api/license/applyLicense */ export const createApiApiLicenseApplyLicense = async (args: CreateApiApiLicenseApplyLicenseArgs, options: CreateApiApiLicenseApplyLicenseOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.licenseText != null) query.append("licenseText", String(args.licenseText)) const url = `${baseUrl.replace(/\/+$/, '')}/api/license/applyLicense${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 res.blob() };