|
194 | 194 | {{^isSyncClient}}async {{/isSyncClient}}def generate_secured_api_key(
|
195 | 195 | self,
|
196 | 196 | parent_api_key: str,
|
197 |
| - restrictions: Optional[SecuredApiKeyRestrictions] = SecuredApiKeyRestrictions(), |
| 197 | + restrictions: Optional[Union[dict, SecuredApiKeyRestrictions]] = SecuredApiKeyRestrictions(), |
198 | 198 | ) -> str:
|
199 | 199 | """
|
200 | 200 | Helper: Generates a secured API key based on the given `parent_api_key` and given `restrictions`.
|
|
244 | 244 | self,
|
245 | 245 | index_name: str,
|
246 | 246 | objects: List[Dict[str, Any]],
|
| 247 | + request_options: Optional[Union[dict, RequestOptions]] = None, |
247 | 248 | ) -> List[BatchResponse]:
|
248 | 249 | """
|
249 | 250 | Helper: Saves the given array of objects in the given index. The `chunked_batch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
|
250 | 251 | """
|
251 |
| - return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=objects, action=Action.ADDOBJECT) |
| 252 | + return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=objects, action=Action.ADDOBJECT, request_options=request_options) |
252 | 253 |
|
253 | 254 | {{^isSyncClient}}async {{/isSyncClient}}def delete_objects(
|
254 | 255 | self,
|
255 | 256 | index_name: str,
|
256 | 257 | object_ids: List[str],
|
| 258 | + request_options: Optional[Union[dict, RequestOptions]] = None, |
257 | 259 | ) -> List[BatchResponse]:
|
258 | 260 | """
|
259 | 261 | Helper: Deletes every records for the given objectIDs. The `chunked_batch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
|
260 | 262 | """
|
261 |
| - return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=[{"objectID": id} for id in object_ids], action=Action.DELETEOBJECT) |
| 263 | + return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=[{"objectID": id} for id in object_ids], action=Action.DELETEOBJECT, request_options=request_options) |
262 | 264 |
|
263 | 265 | {{^isSyncClient}}async {{/isSyncClient}}def partial_update_objects(
|
264 | 266 | self,
|
265 | 267 | index_name: str,
|
266 | 268 | objects: List[Dict[str, Any]],
|
267 | 269 | create_if_not_exists: Optional[bool] = False,
|
| 270 | + request_options: Optional[Union[dict, RequestOptions]] = None, |
268 | 271 | ) -> List[BatchResponse]:
|
269 | 272 | """
|
270 | 273 | Helper: Replaces object content of all the given objects according to their respective `objectID` field. The `chunked_batch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
|
271 | 274 | """
|
272 |
| - return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=objects, action=Action.PARTIALUPDATEOBJECT if create_if_not_exists else Action.PARTIALUPDATEOBJECTNOCREATE) |
| 275 | + return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=objects, action=Action.PARTIALUPDATEOBJECT if create_if_not_exists else Action.PARTIALUPDATEOBJECTNOCREATE, request_options=request_options) |
273 | 276 |
|
274 | 277 | {{^isSyncClient}}async {{/isSyncClient}}def chunked_batch(
|
275 | 278 | self,
|
|
0 commit comments