66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
import {
|
|
IAuthenticateGeneric,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
/**
|
|
* LibreBooking API Credentials
|
|
*
|
|
* LibreBooking verwendet Session-basierte Authentifizierung.
|
|
* Der Node holt bei jeder Ausführung einen neuen Session-Token.
|
|
*/
|
|
export class LibreBookingApi implements ICredentialType {
|
|
name = 'libreBookingApi';
|
|
displayName = 'LibreBooking API';
|
|
documentationUrl = 'https://librebooking.org/docs/api';
|
|
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'LibreBooking URL',
|
|
name: 'url',
|
|
type: 'string',
|
|
default: '',
|
|
placeholder: 'https://booking.example.com',
|
|
required: true,
|
|
description: 'Die Basis-URL Ihrer LibreBooking-Installation (ohne /Web/Services)',
|
|
},
|
|
{
|
|
displayName: 'Benutzername',
|
|
name: 'username',
|
|
type: 'string',
|
|
default: '',
|
|
required: true,
|
|
description: 'Ihr LibreBooking-Benutzername oder E-Mail-Adresse',
|
|
},
|
|
{
|
|
displayName: 'Passwort',
|
|
name: 'password',
|
|
type: 'string',
|
|
typeOptions: {
|
|
password: true,
|
|
},
|
|
default: '',
|
|
required: true,
|
|
description: 'Ihr LibreBooking-Passwort',
|
|
},
|
|
];
|
|
|
|
// Test-Request um die Credentials zu validieren
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: '={{$credentials.url}}',
|
|
url: '/Web/Services/index.php/Authentication/Authenticate',
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: {
|
|
username: '={{$credentials.username}}',
|
|
password: '={{$credentials.password}}',
|
|
},
|
|
},
|
|
};
|
|
}
|