2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2020-12-07 23:40:29 -08:00
2021-12-03 00:44:16 -08:00
export const postOperations : INodeProperties [ ] = [
2020-12-07 23:40:29 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
2022-05-14 01:39:28 -07:00
noDataExpression : true ,
2020-12-07 23:40:29 -08:00
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'contentApi' ] ,
resource : [ 'post' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
name : 'Get' ,
value : 'get' ,
description : 'Get a post' ,
2022-07-10 13:50:51 -07:00
action : 'Get a post' ,
2020-12-07 23:40:29 -08:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2020-12-07 23:40:29 -08:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many posts' ,
2022-09-08 08:10:13 -07:00
action : 'Get many posts' ,
2020-12-07 23:40:29 -08:00
} ,
] ,
default : 'get' ,
} ,
{
displayName : 'Operation' ,
name : 'operation' ,
2022-05-14 01:39:28 -07:00
noDataExpression : true ,
2020-12-07 23:40:29 -08:00
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a post' ,
2022-07-10 13:50:51 -07:00
action : 'Create a post' ,
2020-12-07 23:40:29 -08:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a post' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a post' ,
2020-12-07 23:40:29 -08:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a post' ,
2022-07-10 13:50:51 -07:00
action : 'Get a post' ,
2020-12-07 23:40:29 -08:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2020-12-07 23:40:29 -08:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many posts' ,
2022-09-08 08:10:13 -07:00
action : 'Get many posts' ,
2020-12-07 23:40:29 -08:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a post' ,
2022-07-10 13:50:51 -07:00
action : 'Update a post' ,
2020-12-07 23:40:29 -08:00
} ,
] ,
default : 'get' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-12-07 23:40:29 -08:00
2021-12-03 00:44:16 -08:00
export const postFields : INodeProperties [ ] = [
2020-12-07 23:40:29 -08:00
/* -------------------------------------------------------------------------- */
/* post:create */
/* -------------------------------------------------------------------------- */
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'create' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description : "Post's title" ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Content Format' ,
name : 'contentFormat' ,
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'create' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
name : 'HTML' ,
value : 'html' ,
} ,
{
name : 'Mobile Doc' ,
value : 'mobileDoc' ,
} ,
] ,
default : 'html' ,
2022-05-06 14:01:25 -07:00
description : 'The format of the post' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Content' ,
name : 'content' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'create' ] ,
contentFormat : [ 'html' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The content of the post to create' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Content (JSON)' ,
name : 'content' ,
type : 'json' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'create' ] ,
contentFormat : [ 'mobileDoc' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Mobiledoc is the raw JSON format that Ghost uses to store post contents. <a href="https://ghost.org/docs/concepts/posts/#document-storage">Info</a>.' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'create' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
2022-06-20 07:54:01 -07:00
displayName : 'Author Names or IDs' ,
2020-12-07 23:40:29 -08:00
name : 'authors' ,
type : 'multiOptions' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-12-07 23:40:29 -08:00
typeOptions : {
loadOptionsMethod : 'getAuthors' ,
} ,
default : [ ] ,
} ,
{
displayName : 'Cannonical URL' ,
name : 'canonical_url' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Code Injection Foot' ,
name : 'codeinjection_foot' ,
type : 'string' ,
default : '' ,
description : 'The Code Injection allows you inject a small snippet into your Ghost site' ,
} ,
{
displayName : 'Code Injection Head' ,
name : 'codeinjection_head' ,
type : 'string' ,
default : '' ,
description : 'The Code Injection allows you inject a small snippet into your Ghost site' ,
} ,
{
displayName : 'Featured' ,
name : 'featured' ,
type : 'boolean' ,
default : false ,
} ,
{
displayName : 'Meta Description' ,
name : 'meta_description' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Meta Title' ,
name : 'meta_title' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Open Graph Description' ,
name : 'og_description' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Open Graph Image' ,
name : 'og_image' ,
type : 'string' ,
default : '' ,
description : 'URL of the image' ,
} ,
2022-05-14 01:39:28 -07:00
{
displayName : 'Open Graph Title' ,
name : 'og_title' ,
type : 'string' ,
default : '' ,
} ,
2020-12-07 23:40:29 -08:00
{
displayName : 'Published At' ,
name : 'published_at' ,
type : 'dateTime' ,
default : '' ,
} ,
{
displayName : 'Slug' ,
name : 'slug' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
options : [
{
name : 'Draft' ,
value : 'draft' ,
} ,
{
name : 'Published' ,
value : 'published' ,
} ,
{
name : 'Scheduled' ,
value : 'scheduled' ,
} ,
] ,
default : 'draft' ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-12-07 23:40:29 -08:00
name : 'tags' ,
type : 'multiOptions' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-12-07 23:40:29 -08:00
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
default : [ ] ,
} ,
{
displayName : 'Twitter Description' ,
name : 'twitter_description' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Twitter Image' ,
name : 'twitter_image' ,
type : 'string' ,
default : '' ,
description : 'URL of the image' ,
} ,
{
displayName : 'Twitter Title' ,
name : 'twitter_title' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* post:delete */
/* -------------------------------------------------------------------------- */
{
displayName : 'Post ID' ,
name : 'postId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'delete' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the post to delete' ,
2020-12-07 23:40:29 -08:00
} ,
/* -------------------------------------------------------------------------- */
/* post:get */
/* -------------------------------------------------------------------------- */
{
displayName : 'By' ,
name : 'by' ,
type : 'options' ,
2022-05-14 01:39:28 -07:00
default : 'id' ,
2020-12-07 23:40:29 -08:00
required : true ,
options : [
{
name : 'ID' ,
value : 'id' ,
} ,
{
name : 'Slug' ,
value : 'slug' ,
} ,
] ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'contentApi' , 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'get' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Get the post either by slug or ID' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Identifier' ,
name : 'identifier' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'contentApi' , 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'get' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID or slug of the post to get' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'get' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
default : '' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-miscased-url
2022-08-17 08:50:24 -07:00
description :
'Limit the fields returned in the response object. E.g. for posts fields=title,url.' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Formats' ,
name : 'formats' ,
type : 'multiOptions' ,
options : [
{
name : 'HTML' ,
value : 'html' ,
} ,
{
name : 'Mobile Doc' ,
value : 'mobiledoc' ,
} ,
] ,
2022-08-17 08:50:24 -07:00
default : [ 'mobiledoc' ] ,
2020-12-07 23:40:29 -08:00
} ,
] ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'contentApi' ] ,
resource : [ 'post' ] ,
operation : [ 'get' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
default : '' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-miscased-url
2022-08-17 08:50:24 -07:00
description :
'Limit the fields returned in the response object. E.g. for posts fields=title,url.' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Formats' ,
name : 'formats' ,
type : 'multiOptions' ,
options : [
{
name : 'HTML' ,
value : 'html' ,
} ,
{
name : 'Plaintext' ,
value : 'plaintext' ,
} ,
] ,
2022-08-17 08:50:24 -07:00
default : [ 'html' ] ,
2020-12-07 23:40:29 -08:00
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* post:getAll */
/* -------------------------------------------------------------------------- */
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'contentApi' , 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'getAll' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' , 'contentApi' ] ,
resource : [ 'post' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'contentApi' ] ,
resource : [ 'post' ] ,
operation : [ 'getAll' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
displayName : 'Include' ,
name : 'include' ,
type : 'multiOptions' ,
options : [
{
name : 'Authors' ,
value : 'authors' ,
} ,
{
name : 'Tags' ,
value : 'tags' ,
} ,
] ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'Tells the API to return additional data related to the resource you have requested' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
default : '' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-miscased-url
2022-08-17 08:50:24 -07:00
description :
'Limit the fields returned in the response object. E.g. for posts fields=title,url.' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Formats' ,
name : 'formats' ,
type : 'multiOptions' ,
options : [
{
name : 'HTML' ,
value : 'html' ,
} ,
{
name : 'Plaintext' ,
value : 'plaintext' ,
} ,
] ,
2022-08-17 08:50:24 -07:00
default : [ 'html' ] ,
description :
'By default, only html is returned, however each post and page in Ghost has 2 available formats: html and plaintext' ,
2020-12-07 23:40:29 -08:00
} ,
] ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'getAll' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
displayName : 'Include' ,
name : 'include' ,
type : 'multiOptions' ,
options : [
{
name : 'Authors' ,
value : 'authors' ,
} ,
{
name : 'Tags' ,
value : 'tags' ,
} ,
] ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'Tells the API to return additional data related to the resource you have requested' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
default : '' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-miscased-url
2022-08-17 08:50:24 -07:00
description :
'Limit the fields returned in the response object. E.g. for posts fields=title,url.' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Formats' ,
name : 'formats' ,
type : 'multiOptions' ,
options : [
{
name : 'HTML' ,
value : 'html' ,
} ,
{
name : 'Mobile Doc' ,
value : 'mobiledoc' ,
} ,
] ,
2022-08-17 08:50:24 -07:00
default : [ 'mobiledoc' ] ,
2020-12-07 23:40:29 -08:00
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* post:update */
/* -------------------------------------------------------------------------- */
{
displayName : 'Post ID' ,
name : 'postId' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'update' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the post to update' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Content Format' ,
name : 'contentFormat' ,
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'update' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
name : 'HTML' ,
value : 'html' ,
} ,
{
name : 'Mobile Doc' ,
value : 'mobileDoc' ,
} ,
] ,
default : 'html' ,
2022-05-06 14:01:25 -07:00
description : 'The format of the post' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
source : [ 'adminApi' ] ,
resource : [ 'post' ] ,
operation : [ 'update' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
options : [
{
2022-06-20 07:54:01 -07:00
displayName : 'Author Names or IDs' ,
2020-12-07 23:40:29 -08:00
name : 'authors' ,
type : 'multiOptions' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-12-07 23:40:29 -08:00
typeOptions : {
loadOptionsMethod : 'getAuthors' ,
} ,
default : [ ] ,
} ,
{
displayName : 'Cannonical URL' ,
name : 'canonical_url' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Code Injection Foot' ,
name : 'codeinjection_foot' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Code Injection Head' ,
name : 'codeinjection_head' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Content' ,
name : 'content' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
'/contentFormat' : [ 'html' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Content (JSON)' ,
name : 'contentJson' ,
type : 'json' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
'/contentFormat' : [ 'mobileDoc' ] ,
2020-12-07 23:40:29 -08:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Mobiledoc is the raw JSON format that Ghost uses to store post contents. <a href="https://ghost.org/docs/concepts/posts/#document-storage">Info.</a>.' ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Featured' ,
name : 'featured' ,
type : 'boolean' ,
default : false ,
} ,
{
displayName : 'Meta Description' ,
name : 'meta_description' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Meta Title' ,
name : 'meta_title' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Open Graph Description' ,
name : 'og_description' ,
type : 'string' ,
default : '' ,
} ,
{
2022-05-14 01:39:28 -07:00
displayName : 'Open Graph Image' ,
name : 'og_image' ,
2020-12-07 23:40:29 -08:00
type : 'string' ,
default : '' ,
2022-05-14 01:39:28 -07:00
description : 'URL of the image' ,
2020-12-07 23:40:29 -08:00
} ,
{
2022-05-14 01:39:28 -07:00
displayName : 'Open Graph Title' ,
name : 'og_title' ,
2020-12-07 23:40:29 -08:00
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Published At' ,
name : 'published_at' ,
type : 'dateTime' ,
default : '' ,
} ,
{
displayName : 'Slug' ,
name : 'slug' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
options : [
{
name : 'Draft' ,
value : 'draft' ,
} ,
{
name : 'Published' ,
value : 'published' ,
} ,
{
name : 'Scheduled' ,
value : 'scheduled' ,
} ,
] ,
default : 'draft' ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-12-07 23:40:29 -08:00
name : 'tags' ,
type : 'multiOptions' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-12-07 23:40:29 -08:00
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
default : [ ] ,
} ,
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description : "Post's title" ,
2020-12-07 23:40:29 -08:00
} ,
{
displayName : 'Twitter Description' ,
name : 'twitter_description' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Twitter Image' ,
name : 'twitter_image' ,
type : 'string' ,
default : '' ,
description : 'URL of the image' ,
} ,
{
displayName : 'Twitter Title' ,
name : 'twitter_title' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;