UNPKG

@kadam-net/n8n-nodes-kadam

Version:

Kadam node for n8n to manage campaigns, creatives, and more.

66 lines 2.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createClient = createClient; exports.updateClient = updateClient; exports.getClients = getClients; exports.deleteClient = deleteClient; exports.bindClient = bindClient; exports.unbindClient = unbindClient; exports.depositClientBalance = depositClientBalance; exports.transferFunds = transferFunds; const utils_1 = require("./utils"); async function createClient(i, baseUrl, headers, appId) { const data = this.getNodeParameter('data', i); return utils_1.makeApiRequest.call(this, 'put', `${baseUrl}/ads.clients.put`, headers, { app_id: appId }, { data }); } async function updateClient(i, baseUrl, headers, appId) { const data = this.getNodeParameter('data', i); return utils_1.makeApiRequest.call(this, 'post', `${baseUrl}/ads.clients.update`, headers, { app_id: appId }, { data }); } async function getClients(i, baseUrl, headers, appId) { var _a; const params = { app_id: appId, client_ids: ((_a = this.getNodeParameter('clientIds', i)) === null || _a === void 0 ? void 0 : _a.join(',')) || undefined, }; return utils_1.fetchAll.call(this, `${baseUrl}/ads.clients.get`, headers, params); } async function deleteClient(i, baseUrl, headers, appId) { const ids = this.getNodeParameter('ids', i); return utils_1.makeApiRequest.call(this, 'delete', `${baseUrl}/ads.clients.delete`, headers, { ids, app_id: appId }); } async function bindClient(i, baseUrl, headers, appId) { const params = { app_id: appId, email: this.getNodeParameter('email', i), password: this.getNodeParameter('password', i), }; return utils_1.makeApiRequest.call(this, 'put', `${baseUrl}/ads.clients.bind.put`, headers, params); } async function unbindClient(i, baseUrl, headers, appId) { const params = { app_id: appId, client_id: this.getNodeParameter('clientId', i) }; return utils_1.makeApiRequest.call(this, 'put', `${baseUrl}/ads.clients.unbind.put`, headers, params); } async function depositClientBalance(i, baseUrl, headers, appId) { const params = { app_id: appId, client_id: this.getNodeParameter('clientId', i), sum: this.getNodeParameter('sum', i), back_url: this.getNodeParameter('backUrl', i, null), system_id: this.getNodeParameter('systemId', i), }; return utils_1.makeApiRequest.call(this, 'put', `${baseUrl}/ads.clients.balance.put`, headers, params); } async function transferFunds(i, baseUrl, headers, appId) { const params = { app_id: appId, client_id: this.getNodeParameter('clientId', i), sum: this.getNodeParameter('sum', i), comment: this.getNodeParameter('comment', i, null), }; return utils_1.makeApiRequest.call(this, 'put', `${baseUrl}/ads.clients.money.transfer.put`, headers, params); } //# sourceMappingURL=clients.js.map