@@ -349,13 +349,17 @@ async def browse_objects(
349
349
self ,
350
350
index_name : str ,
351
351
aggregator : Callable [[BrowseResponse ], None ],
352
- browse_params : BrowseParamsObject = BrowseParamsObject () ,
352
+ browse_params : Optional [ BrowseParamsObject ] = None ,
353
353
request_options : Optional [Union [dict , RequestOptions ]] = None ,
354
354
) -> BrowseResponse :
355
355
"""
356
356
Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index.
357
357
"""
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
359
363
360
364
async def _func (_prev : Optional [BrowseResponse ]) -> BrowseResponse :
361
365
if _prev is not None and _prev .cursor is not None :
@@ -376,14 +380,18 @@ async def browse_rules(
376
380
self ,
377
381
index_name : str ,
378
382
aggregator : Callable [[SearchRulesResponse ], None ],
379
- search_rules_params : SearchRulesParams = SearchRulesParams ( hits_per_page = 1000 ) ,
383
+ search_rules_params : Optional [ SearchRulesParams ] = None ,
380
384
request_options : Optional [Union [dict , RequestOptions ]] = None ,
381
385
) -> SearchRulesResponse :
382
386
"""
383
387
Helper: Iterate on the `search_rules` method of the client to allow aggregating rules of an index.
384
388
"""
389
+ if search_rules_params is None :
390
+ search_rules_params = SearchRulesParams (hits_per_page = 1000 )
391
+
385
392
if search_rules_params .hits_per_page is None :
386
393
search_rules_params .hits_per_page = 1000
394
+
387
395
hits_per_page = search_rules_params .hits_per_page
388
396
389
397
async def _func (_prev : Optional [SearchRulesResponse ]) -> SearchRulesResponse :
@@ -405,14 +413,14 @@ async def browse_synonyms(
405
413
self ,
406
414
index_name : str ,
407
415
aggregator : Callable [[SearchSynonymsResponse ], None ],
408
- search_synonyms_params : SearchSynonymsParams = SearchSynonymsParams (
409
- hits_per_page = 1000
410
- ),
416
+ search_synonyms_params : Optional [SearchSynonymsParams ] = None ,
411
417
request_options : Optional [Union [dict , RequestOptions ]] = None ,
412
418
) -> SearchSynonymsResponse :
413
419
"""
414
420
Helper: Iterate on the `search_synonyms` method of the client to allow aggregating synonyms of an index.
415
421
"""
422
+ if search_synonyms_params is None :
423
+ search_synonyms_params = SearchSynonymsParams (hits_per_page = 1000 , page = 0 )
416
424
hits_per_page = 1000
417
425
page = search_synonyms_params .page or 0
418
426
search_synonyms_params .hits_per_page = hits_per_page
@@ -439,13 +447,13 @@ async def _func(
439
447
async def generate_secured_api_key (
440
448
self ,
441
449
parent_api_key : str ,
442
- restrictions : Optional [
443
- Union [dict , SecuredApiKeyRestrictions ]
444
- ] = SecuredApiKeyRestrictions (),
450
+ restrictions : Optional [Union [dict , SecuredApiKeyRestrictions ]] = None ,
445
451
) -> str :
446
452
"""
447
453
Helper: Generates a secured API key based on the given `parent_api_key` and given `restrictions`.
448
454
"""
455
+ if restrictions is None :
456
+ restrictions = SecuredApiKeyRestrictions ()
449
457
restrictions_dict = {}
450
458
if isinstance (restrictions , SecuredApiKeyRestrictions ):
451
459
restrictions_dict = restrictions .to_dict ()
@@ -5365,13 +5373,17 @@ def browse_objects(
5365
5373
self ,
5366
5374
index_name : str ,
5367
5375
aggregator : Callable [[BrowseResponse ], None ],
5368
- browse_params : BrowseParamsObject = BrowseParamsObject () ,
5376
+ browse_params : Optional [ BrowseParamsObject ] = None ,
5369
5377
request_options : Optional [Union [dict , RequestOptions ]] = None ,
5370
5378
) -> BrowseResponse :
5371
5379
"""
5372
5380
Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index.
5373
5381
"""
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
5375
5387
5376
5388
def _func (_prev : Optional [BrowseResponse ]) -> BrowseResponse :
5377
5389
if _prev is not None and _prev .cursor is not None :
@@ -5392,14 +5404,18 @@ def browse_rules(
5392
5404
self ,
5393
5405
index_name : str ,
5394
5406
aggregator : Callable [[SearchRulesResponse ], None ],
5395
- search_rules_params : SearchRulesParams = SearchRulesParams ( hits_per_page = 1000 ) ,
5407
+ search_rules_params : Optional [ SearchRulesParams ] = None ,
5396
5408
request_options : Optional [Union [dict , RequestOptions ]] = None ,
5397
5409
) -> SearchRulesResponse :
5398
5410
"""
5399
5411
Helper: Iterate on the `search_rules` method of the client to allow aggregating rules of an index.
5400
5412
"""
5413
+ if search_rules_params is None :
5414
+ search_rules_params = SearchRulesParams (hits_per_page = 1000 )
5415
+
5401
5416
if search_rules_params .hits_per_page is None :
5402
5417
search_rules_params .hits_per_page = 1000
5418
+
5403
5419
hits_per_page = search_rules_params .hits_per_page
5404
5420
5405
5421
def _func (_prev : Optional [SearchRulesResponse ]) -> SearchRulesResponse :
@@ -5421,14 +5437,14 @@ def browse_synonyms(
5421
5437
self ,
5422
5438
index_name : str ,
5423
5439
aggregator : Callable [[SearchSynonymsResponse ], None ],
5424
- search_synonyms_params : SearchSynonymsParams = SearchSynonymsParams (
5425
- hits_per_page = 1000
5426
- ),
5440
+ search_synonyms_params : Optional [SearchSynonymsParams ] = None ,
5427
5441
request_options : Optional [Union [dict , RequestOptions ]] = None ,
5428
5442
) -> SearchSynonymsResponse :
5429
5443
"""
5430
5444
Helper: Iterate on the `search_synonyms` method of the client to allow aggregating synonyms of an index.
5431
5445
"""
5446
+ if search_synonyms_params is None :
5447
+ search_synonyms_params = SearchSynonymsParams (hits_per_page = 1000 , page = 0 )
5432
5448
hits_per_page = 1000
5433
5449
page = search_synonyms_params .page or 0
5434
5450
search_synonyms_params .hits_per_page = hits_per_page
@@ -5453,13 +5469,13 @@ def _func(_prev: Optional[SearchSynonymsResponse]) -> SearchSynonymsResponse:
5453
5469
def generate_secured_api_key (
5454
5470
self ,
5455
5471
parent_api_key : str ,
5456
- restrictions : Optional [
5457
- Union [dict , SecuredApiKeyRestrictions ]
5458
- ] = SecuredApiKeyRestrictions (),
5472
+ restrictions : Optional [Union [dict , SecuredApiKeyRestrictions ]] = None ,
5459
5473
) -> str :
5460
5474
"""
5461
5475
Helper: Generates a secured API key based on the given `parent_api_key` and given `restrictions`.
5462
5476
"""
5477
+ if restrictions is None :
5478
+ restrictions = SecuredApiKeyRestrictions ()
5463
5479
restrictions_dict = {}
5464
5480
if isinstance (restrictions , SecuredApiKeyRestrictions ):
5465
5481
restrictions_dict = restrictions .to_dict ()
0 commit comments