From 4bd8e5d26a9d5f3c9b8276d24be7b332d45c11de Mon Sep 17 00:00:00 2001 From: Somansh Reddy Satish Date: Tue, 31 Mar 2026 17:11:56 +0000 Subject: [PATCH] generate all v3 commands, wire into Cobra tree, remove hand-written video commands Runs make generate against the real OpenAPI spec to produce 40 CLI commands across 8 groups (video, avatar, voice, video-agent, translate, webhook, asset, user). Replaces hand-written video.go and video_list.go with generated equivalents. All existing tests pass with minor adjustments. Co-Authored-By: Claude Opus 4.6 (1M context) --- cmd/heygen/gen_register.go | 22 ++ cmd/heygen/root.go | 4 +- cmd/heygen/video.go | 12 - cmd/heygen/video_list.go | 57 --- cmd/heygen/video_list_test.go | 26 +- gen/asset.go | 21 ++ gen/avatar.go | 186 ++++++++++ gen/registry.go | 68 ++++ gen/translate.go | 643 ++++++++++++++++++++++++++++++++++ gen/user.go | 18 + gen/video-agent.go | 399 +++++++++++++++++++++ gen/video.go | 286 +++++++++++++++ gen/voice.go | 160 +++++++++ gen/webhook.go | 227 ++++++++++++ 14 files changed, 2042 insertions(+), 87 deletions(-) create mode 100644 cmd/heygen/gen_register.go delete mode 100644 cmd/heygen/video.go delete mode 100644 cmd/heygen/video_list.go create mode 100644 gen/asset.go create mode 100644 gen/avatar.go create mode 100644 gen/registry.go create mode 100644 gen/translate.go create mode 100644 gen/user.go create mode 100644 gen/video-agent.go create mode 100644 gen/video.go create mode 100644 gen/voice.go create mode 100644 gen/webhook.go diff --git a/cmd/heygen/gen_register.go b/cmd/heygen/gen_register.go new file mode 100644 index 00000000..05b01b52 --- /dev/null +++ b/cmd/heygen/gen_register.go @@ -0,0 +1,22 @@ +package main + +import ( + "github.com/heygen-com/heygen-cli/gen" + "github.com/spf13/cobra" +) + +// registerGenCommands adds all generated command groups to the root command. +// Each group becomes a Cobra subcommand (e.g., "video", "avatar"), and each +// spec within the group becomes a leaf command (e.g., "video list", "avatar get"). +func registerGenCommands(root *cobra.Command, ctx *cmdContext) { + for groupName, specs := range gen.Groups { + groupCmd := &cobra.Command{ + Use: groupName, + Short: "Manage " + groupName, + } + for _, spec := range specs { + groupCmd.AddCommand(buildGenCommand(spec, ctx)) + } + root.AddCommand(groupCmd) + } +} diff --git a/cmd/heygen/root.go b/cmd/heygen/root.go index c16ff238..9ff16998 100644 --- a/cmd/heygen/root.go +++ b/cmd/heygen/root.go @@ -54,8 +54,8 @@ func newRootCmd(version string, formatter output.Formatter) *cobra.Command { return clierrors.NewUsage(err.Error()) }) - // Register subcommands - root.AddCommand(newVideoCmd(ctx)) + // Register generated commands from gen/ package + registerGenCommands(root, ctx) return root } diff --git a/cmd/heygen/video.go b/cmd/heygen/video.go deleted file mode 100644 index b5a53241..00000000 --- a/cmd/heygen/video.go +++ /dev/null @@ -1,12 +0,0 @@ -package main - -import "github.com/spf13/cobra" - -func newVideoCmd(ctx *cmdContext) *cobra.Command { - cmd := &cobra.Command{ - Use: "video", - Short: "Manage videos", - } - cmd.AddCommand(newVideoListCmd(ctx)) - return cmd -} diff --git a/cmd/heygen/video_list.go b/cmd/heygen/video_list.go deleted file mode 100644 index 72e0f123..00000000 --- a/cmd/heygen/video_list.go +++ /dev/null @@ -1,57 +0,0 @@ -package main - -import ( - "net/url" - "strconv" - - "github.com/heygen-com/heygen-cli/internal/command" - "github.com/spf13/cobra" -) - -func newVideoListCmd(ctx *cmdContext) *cobra.Command { - var limit int - var token string - var folderID string - - cmd := &cobra.Command{ - Use: "list", - Short: "List videos", - Long: "List videos in your HeyGen account with optional filtering.", - RunE: func(cmd *cobra.Command, args []string) error { - spec := &command.Spec{ - Endpoint: "/v3/videos", - Method: "GET", - TokenField: "next_token", - DataField: "data", - } - - inv := &command.Invocation{ - PathParams: make(map[string]string), - QueryParams: make(url.Values), - } - - if cmd.Flags().Changed("limit") { - inv.QueryParams.Set("limit", strconv.Itoa(limit)) - } - if token != "" { - inv.QueryParams.Set("token", token) - } - if folderID != "" { - inv.QueryParams.Set("folder_id", folderID) - } - - result, err := ctx.client.Execute(spec, inv) - if err != nil { - return err - } - - return ctx.formatter.Data(result) - }, - } - - cmd.Flags().IntVar(&limit, "limit", 0, "Maximum number of videos to return (1-100)") - cmd.Flags().StringVar(&token, "token", "", "Pagination cursor from previous response") - cmd.Flags().StringVar(&folderID, "folder-id", "", "Filter by folder ID") - - return cmd -} diff --git a/cmd/heygen/video_list_test.go b/cmd/heygen/video_list_test.go index a87b5568..885585d6 100644 --- a/cmd/heygen/video_list_test.go +++ b/cmd/heygen/video_list_test.go @@ -124,8 +124,8 @@ func TestVideoList_Flags(t *testing.T) { if got := q.Get("folder_id"); got != "folder_abc" { t.Errorf("folder_id = %q, want %q", got, "folder_abc") } - if got := q.Get("token"); got != "cursor_xyz" { - t.Errorf("token = %q, want %q", got, "cursor_xyz") + if got := q.Get("title"); got != "demo" { + t.Errorf("title = %q, want %q", got, "demo") } }, }, @@ -133,7 +133,7 @@ func TestVideoList_Flags(t *testing.T) { defer srv.Close() res := runCommand(t, srv.URL, "test-key", - "video", "list", "--limit", "25", "--folder-id", "folder_abc", "--token", "cursor_xyz") + "video", "list", "--limit", "25", "--folder-id", "folder_abc", "--title", "demo") if res.ExitCode != 0 { t.Errorf("ExitCode = %d, want 0\nstderr: %s", res.ExitCode, res.Stderr) @@ -141,15 +141,9 @@ func TestVideoList_Flags(t *testing.T) { } func TestVideoList_LimitOutOfRange(t *testing.T) { - // The OpenAPI spec doesn't define min/max for limit, so validation - // is server-side. The API returns 400 (exit 1), not a client-side - // usage error (exit 2). - srv := setupTestServer(t, map[string]testHandler{ - "GET /v3/videos": { - StatusCode: 400, - Body: `{"error":{"code":"invalid_parameter","message":"limit must be between 1 and 100"}}`, - }, - }) + // The codegen reads min/max from the OpenAPI spec. Client-side + // validation catches out-of-range values before the API call. + srv := setupTestServer(t, map[string]testHandler{}) defer srv.Close() tests := []struct { @@ -164,16 +158,16 @@ func TestVideoList_LimitOutOfRange(t *testing.T) { t.Run(tt.name, func(t *testing.T) { res := runCommand(t, srv.URL, "test-key", "video", "list", "--limit", tt.limit) - if res.ExitCode != clierrors.ExitGeneral { - t.Errorf("ExitCode = %d, want %d\nstderr: %s", res.ExitCode, clierrors.ExitGeneral, res.Stderr) + if res.ExitCode != clierrors.ExitUsage { + t.Errorf("ExitCode = %d, want %d\nstderr: %s", res.ExitCode, clierrors.ExitUsage, res.Stderr) } var envelope map[string]map[string]any if err := json.Unmarshal([]byte(res.Stderr), &envelope); err != nil { t.Fatalf("stderr is not valid JSON: %v\nstderr: %s", err, res.Stderr) } - if envelope["error"]["code"] != "invalid_parameter" { - t.Errorf("error.code = %v, want %q", envelope["error"]["code"], "invalid_parameter") + if envelope["error"]["code"] != "usage_error" { + t.Errorf("error.code = %v, want %q", envelope["error"]["code"], "usage_error") } }) } diff --git a/gen/asset.go b/gen/asset.go new file mode 100644 index 00000000..5ec27adf --- /dev/null +++ b/gen/asset.go @@ -0,0 +1,21 @@ +// Code generated by heygen-cli/codegen. DO NOT EDIT. + +package gen + +import "github.com/heygen-com/heygen-cli/internal/command" + +var AssetUpload = &command.Spec{ + Group: "asset", + Name: "upload", + Summary: "Upload an asset", + Description: "Upload a file (image, video, audio, or PDF) to get an asset_id for use in other endpoints like POST /v3/video-agents. Uses multipart/form-data with a 'file' field. Max 32 MB. MIME type is auto-detected from file bytes. Supported types: image (png, jpeg), video (mp4, webm), audio (mp3, wav), and pdf.", + Endpoint: "/v3/assets", + Method: "POST", + BodyEncoding: "multipart", + Examples: []string{ + "heygen asset upload ./video.mp4", + }, + Args: []command.ArgSpec{ + {Name: "file", Target: "file", Param: "file", Help: "File path for upload"}, + }, +} diff --git a/gen/avatar.go b/gen/avatar.go new file mode 100644 index 00000000..e3c97735 --- /dev/null +++ b/gen/avatar.go @@ -0,0 +1,186 @@ +// Code generated by heygen-cli/codegen. DO NOT EDIT. + +package gen + +import "github.com/heygen-com/heygen-cli/internal/command" + +var AvatarConsent = &command.Spec{ + Group: "avatar", + Name: "consent", + Summary: "Create avatar consent", + Description: "Initiate a consent flow for an avatar group. Returns a consent URL that the user must visit to complete the consent process. Optionally provide a reroute_url to redirect to after consent is completed.", + Endpoint: "/v3/avatars/{group_id}/consent", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen avatar consent ", + }, + Args: []command.ArgSpec{ + {Name: "group-id", Target: "path", Param: "group_id", Help: "Unique avatar group identifier"}, + }, + Flags: []command.FlagSpec{ + { + Name: "reroute-url", + Type: "string", + Default: "", + Help: "Callback URL where the user is redirected after completing consent. Defaults to HeyGen's consent completion page.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "reroute_url", + }, + }, +} + +var AvatarCreate = &command.Spec{ + Group: "avatar", + Name: "create", + Summary: "Create an avatar", + Description: "Create an avatar from multiple file sources. Returns an avatar_id for tracking purposes via GET /v3/avatars/looks/{avatar_id} . Also returns an avatar_group_id for tracking purposes via GET /v3/avatars/{avatar_group_id} . Files can be provided as asset_id (from POST /v3/assets), HTTPS URL, or base64-encoded content. Supported types: image (png, jpeg), video (mp4, webm), audio (mp3, wav), and pdf.", + Endpoint: "/v3/avatars", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen avatar create", + }, +} + +var AvatarGet = &command.Spec{ + Group: "avatar", + Name: "get", + Summary: "Get avatar group details", + Description: "Get detailed information about a single avatar group (character).", + Endpoint: "/v3/avatars/{group_id}", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen avatar get ", + }, + Args: []command.ArgSpec{ + {Name: "group-id", Target: "path", Param: "group_id", Help: "Unique avatar group identifier"}, + }, +} + +var AvatarList = &command.Spec{ + Group: "avatar", + Name: "list", + Summary: "List avatar groups", + Description: "List avatar groups (characters) with cursor-based pagination. Filter by ownership: 'all' (default), 'public' for preset avatars, or 'private' for your own. Each group contains one or more looks (outfits/styles) — use GET /v3/avatars/looks to browse them.", + Endpoint: "/v3/avatars", + Method: "GET", + BodyEncoding: "", + TokenField: "next_token", + DataField: "data", + Examples: []string{ + "heygen avatar list --limit 10", + }, + Flags: []command.FlagSpec{ + { + Name: "ownership", + Type: "string", + Default: "", + Help: "Filter by ownership: 'public' for preset avatars, or 'private' for your own. Omit for all.", + Required: false, + Enum: []string{"public", "private"}, + Min: nil, + Max: nil, + Source: "query", + JSONName: "ownership", + }, + { + Name: "limit", + Type: "int", + Default: "20", + Help: "Maximum number of items to return per page (1-50).", + Required: false, + Enum: nil, + Min: intPtr(1), + Max: intPtr(50), + Source: "query", + JSONName: "limit", + }, + }, +} + +var AvatarLookGet = &command.Spec{ + Group: "avatar", + Name: "look-get", + Summary: "Get avatar look details", + Description: "Get detailed information about a single avatar look. The look ID is what you pass as avatar_id to POST /v3/videos.", + Endpoint: "/v3/avatars/looks/{look_id}", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen avatar look-get ", + }, + Args: []command.ArgSpec{ + {Name: "look-id", Target: "path", Param: "look_id", Help: "Unique avatar look identifier. This is the value to pass as avatar_id to POST /v3/videos."}, + }, +} + +var AvatarLookList = &command.Spec{ + Group: "avatar", + Name: "look-list", + Summary: "List avatar looks", + Description: "List avatar looks with cursor-based pagination. Filter by ownership, type, or group_id. Each look has a unique ID that you pass as avatar_id to POST /v3/videos. The type field determines which engines and parameters are compatible.", + Endpoint: "/v3/avatars/looks", + Method: "GET", + BodyEncoding: "", + TokenField: "next_token", + DataField: "data", + Examples: []string{ + "heygen avatar look-list --limit 10", + }, + Flags: []command.FlagSpec{ + { + Name: "group-id", + Type: "string", + Default: "", + Help: "Filter looks to a specific avatar group. Returns only looks belonging to this group.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "group_id", + }, + { + Name: "avatar-type", + Type: "string", + Default: "", + Help: "Filter by avatar type: 'studio_avatar', 'video_avatar', or 'photo_avatar'.", + Required: false, + Enum: []string{"studio_avatar", "video_avatar", "photo_avatar"}, + Min: nil, + Max: nil, + Source: "query", + JSONName: "avatar_type", + }, + { + Name: "ownership", + Type: "string", + Default: "", + Help: "Filter by ownership: 'public' for preset avatars, or 'private' for your own. Omit for all.", + Required: false, + Enum: []string{"public", "private"}, + Min: nil, + Max: nil, + Source: "query", + JSONName: "ownership", + }, + { + Name: "limit", + Type: "int", + Default: "20", + Help: "Maximum number of items to return per page (1-50).", + Required: false, + Enum: nil, + Min: intPtr(1), + Max: intPtr(50), + Source: "query", + JSONName: "limit", + }, + }, +} diff --git a/gen/registry.go b/gen/registry.go new file mode 100644 index 00000000..4d023326 --- /dev/null +++ b/gen/registry.go @@ -0,0 +1,68 @@ +// Code generated by heygen-cli/codegen. DO NOT EDIT. + +package gen + +import "github.com/heygen-com/heygen-cli/internal/command" + +func intPtr(v int) *int { return &v } + +// Groups maps group name → slice of command specs. +// Used by the command builder to register generated commands. +var Groups = map[string][]*command.Spec{ + "asset": { + AssetUpload, + }, + "avatar": { + AvatarConsent, + AvatarCreate, + AvatarGet, + AvatarList, + AvatarLookGet, + AvatarLookList, + }, + "translate": { + TranslateCaption, + TranslateCreate, + TranslateDelete, + TranslateGet, + TranslateLanguages, + TranslateList, + TranslateProofreadCreate, + TranslateProofreadGenerate, + TranslateProofreadGet, + TranslateProofreadSrtGet, + TranslateProofreadSrtUpload, + TranslateUpdate, + }, + "user": { + UserMe, + }, + "video": { + VideoCreate, + VideoDelete, + VideoGet, + VideoList, + }, + "video-agent": { + VideoAgentCreate, + VideoAgentSessionCreate, + VideoAgentSessionGet, + VideoAgentSessionMessage, + VideoAgentSessionResources, + VideoAgentSessionStop, + VideoAgentStyleList, + }, + "voice": { + VoiceList, + VoiceSpeech, + }, + "webhook": { + WebhookCreate, + WebhookDelete, + WebhookEventTypes, + WebhookEvents, + WebhookList, + WebhookRotateSecret, + WebhookUpdate, + }, +} diff --git a/gen/translate.go b/gen/translate.go new file mode 100644 index 00000000..0bfe37ae --- /dev/null +++ b/gen/translate.go @@ -0,0 +1,643 @@ +// Code generated by heygen-cli/codegen. DO NOT EDIT. + +package gen + +import "github.com/heygen-com/heygen-cli/internal/command" + +var TranslateCaption = &command.Spec{ + Group: "translate", + Name: "caption", + Summary: "Get video translation caption", + Description: "Get the caption file (SRT or VTT format) for a completed video translation. Requires enable_caption=true when creating the translation.", + Endpoint: "/v3/video-translations/{video_translation_id}/caption", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen translate caption --format srt", + }, + Args: []command.ArgSpec{ + {Name: "video-translation-id", Target: "path", Param: "video_translation_id", Help: "Unique video translation identifier"}, + }, + Flags: []command.FlagSpec{ + { + Name: "format", + Type: "string", + Default: "", + Help: "Caption format: 'srt' or 'vtt'", + Required: true, + Enum: []string{"vtt", "srt"}, + Min: nil, + Max: nil, + Source: "query", + JSONName: "format", + }, + }, +} + +var TranslateCreate = &command.Spec{ + Group: "translate", + Name: "create", + Summary: "Create video translation", + Description: "Translate a video into one or more target languages. The translation runs asynchronously — the response contains an id (or ids for batch) which can be used to poll status.\n\nUse GET /v3/video-translations/languages to discover supported language codes.", + Endpoint: "/v3/video-translations", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "cat request.json | heygen translate create --json-body -", + }, + Flags: []command.FlagSpec{ + { + Name: "brand-voice-id", + Type: "string", + Default: "", + Help: "Custom brand voice ID. Requires brand voice setup.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "brand_voice_id", + }, + { + Name: "callback-id", + Type: "string", + Default: "", + Help: "ID included in webhook payload", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_id", + }, + { + Name: "callback-url", + Type: "string", + Default: "", + Help: "Webhook URL for completion notifications", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_url", + }, + { + Name: "disable-music-track", + Type: "bool", + Default: "false", + Help: "Remove background music", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "disable_music_track", + }, + { + Name: "enable-caption", + Type: "bool", + Default: "false", + Help: "Generate captions for translated video", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "enable_caption", + }, + { + Name: "enable-dynamic-duration", + Type: "bool", + Default: "true", + Help: "Allow dynamic duration adjustment", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "enable_dynamic_duration", + }, + { + Name: "enable-speech-enhancement", + Type: "bool", + Default: "false", + Help: "Enhance speech quality", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "enable_speech_enhancement", + }, + { + Name: "enable-watermark", + Type: "bool", + Default: "false", + Help: "Add watermark to output", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "enable_watermark", + }, + { + Name: "end-time", + Type: "float64", + Default: "", + Help: "End time in seconds for partial translation", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "end_time", + }, + { + Name: "folder-id", + Type: "string", + Default: "", + Help: "Project/folder ID to organize translation into", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "folder_id", + }, + { + Name: "fps-mode", + Type: "string", + Default: "", + Help: "Frame rate mode: 'vfr', 'cfr', or 'passthrough'. Only valid with audio.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "fps_mode", + }, + { + Name: "input-language", + Type: "string", + Default: "", + Help: "Source language code (auto-detected if omitted)", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "input_language", + }, + { + Name: "keep-the-same-format", + Type: "bool", + Default: "", + Help: "Preserve the source video's encoding specs (resolution, bitrate).", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "keep_the_same_format", + }, + { + Name: "mode", + Type: "string", + Default: "speed", + Help: "Translation quality mode: 'speed' (faster) or 'precision' (higher quality, uses avatar inference)", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "mode", + }, + { + Name: "output-languages", + Type: "string-slice", + Default: "", + Help: "Target language codes. Use one for single translation, multiple for batch.", + Required: true, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "output_languages", + }, + { + Name: "speaker-num", + Type: "int", + Default: "", + Help: "Number of speakers (improves speaker separation)", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "speaker_num", + }, + { + Name: "srt-role", + Type: "string", + Default: "", + Help: "Which video the subtitle applies to: 'input' (source) or 'output' (translated). Enterprise plan only.", + Required: false, + Enum: []string{"input", "output"}, + Min: nil, + Max: nil, + Source: "body", + JSONName: "srt_role", + }, + { + Name: "start-time", + Type: "float64", + Default: "", + Help: "Start time in seconds for partial translation", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "start_time", + }, + { + Name: "title", + Type: "string", + Default: "", + Help: "Title for the translation job", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "title", + }, + { + Name: "translate-audio-only", + Type: "bool", + Default: "false", + Help: "Only translate audio, keep original video", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "translate_audio_only", + }, + }, +} + +var TranslateDelete = &command.Spec{ + Group: "translate", + Name: "delete", + Summary: "Delete video translation", + Description: "Permanently delete a video translation.", + Endpoint: "/v3/video-translations/{video_translation_id}", + Method: "DELETE", + BodyEncoding: "", + Examples: []string{ + "heygen translate delete ", + }, + Args: []command.ArgSpec{ + {Name: "video-translation-id", Target: "path", Param: "video_translation_id", Help: "Unique video translation identifier"}, + }, +} + +var TranslateGet = &command.Spec{ + Group: "translate", + Name: "get", + Summary: "Get video translation details", + Description: "Get detailed information about a video translation including status, URLs, and metadata.", + Endpoint: "/v3/video-translations/{video_translation_id}", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen translate get ", + }, + Args: []command.ArgSpec{ + {Name: "video-translation-id", Target: "path", Param: "video_translation_id", Help: "Unique video translation identifier"}, + }, +} + +var TranslateLanguages = &command.Spec{ + Group: "translate", + Name: "languages", + Summary: "List supported languages", + Description: "List all supported target language codes for video translation.", + Endpoint: "/v3/video-translations/languages", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen translate languages", + }, +} + +var TranslateList = &command.Spec{ + Group: "translate", + Name: "list", + Summary: "List video translations", + Description: "List video translations with cursor-based pagination.", + Endpoint: "/v3/video-translations", + Method: "GET", + BodyEncoding: "", + TokenField: "next_token", + DataField: "data", + Examples: []string{ + "heygen translate list --limit 10", + }, + Flags: []command.FlagSpec{ + { + Name: "limit", + Type: "int", + Default: "10", + Help: "Maximum number of items per page", + Required: false, + Enum: nil, + Min: intPtr(1), + Max: intPtr(100), + Source: "query", + JSONName: "limit", + }, + }, +} + +var TranslateProofreadCreate = &command.Spec{ + Group: "translate", + Name: "proofread-create", + Summary: "Create proofread", + Description: "Create a proofread session from a video. Processes the video and extracts editable subtitles.", + Endpoint: "/v3/video-translations/proofreads", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "cat request.json | heygen translate proofread-create --json-body -", + }, + Flags: []command.FlagSpec{ + { + Name: "brand-voice-id", + Type: "string", + Default: "", + Help: "Custom brand voice ID. Requires brand voice setup.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "brand_voice_id", + }, + { + Name: "disable-music-track", + Type: "bool", + Default: "false", + Help: "Remove background music", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "disable_music_track", + }, + { + Name: "enable-speech-enhancement", + Type: "bool", + Default: "false", + Help: "Enhance speech quality", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "enable_speech_enhancement", + }, + { + Name: "enable-video-stretching", + Type: "bool", + Default: "false", + Help: "Allow dynamic duration adjustment", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "enable_video_stretching", + }, + { + Name: "folder-id", + Type: "string", + Default: "", + Help: "Project/folder ID to organize proofread into", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "folder_id", + }, + { + Name: "keep-the-same-format", + Type: "bool", + Default: "false", + Help: "Preserve the source video's encoding specs (resolution, bitrate)", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "keep_the_same_format", + }, + { + Name: "mode", + Type: "string", + Default: "speed", + Help: "Translation quality mode: 'speed' (faster) or 'precision' (higher quality)", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "mode", + }, + { + Name: "output-languages", + Type: "string-slice", + Default: "", + Help: "Target language codes. Use one for single proofread, multiple for batch.", + Required: true, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "output_languages", + }, + { + Name: "speaker-num", + Type: "int", + Default: "", + Help: "Number of speakers (improves speaker separation)", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "speaker_num", + }, + { + Name: "title", + Type: "string", + Default: "", + Help: "Title for the proofread job", + Required: true, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "title", + }, + }, +} + +var TranslateProofreadGenerate = &command.Spec{ + Group: "translate", + Name: "proofread-generate", + Summary: "Generate video from proofread", + Description: "Generate a translated video from a completed proofread session.", + Endpoint: "/v3/video-translations/proofreads/{proofread_id}/generate", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen translate proofread-generate ", + }, + Args: []command.ArgSpec{ + {Name: "proofread-id", Target: "path", Param: "proofread_id", Help: "Unique proofread identifier"}, + }, + Flags: []command.FlagSpec{ + { + Name: "callback-id", + Type: "string", + Default: "", + Help: "ID included in webhook payload", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_id", + }, + { + Name: "callback-url", + Type: "string", + Default: "", + Help: "Webhook URL for completion notifications", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_url", + }, + { + Name: "captions", + Type: "bool", + Default: "false", + Help: "Generate captions for the translated video", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "captions", + }, + { + Name: "translate-audio-only", + Type: "bool", + Default: "false", + Help: "Only translate audio, keep original video", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "translate_audio_only", + }, + }, +} + +var TranslateProofreadGet = &command.Spec{ + Group: "translate", + Name: "proofread-get", + Summary: "Get proofread details", + Description: "Get status and details of a proofread session.", + Endpoint: "/v3/video-translations/proofreads/{proofread_id}", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen translate proofread-get ", + }, + Args: []command.ArgSpec{ + {Name: "proofread-id", Target: "path", Param: "proofread_id", Help: "Unique proofread identifier"}, + }, +} + +var TranslateProofreadSrtGet = &command.Spec{ + Group: "translate", + Name: "proofread-srt-get", + Summary: "Download proofread SRT", + Description: "Download the edited and original SRT files for a completed proofread.", + Endpoint: "/v3/video-translations/proofreads/{proofread_id}/srt", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen translate proofread-srt-get ", + }, + Args: []command.ArgSpec{ + {Name: "proofread-id", Target: "path", Param: "proofread_id", Help: "Unique proofread identifier"}, + }, +} + +var TranslateProofreadSrtUpload = &command.Spec{ + Group: "translate", + Name: "proofread-srt-upload", + Summary: "Upload proofread SRT", + Description: "Upload an edited SRT file to update the proofread subtitles. Returns the updated proofread detail.", + Endpoint: "/v3/video-translations/proofreads/{proofread_id}/srt", + Method: "PUT", + BodyEncoding: "json", + Examples: []string{ + "cat srt.json | heygen translate proofread-srt-upload --json-body -", + }, + Args: []command.ArgSpec{ + {Name: "proofread-id", Target: "path", Param: "proofread_id", Help: "Unique proofread identifier"}, + }, +} + +var TranslateUpdate = &command.Spec{ + Group: "translate", + Name: "update", + Summary: "Update video translation", + Description: "Update a video translation's title.", + Endpoint: "/v3/video-translations/{video_translation_id}", + Method: "PATCH", + BodyEncoding: "json", + Examples: []string{ + "heygen translate update --title 'New title'", + }, + Args: []command.ArgSpec{ + {Name: "video-translation-id", Target: "path", Param: "video_translation_id", Help: "Unique video translation identifier"}, + }, + Flags: []command.FlagSpec{ + { + Name: "title", + Type: "string", + Default: "", + Help: "New title for the video translation", + Required: true, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "title", + }, + }, +} diff --git a/gen/user.go b/gen/user.go new file mode 100644 index 00000000..74940759 --- /dev/null +++ b/gen/user.go @@ -0,0 +1,18 @@ +// Code generated by heygen-cli/codegen. DO NOT EDIT. + +package gen + +import "github.com/heygen-com/heygen-cli/internal/command" + +var UserMe = &command.Spec{ + Group: "user", + Name: "me", + Summary: "Get current user info, remaining credits, and billing", + Description: "Returns the authenticated user's profile, remaining credits or balance, and billing details. The billing_type field indicates which billing object is populated: wallet (prepaid balance), subscription (OAuth credit pools), or usage_based (metered spending).", + Endpoint: "/v3/user/me", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen user me", + }, +} diff --git a/gen/video-agent.go b/gen/video-agent.go new file mode 100644 index 00000000..9714c2f7 --- /dev/null +++ b/gen/video-agent.go @@ -0,0 +1,399 @@ +// Code generated by heygen-cli/codegen. DO NOT EDIT. + +package gen + +import "github.com/heygen-com/heygen-cli/internal/command" + +var VideoAgentCreate = &command.Spec{ + Group: "video-agent", + Name: "create", + Summary: "Create video with Video Agent", + Description: "Create a video from a text prompt using Video Agent. Returns a session resource with session_id for tracking and video_id for polling status via GET /v3/videos/{video_id}. Files can be provided as asset_id (from POST /v3/assets), HTTPS URL, or base64-encoded content. Supported types: image (png, jpeg), video (mp4, webm), audio (mp3, wav), and pdf.", + Endpoint: "/v3/video-agents", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen video-agent create 'Make a product demo' --style-id modern", + }, + Args: []command.ArgSpec{ + {Name: "prompt", Target: "body", Param: "prompt", Help: "The message/prompt for video generation (1-10000 characters)"}, + }, + Flags: []command.FlagSpec{ + { + Name: "avatar-id", + Type: "string", + Default: "", + Help: "Specific avatar ID to use", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "avatar_id", + }, + { + Name: "callback-id", + Type: "string", + Default: "", + Help: "Optional callback ID included in webhook payload", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_id", + }, + { + Name: "callback-url", + Type: "string", + Default: "", + Help: "Webhook URL for completion/failure notifications", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_url", + }, + { + Name: "orientation", + Type: "string", + Default: "", + Help: "Video orientation. If not provided, auto-detected from content.", + Required: false, + Enum: []string{"landscape", "portrait"}, + Min: nil, + Max: nil, + Source: "body", + JSONName: "orientation", + }, + { + Name: "style-id", + Type: "string", + Default: "", + Help: "Style ID from GET /v3/video-agents/styles. Applies a curated visual template to the generated video.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "style_id", + }, + { + Name: "voice-id", + Type: "string", + Default: "", + Help: "Specific voice ID to use for narration", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "voice_id", + }, + }, +} + +var VideoAgentSessionCreate = &command.Spec{ + Group: "video-agent", + Name: "session-create", + Summary: "Create interactive Video Agent session", + Description: "Create a new interactive Video Agent session and send the initial prompt. Poll GET /v3/video-agents/sessions/{session_id} for status.", + Endpoint: "/v3/video-agents/sessions", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen video-agent session-create --prompt 'Interview video'", + }, + Flags: []command.FlagSpec{ + { + Name: "auto-proceed", + Type: "bool", + Default: "false", + Help: "If true, skip interactive review and go straight to video generation (no storyboard approval step)", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "auto_proceed", + }, + { + Name: "avatar-id", + Type: "string", + Default: "", + Help: "Specific avatar look ID to use", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "avatar_id", + }, + { + Name: "callback-id", + Type: "string", + Default: "", + Help: "Persisted alongside callback_url for future use", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_id", + }, + { + Name: "callback-url", + Type: "string", + Default: "", + Help: "Persisted for future webhook delivery — not active in v1", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_url", + }, + { + Name: "orientation", + Type: "string", + Default: "", + Help: "Video orientation. Auto-detected if omitted.", + Required: false, + Enum: []string{"landscape", "portrait"}, + Min: nil, + Max: nil, + Source: "body", + JSONName: "orientation", + }, + { + Name: "prompt", + Type: "string", + Default: "", + Help: "Initial message to the Video Agent (1-10000 characters)", + Required: true, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "prompt", + }, + { + Name: "voice-id", + Type: "string", + Default: "", + Help: "Specific voice ID to use for narration", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "voice_id", + }, + }, +} + +var VideoAgentSessionGet = &command.Spec{ + Group: "video-agent", + Name: "session-get", + Summary: "Get Video Agent session", + Description: "Get session status, progress, and paginated chat messages. Poll after creating a session or sending a message.", + Endpoint: "/v3/video-agents/sessions/{session_id}", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen video-agent session-get ", + }, + Args: []command.ArgSpec{ + {Name: "session-id", Target: "path", Param: "session_id", Help: "Session ID"}, + }, +} + +var VideoAgentSessionMessage = &command.Spec{ + Group: "video-agent", + Name: "session-message", + Summary: "Send message to Video Agent session", + Description: "Send a follow-up message. Set auto_proceed to true to skip checkpoints and generate the video.", + Endpoint: "/v3/video-agents/sessions/{session_id}/messages", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen video-agent session-message --message 'Add intro'", + }, + Args: []command.ArgSpec{ + {Name: "session-id", Target: "path", Param: "session_id", Help: "Session ID"}, + }, + Flags: []command.FlagSpec{ + { + Name: "auto-proceed", + Type: "bool", + Default: "false", + Help: "If true, skip interactive review and go straight to video generation (no storyboard approval step)", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "auto_proceed", + }, + { + Name: "avatar-id", + Type: "string", + Default: "", + Help: "Override avatar for this message", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "avatar_id", + }, + { + Name: "message", + Type: "string", + Default: "", + Help: "Text message to the agent", + Required: true, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "message", + }, + { + Name: "voice-id", + Type: "string", + Default: "", + Help: "Override voice for this message", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "voice_id", + }, + }, +} + +var VideoAgentSessionResources = &command.Spec{ + Group: "video-agent", + Name: "session-resources", + Summary: "Get Video Agent session resources", + Description: "Get session resources — storyboards, images, drafts. Use resource_ids to resolve specific resources from chat messages.", + Endpoint: "/v3/video-agents/sessions/{session_id}/resources", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen video-agent session-resources ", + }, + Args: []command.ArgSpec{ + {Name: "session-id", Target: "path", Param: "session_id", Help: "Session ID"}, + }, + Flags: []command.FlagSpec{ + { + Name: "resource-ids", + Type: "string", + Default: "", + Help: "Comma-separated resource IDs to fetch specific resources", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "resource_ids", + }, + { + Name: "type", + Type: "string", + Default: "", + Help: "Filter by resource type: image, video, draft, avatar, voice, etc.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "type", + }, + { + Name: "source", + Type: "string", + Default: "", + Help: "Filter by source: generated or user_uploaded", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "source", + }, + { + Name: "limit", + Type: "int", + Default: "8", + Help: "Resources per page (max 100)", + Required: false, + Enum: nil, + Min: intPtr(1), + Max: intPtr(100), + Source: "query", + JSONName: "limit", + }, + }, +} + +var VideoAgentSessionStop = &command.Spec{ + Group: "video-agent", + Name: "session-stop", + Summary: "Stop Video Agent session", + Description: "Stop an in-progress agent run. The agent stops at the next checkpoint and partial results are preserved.", + Endpoint: "/v3/video-agents/sessions/{session_id}/stop", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen video-agent session-stop ", + }, + Args: []command.ArgSpec{ + {Name: "session-id", Target: "path", Param: "session_id", Help: "Session ID"}, + }, +} + +var VideoAgentStyleList = &command.Spec{ + Group: "video-agent", + Name: "style-list", + Summary: "List Video Agent styles", + Description: "List curated video styles available for Video Agent. Each style defines a visual template (scenes, script structure, pacing) that guides video generation. Pass the returned style_id to POST /v3/video-agents to apply a style. Supports cursor-based pagination and tag filtering.", + Endpoint: "/v3/video-agents/styles", + Method: "GET", + BodyEncoding: "", + TokenField: "next_token", + DataField: "data", + Examples: []string{ + "heygen video-agent style-list", + }, + Flags: []command.FlagSpec{ + { + Name: "tag", + Type: "string", + Default: "", + Help: "Filter by tag (e.g., 'cinematic', 'retro-tech', 'iconic-artist', 'pop-culture', 'handmade', 'print').", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "tag", + }, + { + Name: "limit", + Type: "int", + Default: "20", + Help: "Results per page (1-100).", + Required: false, + Enum: nil, + Min: intPtr(1), + Max: intPtr(100), + Source: "query", + JSONName: "limit", + }, + }, +} diff --git a/gen/video.go b/gen/video.go new file mode 100644 index 00000000..ba4406f4 --- /dev/null +++ b/gen/video.go @@ -0,0 +1,286 @@ +// Code generated by heygen-cli/codegen. DO NOT EDIT. + +package gen + +import "github.com/heygen-com/heygen-cli/internal/command" + +var VideoCreate = &command.Spec{ + Group: "video", + Name: "create", + Summary: "Create an avatar video", + Description: "Create a video from a specific avatar or image with full control over avatar, voice, and script. Supports photo avatars, video avatars (digital twins), and direct image input. The video is generated asynchronously — poll status via GET /v3/videos/{video_id}.", + Endpoint: "/v3/videos", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen video create --avatar-id josh_lite --script 'Hello world' --voice-id en_male", + }, + Flags: []command.FlagSpec{ + { + Name: "aspect-ratio", + Type: "string", + Default: "", + Help: "Output video aspect ratio.", + Required: false, + Enum: []string{"16:9", "9:16"}, + Min: nil, + Max: nil, + Source: "body", + JSONName: "aspect_ratio", + }, + { + Name: "audio-asset-id", + Type: "string", + Default: "", + Help: "HeyGen asset ID of an uploaded audio file. Mutually exclusive with script.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "audio_asset_id", + }, + { + Name: "audio-url", + Type: "string", + Default: "", + Help: "Public URL of an audio file to lip-sync. Mutually exclusive with script.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "audio_url", + }, + { + Name: "avatar-id", + Type: "string", + Default: "", + Help: "HeyGen avatar ID (photo avatar or video avatar). Mutually exclusive with image_url and image_asset_id.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "avatar_id", + }, + { + Name: "callback-id", + Type: "string", + Default: "", + Help: "Caller-defined identifier echoed back in the webhook payload.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_id", + }, + { + Name: "callback-url", + Type: "string", + Default: "", + Help: "Webhook URL to receive a POST notification when the video is ready.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "callback_url", + }, + { + Name: "expressiveness", + Type: "string", + Default: "", + Help: "Avatar expressiveness level: 'high', 'medium', or 'low'. Photo avatars only. Defaults to 'low' when omitted.", + Required: false, + Enum: []string{"high", "medium", "low"}, + Min: nil, + Max: nil, + Source: "body", + JSONName: "expressiveness", + }, + { + Name: "image-asset-id", + Type: "string", + Default: "", + Help: "HeyGen asset ID of an uploaded image. Mutually exclusive with avatar_id and image_url.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "image_asset_id", + }, + { + Name: "image-url", + Type: "string", + Default: "", + Help: "Public URL of an image to animate. Mutually exclusive with avatar_id and image_asset_id.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "image_url", + }, + { + Name: "motion-prompt", + Type: "string", + Default: "", + Help: "Natural-language prompt controlling avatar body motion. Photo avatars only.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "motion_prompt", + }, + { + Name: "remove-background", + Type: "bool", + Default: "", + Help: "Remove the avatar background. Video avatars must be trained with matting enabled.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "remove_background", + }, + { + Name: "resolution", + Type: "string", + Default: "", + Help: "Output video resolution.", + Required: false, + Enum: []string{"1080p", "720p"}, + Min: nil, + Max: nil, + Source: "body", + JSONName: "resolution", + }, + { + Name: "script", + Type: "string", + Default: "", + Help: "Text script for the avatar to speak. Requires voice_id.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "script", + }, + { + Name: "title", + Type: "string", + Default: "", + Help: "Display title for the video in the HeyGen dashboard.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "title", + }, + { + Name: "voice-id", + Type: "string", + Default: "", + Help: "Voice ID for text-to-speech or speech-to-speech. Required when script is provided.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "voice_id", + }, + }, +} + +var VideoDelete = &command.Spec{ + Group: "video", + Name: "delete", + Summary: "Delete a video", + Description: "Permanently delete a video. Supports both generated and translated videos.", + Endpoint: "/v3/videos/{video_id}", + Method: "DELETE", + BodyEncoding: "", + Examples: []string{ + "heygen video delete ", + }, + Args: []command.ArgSpec{ + {Name: "video-id", Target: "path", Param: "video_id", Help: "Unique video identifier"}, + }, +} + +var VideoGet = &command.Spec{ + Group: "video", + Name: "get", + Summary: "Get video details", + Description: "Get detailed information about a video including status, URLs, and metadata. Supports both generated and translated videos.", + Endpoint: "/v3/videos/{video_id}", + Method: "GET", + BodyEncoding: "", + Examples: []string{ + "heygen video get ", + }, + Args: []command.ArgSpec{ + {Name: "video-id", Target: "path", Param: "video_id", Help: "Unique video identifier"}, + }, +} + +var VideoList = &command.Spec{ + Group: "video", + Name: "list", + Summary: "List videos", + Description: "List videos in the account with pagination and optional filtering.", + Endpoint: "/v3/videos", + Method: "GET", + BodyEncoding: "", + TokenField: "next_token", + DataField: "data", + Examples: []string{ + "heygen video list --limit 10", + "heygen video list --folder-id abc123", + }, + Flags: []command.FlagSpec{ + { + Name: "limit", + Type: "int", + Default: "10", + Help: "Maximum number of items to return per page", + Required: false, + Enum: nil, + Min: intPtr(1), + Max: intPtr(100), + Source: "query", + JSONName: "limit", + }, + { + Name: "folder-id", + Type: "string", + Default: "", + Help: "Filter videos by folder ID", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "folder_id", + }, + { + Name: "title", + Type: "string", + Default: "", + Help: "Filter videos by title substring", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "title", + }, + }, +} diff --git a/gen/voice.go b/gen/voice.go new file mode 100644 index 00000000..0a1d2073 --- /dev/null +++ b/gen/voice.go @@ -0,0 +1,160 @@ +// Code generated by heygen-cli/codegen. DO NOT EDIT. + +package gen + +import "github.com/heygen-com/heygen-cli/internal/command" + +var VoiceList = &command.Spec{ + Group: "voice", + Name: "list", + Summary: "List voices", + Description: "List available voices with cursor-based pagination. Filter by type (public/private), engine, language, and gender. Use engine=starfish to get voices compatible with the text-to-speech endpoint.", + Endpoint: "/v3/voices", + Method: "GET", + BodyEncoding: "", + TokenField: "next_token", + DataField: "data", + Examples: []string{ + "heygen voice list --type public", + }, + Flags: []command.FlagSpec{ + { + Name: "type", + Type: "string", + Default: "public", + Help: "Voice type: 'public' for the shared library or 'private' for your cloned voices.", + Required: false, + Enum: []string{"public", "private"}, + Min: nil, + Max: nil, + Source: "query", + JSONName: "type", + }, + { + Name: "engine", + Type: "string", + Default: "", + Help: "Filter by voice engine (e.g. 'starfish'). When set, only voices compatible with that engine are returned.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "engine", + }, + { + Name: "language", + Type: "string", + Default: "", + Help: "Filter by language (e.g. 'English').", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "language", + }, + { + Name: "gender", + Type: "string", + Default: "", + Help: "Filter by gender ('male' or 'female').", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "gender", + }, + { + Name: "limit", + Type: "int", + Default: "20", + Help: "Results per page (1-100).", + Required: false, + Enum: nil, + Min: intPtr(1), + Max: intPtr(100), + Source: "query", + JSONName: "limit", + }, + }, +} + +var VoiceSpeech = &command.Spec{ + Group: "voice", + Name: "speech", + Summary: "Create speech audio from text", + Description: "Synthesize speech audio from text using a specified voice. Returns a URL to the generated audio file along with duration and optional word-level timestamps.", + Endpoint: "/v3/voices/speech", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen voice speech 'Hello world' --voice-id en_male", + }, + Args: []command.ArgSpec{ + {Name: "text", Target: "body", Param: "text", Help: "Text to synthesize (1-5000 characters)."}, + }, + Flags: []command.FlagSpec{ + { + Name: "input-type", + Type: "string", + Default: "text", + Help: "Type of the input: 'text' for plain text, 'ssml' for SSML markup. Defaults to 'text'.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "input_type", + }, + { + Name: "language", + Type: "string", + Default: "", + Help: "Base language code (e.g. 'en', 'pt', 'zh'). Optional — auto-detected from text when omitted.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "language", + }, + { + Name: "locale", + Type: "string", + Default: "", + Help: "BCP-47 locale tag (e.g. 'en-US', 'pt-BR'). When set, language is inferred from locale.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "locale", + }, + { + Name: "speed", + Type: "float64", + Default: "1", + Help: "Speed multiplier (0.5-2.0).", + Required: false, + Enum: nil, + Min: intPtr(0), + Max: intPtr(2), + Source: "body", + JSONName: "speed", + }, + { + Name: "voice-id", + Type: "string", + Default: "", + Help: "Voice ID to use. Discover available voices via GET /v1/audio/voices.", + Required: true, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "voice_id", + }, + }, +} diff --git a/gen/webhook.go b/gen/webhook.go new file mode 100644 index 00000000..cf9c8727 --- /dev/null +++ b/gen/webhook.go @@ -0,0 +1,227 @@ +// Code generated by heygen-cli/codegen. DO NOT EDIT. + +package gen + +import "github.com/heygen-com/heygen-cli/internal/command" + +var WebhookCreate = &command.Spec{ + Group: "webhook", + Name: "create", + Summary: "Create a webhook endpoint", + Description: "Register a new webhook endpoint to receive event notifications. Returns the endpoint details including the signing secret — store it securely, it will not be shown again except via rotate-secret.", + Endpoint: "/v3/webhooks/endpoints", + Method: "POST", + BodyEncoding: "json", + Examples: []string{ + "heygen webhook create --url https://example.com/hook", + }, + Flags: []command.FlagSpec{ + { + Name: "entity-id", + Type: "string", + Default: "", + Help: "Optional entity ID to scope this endpoint to a specific resource (e.g. a personalized video project).", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "entity_id", + }, + { + Name: "events", + Type: "string-slice", + Default: "", + Help: "Event types to subscribe to. Omit or set to null to receive all events.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "events", + }, + { + Name: "url", + Type: "string", + Default: "", + Help: "Publicly accessible HTTPS URL that will receive webhook POST requests.", + Required: true, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "url", + }, + }, +} + +var WebhookDelete = &command.Spec{ + Group: "webhook", + Name: "delete", + Summary: "Delete a webhook endpoint", + Description: "Permanently delete a webhook endpoint. Events will no longer be delivered to this URL.", + Endpoint: "/v3/webhooks/endpoints/{endpoint_id}", + Method: "DELETE", + BodyEncoding: "", + Examples: []string{ + "heygen webhook delete ", + }, + Args: []command.ArgSpec{ + {Name: "endpoint-id", Target: "path", Param: "endpoint_id", Help: "Webhook endpoint ID"}, + }, +} + +var WebhookEventTypes = &command.Spec{ + Group: "webhook", + Name: "event-types", + Summary: "List webhook event types", + Description: "List all available webhook event types with human-readable descriptions. Returns the complete set in a single response (no pagination needed).", + Endpoint: "/v3/webhooks/event-types", + Method: "GET", + BodyEncoding: "", + TokenField: "next_token", + DataField: "data", + Examples: []string{ + "heygen webhook event-types", + }, +} + +var WebhookEvents = &command.Spec{ + Group: "webhook", + Name: "events", + Summary: "List webhook events", + Description: "List delivered webhook events with cursor-based pagination. Filter by event type or entity ID.", + Endpoint: "/v3/webhooks/events", + Method: "GET", + BodyEncoding: "", + TokenField: "next_token", + DataField: "data", + Examples: []string{ + "heygen webhook events --event-type avatar_video.success", + }, + Flags: []command.FlagSpec{ + { + Name: "event-type", + Type: "string", + Default: "", + Help: "Filter events by type, e.g. 'avatar_video.success'.", + Required: false, + Enum: []string{"avatar_video.success", "avatar_video.fail", "avatar_video_gif.success", "avatar_video_gif.fail", "video_translate.success", "video_translate.fail", "personalized_video", "instant_avatar.success", "instant_avatar.fail", "photo_avatar_generation.success", "photo_avatar_generation.fail", "photo_avatar_train.success", "photo_avatar_train.fail", "photo_avatar_add_motion.success", "photo_avatar_add_motion.fail", "proofread_creation.success", "proofread_creation.fail", "live_avatar.success", "live_avatar.fail", "avatar_video_caption.success", "avatar_video_caption.fail", "video_agent.success", "video_agent.fail"}, + Min: nil, + Max: nil, + Source: "query", + JSONName: "event_type", + }, + { + Name: "entity-id", + Type: "string", + Default: "", + Help: "Filter events by entity ID.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "query", + JSONName: "entity_id", + }, + { + Name: "limit", + Type: "int", + Default: "10", + Help: "Maximum number of events to return (1-100). Default: 10.", + Required: false, + Enum: nil, + Min: intPtr(1), + Max: intPtr(100), + Source: "query", + JSONName: "limit", + }, + }, +} + +var WebhookList = &command.Spec{ + Group: "webhook", + Name: "list", + Summary: "List webhook endpoints", + Description: "List registered webhook endpoints with cursor-based pagination.", + Endpoint: "/v3/webhooks/endpoints", + Method: "GET", + BodyEncoding: "", + TokenField: "next_token", + DataField: "data", + Examples: []string{ + "heygen webhook list", + }, + Flags: []command.FlagSpec{ + { + Name: "limit", + Type: "int", + Default: "10", + Help: "Maximum number of endpoints to return (1-100). Default: 10.", + Required: false, + Enum: nil, + Min: intPtr(1), + Max: intPtr(100), + Source: "query", + JSONName: "limit", + }, + }, +} + +var WebhookRotateSecret = &command.Spec{ + Group: "webhook", + Name: "rotate-secret", + Summary: "Rotate webhook signing secret", + Description: "Generate a new signing secret for a webhook endpoint. The old secret is immediately invalidated. Store the new secret securely — it will not be shown again.", + Endpoint: "/v3/webhooks/endpoints/{endpoint_id}/rotate-secret", + Method: "POST", + BodyEncoding: "", + Examples: []string{ + "heygen webhook rotate-secret ", + }, + Args: []command.ArgSpec{ + {Name: "endpoint-id", Target: "path", Param: "endpoint_id", Help: "Webhook endpoint ID"}, + }, +} + +var WebhookUpdate = &command.Spec{ + Group: "webhook", + Name: "update", + Summary: "Update a webhook endpoint", + Description: "Update the URL and/or subscribed event types for an existing webhook endpoint.", + Endpoint: "/v3/webhooks/endpoints/{endpoint_id}", + Method: "PATCH", + BodyEncoding: "json", + Examples: []string{ + "heygen webhook update --url https://new.example.com/hook", + }, + Args: []command.ArgSpec{ + {Name: "endpoint-id", Target: "path", Param: "endpoint_id", Help: "Webhook endpoint ID"}, + }, + Flags: []command.FlagSpec{ + { + Name: "events", + Type: "string-slice", + Default: "", + Help: "New list of event types to subscribe to. Replaces the existing list.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "events", + }, + { + Name: "url", + Type: "string", + Default: "", + Help: "New URL for the endpoint. Must be publicly accessible HTTPS.", + Required: false, + Enum: nil, + Min: nil, + Max: nil, + Source: "body", + JSONName: "url", + }, + }, +}