diff --git a/crates/api_clients/fal_client/src/requests/webhook/video/image/enqueue_hailuo_v2p3_fast_pro_image_to_video_webhook.rs b/crates/api_clients/fal_client/src/requests/webhook/video/image/enqueue_hailuo_v2p3_fast_pro_image_to_video_webhook.rs new file mode 100644 index 0000000000..1e3a72a1b4 --- /dev/null +++ b/crates/api_clients/fal_client/src/requests/webhook/video/image/enqueue_hailuo_v2p3_fast_pro_image_to_video_webhook.rs @@ -0,0 +1,70 @@ +use crate::creds::fal_api_key::FalApiKey; +use crate::error::classify_fal_error::classify_fal_error; +use crate::error::fal_error_plus::FalErrorPlus; +use fal::endpoints::fal_ai::minimax::hailuo::hailuo_v2p3_fast_pro_image_to_video::{hailuo_v2p3_fast_pro_image_to_video, HailuoV2p3FastProImageToVideoInput}; +use fal::webhook::WebhookResponse; +use reqwest::IntoUrl; + +pub struct EnqueueHailuoV2p3FastProImageToVideoArgs<'a, R: IntoUrl> { + // Request required + pub prompt: String, + pub image_url: String, + + // Optional args + pub prompt_optimizer: Option, + + // Fulfillment + pub webhook_url: R, + pub api_key: &'a FalApiKey, +} + +pub async fn enqueue_hailuo_v2p3_fast_pro_image_to_video_webhook( + args: EnqueueHailuoV2p3FastProImageToVideoArgs<'_, R> +) -> Result { + + let prompt_optimizer = args.prompt_optimizer.unwrap_or(true); + + let request = HailuoV2p3FastProImageToVideoInput { + prompt: args.prompt, + image_url: args.image_url, + // Optionals + prompt_optimizer: Some(prompt_optimizer), + }; + + let result = hailuo_v2p3_fast_pro_image_to_video(request) + .with_api_key(&args.api_key.0) + .queue_webhook(args.webhook_url) + .await; + + result.map_err(|err| classify_fal_error(err)) +} + +#[cfg(test)] +mod tests { + use crate::creds::fal_api_key::FalApiKey; + use crate::requests::webhook::video::image::enqueue_hailuo_v2p3_fast_pro_image_to_video_webhook::{enqueue_hailuo_v2p3_fast_pro_image_to_video_webhook, EnqueueHailuoV2p3FastProImageToVideoArgs}; + use errors::AnyhowResult; + use std::fs::read_to_string; + use test_data::web::image_urls::TREX_SKELETON_IMAGE_URL; + + #[tokio::test] + #[ignore] + async fn test() -> AnyhowResult<()> { + // XXX: Don't commit secrets! + let secret = read_to_string("/home/bt/Artcraft/credentials/fal_api_key.txt")?; + + let api_key = FalApiKey::from_str(&secret); + + let args = EnqueueHailuoV2p3FastProImageToVideoArgs { + image_url: TREX_SKELETON_IMAGE_URL.to_string(), + prompt: "the t-rex skeleton gets off the podium and begins walking to the camera. the camera orbits slightly. The t-rex gets close and then bites.".to_string(), + prompt_optimizer: Some(true), + api_key: &api_key, + webhook_url: "https://example.com/webhook", + }; + + let result = enqueue_hailuo_v2p3_fast_pro_image_to_video_webhook(args).await?; + + Ok(()) + } +} diff --git a/crates/api_clients/fal_client/src/requests/webhook/video/image/enqueue_hailuo_v2p3_pro_image_to_video_webhook.rs b/crates/api_clients/fal_client/src/requests/webhook/video/image/enqueue_hailuo_v2p3_pro_image_to_video_webhook.rs new file mode 100644 index 0000000000..ac1e05b8ca --- /dev/null +++ b/crates/api_clients/fal_client/src/requests/webhook/video/image/enqueue_hailuo_v2p3_pro_image_to_video_webhook.rs @@ -0,0 +1,70 @@ +use crate::creds::fal_api_key::FalApiKey; +use crate::error::classify_fal_error::classify_fal_error; +use crate::error::fal_error_plus::FalErrorPlus; +use fal::endpoints::fal_ai::minimax::hailuo::hailuo_v2p3_pro_image_to_video::{hailuo_v2p3_pro_image_to_video, HailuoV2p3ProImageToVideoInput}; +use fal::webhook::WebhookResponse; +use reqwest::IntoUrl; + +pub struct EnqueueHailuoV2p3ProImageToVideoArgs<'a, R: IntoUrl> { + // Request required + pub prompt: String, + pub image_url: String, + + // Optional args + pub prompt_optimizer: Option, + + // Fulfillment + pub webhook_url: R, + pub api_key: &'a FalApiKey, +} + +pub async fn enqueue_hailuo_v2p3_pro_image_to_video_webhook( + args: EnqueueHailuoV2p3ProImageToVideoArgs<'_, R> +) -> Result { + + let prompt_optimizer = args.prompt_optimizer.unwrap_or(true); + + let request = HailuoV2p3ProImageToVideoInput { + prompt: args.prompt, + image_url: args.image_url, + // Optionals + prompt_optimizer: Some(prompt_optimizer), + }; + + let result = hailuo_v2p3_pro_image_to_video(request) + .with_api_key(&args.api_key.0) + .queue_webhook(args.webhook_url) + .await; + + result.map_err(|err| classify_fal_error(err)) +} + +#[cfg(test)] +mod tests { + use crate::creds::fal_api_key::FalApiKey; + use crate::requests::webhook::video::image::enqueue_hailuo_v2p3_pro_image_to_video_webhook::{enqueue_hailuo_v2p3_pro_image_to_video_webhook, EnqueueHailuoV2p3ProImageToVideoArgs}; + use errors::AnyhowResult; + use std::fs::read_to_string; + use test_data::web::image_urls::TREX_SKELETON_IMAGE_URL; + + #[tokio::test] + #[ignore] + async fn test() -> AnyhowResult<()> { + // XXX: Don't commit secrets! + let secret = read_to_string("/home/bt/Artcraft/credentials/fal_api_key.txt")?; + + let api_key = FalApiKey::from_str(&secret); + + let args = EnqueueHailuoV2p3ProImageToVideoArgs { + image_url: TREX_SKELETON_IMAGE_URL.to_string(), + prompt: "the t-rex skeleton gets off the podium and begins walking to the camera. the camera orbits slightly. The t-rex gets close and then bites.".to_string(), + prompt_optimizer: Some(true), + api_key: &api_key, + webhook_url: "https://example.com/webhook", + }; + + let result = enqueue_hailuo_v2p3_pro_image_to_video_webhook(args).await?; + + Ok(()) + } +} diff --git a/crates/api_clients/fal_client/src/requests/webhook/video/image/mod.rs b/crates/api_clients/fal_client/src/requests/webhook/video/image/mod.rs index ea85c49e8f..27efbc5d46 100644 --- a/crates/api_clients/fal_client/src/requests/webhook/video/image/mod.rs +++ b/crates/api_clients/fal_client/src/requests/webhook/video/image/mod.rs @@ -1,6 +1,8 @@ +pub mod enqueue_hailuo_v2p3_fast_pro_image_to_video_webhook; +pub mod enqueue_hailuo_v2p3_pro_image_to_video_webhook; pub mod enqueue_kling_v2p5_turbo_pro_image_to_video_webhook; pub mod enqueue_kling_v2p5_turbo_standard_image_to_video_webhook; pub mod enqueue_kling_v2p6_pro_image_to_video_webhook; pub mod enqueue_pixverse_v5_image_to_video_webhook; -pub mod enqueue_sora_2_pro_image_to_video_webhook; -pub mod enqueue_sora_2_image_to_video_webhook; \ No newline at end of file +pub mod enqueue_sora_2_image_to_video_webhook; +pub mod enqueue_sora_2_pro_image_to_video_webhook; \ No newline at end of file diff --git a/crates/api_clients/fal_client/src/requests/webhook/video/text/enqueue_hailuo_v2p3_pro_text_to_video_webhook.rs b/crates/api_clients/fal_client/src/requests/webhook/video/text/enqueue_hailuo_v2p3_pro_text_to_video_webhook.rs new file mode 100644 index 0000000000..409d3a805f --- /dev/null +++ b/crates/api_clients/fal_client/src/requests/webhook/video/text/enqueue_hailuo_v2p3_pro_text_to_video_webhook.rs @@ -0,0 +1,66 @@ +use crate::creds::fal_api_key::FalApiKey; +use crate::error::classify_fal_error::classify_fal_error; +use crate::error::fal_error_plus::FalErrorPlus; +use fal::endpoints::fal_ai::minimax::hailuo::hailuo_v2p3_pro_text_to_video::{hailuo_v2p3_pro_text_to_video, HailuoV2p3ProTextToVideoInput}; +use fal::webhook::WebhookResponse; +use reqwest::IntoUrl; + +pub struct EnqueueHailuoV2p3ProTextToVideoArgs<'a, R: IntoUrl> { + // Request required + pub prompt: String, + + // Optional args + pub prompt_optimizer: Option, + + // Fulfillment + pub webhook_url: R, + pub api_key: &'a FalApiKey, +} + +pub async fn enqueue_hailuo_v2p3_pro_text_to_video_webhook( + args: EnqueueHailuoV2p3ProTextToVideoArgs<'_, R> +) -> Result { + + let prompt_optimizer = args.prompt_optimizer.unwrap_or(true); + + let request = HailuoV2p3ProTextToVideoInput { + prompt: args.prompt, + // Optionals + prompt_optimizer: Some(prompt_optimizer), + }; + + let result = hailuo_v2p3_pro_text_to_video(request) + .with_api_key(&args.api_key.0) + .queue_webhook(args.webhook_url) + .await; + + result.map_err(|err| classify_fal_error(err)) +} + +#[cfg(test)] +mod tests { + use crate::creds::fal_api_key::FalApiKey; + use crate::requests::webhook::video::text::enqueue_hailuo_v2p3_pro_text_to_video_webhook::{enqueue_hailuo_v2p3_pro_text_to_video_webhook, EnqueueHailuoV2p3ProTextToVideoArgs}; + use errors::AnyhowResult; + use std::fs::read_to_string; + + #[tokio::test] + #[ignore] + async fn test() -> AnyhowResult<()> { + // XXX: Don't commit secrets! + let secret = read_to_string("/home/bt/Artcraft/credentials/fal_api_key.txt")?; + + let api_key = FalApiKey::from_str(&secret); + + let args = EnqueueHailuoV2p3ProTextToVideoArgs { + prompt: "a gray alien with big eyes dressed in an american flag tank top gives the peace symbol, it then barbecues some hot dogs on the grill".to_string(), + prompt_optimizer: Some(true), + api_key: &api_key, + webhook_url: "https://example.com/webhook", + }; + + let result = enqueue_hailuo_v2p3_pro_text_to_video_webhook(args).await?; + + Ok(()) + } +} diff --git a/crates/api_clients/fal_client/src/requests/webhook/video/text/mod.rs b/crates/api_clients/fal_client/src/requests/webhook/video/text/mod.rs index 874e91fd73..455d81b8c1 100644 --- a/crates/api_clients/fal_client/src/requests/webhook/video/text/mod.rs +++ b/crates/api_clients/fal_client/src/requests/webhook/video/text/mod.rs @@ -2,4 +2,5 @@ pub mod enqueue_kling_v2p5_turbo_pro_text_to_video_webhook; pub mod enqueue_kling_v2p6_pro_text_to_video_webhook; pub mod enqueue_pixverse_v5_text_to_video_webhook; pub mod enqueue_sora_2_pro_text_to_video_webhook; -pub mod enqueue_sora_2_text_to_video_webhook; \ No newline at end of file +pub mod enqueue_sora_2_text_to_video_webhook; +pub mod enqueue_hailuo_v2p3_pro_text_to_video_webhook; \ No newline at end of file diff --git a/crates/vendor/fal-rs/src/endpoints/fal_ai/minimax/hailuo/hailuo_v2p3_pro_text_to_video.rs b/crates/vendor/fal-rs/src/endpoints/fal_ai/minimax/hailuo/hailuo_v2p3_pro_text_to_video.rs index 4597f9465f..a728c7e693 100644 --- a/crates/vendor/fal-rs/src/endpoints/fal_ai/minimax/hailuo/hailuo_v2p3_pro_text_to_video.rs +++ b/crates/vendor/fal-rs/src/endpoints/fal_ai/minimax/hailuo/hailuo_v2p3_pro_text_to_video.rs @@ -20,7 +20,7 @@ pub struct VideoFile { pub url: String, } -pub fn hailuo_v2p3_pro_image_to_video( +pub fn hailuo_v2p3_pro_text_to_video( params: HailuoV2p3ProTextToVideoInput, ) -> FalRequest { FalRequest::new("fal-ai/minimax/hailuo-2.3/pro/text-to-video", params)