Skip to content
Merged
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
14 changes: 7 additions & 7 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use crate::{
};
use serde::Deserialize;
use serde_json::{json, Value};
use std::{collections::HashMap, sync::Arc, time::Duration};
use std::{collections::HashMap, time::Duration};
use time::OffsetDateTime;

/// The top-level struct of the SDK, representing a client containing [indexes](../indexes/struct.Index.html).
#[derive(Debug, Clone)]
pub struct Client {
pub(crate) host: Arc<String>,
pub(crate) api_key: Arc<String>,
pub(crate) host: String,
pub(crate) api_key: String,
}

impl Client {
Expand All @@ -36,8 +36,8 @@ impl Client {
/// ```
pub fn new(host: impl Into<String>, api_key: impl Into<String>) -> Client {
Client {
host: Arc::new(host.into()),
api_key: Arc::new(api_key.into()),
host: host.into(),
api_key: api_key.into(),
}
}

Expand Down Expand Up @@ -985,7 +985,7 @@ mod tests {
let key = client.create_key(key).await.unwrap();
let master_key = client.api_key.clone();
// this key has no right
client.api_key = Arc::new(key.key.clone());
client.api_key = key.key.clone();
// with a wrong key
let error = client.delete_key("invalid_key").await.unwrap_err();
assert!(matches!(
Expand Down Expand Up @@ -1060,7 +1060,7 @@ mod tests {

// backup the master key for cleanup at the end of the test
let master_client = client.clone();
client.api_key = Arc::new(no_right_key.key.clone());
client.api_key = no_right_key.key.clone();

let mut key = KeyBuilder::new();
key.with_name(format!("{name}_2"));
Expand Down