Skip to content

Commit 729842b

Browse files
julienbourdeauaseure
authored andcommitted
fix(keys): Deprecate Index::add_api_key for Client::add_api_key
1 parent 0005280 commit 729842b

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

algoliasearch/index.py

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -909,45 +909,16 @@ def addUserKey(self, obj, validity=0, max_queries_per_ip_per_hour=0,
909909
@deprecated
910910
def add_user_key(self, obj, validity=0, max_queries_per_ip_per_hour=0,
911911
max_hits_per_query=0):
912-
"""Use `add_api_key`"""
912+
"""Use `add_api_key` on the client instead"""
913913
return self.add_api_key(
914914
obj, validity, max_queries_per_ip_per_hour,
915915
max_hits_per_query
916916
)
917917

918+
@deprecated
918919
def add_api_key(self, obj, validity=0, max_queries_per_ip_per_hour=0,
919920
max_hits_per_query=0, request_options=None):
920-
"""
921-
Create a new api key associated to this index (can only access to
922-
this index).
923-
924-
@param obj can be two different parameters:
925-
The list of parameters for this key. Defined by a dictionary that
926-
can contains the following values:
927-
- acl: array of string
928-
- indices: array of string
929-
- validity: int
930-
- referers: array of string
931-
- description: string
932-
- maxHitsPerQuery: integer
933-
- queryParameters: string
934-
- maxQueriesPerIPPerHour: integer
935-
Or the list of ACL for this key. Defined by an array of string that
936-
can contains the following values:
937-
- search: allow to search (https and http)
938-
- addObject: allows to add/update an object in the index (https only)
939-
- deleteObject : allows to delete an existing object (https only)
940-
- deleteIndex : allows to delete index content (https only)
941-
- settings : allows to get index settings (https only)
942-
- editSettings : allows to change index settings (https only)
943-
@param validity the number of seconds after which the key will be
944-
automatically removed (0 means no time limit for this key)
945-
@param max_queries_per_ip_per_hour Specify the maximum number of API
946-
calls allowed from an IP address per hour. Defaults to 0 (no
947-
rate limit)
948-
@param max_hits_per_query Specify the maximum number of hits this
949-
API key can retrieve in one call. Defaults to 0 (unlimited)
950-
"""
921+
"""Use `add_api_key` on the client instead"""
951922
if not isinstance(obj, dict):
952923
obj = {'acl': obj}
953924

0 commit comments

Comments
 (0)