@@ -29,7 +29,7 @@ pub struct SwapIndexes {
29
29
30
30
#[ cfg( feature = "isahc" ) ]
31
31
#[ cfg( not( target_arch = "wasm32" ) ) ]
32
- impl Client < IsahcClient > {
32
+ impl Client {
33
33
/// Create a client using the specified server.
34
34
///
35
35
/// Don't put a '/' at the end of the host.
@@ -46,7 +46,7 @@ impl Client<IsahcClient> {
46
46
///
47
47
/// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY));
48
48
/// ```
49
- pub fn new ( host : impl Into < String > , api_key : Option < impl Into < String > > ) -> Client < IsahcClient > {
49
+ pub fn new ( host : impl Into < String > , api_key : Option < impl Into < String > > ) -> Client {
50
50
Client {
51
51
host : host. into ( ) ,
52
52
api_key : api_key. map ( |api_key| api_key. into ( ) ) ,
@@ -1211,7 +1211,7 @@ mod tests {
1211
1211
}
1212
1212
1213
1213
#[ meilisearch_test]
1214
- async fn test_swapping_two_indexes ( client : Client < IsahcClient > ) {
1214
+ async fn test_swapping_two_indexes ( client : Client ) {
1215
1215
let index_1 = client. index ( "test_swapping_two_indexes_1" ) ;
1216
1216
let index_2 = client. index ( "test_swapping_two_indexes_2" ) ;
1217
1217
@@ -1273,7 +1273,7 @@ mod tests {
1273
1273
. match_header( "User-Agent" , user_agent)
1274
1274
. create_async( )
1275
1275
. await ,
1276
- client. http_client. clone ( ) . request:: <( ) , ( ) , ( ) >(
1276
+ client. http_client. request:: <( ) , ( ) , ( ) >(
1277
1277
address,
1278
1278
None ,
1279
1279
Method :: Get { query: ( ) } ,
@@ -1285,7 +1285,7 @@ mod tests {
1285
1285
. match_header( "User-Agent" , user_agent)
1286
1286
. create_async( )
1287
1287
. await ,
1288
- client. http_client. clone ( ) . request:: <( ) , ( ) , ( ) >(
1288
+ client. http_client. request:: <( ) , ( ) , ( ) >(
1289
1289
address,
1290
1290
None ,
1291
1291
Method :: Post {
@@ -1300,7 +1300,7 @@ mod tests {
1300
1300
. match_header( "User-Agent" , user_agent)
1301
1301
. create_async( )
1302
1302
. await ,
1303
- client. http_client. clone ( ) . request:: <( ) , ( ) , ( ) >(
1303
+ client. http_client. request:: <( ) , ( ) , ( ) >(
1304
1304
address,
1305
1305
None ,
1306
1306
Method :: Delete { query: ( ) } ,
@@ -1312,7 +1312,7 @@ mod tests {
1312
1312
. match_header( "User-Agent" , user_agent)
1313
1313
. create_async( )
1314
1314
. await ,
1315
- client. http_client. clone ( ) . request:: <( ) , ( ) , ( ) >(
1315
+ client. http_client. request:: <( ) , ( ) , ( ) >(
1316
1316
address,
1317
1317
None ,
1318
1318
Method :: Put {
@@ -1327,7 +1327,7 @@ mod tests {
1327
1327
. match_header( "User-Agent" , user_agent)
1328
1328
. create_async( )
1329
1329
. await ,
1330
- client. http_client. clone ( ) . request:: <( ) , ( ) , ( ) >(
1330
+ client. http_client. request:: <( ) , ( ) , ( ) >(
1331
1331
address,
1332
1332
None ,
1333
1333
Method :: Patch {
@@ -1347,28 +1347,28 @@ mod tests {
1347
1347
}
1348
1348
1349
1349
#[ meilisearch_test]
1350
- async fn test_get_tasks ( client : Client < IsahcClient > ) {
1350
+ async fn test_get_tasks ( client : Client ) {
1351
1351
let tasks = client. get_tasks ( ) . await . unwrap ( ) ;
1352
1352
assert_eq ! ( tasks. limit, 20 ) ;
1353
1353
}
1354
1354
1355
1355
#[ meilisearch_test]
1356
- async fn test_get_tasks_with_params ( client : Client < IsahcClient > ) {
1356
+ async fn test_get_tasks_with_params ( client : Client ) {
1357
1357
let query = TasksSearchQuery :: new ( & client) ;
1358
1358
let tasks = client. get_tasks_with ( & query) . await . unwrap ( ) ;
1359
1359
1360
1360
assert_eq ! ( tasks. limit, 20 ) ;
1361
1361
}
1362
1362
1363
1363
#[ meilisearch_test]
1364
- async fn test_get_keys ( client : Client < IsahcClient > ) {
1364
+ async fn test_get_keys ( client : Client ) {
1365
1365
let keys = client. get_keys ( ) . await . unwrap ( ) ;
1366
1366
1367
1367
assert ! ( keys. results. len( ) >= 2 ) ;
1368
1368
}
1369
1369
1370
1370
#[ meilisearch_test]
1371
- async fn test_delete_key ( client : Client < IsahcClient > , name : String ) {
1371
+ async fn test_delete_key ( client : Client , name : String ) {
1372
1372
let mut key = KeyBuilder :: new ( ) ;
1373
1373
key. with_name ( & name) ;
1374
1374
let key = client. create_key ( key) . await . unwrap ( ) ;
@@ -1384,7 +1384,7 @@ mod tests {
1384
1384
}
1385
1385
1386
1386
#[ meilisearch_test]
1387
- async fn test_error_delete_key ( mut client : Client < IsahcClient > , name : String ) {
1387
+ async fn test_error_delete_key ( mut client : Client , name : String ) {
1388
1388
// ==> accessing a key that does not exist
1389
1389
let error = client. delete_key ( "invalid_key" ) . await . unwrap_err ( ) ;
1390
1390
assert ! ( matches!(
@@ -1431,7 +1431,7 @@ mod tests {
1431
1431
}
1432
1432
1433
1433
#[ meilisearch_test]
1434
- async fn test_create_key ( client : Client < IsahcClient > , name : String ) {
1434
+ async fn test_create_key ( client : Client , name : String ) {
1435
1435
let expires_at = OffsetDateTime :: now_utc ( ) + time:: Duration :: HOUR ;
1436
1436
let mut key = KeyBuilder :: new ( ) ;
1437
1437
key. with_action ( Action :: DocumentsAdd )
@@ -1454,7 +1454,7 @@ mod tests {
1454
1454
}
1455
1455
1456
1456
#[ meilisearch_test]
1457
- async fn test_error_create_key ( mut client : Client < IsahcClient > , name : String ) {
1457
+ async fn test_error_create_key ( mut client : Client , name : String ) {
1458
1458
// ==> Invalid index name
1459
1459
/* TODO: uncomment once meilisearch fix this bug: https://github.com/meilisearch/meilisearch/issues/2158
1460
1460
let mut key = KeyBuilder::new();
@@ -1500,7 +1500,7 @@ mod tests {
1500
1500
}
1501
1501
1502
1502
#[ meilisearch_test]
1503
- async fn test_update_key ( client : Client < IsahcClient > , description : String ) {
1503
+ async fn test_update_key ( client : Client , description : String ) {
1504
1504
let mut key = KeyBuilder :: new ( ) ;
1505
1505
key. with_name ( "test_update_key" ) ;
1506
1506
let mut key = client. create_key ( key) . await . unwrap ( ) ;
@@ -1518,7 +1518,7 @@ mod tests {
1518
1518
}
1519
1519
1520
1520
#[ meilisearch_test]
1521
- async fn test_get_index ( client : Client < IsahcClient > , index_uid : String ) -> Result < ( ) , Error > {
1521
+ async fn test_get_index ( client : Client , index_uid : String ) -> Result < ( ) , Error > {
1522
1522
let task = client. create_index ( & index_uid, None ) . await ?;
1523
1523
let index = client
1524
1524
. wait_for_task ( task, None , None )
@@ -1536,10 +1536,7 @@ mod tests {
1536
1536
}
1537
1537
1538
1538
#[ meilisearch_test]
1539
- async fn test_error_create_index (
1540
- client : Client < IsahcClient > ,
1541
- index : Index < IsahcClient > ,
1542
- ) -> Result < ( ) , Error > {
1539
+ async fn test_error_create_index ( client : Client , index : Index ) -> Result < ( ) , Error > {
1543
1540
let error = client
1544
1541
. create_index ( "Wrong index name" , None )
1545
1542
. await
@@ -1574,15 +1571,15 @@ mod tests {
1574
1571
}
1575
1572
1576
1573
#[ meilisearch_test]
1577
- async fn test_list_all_indexes ( client : Client < IsahcClient > ) {
1574
+ async fn test_list_all_indexes ( client : Client ) {
1578
1575
let all_indexes = client. list_all_indexes ( ) . await . unwrap ( ) ;
1579
1576
1580
1577
assert_eq ! ( all_indexes. limit, 20 ) ;
1581
1578
assert_eq ! ( all_indexes. offset, 0 ) ;
1582
1579
}
1583
1580
1584
1581
#[ meilisearch_test]
1585
- async fn test_list_all_indexes_with_params ( client : Client < IsahcClient > ) {
1582
+ async fn test_list_all_indexes_with_params ( client : Client ) {
1586
1583
let mut query = IndexesQuery :: new ( & client) ;
1587
1584
query. with_limit ( 1 ) ;
1588
1585
let all_indexes = client. list_all_indexes_with ( & query) . await . unwrap ( ) ;
@@ -1592,15 +1589,15 @@ mod tests {
1592
1589
}
1593
1590
1594
1591
#[ meilisearch_test]
1595
- async fn test_list_all_indexes_raw ( client : Client < IsahcClient > ) {
1592
+ async fn test_list_all_indexes_raw ( client : Client ) {
1596
1593
let all_indexes_raw = client. list_all_indexes_raw ( ) . await . unwrap ( ) ;
1597
1594
1598
1595
assert_eq ! ( all_indexes_raw[ "limit" ] , json!( 20 ) ) ;
1599
1596
assert_eq ! ( all_indexes_raw[ "offset" ] , json!( 0 ) ) ;
1600
1597
}
1601
1598
1602
1599
#[ meilisearch_test]
1603
- async fn test_list_all_indexes_raw_with_params ( client : Client < IsahcClient > ) {
1600
+ async fn test_list_all_indexes_raw_with_params ( client : Client ) {
1604
1601
let mut query = IndexesQuery :: new ( & client) ;
1605
1602
query. with_limit ( 1 ) ;
1606
1603
let all_indexes_raw = client. list_all_indexes_raw_with ( & query) . await . unwrap ( ) ;
@@ -1610,18 +1607,15 @@ mod tests {
1610
1607
}
1611
1608
1612
1609
#[ meilisearch_test]
1613
- async fn test_get_primary_key_is_none ( mut index : Index < IsahcClient > ) {
1610
+ async fn test_get_primary_key_is_none ( mut index : Index ) {
1614
1611
let primary_key = index. get_primary_key ( ) . await ;
1615
1612
1616
1613
assert ! ( primary_key. is_ok( ) ) ;
1617
1614
assert ! ( primary_key. unwrap( ) . is_none( ) ) ;
1618
1615
}
1619
1616
1620
1617
#[ meilisearch_test]
1621
- async fn test_get_primary_key (
1622
- client : Client < IsahcClient > ,
1623
- index_uid : String ,
1624
- ) -> Result < ( ) , Error > {
1618
+ async fn test_get_primary_key ( client : Client , index_uid : String ) -> Result < ( ) , Error > {
1625
1619
let mut index = client
1626
1620
. create_index ( index_uid, Some ( "primary_key" ) )
1627
1621
. await ?
0 commit comments