Page MenuHomeSealhub

No OneTemporary

diff --git a/credentials/PhabricatorApi.credentials.ts b/credentials/PhabricatorApi.credentials.ts
index 6a19976..d770f71 100644
--- a/credentials/PhabricatorApi.credentials.ts
+++ b/credentials/PhabricatorApi.credentials.ts
@@ -1,50 +1,51 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class PhabricatorApi implements ICredentialType {
name = 'phabricatorApi';
displayName = 'Phabricator API';
documentationUrl = 'https://hub.sealcode.org/conduit/';
properties: INodeProperties[] = [
{
displayName: 'Token',
name: 'token',
type: 'string',
default: '',
},
{
displayName: 'Domain',
name: 'domain',
type: 'string',
default: 'https://hub.sealcode.org',
},
];
// This allows the credential to be used by other parts of n8n
// stating how this credential is injected as part of the request
// An example is the Http Request node that can make generic calls
// reusing this credential
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: {
'api.token': '={{$credentials.token}}',
},
},
};
// The block below tells how this credential can be tested
test: ICredentialTestRequest = {
request: {
+ method: 'POST',
baseURL: '={{$credentials?.domain}}',
url: '/api/user.whoami',
},
};
}
diff --git a/nodes/Phabricator/Phabricator.node.ts b/nodes/Phabricator/Phabricator.node.ts
index 73543e0..c8b6d6e 100644
--- a/nodes/Phabricator/Phabricator.node.ts
+++ b/nodes/Phabricator/Phabricator.node.ts
@@ -1,80 +1,94 @@
-import { INodeType, INodeTypeDescription } from 'n8n-workflow';
+import {
+ IExecuteFunctions,
+ INodeExecutionData,
+ INodeType,
+ INodeTypeDescription,
+ NodeExecutionWithMetadata,
+} from 'n8n-workflow';
import { methods, apps, short_descriptions, fields } from './methods';
export class Phabricator implements INodeType {
description: INodeTypeDescription = {
displayName: 'Phabricator',
name: 'phabricator',
icon: 'file:phabricator.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"]}}',
description: 'Interact with Phabricator',
defaults: {
name: 'Phabricator',
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'phabricatorApi',
required: true,
},
],
requestDefaults: {
method: 'POST',
baseURL: 'https://hub.sealcode.org',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
},
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: apps.map((method) => ({
name: method,
value: method,
action: method,
description: `Call ${method} Conduit method`,
})),
default: 'user.whoami',
},
...apps.map((app) => ({
displayName: 'Operation',
name: 'operation',
type: <const>'options',
noDataExpression: true,
description: 'Choose an operation',
required: true,
displayOptions: {
show: {
resource: [app],
},
},
options: Object.entries(methods)
.filter(([method_name]) => {
return method_name.startsWith(app + '.');
})
.map(([method_name, method]) => ({
name: method_name,
value: method_name,
description: method.description,
action:
method_name.split('.').slice(1).join('.') + ': ' + short_descriptions[method_name],
routing: {
request: {
method: <const>'POST',
url: '/api/' + method_name,
},
},
})),
default: Object.keys(methods).filter((method_name) => method_name.startsWith(app + '.'))[0],
})),
...fields,
],
};
+
+ async execute(
+ this: IExecuteFunctions,
+ ): Promise<INodeExecutionData[][] | NodeExecutionWithMetadata[][] | null> {
+ const credentials = this.getCredentials('phabricatorApi');
+ console.log(credentials);
+ return [];
+ }
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 8, 06:59 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034253
Default Alt Text
(4 KB)

Event Timeline