Skip to content

Commit e5569bb

Browse files
committed
Add keys parameter in missing routes v0.28.x
1 parent cd973eb commit e5569bb

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

.code-samples.meilisearch.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,14 +589,15 @@ authorization_header_1: |-
589589
client = Client('http://127.0.0.1:7700', 'masterKey')
590590
client.get_keys()
591591
tenant_token_guide_generate_sdk_1: |-
592+
uid = '85c3c2f9-bdd6-41f1-abd8-11fcf80e0f76';
592593
api_key = 'B5KdX2MY2jV6EXfUs6scSfmC...'
593594
expires_at = datetime(2025, 12, 20)
594595
search_rules = {
595596
'patient_medical_records': {
596597
'filter': 'user_id = 1'
597598
}
598599
}
599-
token = client.generate_tenant_token(search_rules=search_rules, api_key=api_key, expires_at=expires_at)
600+
token = client.generate_tenant_token(api_key_uid=uid, search_rules=search_rules, api_key=api_key, expires_at=expires_at)
600601
tenant_token_guide_search_sdk_1: |-
601602
front_end_client = Client('http://127.0.0.1:7700', token)
602603
front_end_client.index('patient_medical_records').search('blood test')

meilisearch/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def create_key(
309309

310310
def update_key(
311311
self,
312-
key: str,
312+
key_or_uid: str,
313313
options: Dict[str, Any]
314314
) -> Dict[str, Any]:
315315
"""Update an API key.
@@ -318,7 +318,7 @@ def update_key(
318318
319319
----------
320320
key:
321-
The key for which to update the information.
321+
The key or the uid of the key for which to update the information.
322322
options:
323323
The information to use in creating the key (ex: { 'description': 'Search Key', 'expiresAt': '22-01-01' }). Note that if an
324324
expires_at value is included it should be in UTC time.
@@ -334,16 +334,16 @@ def update_key(
334334
MeiliSearchApiError
335335
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
336336
"""
337-
url = f'{self.config.paths.keys}/{key}'
337+
url = f'{self.config.paths.keys}/{key_or_uid}'
338338
return self.http.patch(url, options)
339339

340-
def delete_key(self, key: str) -> Dict[str, int]:
340+
def delete_key(self, key_or_uid: str) -> Dict[str, int]:
341341
"""Deletes an API key.
342342
343343
Parameters
344344
----------
345345
key:
346-
The key to delete.
346+
The key or the uid of the key to delete.
347347
348348
Returns
349349
-------
@@ -356,7 +356,7 @@ def delete_key(self, key: str) -> Dict[str, int]:
356356
MeiliSearchApiError
357357
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
358358
"""
359-
return self.http.delete(f'{self.config.paths.keys}/{key}')
359+
return self.http.delete(f'{self.config.paths.keys}/{key_or_uid}')
360360

361361
def get_version(self) -> Dict[str, str]:
362362
"""Get version Meilisearch

0 commit comments

Comments
 (0)