Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/linkedin

src/create-post.ts

15 lines · 652 B · TypeScript
import { createPost, requireRecord } from './client.ts'
import type { CreatePostInput } from './client.ts'

/**
 * Create or dry-run a LinkedIn Posts API post with generic payload fields.
 * @returns Dry-run preview or publish result when `confirm: true`.
 * @example
 * import createPost from 'kody:@kody/linkedin/create-post'
 * const result = await createPost({ commentary: 'Draft text', dryRun: true })
 * // => { dryRun: true, body: { ... } }
 */
export default async function createPostEntrypoint(params: Partial<CreatePostInput> & Record<string, unknown> = {}) {
  const input = requireRecord(params, 'create-post')
  return createPost(input)
}