@@ -349,13 +349,17 @@ async def browse_objects(
349349 self ,
350350 index_name : str ,
351351 aggregator : Callable [[BrowseResponse ], None ],
352- browse_params : BrowseParamsObject = BrowseParamsObject () ,
352+ browse_params : Optional [ BrowseParamsObject ] = None ,
353353 request_options : Optional [Union [dict , RequestOptions ]] = None ,
354354 ) -> BrowseResponse :
355355 """
356356 Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index.
357357 """
358- browse_params .hits_per_page = browse_params .hits_per_page or 1000
358+ if browse_params is None :
359+ browse_params = BrowseParamsObject (hits_per_page = 1000 )
360+
361+ if browse_params .hits_per_page is None :
362+ browse_params .hits_per_page = 1000
359363
360364 async def _func (_prev : Optional [BrowseResponse ]) -> BrowseResponse :
361365 if _prev is not None and _prev .cursor is not None :
@@ -376,14 +380,18 @@ async def browse_rules(
376380 self ,
377381 index_name : str ,
378382 aggregator : Callable [[SearchRulesResponse ], None ],
379- search_rules_params : SearchRulesParams = SearchRulesParams ( hits_per_page = 1000 ) ,
383+ search_rules_params : Optional [ SearchRulesParams ] = None ,
380384 request_options : Optional [Union [dict , RequestOptions ]] = None ,
381385 ) -> SearchRulesResponse :
382386 """
383387 Helper: Iterate on the `search_rules` method of the client to allow aggregating rules of an index.
384388 """
389+ if search_rules_params is None :
390+ search_rules_params = SearchRulesParams (hits_per_page = 1000 )
391+
385392 if search_rules_params .hits_per_page is None :
386393 search_rules_params .hits_per_page = 1000
394+
387395 hits_per_page = search_rules_params .hits_per_page
388396
389397 async def _func (_prev : Optional [SearchRulesResponse ]) -> SearchRulesResponse :
@@ -405,14 +413,14 @@ async def browse_synonyms(
405413 self ,
406414 index_name : str ,
407415 aggregator : Callable [[SearchSynonymsResponse ], None ],
408- search_synonyms_params : SearchSynonymsParams = SearchSynonymsParams (
409- hits_per_page = 1000
410- ),
416+ search_synonyms_params : Optional [SearchSynonymsParams ] = None ,
411417 request_options : Optional [Union [dict , RequestOptions ]] = None ,
412418 ) -> SearchSynonymsResponse :
413419 """
414420 Helper: Iterate on the `search_synonyms` method of the client to allow aggregating synonyms of an index.
415421 """
422+ if search_synonyms_params is None :
423+ search_synonyms_params = SearchSynonymsParams (hits_per_page = 1000 , page = 0 )
416424 hits_per_page = 1000
417425 page = search_synonyms_params .page or 0
418426 search_synonyms_params .hits_per_page = hits_per_page
@@ -439,13 +447,13 @@ async def _func(
439447 async def generate_secured_api_key (
440448 self ,
441449 parent_api_key : str ,
442- restrictions : Optional [
443- Union [dict , SecuredApiKeyRestrictions ]
444- ] = SecuredApiKeyRestrictions (),
450+ restrictions : Optional [Union [dict , SecuredApiKeyRestrictions ]] = None ,
445451 ) -> str :
446452 """
447453 Helper: Generates a secured API key based on the given `parent_api_key` and given `restrictions`.
448454 """
455+ if restrictions is None :
456+ restrictions = SecuredApiKeyRestrictions ()
449457 restrictions_dict = {}
450458 if isinstance (restrictions , SecuredApiKeyRestrictions ):
451459 restrictions_dict = restrictions .to_dict ()
@@ -5365,13 +5373,17 @@ def browse_objects(
53655373 self ,
53665374 index_name : str ,
53675375 aggregator : Callable [[BrowseResponse ], None ],
5368- browse_params : BrowseParamsObject = BrowseParamsObject () ,
5376+ browse_params : Optional [ BrowseParamsObject ] = None ,
53695377 request_options : Optional [Union [dict , RequestOptions ]] = None ,
53705378 ) -> BrowseResponse :
53715379 """
53725380 Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index.
53735381 """
5374- browse_params .hits_per_page = browse_params .hits_per_page or 1000
5382+ if browse_params is None :
5383+ browse_params = BrowseParamsObject (hits_per_page = 1000 )
5384+
5385+ if browse_params .hits_per_page is None :
5386+ browse_params .hits_per_page = 1000
53755387
53765388 def _func (_prev : Optional [BrowseResponse ]) -> BrowseResponse :
53775389 if _prev is not None and _prev .cursor is not None :
@@ -5392,14 +5404,18 @@ def browse_rules(
53925404 self ,
53935405 index_name : str ,
53945406 aggregator : Callable [[SearchRulesResponse ], None ],
5395- search_rules_params : SearchRulesParams = SearchRulesParams ( hits_per_page = 1000 ) ,
5407+ search_rules_params : Optional [ SearchRulesParams ] = None ,
53965408 request_options : Optional [Union [dict , RequestOptions ]] = None ,
53975409 ) -> SearchRulesResponse :
53985410 """
53995411 Helper: Iterate on the `search_rules` method of the client to allow aggregating rules of an index.
54005412 """
5413+ if search_rules_params is None :
5414+ search_rules_params = SearchRulesParams (hits_per_page = 1000 )
5415+
54015416 if search_rules_params .hits_per_page is None :
54025417 search_rules_params .hits_per_page = 1000
5418+
54035419 hits_per_page = search_rules_params .hits_per_page
54045420
54055421 def _func (_prev : Optional [SearchRulesResponse ]) -> SearchRulesResponse :
@@ -5421,14 +5437,14 @@ def browse_synonyms(
54215437 self ,
54225438 index_name : str ,
54235439 aggregator : Callable [[SearchSynonymsResponse ], None ],
5424- search_synonyms_params : SearchSynonymsParams = SearchSynonymsParams (
5425- hits_per_page = 1000
5426- ),
5440+ search_synonyms_params : Optional [SearchSynonymsParams ] = None ,
54275441 request_options : Optional [Union [dict , RequestOptions ]] = None ,
54285442 ) -> SearchSynonymsResponse :
54295443 """
54305444 Helper: Iterate on the `search_synonyms` method of the client to allow aggregating synonyms of an index.
54315445 """
5446+ if search_synonyms_params is None :
5447+ search_synonyms_params = SearchSynonymsParams (hits_per_page = 1000 , page = 0 )
54325448 hits_per_page = 1000
54335449 page = search_synonyms_params .page or 0
54345450 search_synonyms_params .hits_per_page = hits_per_page
@@ -5453,13 +5469,13 @@ def _func(_prev: Optional[SearchSynonymsResponse]) -> SearchSynonymsResponse:
54535469 def generate_secured_api_key (
54545470 self ,
54555471 parent_api_key : str ,
5456- restrictions : Optional [
5457- Union [dict , SecuredApiKeyRestrictions ]
5458- ] = SecuredApiKeyRestrictions (),
5472+ restrictions : Optional [Union [dict , SecuredApiKeyRestrictions ]] = None ,
54595473 ) -> str :
54605474 """
54615475 Helper: Generates a secured API key based on the given `parent_api_key` and given `restrictions`.
54625476 """
5477+ if restrictions is None :
5478+ restrictions = SecuredApiKeyRestrictions ()
54635479 restrictions_dict = {}
54645480 if isinstance (restrictions , SecuredApiKeyRestrictions ):
54655481 restrictions_dict = restrictions .to_dict ()
0 commit comments