UNPKG

n8n-nodes-feishu-lite

Version:
36 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class RequestUtils { static async originRequest(options, clearAccessToken = false) { const credentials = await this.getCredentials('feishuCredentialsApi'); return this.helpers.requestWithAuthentication .call(this, 'feishuCredentialsApi', options, { credentialsDecrypted: { data: { ...credentials, accessToken: clearAccessToken ? '' : credentials.accessToken, }, }, }); } static async request(options) { if (options.json === undefined) options.json = true; return RequestUtils.originRequest.call(this, options).then((data) => { const handleResponse = (data) => { if (data.code && data.code !== 0) { throw new Error(`Request Error: ${data.code}, ${data.msg} \n ` + JSON.stringify(data.error)); } return data; }; if (data.code && data.code === 99991663) { return RequestUtils.originRequest.call(this, options, true).then((data) => { return handleResponse(data); }); } return handleResponse(data); }); } } exports.default = RequestUtils; //# sourceMappingURL=RequestUtils.js.map