2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2021-02-04 00:37:03 -08:00
2021-12-03 00:44:16 -08:00
export const postCommentOperations : INodeProperties [ ] = [
2021-02-04 00:37:03 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-02-04 00:37:03 -08:00
default : 'create' ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a top-level comment in a post' ,
2022-07-10 13:50:51 -07:00
action : 'Create a comment in a post' ,
2021-02-04 00:37:03 -08:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-02-04 00:37:03 -08:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Retrieve many comments in a post' ,
2022-09-08 08:10:13 -07:00
action : 'Get many comments in a post' ,
2021-02-04 00:37:03 -08:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Remove a comment from a post' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a comment from a post' ,
2021-02-04 00:37:03 -08:00
} ,
{
name : 'Reply' ,
value : 'reply' ,
description : 'Write a reply to a comment in a post' ,
2022-07-10 13:50:51 -07:00
action : 'Reply to a comment in a post' ,
2021-02-04 00:37:03 -08:00
} ,
] ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2021-02-04 00:37:03 -08:00
2021-12-03 00:44:16 -08:00
export const postCommentFields : INodeProperties [ ] = [
2021-02-04 00:37:03 -08:00
// ----------------------------------
// postComment: create
// ----------------------------------
{
displayName : 'Post ID' ,
name : 'postId' ,
type : 'string' ,
required : true ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the post to write the comment to. Found in the post URL: <code>/r/[subreddit_name]/comments/[post_id]/[post_title]</code>' ,
2021-02-04 00:37:03 -08:00
placeholder : 'l0me7x' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
operation : [ 'create' ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
{
displayName : 'Comment Text' ,
name : 'commentText' ,
type : 'string' ,
required : true ,
default : '' ,
description : 'Text of the comment. Markdown supported.' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
operation : [ 'create' ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
// ----------------------------------
// postComment: getAll
// ----------------------------------
{
displayName : 'Subreddit' ,
name : 'subreddit' ,
type : 'string' ,
required : true ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The name of subreddit where the post is' ,
2021-02-04 00:37:03 -08:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
operation : [ 'getAll' ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
{
displayName : 'Post ID' ,
name : 'postId' ,
type : 'string' ,
required : true ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the post to get all comments from. Found in the post URL: <code>/r/[subreddit_name]/comments/[post_id]/[post_title]</code>' ,
2021-02-04 00:37:03 -08:00
placeholder : 'l0me7x' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
operation : [ 'getAll' ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2021-02-04 00:37:03 -08:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
operation : [ 'getAll' ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-02-04 00:37:03 -08:00
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
// ----------------------------------
// postComment: delete
// ----------------------------------
{
displayName : 'Comment ID' ,
name : 'commentId' ,
type : 'string' ,
required : true ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the comment to remove. Found in the comment URL:<code>/r/[subreddit_name]/comments/[post_id]/[post_title]/[comment_id]</code>' ,
2021-02-04 00:37:03 -08:00
placeholder : 'gla7fmt' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
operation : [ 'delete' ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
// ----------------------------------
// postComment: reply
// ----------------------------------
{
displayName : 'Comment ID' ,
name : 'commentId' ,
type : 'string' ,
required : true ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the comment to reply to. To be found in the comment URL: <code>www.reddit.com/r/[subreddit_name]/comments/[post_id]/[post_title]/[comment_id]</code>' ,
2021-02-04 00:37:03 -08:00
placeholder : 'gl9iroa' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
operation : [ 'reply' ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
{
displayName : 'Reply Text' ,
name : 'replyText' ,
type : 'string' ,
required : true ,
default : '' ,
description : 'Text of the reply. Markdown supported.' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'postComment' ] ,
operation : [ 'reply' ] ,
2021-02-04 00:37:03 -08:00
} ,
} ,
} ,
2021-12-03 00:44:16 -08:00
] ;