export type CreateApiV1TasksParityCheckerArgs = {start_id?: number | undefined, max_id?: number | undefined, do_not_reprocess_valid_records?: boolean | undefined, parity_check_status?: string | undefined, do_not_retry_emit_until?: number | undefined, record_type?: ('charge' | 'refund') | undefined}; export type CreateApiV1TasksParityCheckerOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Parity check charges or refunds with ledger * * POST /v1/tasks/parity-checker */ export const createApiV1TasksParityChecker = async (args: CreateApiV1TasksParityCheckerArgs, options: CreateApiV1TasksParityCheckerOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.start_id != null) query.append("start_id", String(args.start_id)) if (args.max_id != null) query.append("max_id", String(args.max_id)) if (args.do_not_reprocess_valid_records != null) query.append("do_not_reprocess_valid_records", String(args.do_not_reprocess_valid_records)) if (args.parity_check_status != null) query.append("parity_check_status", String(args.parity_check_status)) if (args.do_not_retry_emit_until != null) query.append("do_not_retry_emit_until", String(args.do_not_retry_emit_until)) if (args.record_type != null) query.append("record_type", String(args.record_type)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/tasks/parity-checker${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 };