mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
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>
This commit is contained in:
committed by
GitHub
parent
5f3bed3d4e
commit
06c407def8
155
packages/nodes-base/nodes/PostBin/RequestDescription.ts
Normal file
155
packages/nodes-base/nodes/PostBin/RequestDescription.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
import {
|
||||
INodeProperties
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
buildBinTestURL,
|
||||
buildRequestURL
|
||||
} from './GenericFunctions';
|
||||
|
||||
// Operations for the `Request` resource
|
||||
export const requestOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'request',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a request',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '=/developers/postbin/api/bin/{{$parameter["binId"]}}/req/{{$parameter["requestId"]}}',
|
||||
},
|
||||
send: {
|
||||
preSend: [
|
||||
// Parse binId before sending to make sure it's in the right format
|
||||
buildRequestURL,
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Remove First',
|
||||
value: 'removeFirst',
|
||||
description: 'Remove the first request from bin',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '=/developers/postbin/api/bin/{{$parameter["binId"]}}/req/shift',
|
||||
},
|
||||
send: {
|
||||
preSend: [
|
||||
// Parse binId before sending to make sure it's in the right format
|
||||
buildRequestURL,
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Send',
|
||||
value: 'send',
|
||||
description: 'Send a test request to the bin',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'POST',
|
||||
},
|
||||
send: {
|
||||
preSend: [
|
||||
// Parse binId before sending to make sure it's in the right format
|
||||
buildBinTestURL,
|
||||
],
|
||||
},
|
||||
output: {
|
||||
postReceive: [
|
||||
{
|
||||
type: 'set',
|
||||
properties: {
|
||||
value: '={{ { "requestId": $response.body } }}',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
},
|
||||
];
|
||||
|
||||
// Properties of the `Request` resource
|
||||
export const requestFields: INodeProperties[] = [
|
||||
{
|
||||
name: 'binId',
|
||||
displayName: 'Bin ID',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'request',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
'removeFirst',
|
||||
'send',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Unique identifier for each bin',
|
||||
},
|
||||
{
|
||||
name: 'binContent',
|
||||
displayName: 'Bin Content',
|
||||
type: 'string',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
rows: 5,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'request',
|
||||
],
|
||||
operation: [
|
||||
'send',
|
||||
],
|
||||
},
|
||||
},
|
||||
// Content is sent in the body of POST requests
|
||||
routing: {
|
||||
send: {
|
||||
property: 'content',
|
||||
type: 'body',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'requestId',
|
||||
displayName: 'Request ID',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'request',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Unique identifier for each request',
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user