Add Event resource and update branding
- Add Event resource with get and getAll operations - Implement event tracking for Strike API events - Update node icon from strike.svg to strike.png - Add comprehensive README.md with disclaimer about AI-assisted development - Update CLAUDE.MD documentation with Event resource details - Build dist files with new Event operations Changes include: - New EventDescription.ts with event operations - Updated Strike.node.ts to handle event resource - Icon changed to PNG format for better compatibility - Production-ready README with usage examples and warnings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -27,13 +27,15 @@ import {
|
||||
accountFields,
|
||||
paymentMethodOperations,
|
||||
paymentMethodFields,
|
||||
eventOperations,
|
||||
eventFields,
|
||||
} from './descriptions';
|
||||
|
||||
export class Strike implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Strike',
|
||||
name: 'strike',
|
||||
icon: 'file:strike.svg',
|
||||
icon: 'file:strike.png',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
@ -72,6 +74,10 @@ export class Strike implements INodeType {
|
||||
name: 'Deposit',
|
||||
value: 'deposit',
|
||||
},
|
||||
{
|
||||
name: 'Event',
|
||||
value: 'event',
|
||||
},
|
||||
{
|
||||
name: 'Invoice',
|
||||
value: 'invoice',
|
||||
@ -104,6 +110,8 @@ export class Strike implements INodeType {
|
||||
...currencyExchangeFields,
|
||||
...depositOperations,
|
||||
...depositFields,
|
||||
...eventOperations,
|
||||
...eventFields,
|
||||
...invoiceOperations,
|
||||
...invoiceFields,
|
||||
...paymentOperations,
|
||||
@ -180,6 +188,36 @@ export class Strike implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
// event
|
||||
// ----------------------------------------
|
||||
if (resource === 'event') {
|
||||
if (operation === 'get') {
|
||||
const eventId = this.getNodeParameter('eventId', i) as string;
|
||||
responseData = await strikeApiRequest.call(this, 'GET', `/events/${eventId}`);
|
||||
} else if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||
const query: IDataObject = {};
|
||||
|
||||
if (filters.filter) {
|
||||
query.$filter = filters.filter;
|
||||
}
|
||||
if (filters.orderBy) {
|
||||
query.$orderby = filters.orderBy;
|
||||
}
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await strikeApiRequestAllItems.call(this, 'GET', '/events', {}, query);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
query.$top = limit;
|
||||
responseData = await strikeApiRequest.call(this, 'GET', '/events', {}, query);
|
||||
responseData = responseData.items || responseData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
// deposit
|
||||
// ----------------------------------------
|
||||
|
||||
113
nodes/Strike/descriptions/EventDescription.ts
Normal file
113
nodes/Strike/descriptions/EventDescription.ts
Normal file
@ -0,0 +1,113 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const eventOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get an event by ID',
|
||||
action: 'Get an event',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many events',
|
||||
action: 'Get many events',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
];
|
||||
|
||||
export const eventFields: INodeProperties[] = [
|
||||
// ----------------------------------
|
||||
// event:get
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Event ID',
|
||||
name: 'eventId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'The ID of the event to retrieve',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// event:getAll
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Filter (OData)',
|
||||
name: 'filter',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'OData filter expression (e.g., eventType eq \'invoice.created\')',
|
||||
},
|
||||
{
|
||||
displayName: 'Order By',
|
||||
name: 'orderBy',
|
||||
type: 'string',
|
||||
default: 'created desc',
|
||||
description: 'OData orderby expression',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@ -7,3 +7,4 @@ export * from './CurrencyExchangeDescription';
|
||||
export * from './RatesDescription';
|
||||
export * from './AccountDescription';
|
||||
export * from './PaymentMethodDescription';
|
||||
export * from './EventDescription';
|
||||
|
||||
BIN
nodes/Strike/strike.png
Normal file
BIN
nodes/Strike/strike.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Reference in New Issue
Block a user