← Public packages
@kentcdodds/bluesky
Bluesky and AT Protocol helpers using package-storage handle plus blueskyAppPassword.
src/create-post.ts
29 lines · 1.5 KB · TypeScriptimport { createPost } from './client.ts'
import type { CreatePostInput } from './types.ts'
/**
* Create or dry-run a Bluesky post. Publishing requires `confirm: true`.
* Replies: pass `reply: { root: { uri, cid }, parent: { uri, cid } }` (aliases replyTo / parent+root / parentUri+… / replyToUri+replyToCid).
* Unknown keys are rejected. Dry-run echoes `mode: 'reply' | 'standalone'`. Prefer `./reply-post` when a parent is required.
* @param params.text - Post text body.
* @param params.identifier - Optional session identifier; defaults to packageStorage `blueskyHandle`.
* @param params.autoLinkFacets - Automatically make HTTP(S) URLs clickable; defaults to true when facets are not supplied.
* @param params.externalCard - Optional external-link card metadata. A thumbnail URL is fetched, fitted under Bluesky's 1 MB blob limit when needed, and uploaded as a Bluesky blob.
* @returns Created record or dry-run payload when `confirm` is omitted.
* @example
* import createPost from 'kody:@kentcdodds/bluesky/create-post'
* const result = await createPost({
* text: 'Watch this: https://example.com',
* externalCard: {
* uri: 'https://example.com',
* title: 'Example video',
* description: 'A useful video.',
* thumbnailUrl: 'https://example.com/thumbnail.jpg',
* },
* dryRun: true,
* })
* // => { dryRun: true, action: 'create-post', payload: { ... } }
*/
export default async function createPostEntrypoint(params: CreatePostInput = {}) {
return await createPost(params)
}