n8n-nodes-easy-appointments
Version:
n8n nodes for Easy!Appointments API integration
85 lines • 2.96 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EasyAppointmentsApi = void 0;
class EasyAppointmentsApi {
constructor() {
this.name = 'easyAppointmentsApi';
this.displayName = 'Easy!Appointments API';
this.documentationUrl = 'https://easyappointments.org/docs.html';
this.properties = [
{
displayName: 'Authentication Type',
name: 'authenticationType',
type: 'options',
options: [
{ name: 'Bearer Token', value: 'bearerToken' },
{ name: 'Basic Auth', value: 'basicAuth' },
],
default: 'bearerToken',
},
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
default: '',
displayOptions: {
show: { authenticationType: ['bearerToken'] },
},
typeOptions: { password: true },
description: 'The API key from Easy!Appointments settings',
},
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
displayOptions: {
show: { authenticationType: ['basicAuth'] },
},
description: 'Admin username',
},
{
displayName: 'Password',
name: 'password',
type: 'string',
default: '',
displayOptions: {
show: { authenticationType: ['basicAuth'] },
},
typeOptions: { password: true },
description: 'Admin password',
},
{
displayName: 'Base URL',
name: 'baseUrl',
type: 'string',
default: 'https://demo.easyappointments.org/index.php/api/v1',
description: 'Your Easy!Appointments base URL',
},
];
this.authenticate = {
type: 'generic',
properties: {
headers: {
Authorization: `={{
$credentials.authenticationType === "bearerToken"
? "Bearer " + $credentials.apiKey
: ($credentials.authenticationType === "basicAuth"
? "Basic " + Buffer.from($credentials.username + ":" + $credentials.password).toString("base64")
: undefined
)
}}`,
},
},
};
this.test = {
request: {
baseURL: '={{ $credentials.baseUrl }}',
url: '/appointments',
method: 'GET',
},
};
}
}
exports.EasyAppointmentsApi = EasyAppointmentsApi;
//# sourceMappingURL=EasyAppointmentsApi.credentials.js.map