export type ISO3 = string; export type ChangeType = 'requirement_changed' | 'days_changed' | 'new_policy' | 'suspended' | 'restored' | 'fee_changed' | 'process_changed'; export type GetApiApiV1VisaChangesArgs = {passport?: ISO3 | undefined, destination?: ISO3 | undefined, since?: string | undefined, type?: ChangeType | undefined, severity?: ('minor' | 'major') | undefined, wishlist?: string | undefined, limit?: number | undefined, offset?: number | undefined}; export type GetApiApiV1VisaChangesOptions = {baseUrl?: string | undefined, apiKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Policy change feed — WITHDRAWN, returns 503 * * GET /api/v1/visa/changes * * Also accepts auth: apiKeyQuery */ export const getApiApiV1VisaChanges = async (args: GetApiApiV1VisaChangesArgs, options?: GetApiApiV1VisaChangesOptions) => { const {baseUrl = "https://visa.orizn.app", fetch: fetchFn = fetch, apiKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.passport != null) query.append("passport", String(args.passport)) if (args.destination != null) query.append("destination", String(args.destination)) if (args.since != null) query.append("since", String(args.since)) if (args.type != null) query.append("type", String(args.type)) if (args.severity != null) query.append("severity", String(args.severity)) if (args.wishlist != null) query.append("wishlist", String(args.wishlist)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.offset != null) query.append("offset", String(args.offset)) if (apiKeyHeader !== undefined) headers.set("x-api-key", apiKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/visa/changes${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 };