Skip to content
← Public packages

@kentcdodds/linkedin

Headless helpers for LinkedIn identity, requests, and guarded posting using the saved linkedin OAuth integration.

src/create-post.ts

17 lines · 769 B · TypeScript
import { createPost } from './client.ts'
import { parseCreatePostInput } from './create-post-input.ts'

/**
 * Create or dry-run a LinkedIn Posts API post with generic payload fields.
 * Maps commentary aliases (`text` / `message` / `body`); rejects unknown keys.
 * Controlled extension bag: `content` (LinkedIn API content object).
 * @returns Dry-run preview or publish result when `confirm: true`.
 * @example
 * import createPost from 'kody:@kentcdodds/linkedin/create-post'
 * const result = await createPost({ commentary: 'Draft text', dryRun: true })
 * // => { dryRun: true, body: { ... } }
 */
export default async function createPostEntrypoint(params: Record<string, unknown> = {}) {
  const input = parseCreatePostInput(params)
  return createPost(input)
}