mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
e63b3982d2
* rename sendinblue to brevo * refactor sendinblue node files/folders to brevo * update codex node, documentation urls and api baseUrls * adding comments to original node names
196 lines
3.8 KiB
TypeScript
196 lines
3.8 KiB
TypeScript
import type { INodeProperties } from 'n8n-workflow';
|
|
|
|
export const senderOperations: INodeProperties[] = [
|
|
{
|
|
displayName: 'Operation',
|
|
name: 'operation',
|
|
type: 'options',
|
|
noDataExpression: true,
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['sender'],
|
|
},
|
|
},
|
|
options: [
|
|
{
|
|
name: 'Create',
|
|
value: 'create',
|
|
action: 'Create a sender',
|
|
},
|
|
{
|
|
name: 'Delete',
|
|
value: 'delete',
|
|
routing: {
|
|
request: {
|
|
method: 'DELETE',
|
|
url: '=/v3/senders/{{$parameter.id}}',
|
|
},
|
|
output: {
|
|
postReceive: [
|
|
{
|
|
type: 'set',
|
|
properties: {
|
|
value: '={{ { "success": true } }}',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
action: 'Delete a sender',
|
|
},
|
|
{
|
|
name: 'Get Many',
|
|
value: 'getAll',
|
|
routing: {
|
|
request: {
|
|
method: 'GET',
|
|
url: '/v3/senders',
|
|
},
|
|
send: {
|
|
paginate: false,
|
|
},
|
|
output: {
|
|
postReceive: [
|
|
{
|
|
type: 'rootProperty',
|
|
properties: {
|
|
property: 'senders',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
action: 'Get many senders',
|
|
},
|
|
],
|
|
default: 'create',
|
|
},
|
|
];
|
|
|
|
const senderCreateOperation: INodeProperties[] = [
|
|
{
|
|
displayName: 'Name',
|
|
name: 'name',
|
|
type: 'string',
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['sender'],
|
|
operation: ['create'],
|
|
},
|
|
},
|
|
routing: {
|
|
request: {
|
|
method: 'POST',
|
|
url: '/v3/senders',
|
|
},
|
|
send: {
|
|
property: 'name',
|
|
type: 'body',
|
|
},
|
|
},
|
|
required: true,
|
|
description: 'Name of the sender',
|
|
},
|
|
{
|
|
displayName: 'Email',
|
|
name: 'email',
|
|
type: 'string',
|
|
placeholder: 'name@email.com',
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['sender'],
|
|
operation: ['create'],
|
|
},
|
|
},
|
|
routing: {
|
|
send: {
|
|
property: 'email',
|
|
type: 'body',
|
|
},
|
|
},
|
|
required: true,
|
|
description: 'Email of the sender',
|
|
},
|
|
];
|
|
|
|
const senderDeleteOperation: INodeProperties[] = [
|
|
{
|
|
displayName: 'Sender ID',
|
|
name: 'id',
|
|
type: 'string',
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['sender'],
|
|
operation: ['delete'],
|
|
},
|
|
},
|
|
description: 'ID of the sender to delete',
|
|
},
|
|
];
|
|
|
|
const senderGetAllOperation: INodeProperties[] = [
|
|
{
|
|
displayName: 'Return All',
|
|
name: 'returnAll',
|
|
type: 'boolean',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['sender'],
|
|
operation: ['getAll'],
|
|
},
|
|
},
|
|
default: false,
|
|
description: 'Whether to return all results or only up to a given limit',
|
|
},
|
|
{
|
|
displayName: 'Limit',
|
|
name: 'limit',
|
|
type: 'number',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['sender'],
|
|
operation: ['getAll'],
|
|
returnAll: [false],
|
|
},
|
|
},
|
|
typeOptions: {
|
|
minValue: 1,
|
|
maxValue: 1000,
|
|
},
|
|
routing: {
|
|
output: {
|
|
postReceive: [
|
|
{
|
|
type: 'limit',
|
|
properties: {
|
|
maxResults: '={{$value}}',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
default: 10,
|
|
description: 'Max number of results to return',
|
|
},
|
|
];
|
|
|
|
export const senderFields: INodeProperties[] = [
|
|
/* -------------------------------------------------------------------------- */
|
|
/* sender:create */
|
|
/* -------------------------------------------------------------------------- */
|
|
...senderCreateOperation,
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* sender:delete */
|
|
/* -------------------------------------------------------------------------- */
|
|
...senderDeleteOperation,
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* sender:getAll */
|
|
/* -------------------------------------------------------------------------- */
|
|
...senderGetAllOperation,
|
|
];
|