n8n/packages/nodes-base/credentials/SeaTableApi.credentials.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-10-25 17:20:43 -07:00
import type { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
export class SeaTableApi implements ICredentialType {
name = 'seaTableApi';
displayName = 'SeaTable API';
2023-10-25 17:20:43 -07:00
documentationUrl =
'https://seatable.io/docs/n8n-integration/erstellen-eines-api-tokens-fuer-n8n/?lang=auto';
properties: INodeProperties[] = [
{
displayName: 'Environment',
name: 'environment',
type: 'options',
default: 'cloudHosted',
options: [
{
name: 'Cloud-Hosted',
value: 'cloudHosted',
},
{
name: 'Self-Hosted',
value: 'selfHosted',
},
],
},
{
displayName: 'Self-Hosted Domain',
name: 'domain',
type: 'string',
default: '',
2023-10-25 17:20:43 -07:00
placeholder: 'https://seatable.example.com',
displayOptions: {
show: {
environment: ['selfHosted'],
},
},
},
{
displayName: 'API Token (of a Base)',
name: 'token',
type: 'string',
2023-10-25 17:20:43 -07:00
description:
'The API-Token of the SeaTable base you would like to use with n8n. n8n can only connect to one base a at a time.',
typeOptions: { password: true },
default: '',
},
];
2023-10-25 17:20:43 -07:00
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials?.domain || "https://cloud.seatable.io" }}',
url: '/api/v2.1/dtable/app-access-token/',
headers: {
Authorization: '={{"Token " + $credentials.token}}',
},
},
};
}