async_dashscope/operation/
text2image.rs1use crate::{Client, error::Result};
2pub use output::*;
3pub use param::*;
4
5mod output;
6mod param;
7
8const TEXT2IMAGE_PATH: &str = "/services/aigc/text2image/image-synthesis";
9
10pub struct Text2Image<'a> {
11 client: &'a Client,
12}
13
14impl<'a> Text2Image<'a> {
15 pub fn new(client: &'a Client) -> Self {
16 Self { client }
17 }
18
19 pub async fn call(&self, request: Text2imageParam) -> Result<Text2ImageOutput> {
20 let mut headers = self.client.config().headers();
27 headers.insert("X-DashScope-Async", "enable".parse().unwrap());
28
29 self.client
31 .post_with_headers(TEXT2IMAGE_PATH, request, headers)
32 .await
33 }
34}