2021-01-28 10:00:47 -08:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
2021-12-03 00:44:16 -08:00
export const postOperations : INodeProperties [ ] = [
2021-01-28 10:00:47 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-01-28 10:00:47 -08:00
description : 'Choose an operation' ,
required : true ,
displayOptions : {
show : {
resource : [
'post' ,
] ,
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a post' ,
2022-07-10 13:50:51 -07:00
action : 'Create a post' ,
2021-01-28 10:00:47 -08:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a post' ,
2022-07-10 13:50:51 -07:00
action : 'Get a post' ,
2021-01-28 10:00:47 -08:00
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all posts' ,
2022-07-10 13:50:51 -07:00
action : 'Get all posts' ,
2021-01-28 10:00:47 -08:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a post' ,
2022-07-10 13:50:51 -07:00
action : 'Update a post' ,
2021-01-28 10:00:47 -08:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2021-01-28 10:00:47 -08:00
export const postFields : INodeProperties [ ] = [
/* -------------------------------------------------------------------------- */
/* post:create */
/* -------------------------------------------------------------------------- */
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
displayOptions : {
show : {
resource : [
'post' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Title of the post' ,
2021-01-28 10:00:47 -08:00
} ,
{
displayName : 'Content' ,
name : 'content' ,
type : 'string' ,
required : true ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
displayOptions : {
show : {
resource : [
'post' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Content of the post' ,
2021-01-28 10:00:47 -08:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'post' ,
] ,
} ,
} ,
default : { } ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Category Name or ID' ,
2021-01-28 10:00:47 -08:00
name : 'category' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCategories' ,
} ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'ID of the category. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2021-01-28 10:00:47 -08:00
} ,
{
displayName : 'Reply To Post Number' ,
name : 'reply_to_post_number' ,
type : 'string' ,
default : '' ,
description : 'The number of the post to reply to' ,
} ,
{
displayName : 'Topic ID' ,
name : 'topic_id' ,
type : 'string' ,
default : '' ,
description : 'ID of the topic' ,
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* post:get */
/* -------------------------------------------------------------------------- */
{
displayName : 'Post ID' ,
name : 'postId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
resource : [
'post' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'ID of the post' ,
2021-01-28 10:00:47 -08:00
} ,
/* -------------------------------------------------------------------------- */
/* post:getAll */
/* -------------------------------------------------------------------------- */
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'post' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2021-01-28 10:00:47 -08:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
resource : [
'post' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-01-28 10:00:47 -08:00
} ,
/* -------------------------------------------------------------------------- */
/* post:update */
/* -------------------------------------------------------------------------- */
{
displayName : 'Post ID' ,
name : 'postId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
resource : [
'post' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'ID of the post' ,
2021-01-28 10:00:47 -08:00
} ,
{
displayName : 'Content' ,
name : 'content' ,
type : 'string' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
required : true ,
displayOptions : {
show : {
resource : [
'post' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
default : '' ,
description : 'Content of the post. HTML is supported.' ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'post' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
options : [
{
displayName : 'Edit Reason' ,
name : 'edit_reason' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Cooked' ,
name : 'cooked' ,
type : 'boolean' ,
default : false ,
} ,
] ,
} ,
] ;