"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getUsage = void 0; const register_usage_event_1 = require("./register-usage-event"); const getUsage = async ({ since, ...apiOrLicenseKey }) => { const apiKey = 'apiKey' in apiOrLicenseKey ? apiOrLicenseKey.apiKey : null; const licenseKey = 'licenseKey' in apiOrLicenseKey ? apiOrLicenseKey.licenseKey : null; const res = await fetch(`${register_usage_event_1.HOST}/api/track/get-usage`, { method: 'POST', body: JSON.stringify({ apiKey: licenseKey !== null && licenseKey !== void 0 ? licenseKey : apiKey, since: since !== null && since !== void 0 ? since : null, }), headers: { 'Content-Type': 'application/json', }, }); const json = (await res.json()); if (json.success) { return { cloudRenders: json.cloudRenders, webcodecConversions: json.webcodecConversions, }; } throw new Error(json.error); }; exports.getUsage = getUsage;