2022-05-27 09:04:56 -07:00
|
|
|
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',
|
2022-06-03 10:23:49 -07:00
|
|
|
noDataExpression: true,
|
2022-05-27 09:04:56 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'bin',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create bin',
|
|
|
|
routing: {
|
|
|
|
request: {
|
|
|
|
method: 'POST',
|
|
|
|
url: '/developers/postbin/api/bin',
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
postReceive: [
|
|
|
|
transformBinReponse,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Create a bin',
|
2022-05-27 09:04:56 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get a bin',
|
2022-05-27 09:04:56 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Delete a bin',
|
2022-05-27 09:04:56 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
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',
|
|
|
|
},
|
|
|
|
];
|