Skip to content

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

Package listing

@kody/linkedin

src/create-text-post.ts

17 lines · 825 B · TypeScript
import { createTextPost, requireRecord, requireStringField } from './client.ts'
import type { CreateTextPostInput } from './client.ts'

/**
 * Create or dry-run a personal-profile LinkedIn text post.
 * @param params.text - Post commentary text.
 * @returns Dry-run preview or published post metadata when `confirm: true`.
 * @example
 * import createTextPost from 'kody:@kody/linkedin/create-text-post'
 * const result = await createTextPost({ text: 'Draft text', dryRun: true })
 * // => { dryRun: true, body: { commentary: 'Draft text', ... } }
 */
export default async function createTextPostEntrypoint(params: Partial<CreateTextPostInput> & Record<string, unknown> = {}) {
  const input = requireRecord(params, 'create-text-post')
  requireStringField(input, 'text', 'create-text-post')
  return createTextPost(input)
}