export type GetApiApiVatValidateStatusArgs = {api_key: string, format?: ('json' | 'xml' | 'csv' | 'tsv') | undefined, callback?: string | undefined}; export type GetApiApiVatValidateStatusOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Availability of the VAT registries behind /api/vat/validate. Available on every plan and NOT counted against any daily quota (a valid API key is still required; limited to 30 requests/minute per key). Returns the European Commission VIES per-member-state availability (cached 5 minutes) and which registries are enabled. Use it to explain an "unavailable" validation result or to defer checks for a member state whose system is down. * * GET /api/vat/validate/status */ export const getApiApiVatValidateStatus = async (args: GetApiApiVatValidateStatusArgs, options: GetApiApiVatValidateStatusOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.api_key != null) query.append("api_key", String(args.api_key)) if (args.format != null) query.append("format", String(args.format)) if (args.callback != null) query.append("callback", String(args.callback)) const url = `${baseUrl.replace(/\/+$/, '')}/api/vat/validate/status${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 (await res.json()) as unknown };