export type GetApiApiV1ClaimLicenseArgs = {'X-Requested-With': string, license_key: unknown, product_id: unknown}; export type GetApiApiV1ClaimLicenseOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Attempts to claim a white label license * * GET /api/v1/claim_license */ export const getApiApiV1ClaimLicense = async (args: GetApiApiV1ClaimLicenseArgs, options?: GetApiApiV1ClaimLicenseOptions) => { const {baseUrl = "https://demo.invoiceninja.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Requested-With'] != null) headers.set("X-Requested-With", String(args['X-Requested-With'])) if (args.license_key != null) query.append("license_key", String(args.license_key)) if (args.product_id != null) query.append("product_id", String(args.product_id)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/claim_license${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };