Skip to content

Commit 19a67f6

Browse files
authored
Merge branch 'main' into patch-1
2 parents 039d187 + efacc5c commit 19a67f6

File tree

31 files changed

+2320
-1858
lines changed

31 files changed

+2320
-1858
lines changed

.code-samples.meilisearch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ primary_field_guide_add_document_primary_key: |-
993993
getting_started_add_documents_md: |-
994994
```toml
995995
[dependencies]
996-
meilisearch-sdk = "0.25.0"
996+
meilisearch-sdk = "0.26.0"
997997
# futures: because we want to block on futures
998998
futures = "0.3"
999999
# serde: required if you are going to use documents
@@ -1611,7 +1611,7 @@ search_parameter_guide_facet_stats_1: |-
16111611
get_proximity_precision_settings_1: |-
16121612
let proximity_precision: String = client
16131613
.index("books")
1614-
.get_typo_tolerance()
1614+
.get_proximity_precision()
16151615
.await
16161616
.unwrap();
16171617
update_proximity_precision_settings_1: |-

.github/workflows/tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
with:
3333
command: check
3434
args: --workspace --all-targets --all
35+
- name: Cargo check no default features
36+
uses: actions-rs/cargo@v1
37+
with:
38+
command: check
39+
args: --workspace --all-targets --all --no-default-features
3540

3641
linter:
3742
name: clippy-check

Cargo.toml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "meilisearch-sdk"
3-
version = "0.25.0"
3+
version = "0.26.0"
44
authors = ["Mubelotix <[email protected]>"]
55
edition = "2018"
66
description = "Rust wrapper for the Meilisearch API. Meilisearch is a powerful, fast, open-source, easy to use and deploy search engine."
@@ -18,28 +18,28 @@ log = "0.4"
1818
serde = { version = "1.0", features = ["derive"] }
1919
serde_json = "1.0"
2020
time = { version = "0.3.7", features = ["serde-well-known", "formatting", "parsing"] }
21-
jsonwebtoken = { version = "9", default-features = false }
2221
yaup = "0.2.0"
2322
either = { version = "1.8.0", features = ["serde"] }
2423
thiserror = "1.0.37"
25-
meilisearch-index-setting-macro = { path = "meilisearch-index-setting-macro", version = "0.25.0" }
24+
meilisearch-index-setting-macro = { path = "meilisearch-index-setting-macro", version = "0.26.0" }
25+
pin-project-lite = { version = "0.2.13", optional = true }
26+
reqwest = { version = "0.12.3", optional = true, default-features = false, features = ["rustls-tls", "http2", "stream"] }
27+
bytes = { version = "1.6", optional = true }
28+
uuid = { version = "1.1.2", features = ["v4"] }
29+
futures-io = "0.3.30"
30+
futures = "0.3"
2631

2732
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
28-
futures = "0.3"
29-
futures-io = "0.3.26"
30-
isahc = { version = "1.0", features = ["http2", "text-decoding"], default_features = false }
31-
uuid = { version = "1.1.2", features = ["v4"] }
33+
jsonwebtoken = { version = "9", default-features = false }
3234

3335
[target.'cfg(target_arch = "wasm32")'.dependencies]
34-
js-sys = "0.3.47"
35-
web-sys = { version = "0.3", features = ["RequestInit", "Headers", "Window", "Response", "console"] }
36-
wasm-bindgen = "0.2"
36+
uuid = { version = "1.8.0", default-features = false, features = ["v4", "js"] }
37+
web-sys = "0.3"
3738
wasm-bindgen-futures = "0.4"
3839

3940
[features]
40-
default = ["isahc-static-curl"]
41-
isahc-static-curl = ["isahc/static-curl"]
42-
isahc-static-ssl = ["isahc/static-ssl"]
41+
default = ["reqwest"]
42+
reqwest = ["dep:reqwest", "pin-project-lite", "bytes"]
4343

4444
[dev-dependencies]
4545
futures-await-test = "0.3"
@@ -56,3 +56,4 @@ lazy_static = "1.4"
5656
web-sys = "0.3"
5757
console_error_panic_hook = "0.1"
5858
big_s = "1.0.2"
59+
insta = "1.38.0"

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ To use `meilisearch-sdk`, add this to your `Cargo.toml`:
5858

5959
```toml
6060
[dependencies]
61-
meilisearch-sdk = "0.25.0"
61+
meilisearch-sdk = "0.26.0"
6262
```
6363

6464
The following optional dependencies may also be useful:
@@ -108,9 +108,10 @@ struct Movie {
108108
}
109109

110110

111-
fn main() { block_on(async move {
111+
#[tokio::main(flavor = "current_thread")]
112+
async fn main() {
112113
// Create a client (without sending any request so that can't fail)
113-
let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY));
114+
let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
114115

115116
// An index is where the documents are stored.
116117
let movies = client.index("movies");
@@ -124,7 +125,7 @@ fn main() { block_on(async move {
124125
Movie { id: 5, title: String::from("Moana"), genres: vec!["Fantasy".to_string(), "Action".to_string()] },
125126
Movie { id: 6, title: String::from("Philadelphia"), genres: vec!["Drama".to_string()] },
126127
], Some("id")).await.unwrap();
127-
})}
128+
}
128129
```
129130

130131
With the `uid`, you can check the status (`enqueued`, `canceled`, `processing`, `succeeded` or `failed`) of your documents addition using the [task](https://www.meilisearch.com/docs/reference/api/tasks#get-task).
@@ -238,6 +239,12 @@ Json output:
238239
}
239240
```
240241

242+
#### Customize the `HttpClient` <!-- omit in TOC -->
243+
244+
By default, the SDK uses [`reqwest`](https://docs.rs/reqwest/latest/reqwest/) to make http calls.
245+
The SDK lets you customize the http client by implementing the `HttpClient` trait yourself and
246+
initializing the `Client` with the `new_with_client` method.
247+
241248
## 🌐 Running in the Browser with WASM <!-- omit in TOC -->
242249

243250
This crate fully supports WASM.

README.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ To use `meilisearch-sdk`, add this to your `Cargo.toml`:
5858

5959
```toml
6060
[dependencies]
61-
meilisearch-sdk = "0.25.0"
61+
meilisearch-sdk = "0.26.0"
6262
```
6363

6464
The following optional dependencies may also be useful:

examples/cli-app-with-awc/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "cli-app-with-awc"
3+
version = "0.0.0"
4+
edition = "2021"
5+
publish = false
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]
10+
meilisearch-sdk = { path = "../..", default-features = false }
11+
futures = "0.3"
12+
serde = { version = "1.0", features = ["derive"] }
13+
serde_json = "1.0"
14+
lazy_static = "1.4.0"
15+
awc = "3.4"
16+
async-trait = "0.1.51"
17+
tokio = { version = "1.27.0", features = ["full"] }
18+
yaup = "0.2.0"
19+
tokio-util = { version = "0.7.10", features = ["full"] }
20+
actix-rt = "2.9.0"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
[
2+
{
3+
"id": 1,
4+
"seaon": "winter",
5+
"article": "sweater",
6+
"cost": 63.40,
7+
"size":"L",
8+
"pattern":"striped"
9+
},
10+
{
11+
"id": 2,
12+
"seaon": "spring",
13+
"article": "sweat pants",
14+
"cost": 18.00,
15+
"size":"XXXL",
16+
"pattern":"floral"
17+
},
18+
{
19+
"id": 3,
20+
"seaon": "fall",
21+
"article": "t-shirt",
22+
"cost": 1634.90,
23+
"size":"M",
24+
"pattern":"solid black"
25+
},
26+
{
27+
"id": 4,
28+
"seaon": "summer",
29+
"article": "tank top",
30+
"cost": 3.40,
31+
"size":"L",
32+
"pattern":"diagonal"
33+
},
34+
{
35+
"id": 5,
36+
"seaon": "winter",
37+
"article": "jeans",
38+
"cost": 4.20,
39+
"size":"XL",
40+
"pattern":"striped"
41+
},
42+
{
43+
"id": 6,
44+
"seaon": "spring",
45+
"article": "sun dress",
46+
"cost": 12634.56,
47+
"size":"L",
48+
"pattern":"floral"
49+
},
50+
{
51+
"id": 7,
52+
"seaon": "fall",
53+
"article": "sweatshirt",
54+
"cost": 90.80,
55+
"size":"M",
56+
"pattern":"checker"
57+
},
58+
{
59+
"id": 8,
60+
"seaon": "summer",
61+
"article": "shorts",
62+
"cost": 16.34,
63+
"size":"XS",
64+
"pattern":"solid beige"
65+
},
66+
{
67+
"id": 9,
68+
"seaon": "winter",
69+
"article": "jacket",
70+
"cost": 634,
71+
"size":"L",
72+
"pattern":"camo"
73+
}
74+
]

0 commit comments

Comments
 (0)