Function get_intents

Source
pub async fn get_intents(
    client: &mut NlpClient,
    request: GetIntentsRequest,
) -> Result<Vec<GetIntentsResponse>, Box<dyn Error>>
Expand description

Gets the intents available on the server.

§Arguments

  • client - The client to use to communicate with the server.
  • request - The request to send to the server. If None is given, the default request will be used.

§Example

use aristech_nlp_client::{get_client, get_intents, TlsOptions};
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 intents = get_intents(&mut client, None).await?;
    for intent in intents {
        println!("{:?}", intent);
    }
    Ok(())
}