first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,297 @@
import type { INodeProperties } from 'n8n-workflow';
export const affiliateOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['affiliate'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create an affiliate',
action: 'Create an affiliate',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete an affiliate',
action: 'Delete an affiliate',
},
{
name: 'Get',
value: 'get',
description: 'Get an affiliate by ID',
action: 'Get an affiliate',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many affiliates',
action: 'Get many affiliates',
},
],
default: 'create',
},
];
export const affiliateFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* affiliate:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
required: true,
default: '',
displayOptions: {
show: {
operation: ['create'],
resource: ['affiliate'],
},
},
description: 'The affiliates email',
},
{
displayName: 'First Name',
name: 'firstname',
type: 'string',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['affiliate'],
},
},
default: '',
description: 'The affiliates firstname',
},
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['affiliate'],
},
},
default: '',
description: 'The affiliates lastname',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['affiliate'],
operation: ['create'],
},
},
options: [
{
displayName: 'Address',
name: 'addressUi',
placeholder: 'Address',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'addressValues',
displayName: 'Address',
values: [
{
displayName: 'Line 1',
name: 'address',
type: 'string',
default: '',
},
{
displayName: 'Line 2',
name: 'address_two',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'postal_code',
type: 'string',
default: '',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
},
{
displayName: 'Country Code',
name: 'country',
type: 'string',
default: '',
description:
'The countrys ISO_3166-1 code. <a href="https://en.wikipedia.org/wiki/ISO_3166-1">Codes</a>.',
},
],
},
],
},
{
displayName: 'Company Name',
name: 'companyName',
type: 'string',
default: '',
description: 'The affiliates company data',
},
],
},
/* -------------------------------------------------------------------------- */
/* affiliate:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Affiliate ID',
name: 'affiliateId',
required: true,
type: 'string',
default: '',
displayOptions: {
show: {
resource: ['affiliate'],
operation: ['delete'],
},
},
description: 'The ID of the affiliate',
},
/* -------------------------------------------------------------------------- */
/* affiliate:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Affiliate ID',
name: 'affiliateId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['affiliate'],
operation: ['get'],
},
},
description: 'The ID of the affiliate',
},
/* -------------------------------------------------------------------------- */
/* affiliate:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['affiliate'],
operation: ['getAll'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: ['affiliate'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 1000,
},
default: 100,
description: 'Max number of results to return',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['affiliate'],
operation: ['getAll'],
},
},
options: [
{
displayName: 'Affiliate Group ID',
name: 'affiliate_group_id',
type: 'string',
default: '',
description: 'Retrieves affiliates for a certain affiliate group',
},
{
displayName: 'Click ID',
name: 'click_id',
type: 'string',
default: '',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
default: '',
description: 'An email address,',
},
{
displayName: 'Parent ID',
name: 'parentId',
type: 'string',
default: '',
description: 'Retrieves children for a certain parent affiliate',
},
{
displayName: 'Referral Code',
name: 'referral_code',
type: 'string',
default: '',
description:
'An affiliates referral code. This corresponds to the value of ref= in their referral link.',
},
{
displayName: 'Source ID',
name: 'source_id',
type: 'string',
default: '',
},
],
},
];
@@ -0,0 +1,170 @@
import type { INodeProperties } from 'n8n-workflow';
export const affiliateMetadataOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['affiliateMetadata'],
},
},
options: [
{
name: 'Add',
value: 'add',
description: 'Add metadata to affiliate',
action: 'Add metadata to an affiliate',
},
{
name: 'Remove',
value: 'remove',
description: 'Remove metadata from affiliate',
action: 'Remove metadata from an affiliate',
},
{
name: 'Update',
value: 'update',
description: "Update affiliate's metadata",
action: 'Update metadata for an affiliate',
},
],
default: 'add',
},
];
export const affiliateMetadataFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* affiliateMetadata:add */
/* -------------------------------------------------------------------------- */
{
displayName: 'Affiliate ID',
name: 'affiliateId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['affiliateMetadata'],
operation: ['add'],
},
},
description: 'The ID of the affiliate',
},
{
displayName: 'Metadata',
name: 'metadataUi',
placeholder: 'Add Metadata',
type: 'fixedCollection',
displayOptions: {
show: {
resource: ['affiliateMetadata'],
operation: ['add'],
},
},
default: {},
typeOptions: {
multipleValues: true,
},
description: 'Meta data',
options: [
{
name: 'metadataValues',
displayName: 'Metadata',
values: [
{
displayName: 'Key',
name: 'key',
type: 'string',
default: '',
description: 'Name of the metadata key to add',
},
{
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
description: 'Value to set for the metadata key',
},
],
},
],
},
/* -------------------------------------------------------------------------- */
/* ffiliateMetadata:remove */
/* -------------------------------------------------------------------------- */
{
displayName: 'Affiliate ID',
name: 'affiliateId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['affiliateMetadata'],
operation: ['remove'],
},
},
description: 'The ID of the affiliate',
},
{
displayName: 'Key',
name: 'key',
type: 'string',
displayOptions: {
show: {
resource: ['affiliateMetadata'],
operation: ['remove'],
},
},
default: '',
description: 'Name of the metadata key to remove',
},
/* -------------------------------------------------------------------------- */
/* affiliateMetadata:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Affiliate ID',
name: 'affiliateId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['affiliateMetadata'],
operation: ['update'],
},
},
description: 'The ID of the affiliate',
},
{
displayName: 'Key',
name: 'key',
type: 'string',
displayOptions: {
show: {
resource: ['affiliateMetadata'],
operation: ['update'],
},
},
default: '',
description: 'Name of the metadata key to update',
},
{
displayName: 'Value',
name: 'value',
type: 'string',
displayOptions: {
show: {
resource: ['affiliateMetadata'],
operation: ['update'],
},
},
default: '',
description: 'Value to set for the metadata key',
},
];
@@ -0,0 +1,72 @@
import type {
IDataObject,
IExecuteFunctions,
IHookFunctions,
ILoadOptionsFunctions,
JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function tapfiliateApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
endpoint: string,
body: IDataObject = {},
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
) {
const credentials = await this.getCredentials('tapfiliateApi');
const options: IRequestOptions = {
headers: {
'Api-Key': credentials.apiKey,
},
method,
qs,
body,
uri: uri || `https://api.tapfiliate.com/1.6${endpoint}`,
json: true,
};
if (Object.keys(body).length === 0) {
delete options.body;
}
if (Object.keys(option).length !== 0) {
Object.assign(options, option);
}
try {
return await this.helpers.request(options);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function tapfiliateApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
endpoint: string,
body: IDataObject = {},
query: IDataObject = {},
) {
const returnData: IDataObject[] = [];
let responseData;
query.page = 1;
do {
responseData = await tapfiliateApiRequest.call(this, method, endpoint, body, query, '', {
resolveWithFullResponse: true,
});
returnData.push.apply(returnData, responseData.body as IDataObject[]);
query.page++;
} while (responseData.headers.link.includes('next'));
return returnData;
}
@@ -0,0 +1,316 @@
import type { INodeProperties } from 'n8n-workflow';
export const programAffiliateOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['programAffiliate'],
},
},
options: [
{
name: 'Add',
value: 'add',
description: 'Add affiliate to program',
action: 'Add a program affiliate',
},
{
name: 'Approve',
value: 'approve',
description: 'Approve an affiliate for a program',
action: 'Approve a program affiliate',
},
{
name: 'Disapprove',
value: 'disapprove',
description: 'Disapprove an affiliate',
action: 'Disapprove a program affiliate',
},
{
name: 'Get',
value: 'get',
description: 'Get an affiliate in a program',
action: 'Get a program affiliate',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many affiliates in program',
action: 'Get many program affiliates',
},
],
default: 'add',
},
];
export const programAffiliateFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* programAffiliate:add */
/* -------------------------------------------------------------------------- */
{
displayName: 'Program Name or ID',
name: 'programId',
type: 'options',
required: true,
typeOptions: {
loadOptionsMethod: 'getPrograms',
},
default: '',
displayOptions: {
show: {
operation: ['add'],
resource: ['programAffiliate'],
},
},
description:
'The ID of the Program to add the affiliate to. This ID can be found as part of the URL when viewing the program on the platform. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Affiliate ID',
name: 'affiliateId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: ['programAffiliate'],
operation: ['add'],
},
},
description: 'The ID of the affiliate',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['programAffiliate'],
operation: ['add'],
},
},
options: [
{
displayName: 'Approved',
name: 'approved',
type: 'boolean',
default: true,
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: 'An optional approval status',
},
{
displayName: 'Coupon',
name: 'coupon',
type: 'string',
default: '',
description: 'An optional coupon for this affiliate',
},
],
},
/* -------------------------------------------------------------------------- */
/* programAffiliate:approve */
/* -------------------------------------------------------------------------- */
{
displayName: 'Program Name or ID',
name: 'programId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getPrograms',
},
default: '',
displayOptions: {
show: {
operation: ['approve'],
resource: ['programAffiliate'],
},
},
description:
'The ID of the Program to add the affiliate to. This ID can be found as part of the URL when viewing the program on the platform. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Affiliate ID',
name: 'affiliateId',
type: 'string',
default: '',
displayOptions: {
show: {
resource: ['programAffiliate'],
operation: ['approve'],
},
},
description: 'The ID of the affiliate',
},
/* -------------------------------------------------------------------------- */
/* programAffiliate:disapprove */
/* -------------------------------------------------------------------------- */
{
displayName: 'Program Name or ID',
name: 'programId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getPrograms',
},
default: '',
displayOptions: {
show: {
operation: ['disapprove'],
resource: ['programAffiliate'],
},
},
description:
'The ID of the Program to add the affiliate to. This ID can be found as part of the URL when viewing the program on the platform. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Affiliate ID',
name: 'affiliateId',
type: 'string',
default: '',
displayOptions: {
show: {
resource: ['programAffiliate'],
operation: ['disapprove'],
},
},
description: 'The ID of the affiliate',
},
/* -------------------------------------------------------------------------- */
/* affiliate:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Program Name or ID',
name: 'programId',
type: 'options',
required: true,
typeOptions: {
loadOptionsMethod: 'getPrograms',
},
default: '',
displayOptions: {
show: {
operation: ['get'],
resource: ['programAffiliate'],
},
},
description:
'The ID of the Program to add the affiliate to. This ID can be found as part of the URL when viewing the program on the platform. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Affiliate ID',
name: 'affiliateId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['programAffiliate'],
operation: ['get'],
},
},
description: 'The ID of the affiliate',
},
/* -------------------------------------------------------------------------- */
/* programAffiliate:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Program Name or ID',
name: 'programId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getPrograms',
},
required: true,
default: '',
displayOptions: {
show: {
operation: ['getAll'],
resource: ['programAffiliate'],
},
},
description:
'The ID of the Program to add the affiliate to. This ID can be found as part of the URL when viewing the program on the platform. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['programAffiliate'],
operation: ['getAll'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: ['programAffiliate'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 1000,
},
default: 100,
description: 'Max number of results to return',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['programAffiliate'],
operation: ['getAll'],
},
},
options: [
{
displayName: 'Affiliate Group ID',
name: 'affiliate_group_id',
type: 'string',
default: '',
description: 'Retrieves affiliates for a certain affiliate group',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
default: '',
description: 'An email address',
},
{
displayName: 'Parent ID',
name: 'parentId',
type: 'string',
default: '',
description: 'Retrieves children for a certain parent affiliate',
},
{
displayName: 'Source ID',
name: 'source_id',
type: 'string',
default: '',
},
],
},
];
@@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.tapfiliate",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Sales"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/tapfiliate/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.tapfiliate/"
}
]
}
}
@@ -0,0 +1,316 @@
import type {
IExecuteFunctions,
IDataObject,
ILoadOptionsFunctions,
INodeExecutionData,
INodePropertyOptions,
INodeType,
INodeTypeDescription,
} from 'n8n-workflow';
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
import { affiliateFields, affiliateOperations } from './AffiliateDescription';
import {
affiliateMetadataFields,
affiliateMetadataOperations,
} from './AffiliateMetadataDescription';
import { tapfiliateApiRequest, tapfiliateApiRequestAllItems } from './GenericFunctions';
import { programAffiliateFields, programAffiliateOperations } from './ProgramAffiliateDescription';
export class Tapfiliate implements INodeType {
description: INodeTypeDescription = {
displayName: 'Tapfiliate',
name: 'tapfiliate',
icon: 'file:tapfiliate.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ":" + $parameter["resource"]}}',
description: 'Consume Tapfiliate API',
defaults: {
name: 'Tapfiliate',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'tapfiliateApi',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Affiliate',
value: 'affiliate',
},
{
name: 'Affiliate Metadata',
value: 'affiliateMetadata',
},
{
name: 'Program Affiliate',
value: 'programAffiliate',
},
],
default: 'affiliate',
required: true,
},
...affiliateOperations,
...affiliateFields,
...affiliateMetadataOperations,
...affiliateMetadataFields,
...programAffiliateOperations,
...programAffiliateFields,
],
};
methods = {
loadOptions: {
// Get custom fields to display to user so that they can select them easily
async getPrograms(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const programs = await tapfiliateApiRequestAllItems.call(this, 'GET', '/programs/');
for (const program of programs) {
returnData.push({
name: program.title as string,
value: program.id as string,
});
}
return returnData;
},
},
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const length = items.length;
const qs: IDataObject = {};
let responseData;
const returnData: INodeExecutionData[] = [];
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
for (let i = 0; i < length; i++) {
try {
if (resource === 'affiliate') {
if (operation === 'create') {
//https://tapfiliate.com/docs/rest/#affiliates-affiliates-collection-post
const firstname = this.getNodeParameter('firstname', i) as string;
const lastname = this.getNodeParameter('lastname', i) as string;
const email = this.getNodeParameter('email', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i);
const body: IDataObject = {
firstname,
lastname,
email,
};
Object.assign(body, additionalFields);
if (body.addressUi) {
body.address = (body.addressUi as IDataObject).addressValues as IDataObject;
delete body.addressUi;
if ((body.address as IDataObject).country) {
(body.address as IDataObject).country = {
code: (body.address as IDataObject).country,
};
}
}
if (body.companyName) {
body.company = {
name: body.companyName,
};
delete body.companyName;
}
responseData = await tapfiliateApiRequest.call(this, 'POST', '/affiliates/', body);
returnData.push(responseData as INodeExecutionData);
}
if (operation === 'delete') {
//https://tapfiliate.com/docs/rest/#affiliates-affiliate-delete
const affiliateId = this.getNodeParameter('affiliateId', i) as string;
responseData = await tapfiliateApiRequest.call(
this,
'DELETE',
`/affiliates/${affiliateId}/`,
);
responseData = { success: true };
}
if (operation === 'get') {
//https://tapfiliate.com/docs/rest/#affiliates-affiliate-get
const affiliateId = this.getNodeParameter('affiliateId', i) as string;
responseData = await tapfiliateApiRequest.call(
this,
'GET',
`/affiliates/${affiliateId}/`,
);
}
if (operation === 'getAll') {
//https://tapfiliate.com/docs/rest/#affiliates-affiliates-collection-get
const returnAll = this.getNodeParameter('returnAll', i);
const filters = this.getNodeParameter('filters', i);
Object.assign(qs, filters);
if (returnAll) {
responseData = await tapfiliateApiRequestAllItems.call(
this,
'GET',
'/affiliates/',
{},
qs,
);
} else {
const limit = this.getNodeParameter('limit', i);
responseData = await tapfiliateApiRequest.call(this, 'GET', '/affiliates/', {}, qs);
responseData = responseData.splice(0, limit);
}
}
}
if (resource === 'affiliateMetadata') {
if (operation === 'add') {
//https://tapfiliate.com/docs/rest/#affiliates-meta-data-key-put
const affiliateId = this.getNodeParameter('affiliateId', i) as string;
const metadata =
((this.getNodeParameter('metadataUi', i) as IDataObject)
?.metadataValues as IDataObject[]) || [];
if (metadata.length === 0) {
throw new NodeOperationError(this.getNode(), 'Metadata cannot be empty.', {
itemIndex: i,
});
}
for (const { key, value } of metadata) {
await tapfiliateApiRequest.call(
this,
'PUT',
`/affiliates/${affiliateId}/meta-data/${key}/`,
{ value },
);
}
responseData = { success: true };
}
if (operation === 'remove') {
//https://tapfiliate.com/docs/rest/#affiliates-meta-data-key-delete
const affiliateId = this.getNodeParameter('affiliateId', i) as string;
const key = this.getNodeParameter('key', i) as string;
responseData = await tapfiliateApiRequest.call(
this,
'DELETE',
`/affiliates/${affiliateId}/meta-data/${key}/`,
);
responseData = { success: true };
}
if (operation === 'update') {
//https://tapfiliate.com/docs/rest/#affiliates-notes-collection-get
const affiliateId = this.getNodeParameter('affiliateId', i) as string;
const key = this.getNodeParameter('key', i) as string;
const value = this.getNodeParameter('value', i) as string;
responseData = await tapfiliateApiRequest.call(
this,
'PUT',
`/affiliates/${affiliateId}/meta-data/`,
{ [key]: value },
);
}
}
if (resource === 'programAffiliate') {
if (operation === 'add') {
//https://tapfiliate.com/docs/rest/#programs-program-affiliates-collection-post
const programId = this.getNodeParameter('programId', i) as string;
const affiliateId = this.getNodeParameter('affiliateId', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i);
const body: IDataObject = {
affiliate: {
id: affiliateId,
},
};
Object.assign(body, additionalFields);
responseData = await tapfiliateApiRequest.call(
this,
'POST',
`/programs/${programId}/affiliates/`,
body,
);
}
if (operation === 'approve') {
//https://tapfiliate.com/docs/rest/#programs-approve-an-affiliate-for-a-program-put
const programId = this.getNodeParameter('programId', i) as string;
const affiliateId = this.getNodeParameter('affiliateId', i) as string;
responseData = await tapfiliateApiRequest.call(
this,
'PUT',
`/programs/${programId}/affiliates/${affiliateId}/approved/`,
);
}
if (operation === 'disapprove') {
//https://tapfiliate.com/docs/rest/#programs-approve-an-affiliate-for-a-program-delete
const programId = this.getNodeParameter('programId', i) as string;
const affiliateId = this.getNodeParameter('affiliateId', i) as string;
responseData = await tapfiliateApiRequest.call(
this,
'DELETE',
`/programs/${programId}/affiliates/${affiliateId}/approved/`,
);
}
if (operation === 'get') {
//https://tapfiliate.com/docs/rest/#programs-affiliate-in-program-get
const programId = this.getNodeParameter('programId', i) as string;
const affiliateId = this.getNodeParameter('affiliateId', i) as string;
responseData = await tapfiliateApiRequest.call(
this,
'GET',
`/programs/${programId}/affiliates/${affiliateId}/`,
);
}
if (operation === 'getAll') {
//https://tapfiliate.com/docs/rest/#programs-program-affiliates-collection-get
const programId = this.getNodeParameter('programId', i) as string;
const returnAll = this.getNodeParameter('returnAll', i);
const filters = this.getNodeParameter('filters', i);
Object.assign(qs, filters);
if (returnAll) {
responseData = await tapfiliateApiRequestAllItems.call(
this,
'GET',
`/programs/${programId}/affiliates/`,
{},
qs,
);
} else {
const limit = this.getNodeParameter('limit', i);
responseData = await tapfiliateApiRequest.call(
this,
'GET',
`/programs/${programId}/affiliates/`,
{},
qs,
);
responseData = responseData.splice(0, limit);
}
}
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail()) {
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
);
returnData.push(...executionErrorData);
continue;
}
throw error;
}
}
return [returnData];
}
}
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="900"><defs><linearGradient id="a" x1="2.037%" x2="106.275%" y1="113.141%" y2="-7.854%"><stop offset="0%" stop-color="#2FDFBF"/><stop offset="0%" stop-color="#2FDFBF"/><stop offset="100%" stop-color="#2F74FF"/></linearGradient></defs><path fill="url(#a)" d="M900 289.19c0-113.514-67.164-221.622-178.657-267.568C685.075 6.757 647.463 0 609.851 0 552.09 0 495.67 17.568 448.657 48.649 402.985 17.568 347.91 0 288.806 0c-20.15 0-41.642 2.703-63.134 6.757C118.209 29.73 32.239 113.514 6.716 220.27v2.703C2.686 241.892 0 262.163 0 281.081 0 322.973 9.403 363.514 24.18 400l145.074 363.514c21.492 55.405 64.477 101.35 123.582 122.972 21.492 8.109 42.985 12.163 65.82 13.514h502.389l-90-239.19L878.507 400C891.94 363.514 900 325.676 900 289.19m-804.627-8.11c0-12.162 1.343-25.676 4.03-37.838v-2.702c16.12-68.92 75.224-127.027 145.075-140.541 14.776-2.703 29.552-4.054 42.985-4.054 32.238 0 61.79 8.108 88.656 21.622-13.432 18.918-25.522 37.837-34.925 60.81L188.06 556.757l-76.567-191.892c-9.403-28.379-16.12-56.757-16.12-83.784zm693.134 82.433L666.27 659.459l55.074 145.946H362.687q-18.135 0-36.27-8.108c-48.357-17.567-76.566-63.513-76.566-110.81 0-13.514 2.686-28.379 8.06-43.244l173.283-428.378c30.896-74.324 103.433-118.92 180-118.92 24.18 0 49.702 4.055 73.88 14.866 75.225 31.08 119.553 102.703 119.553 178.378-1.343 24.325-5.373 50-16.12 74.325z"/></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB