المنشورات (Posts)
أنشئ وانشر عبر القنوات المتصلة — نفس مسار المُنشئ الذي يستخدمه التطبيق، من الكود.


On this page
مثال سريع
مُدقّق الأنواع مقابل @medalsocial/sdk v1.3.0 (2026-07-20). أي إصدار يغيّر توقيعًا يوقف بناء هذه الصفحة.
ts
import { Medal } from '@medalsocial/sdk';
const medal = new Medal(process.env.MEDAL_API_KEY as string);
// Create a draft targeting connected channels
const { data: post } = await medal.posts.create({
content: 'Our Midsummer Blend is back — bright, honeyed, small batches.',
channel_ids: ['ch_1', 'ch_2'],
});
// Schedule it (ISO 8601 or epoch millis)
await medal.posts.schedule(post.id, {
scheduled_at: '2026-08-01T09:00:00Z',
});
// …or publish immediately
await medal.posts.publish(post.id);
// List recent posts, newest first
const { data: posts, pagination } = await medal.posts.list({ limit: 20 });
console.log(posts.length, 'posts, more:', pagination.has_more);medal.posts.list()
List posts with cursor-based pagination and optional filters.
ts
list(options?: ListPostsOptions): Promise<PaginatedResponse<Post>>أُضيف في v1.0.0
medal.posts.create()
Create a new post with content and target channels.
ts
create(input: CreatePostInput): Promise<ApiResponse<{ id: string; }>>أُضيف في v1.0.0
medal.posts.get()
Get a post by ID, including its per-channel variants.
ts
get(id: string): Promise<ApiResponse<PostDetail>>أُضيف في v1.0.0
medal.posts.update()
Update a draft post's title or content.
ts
update(id: string, input: UpdatePostInput): Promise<ApiResponse<{ success: boolean; }>>أُضيف في v1.0.0
medal.posts.remove()
Delete a post.
ts
remove(id: string): Promise<ApiResponse<{ success: boolean; }>>أُضيف في v1.0.0
medal.posts.schedule()
Schedule a post for future publication.
ts
schedule(id: string, input: SchedulePostInput): Promise<ApiResponse<ScheduleResult>>أُضيف في v1.0.0
medal.posts.publish()
Publish a post immediately to all target channels.
ts
publish(id: string): Promise<ApiResponse<PublishResult>>أُضيف في v1.0.0
medal.posts.channels()
List connected publishing channels for this workspace.
ts
channels(): Promise<ApiResponse<Channel[]>>أُضيف في v1.0.0