pub async fn update_content(
client: &mut NlpClient,
request: UpdateContentRequest,
) -> Result<UpdateContentResponse, Box<dyn Error>>Expand description
Updates the content for the given request.
§Arguments
client- The client to use to communicate with the server.request- The request to send to the server.
§Example
use aristech_nlp_client::{get_client, update_content, TlsOptions, UpdateContentRequest, ContentMetaData, ContentData, DescriptionMapping, Output, OutputType};
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut client = get_client("https://nlp.example.com".to_string(), Some(TlsOptions::default())).await?;
let request = UpdateContentRequest {
id: "123".to_string(),
metadata: Some(ContentMetaData {
project_id: "456".to_string(),
..ContentMetaData::default()
}),
content: Some(ContentData {
topic: "lottery".to_string(),
description_mappings: vec![DescriptionMapping {
uuid: "82a2133e-038e-4c83-aa26-de47ed386c55".to_string(),
description: "What are the lottery numbers?".to_string(),
..DescriptionMapping::default()
}],
output: vec![Output {
r#type: OutputType::Chat.into(),
data: "The latest lottery numbers are {{lotto_numbers}}".into(),
}],
..ContentData::default()
}),
};
let response = update_content(&mut client, request).await?;
println!("{:?}", response);
Ok(())
}