mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 09:04:07 -08:00
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import type { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
|
|
export class SeaTableApi implements ICredentialType {
|
|
name = 'seaTableApi';
|
|
displayName = 'SeaTable API';
|
|
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: '',
|
|
placeholder: 'https://seatable.example.com',
|
|
displayOptions: {
|
|
show: {
|
|
environment: ['selfHosted'],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
displayName: 'API Token (of a Base)',
|
|
name: 'token',
|
|
type: 'string',
|
|
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: '',
|
|
},
|
|
];
|
|
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: '={{$credentials?.domain || "https://cloud.seatable.io" }}',
|
|
url: '/api/v2.1/dtable/app-access-token/',
|
|
headers: {
|
|
Authorization: '={{"Token " + $credentials.token}}',
|
|
},
|
|
},
|
|
};
|
|
}
|