2023-01-27 03:22:44 -08:00
|
|
|
import type { INodeProperties } from 'n8n-workflow';
|
2022-05-27 09:04:56 -07:00
|
|
|
|
2023-03-03 09:49:19 -08:00
|
|
|
import { buildBinAPIURL, transformBinResponse } from './GenericFunctions';
|
2022-05-27 09:04:56 -07:00
|
|
|
|
|
|
|
// 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: {
|
2022-08-17 08:50:24 -07:00
|
|
|
show: {
|
|
|
|
resource: ['bin'],
|
|
|
|
},
|
2022-05-27 09:04:56 -07:00
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create bin',
|
|
|
|
routing: {
|
|
|
|
request: {
|
|
|
|
method: 'POST',
|
|
|
|
url: '/developers/postbin/api/bin',
|
|
|
|
},
|
|
|
|
output: {
|
2023-03-03 09:49:19 -08:00
|
|
|
postReceive: [transformBinResponse],
|
2022-05-27 09:04:56 -07:00
|
|
|
},
|
|
|
|
},
|
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: {
|
2023-03-03 09:49:19 -08:00
|
|
|
postReceive: [transformBinResponse],
|
2022-05-27 09:04:56 -07:00
|
|
|
},
|
|
|
|
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[] = [
|
|
|
|
{
|
|
|
|
displayName: 'Bin ID',
|
2022-09-12 00:25:39 -07:00
|
|
|
name: 'binId',
|
2022-05-27 09:04:56 -07:00
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['bin'],
|
|
|
|
operation: ['get', 'delete'],
|
2022-05-27 09:04:56 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
description: 'Unique identifier for each bin',
|
|
|
|
},
|
|
|
|
];
|