2023-10-25 17:20:43 -07:00
|
|
|
import type { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
2022-03-13 01:45:26 -08:00
|
|
|
|
2021-09-29 16:28:27 -07:00
|
|
|
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';
|
2021-09-29 16:28:27 -07:00
|
|
|
properties: INodeProperties[] = [
|
|
|
|
{
|
|
|
|
displayName: 'Environment',
|
|
|
|
name: 'environment',
|
|
|
|
type: 'options',
|
|
|
|
default: 'cloudHosted',
|
|
|
|
options: [
|
|
|
|
{
|
2022-04-13 23:32:27 -07:00
|
|
|
name: 'Cloud-Hosted',
|
2021-09-29 16:28:27 -07:00
|
|
|
value: 'cloudHosted',
|
|
|
|
},
|
|
|
|
{
|
2022-04-13 23:32:27 -07:00
|
|
|
name: 'Self-Hosted',
|
2021-09-29 16:28:27 -07:00
|
|
|
value: 'selfHosted',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2022-04-13 23:32:27 -07:00
|
|
|
displayName: 'Self-Hosted Domain',
|
2021-09-29 16:28:27 -07:00
|
|
|
name: 'domain',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2023-10-25 17:20:43 -07:00
|
|
|
placeholder: 'https://seatable.example.com',
|
2021-09-29 16:28:27 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-07-24 08:36:17 -07:00
|
|
|
environment: ['selfHosted'],
|
2021-09-29 16:28:27 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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.',
|
2023-08-01 04:08:25 -07:00
|
|
|
typeOptions: { password: true },
|
2021-09-29 16:28:27 -07:00
|
|
|
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}}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2021-09-29 16:28:27 -07:00
|
|
|
}
|