Files
n8n-nodes-strike/dist/nodes/Strike/StrikeApi.js
Martien 5605b9b49a Initial commit: n8n Strike API node
- Add Strike API credentials configuration
- Implement Strike node with 9 resources (Account, Balance, Currency Exchange, Deposit, Invoice, Payment, Payment Method, Payout, Rates)
- Add comprehensive operation descriptions for all resources
- Include CLAUDE.MD documentation
- Set up build configuration with TypeScript, ESLint, and Prettier

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 11:00:38 +01:00

43 lines
1.4 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.strikeApiRequest = strikeApiRequest;
exports.strikeApiRequestAllItems = strikeApiRequestAllItems;
async function strikeApiRequest(method, endpoint, body = {}, query = {}) {
const credentials = await this.getCredentials('strikeApi');
const baseUrl = credentials.environment === 'sandbox'
? 'https://api.strike.me'
: 'https://api.strike.me';
const options = {
method,
url: `${baseUrl}/v1${endpoint}`,
headers: {
'Content-Type': 'application/json',
},
body,
qs: query,
json: true,
};
if (Object.keys(body).length === 0) {
delete options.body;
}
if (Object.keys(query).length === 0) {
delete options.qs;
}
return this.helpers.requestWithAuthentication.call(this, 'strikeApi', options);
}
async function strikeApiRequestAllItems(method, endpoint, body = {}, query = {}) {
const returnData = [];
let responseData;
query.$top = query.$top || 100;
query.$skip = 0;
do {
responseData = await strikeApiRequest.call(this, method, endpoint, body, query);
const items = responseData.items || responseData;
if (Array.isArray(items)) {
returnData.push(...items);
}
query.$skip += query.$top;
} while (responseData.items && responseData.items.length === query.$top);
return returnData;
}