use crate::{Client, error::Result};
pub use output::*;
pub use param::*;
mod output;
mod param;
const TEXT2IMAGE_PATH: &str = "/services/aigc/text2image/image-synthesis";
pub struct Text2Image<'a> {
client: &'a Client,
}
impl<'a> Text2Image<'a> {
pub fn new(client: &'a Client) -> Self {
Self { client }
}
pub async fn call(&self, request: Text2imageParam) -> Result<Text2ImageOutput> {
let mut headers = self.client.config().headers();
headers.insert("X-DashScope-Async", "enable".parse().unwrap());
self.client
.post_with_headers(TEXT2IMAGE_PATH, request, headers)
.await
}
}