Skip to content

Update keys for v0.28.0 #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Aug 25, 2022
Merged

Conversation

bidoubiwa
Copy link
Contributor

@bidoubiwa bidoubiwa commented Aug 4, 2022

Changes related to the keys management

Related to:

All the changes:

  • Creation of client.get_keys_with() that lets you paginate on limit (default: 20), offset (default: 0).
  • The returned keys when using get_keys_with get_keys or get_key now returns an additional field uid.
  • get_key, delete_key and update_key accepts both the uid or the key itself as a selector
  • create_key accepts a custom uid to generate a determinist API key. If null Meilisearch generates one. It must be a UUID v4 value.
  • create_key accepts a custom name.
  • update_key only accepts updates on the description and the name
  • The response from get_keys_with and get_keys is now a KeysResults instead of Vec<Key>.

Breaking

  • The returned keys when using get_keys_with get_keys or get_key now returns an additional field uid.
  • The response from get_keys_with and get_keys is now a KeysResults instead of Vec<Key>.

get_keys without filtering

    let client = Client::new(MEILISEARCH_HOST, MEILISEARCH_API_KEY);
    let keys = client.get_keys().await.unwrap();

get_keys with filtering

    let client = Client::new(MEILISEARCH_HOST, MEILISEARCH_API_KEY);
    let mut query = KeysQuery::new();
    query.with_limit(1);
    let keys = client.get_keys_with(&query).await.unwrap();

Response:

pub struct KeysResults {
    pub results: Vec<Key>,
    pub limit: u32,
    pub offset: u32,
}

@bidoubiwa bidoubiwa changed the base branch from main to update_http_methods_for_v0.28.0 August 4, 2022 12:19
@bidoubiwa bidoubiwa requested a review from alallema August 10, 2022 14:34
@bidoubiwa bidoubiwa added the breaking-change The related changes are breaking for the users label Aug 10, 2022
Base automatically changed from update_http_methods_for_v0.28.0 to bump-meilisearch-v0.28.0 August 22, 2022 12:48
Copy link
Contributor

@alallema alallema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well Done! I really like the new way to handle the key 🏅
I just have some questions

@@ -6,20 +6,23 @@ use crate::{client::Client, errors::Error};
/// Represent a [meilisearch key](https://docs.meilisearch.com/reference/api/keys.html#returned-fields)
/// You can get a [Key] from the [Client::get_key] method.
/// Or you can create a [Key] with the [KeyBuilder::create] or [Client::create_key] methods.
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where you made a copy or use Clone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its to give the possibility to the user to copy if they'd like to

Copy link
Member

@irevoire irevoire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a lot of concerns about the test; I know it probably won’t cause any issue right now but I’m afraid they’ll become flaky after some time thus, most of my comments are to prevent this from happening.

@bidoubiwa bidoubiwa requested review from alallema and irevoire August 24, 2022 15:08
@bidoubiwa bidoubiwa merged commit 24e6b17 into bump-meilisearch-v0.28.0 Aug 25, 2022
@bidoubiwa bidoubiwa deleted the update_keys_for_v0.28.0 branch August 25, 2022 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The related changes are breaking for the users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants