| 1 |
import apiFetch from '@wordpress/api-fetch'; |
| 2 |
import { __ } from '@wordpress/i18n'; |
| 3 |
|
| 4 |
const path = '/extendify/v1/agent/content-read'; |
| 5 |
|
| 6 |
export const contentRead = { |
| 7 |
name: 'extendify/content-read', |
| 8 |
label: __('Page text', 'extendify-local'), |
| 9 |
description: |
| 10 |
'Read one post, page, header, footer or pattern in full — either the words a visitor sees or the block markup behind them. Name it by the id another tool returned, or by its slug.', |
| 11 |
inputSchema: { |
| 12 |
type: 'object', |
| 13 |
properties: { |
| 14 |
id: { |
| 15 |
type: 'integer', |
| 16 |
description: 'The id of the post to read.', |
| 17 |
}, |
| 18 |
slug: { |
| 19 |
type: 'string', |
| 20 |
description: 'The slug of the post to read, when its id is not known.', |
| 21 |
}, |
| 22 |
format: { |
| 23 |
type: 'string', |
| 24 |
enum: ['text', 'blocks', 'excerpt'], |
| 25 |
description: |
| 26 |
'text for the words a visitor sees, blocks for the markup behind them, excerpt for the summary. Defaults to text.', |
| 27 |
}, |
| 28 |
includeMeta: { |
| 29 |
type: 'boolean', |
| 30 |
description: 'Also return the fields stored alongside the post.', |
| 31 |
}, |
| 32 |
}, |
| 33 |
}, |
| 34 |
annotations: { readonly: true }, |
| 35 |
execute: (input = {}) => apiFetch({ path, method: 'POST', data: input }), |
| 36 |
}; |
| 37 |
|