Expand description

A well designed api client for MeiliSearch.

CAVEAT: WIP

Quick Start

To get you started quickly, the easiest and highest-level way to create index is to use [create_index];

use meilisearch_api_client::{Config, client::Client, CreateIndexRequest};

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
   let uid  = "demo".to_string();
   let name = "demoname".to_string();

   // construct a request param
   let req_data = CreateIndexRequest { uid, name, primary_key: None};

   // config contains MeiliSearch server's host and port
   let config = Config::new("http://127.0.0.1".to_string(), 7700);

   // Client is api interface, using async/await.
   let res = Client::new(config).create_index(req_data).await;
   match res {
       Ok(index) => {
           println!("ceate index: {:?}", index);
       },
       Err(err) => {
           println!("err: {:?}", err);
       }
    }
     
    Ok(())
}

Output:

{"name":"demoname","uid":"demo","createdAt":"2020-05-14T08:56:24.483670375Z","updatedAt":"2020-05-14T08:56:24.484410846Z","primaryKey":null}

Installation

This crate requires a MeiliSearch server to run. See here to install and run MeiliSearch.
For the user guide and further documentation, can be found here

Modules

  • Module containing all the api interfaces
  • Module containing ServiceError

Structs

Traits