n8n/packages/nodes-base/nodes/PostBin/BinDescription.ts
Milorad FIlipović 06c407def8
feat(PostBin Node): Add PostBin node (#3236)
* 🚧 Initial progress on PostBin node.

*  Implemented Bin and Request operations for PostBin node.

* 🚧 Reworked the node in the declarative way.

* 🚧 PosBin node refactoring after reworking it.

*  Implemented Bin id parsing in PostBin node. Done some final refactoring and documentation.

*  Improvements

*  Add comments

* 👌Updating the PostBin node based on the product review

* 💄Updating PostBin node Bin ID validation logic

*  Small improvements

*  Transform the bin requests and add additional properties

Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2022-05-27 18:04:56 +02:00

105 lines
1.7 KiB
TypeScript

import {
INodeProperties
} from 'n8n-workflow';
import {
buildBinAPIURL,
transformBinReponse,
} from './GenericFunctions';
// Operations for the `Bin` resource:
export const binOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'bin',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create bin',
routing: {
request: {
method: 'POST',
url: '/developers/postbin/api/bin',
},
output: {
postReceive: [
transformBinReponse,
],
},
},
},
{
name: 'Get',
value: 'get',
description: 'Get a bin',
routing: {
request: {
method: 'GET',
},
output: {
postReceive: [
transformBinReponse,
],
},
send: {
preSend: [
// Parse binId before sending to make sure it's in the right format
buildBinAPIURL,
],
},
},
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a bin',
routing: {
request: {
method: 'DELETE',
},
send: {
preSend: [
// Parse binId before sending to make sure it's in the right format
buildBinAPIURL,
],
},
},
},
],
default: 'create',
},
];
// Properties of the `Bin` resource
export const binFields: INodeProperties[] = [
{
name: 'binId',
displayName: 'Bin ID',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'bin',
],
operation: [
'get',
'delete',
],
},
},
description: 'Unique identifier for each bin',
},
];