-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Expand file tree
/
Copy pathedit_post.ts
More file actions
118 lines (113 loc) · 3.39 KB
/
Copy pathedit_post.ts
File metadata and controls
118 lines (113 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import {
type BufferEditPostParams,
type BufferPostResponse,
POST_OUTPUT_PROPERTIES,
} from '@/tools/buffer/types'
import type { ToolConfig } from '@/tools/types'
export const bufferEditPostTool: ToolConfig<BufferEditPostParams, BufferPostResponse> = {
id: 'buffer_edit_post',
name: 'Buffer Edit Post',
description:
'Edit an existing Buffer post — update its text, schedule, or media. Attaching new media replaces the existing attachments',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Buffer API key',
},
postId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the post to edit',
},
text: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'New text content of the post',
},
mode: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'How to share the post: addToQueue, shareNext, shareNow, or customScheduled (requires dueAt)',
},
schedulingType: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'How the post publishes: automatic (Buffer publishes it, default) or notification (you get a mobile reminder)',
},
dueAt: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Publish time as an ISO 8601 timestamp (required when mode is customScheduled)',
},
saveToDraft: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Save the post as a draft instead of scheduling it',
},
media: {
type: 'file',
required: false,
visibility: 'user-or-llm',
description:
'Image or video to attach — an uploaded file, a file reference from a previous block, or a publicly accessible URL. Buffer downloads the media at publish time; uploaded files are shared via a link valid for 7 days, so use a public URL for posts scheduled further out. Replaces existing attachments',
},
mediaType: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Force the attachment type when it cannot be detected from the file or URL: image or video (default auto)',
},
mediaAltText: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Alt text for an attached image',
},
},
request: {
url: '/api/tools/buffer/edit-post',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
apiKey: params.apiKey,
postId: params.postId,
text: params.text,
mode: params.mode,
schedulingType: params.schedulingType,
dueAt: params.dueAt,
saveToDraft: params.saveToDraft,
media: params.media,
mediaType: params.mediaType,
mediaAltText: params.mediaAltText,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!data.success) {
throw new Error(data.error || 'Failed to edit post')
}
return {
success: true,
output: data.output,
}
},
outputs: {
post: {
type: 'object',
description: 'The updated post',
properties: POST_OUTPUT_PROPERTIES,
},
},
}