Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
- name: Build
run: cargo build --verbose
- name: Docker setup
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --no-analytics=true
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --no-analytics=true --master-key=masterKey
- name: Run tests
run: cargo test --verbose -- --test-threads=1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Document for Book {
#[tokio::main]
async fn main() {
// Create a client (without sending any request so that can't fail)
let client = Client::new("http://localhost:7700", "");
let client = Client::new("http://localhost:7700", "masterKey");

// Get the index called "books"
let mut books = client.get_or_create("books").await.unwrap();
Expand Down
16 changes: 8 additions & 8 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> Client<'a> {
/// # use meilisearch_sdk::{client::*, indexes::*};
/// #
/// // create the client
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// ```
pub const fn new(host: &'a str, apikey: &'a str) -> Client<'a> {
Client { host, apikey }
Expand All @@ -37,7 +37,7 @@ impl<'a> Client<'a> {
/// # #[tokio::main]
/// # async fn main() {
/// // create the client
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
///
/// let indexes: Vec<Index> = client.list_all_indexes().await.unwrap();
/// println!("{:?}", indexes);
Expand Down Expand Up @@ -69,7 +69,7 @@ impl<'a> Client<'a> {
/// # #[tokio::main]
/// # async fn main() {
/// // create the client
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// # client.create_index("movies", None).await;
///
/// // get the index named "movies"
Expand Down Expand Up @@ -104,7 +104,7 @@ impl<'a> Client<'a> {
/// # #[tokio::main]
/// # async fn main() {
/// // create the client
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
///
/// # if let Ok(mut movies) = client.get_index("movies").await {
/// # movies.delete().await.unwrap();
Expand Down Expand Up @@ -164,7 +164,7 @@ impl<'a> Client<'a> {
/// #
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let stats = client.get_stats().await.unwrap();
/// # }
/// ```
Expand All @@ -186,7 +186,7 @@ impl<'a> Client<'a> {
/// #
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
///
/// match client.get_health().await {
/// Ok(()) => println!("server is operationnal"),
Expand Down Expand Up @@ -217,7 +217,7 @@ impl<'a> Client<'a> {
/// #
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
///
/// client.set_health(false).await.unwrap();
/// # client.set_health(true).await.unwrap();
Expand Down Expand Up @@ -250,7 +250,7 @@ impl<'a> Client<'a> {
/// #
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let version = client.get_version().await.unwrap();
/// # }
/// ```
Expand Down
22 changes: 11 additions & 11 deletions src/indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl JsonIndex {
/// # use meilisearch_sdk::{client::*, indexes::*};
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
///
/// // get the index called movies or create it if it does not exist
/// let movies = client.get_or_create("movies").await.unwrap();
Expand Down Expand Up @@ -67,7 +67,7 @@ impl<'a> Index<'a> {
/// # use meilisearch_sdk::{client::*, indexes::*};
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// # client.create_index("movies", None).await;
///
/// // get the index named "movies" and delete it
Expand Down Expand Up @@ -107,7 +107,7 @@ impl<'a> Index<'a> {
///
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let mut movies = client.get_or_create("movies").await.unwrap();
///
/// // add some documents
Expand Down Expand Up @@ -163,7 +163,7 @@ impl<'a> Index<'a> {
///
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// # client.create_index("movies", None).await;
/// let movies = client.get_index("movies").await.unwrap();
/// # let mut movies = client.get_index("movies").await.unwrap();
Expand Down Expand Up @@ -222,7 +222,7 @@ impl<'a> Index<'a> {
///
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// # client.create_index("movies", None).await;
/// let movie_index = client.get_index("movies").await.unwrap();
/// # let mut movie_index = client.get_index("movies").await.unwrap();
Expand Down Expand Up @@ -297,7 +297,7 @@ impl<'a> Index<'a> {
///
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let mut movie_index = client.get_or_create("movies").await.unwrap();
///
/// movie_index.add_or_replace(&[
Expand Down Expand Up @@ -385,7 +385,7 @@ impl<'a> Index<'a> {
///
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let mut movie_index = client.get_or_create("movies").await.unwrap();
///
/// movie_index.add_or_update(&[
Expand Down Expand Up @@ -454,7 +454,7 @@ impl<'a> Index<'a> {
/// # #[tokio::main]
/// # async fn main() {
/// #
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let mut movie_index = client.get_or_create("movies").await.unwrap();
///
/// // add some documents
Expand Down Expand Up @@ -499,7 +499,7 @@ impl<'a> Index<'a> {
/// # #[tokio::main]
/// # async fn main() {
/// #
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let mut movies = client.get_or_create("movies").await.unwrap();
///
/// # movies.add_or_replace(&[Movie{name:String::from("Interstellar"), description:String::from("Interstellar chronicles the adventures of a group of explorers who make use of a newly discovered wormhole to surpass the limitations on human space travel and conquer the vast distances involved in an interstellar voyage.")}], Some("name")).await.unwrap();
Expand Down Expand Up @@ -547,7 +547,7 @@ impl<'a> Index<'a> {
/// # #[tokio::main]
/// # async fn main() {
/// #
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let mut movies = client.get_or_create("movies").await.unwrap();
///
/// // add some documents
Expand Down Expand Up @@ -588,7 +588,7 @@ impl<'a> Index<'a> {
/// #
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let movies = client.get_or_create("movies").await.unwrap();
///
/// let stats = movies.get_stats().await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
//! #[tokio::main]
//! async fn main() {
//! // Create a client (without sending any request so that can't fail)
//! let client = Client::new("http://localhost:7700", "");
//! let client = Client::new("http://localhost:7700", "masterKey");
//!
//! // Get the index called "books"
//! let mut books = client.get_or_create("books").await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<'a> Progress<'a> {
/// # use meilisearch_sdk::{client::*, indexes::*, document::*};
/// # #[tokio::main]
/// # async fn main() {
/// let client = Client::new("http://localhost:7700", "");
/// let client = Client::new("http://localhost:7700", "masterKey");
/// let mut movies_index = client.get_or_create("movies").await.unwrap();
/// let progress = movies_index.delete_all_documents().await.unwrap();
/// let status = progress.get_status().await.unwrap();
Expand Down
Loading