mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -08:00
d4f858db92
* 👕 Apply `node-param-operation-option-action-wrong-for-get-many` * 🔥 Remove `package-lock.json` * 📦 Re-add `package-lock.json` * ⚡ master update Co-authored-by: Michael Kret <michael.k@radency.com>
196 lines
3.8 KiB
TypeScript
196 lines
3.8 KiB
TypeScript
import { IExecuteSingleFunctions, INodeExecutionData, 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,
|
|
];
|