// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../core/resource'; import { APIPromise } from '../../../../core/api-promise'; import { RequestOptions } from '../../../../internal/request-options'; import { path } from '../../../../internal/utils/path'; export class VideoScript extends APIResource { /** * Retrieve the generated video script for a specific campaign lead. The script is * automatically generated when the lead is accepted. Returns a 425 Too Early * status if the script is not yet available. * * @example * ```ts * const videoScript = * await client.creators.campaigns.leads.videoScript.retrieve( * '550e8400-e29b-41d4-a716-446655440001', * { * id: '550e8400-e29b-41d4-a716-446655440000-instagram', * }, * ); * ``` */ retrieve( leadID: string, params: VideoScriptRetrieveParams, options?: RequestOptions, ): APIPromise { const { id } = params; return this._client.get(path`/creators/campaigns/${id}/leads/${leadID}/video-script`, options); } /** * Manually regenerate the video script for a campaign lead. This endpoint can be * used for debugging or when the creator wants a new version of the script. Only * available for accepted leads. Supports optional language parameter to generate * script in specific language (defaults to en-US). * * @example * ```ts * const response = * await client.creators.campaigns.leads.videoScript.regenerate( * '550e8400-e29b-41d4-a716-446655440001', * { id: '550e8400-e29b-41d4-a716-446655440000' }, * ); * ``` */ regenerate( leadID: string, params: VideoScriptRegenerateParams, options?: RequestOptions, ): APIPromise { const { id, language, ...body } = params; return this._client.post(path`/creators/campaigns/${id}/leads/${leadID}/video-script/regenerate`, { query: { language }, body, ...options, }); } } export interface VideoScriptRetrieveResponse { data: VideoScriptRetrieveResponse.Data; /** * Indicates if the request was successful */ success: boolean; } export namespace VideoScriptRetrieveResponse { export interface Data { brand: string; language: string; platform: 'tiktok' | 'youtube' | 'instagram' | 'reel'; product: string; script: Array; duration?: 'short' | 'long'; generatedAt?: string; music?: Data.Music; scriptVersion?: string; title?: string; tone?: string; } export namespace Data { export interface Script { section: 'intro' | 'hook' | 'body' | 'cta'; onScreenLink?: string; overlayText?: string; productDisplay?: string; visuals?: Array; voiceover?: string; } export interface Music { track: string; type?: string; volume?: 'low' | 'medium' | 'medium-low' | 'high'; } } } export interface VideoScriptRegenerateResponse { data: VideoScriptRegenerateResponse.Data; /** * Success message */ message: string; /** * Indicates if the regeneration was successful */ success: boolean; } export namespace VideoScriptRegenerateResponse { export interface Data { brand: string; language: string; platform: 'tiktok' | 'youtube' | 'instagram' | 'reel'; product: string; script: Array; duration?: 'short' | 'long'; generatedAt?: string; music?: Data.Music; scriptVersion?: string; title?: string; tone?: string; } export namespace Data { export interface Script { section: 'intro' | 'hook' | 'body' | 'cta'; onScreenLink?: string; overlayText?: string; productDisplay?: string; visuals?: Array; voiceover?: string; } export interface Music { track: string; type?: string; volume?: 'low' | 'medium' | 'medium-low' | 'high'; } } } export interface VideoScriptRetrieveParams { /** * Campaign ID or Virtual Campaign ID (with platform suffix) */ id: string; } export interface VideoScriptRegenerateParams { /** * Path param: Campaign ID */ id: string; /** * Query param: Language code for the video script (e.g., en-US, es-AR, fr-FR) */ language?: string; } export declare namespace VideoScript { export { type VideoScriptRetrieveResponse as VideoScriptRetrieveResponse, type VideoScriptRegenerateResponse as VideoScriptRegenerateResponse, type VideoScriptRetrieveParams as VideoScriptRetrieveParams, type VideoScriptRegenerateParams as VideoScriptRegenerateParams, }; }