/** * AIKDATA_AI SDK * Auto-generated — v1.0 */ class AikdataAiClient { constructor(token, baseUrl = 'https://ms.aikdata.com/api/gw/aikdata_ai') { this.token = token; this.baseUrl = baseUrl.replace(/\/$/, ''); } // ── Trámites ── /** * Create a new tramite and receive a unique verification token */ async generarToken(body = null) { return this._request('POST', `/generar-token`, {}, body); } /** * Query the current status of a tramite by its token */ async consultarTrámite(token) { return this._request('GET', `/consultar-tramite/${token}`); } // ── Aprobación ── /** * Approve or reject a pending tramite */ async aprobarTrámite(body = null) { return this._request('POST', `/aprobar`, {}, body); } // ── Análisis ── /** * AI-powered analysis of a KYC/Due-Diligence document */ async analizarKYC(body = null) { return this._request('POST', `/analizar-kyc`, {}, body); } // ── HTTP helper ── async _request(method, path, query = {}, body = null) { const url = new URL(this.baseUrl + path); Object.entries(query).forEach(([k, v]) => { if (v !== undefined && v !== null) url.searchParams.set(k, v); }); const opts = { method, headers: { 'Authorization': `Bearer ${this.token}`, 'Content-Type': 'application/json', 'Accept': 'application/json', }, }; if (body && ['POST', 'PUT', 'PATCH'].includes(method)) { opts.body = JSON.stringify(body); } const res = await fetch(url.toString(), opts); return { status: res.status, data: await res.json() }; } } module.exports = { AikdataAiClient };