Skip to content

src/youtube-update-video.ts

26 lines · 1.4 KB · TypeScript
Raw
import { updateVideo, type YouTubeUpdateVideoParams } from './youtube.ts'

export type { YouTubeUpdateVideoParams } from './youtube.ts'
export { updateVideo }

/**
 * PATCH snippet and/or status for an existing YouTube video. Maps id/privacyStatus aliases; rejects unknown keys.
 *
 * Use this alias when you only need update, not the full `./youtube` helper namespace.
 *
 * @param params.account - Google account alias (`youtube-brand` or `youtube-plus`).
 * @param params.id - YouTube video id.
 * @param params.title - Optional new title.
 * @param params.description - Optional new description.
 * @param params.privacyStatus - Optional privacy (`public`, `unlisted`, `private`).
 * @param params.publishAt - Optional RFC3339 UTC publish time (requires private until then).
 * @param params.dryRun - Return the would-be request without calling YouTube.
 * @returns Updated video resource, or `{ dryRun: true, ... }` when dryRun is set.
 * @example
 * import updateVideo from 'kody:@kentcdodds/google/youtube-update-video'
 * const result = await updateVideo({ account: 'youtube-plus', id: 'abc123', privacyStatus: 'unlisted', dryRun: true })
 * // => { dryRun: true, id: 'abc123', part: 'status', body: { id: 'abc123', status: { privacyStatus: 'unlisted' } } }
 */
export default async function youtubeUpdateVideo(params: YouTubeUpdateVideoParams) {
	return await updateVideo(params)
}