|
122 | 122 | self, |
123 | 123 | index_name: str, |
124 | 124 | aggregator: Callable[[BrowseResponse], None], |
125 | | - browse_params: BrowseParamsObject = BrowseParamsObject(), |
| 125 | + browse_params: Optional[BrowseParamsObject] = None, |
126 | 126 | request_options: Optional[Union[dict, RequestOptions]] = None, |
127 | 127 | ) -> BrowseResponse: |
128 | 128 | """ |
129 | 129 | Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index. |
130 | 130 | """ |
131 | | - browse_params.hits_per_page = browse_params.hits_per_page or 1000 |
| 131 | + if browse_params is None: |
| 132 | + browse_params = BrowseParamsObject(hits_per_page=1000) |
| 133 | + |
| 134 | + if browse_params.hits_per_page is None: |
| 135 | + browse_params.hits_per_page = 1000 |
132 | 136 |
|
133 | 137 | {{^isSyncClient}}async {{/isSyncClient}}def _func(_prev: Optional[BrowseResponse]) -> BrowseResponse: |
134 | 138 | if _prev is not None and _prev.cursor is not None: |
|
149 | 153 | self, |
150 | 154 | index_name: str, |
151 | 155 | aggregator: Callable[[SearchRulesResponse], None], |
152 | | - search_rules_params: SearchRulesParams = SearchRulesParams(hits_per_page=1000), |
| 156 | + search_rules_params: Optional[SearchRulesParams] = None, |
153 | 157 | request_options: Optional[Union[dict, RequestOptions]] = None, |
154 | 158 | ) -> SearchRulesResponse: |
155 | 159 | """ |
156 | 160 | Helper: Iterate on the `search_rules` method of the client to allow aggregating rules of an index. |
157 | 161 | """ |
| 162 | + if search_rules_params is None: |
| 163 | + search_rules_params = SearchRulesParams(hits_per_page=1000) |
| 164 | + |
158 | 165 | if search_rules_params.hits_per_page is None: |
159 | 166 | search_rules_params.hits_per_page = 1000 |
| 167 | + |
160 | 168 | hits_per_page = search_rules_params.hits_per_page |
161 | 169 |
|
162 | 170 | {{^isSyncClient}}async {{/isSyncClient}}def _func(_prev: Optional[SearchRulesResponse]) -> SearchRulesResponse: |
|
177 | 185 | self, |
178 | 186 | index_name: str, |
179 | 187 | aggregator: Callable[[SearchSynonymsResponse], None], |
180 | | - search_synonyms_params: SearchSynonymsParams = SearchSynonymsParams(hits_per_page=1000), |
| 188 | + search_synonyms_params: Optional[SearchSynonymsParams] = None, |
181 | 189 | request_options: Optional[Union[dict, RequestOptions]] = None, |
182 | 190 | ) -> SearchSynonymsResponse: |
183 | 191 | """ |
184 | 192 | Helper: Iterate on the `search_synonyms` method of the client to allow aggregating synonyms of an index. |
185 | 193 | """ |
| 194 | + if search_synonyms_params is None: |
| 195 | + search_synonyms_params = SearchSynonymsParams( |
| 196 | + hits_per_page=1000, |
| 197 | + page=0 |
| 198 | + ) |
186 | 199 | hits_per_page = 1000 |
187 | 200 | page = search_synonyms_params.page or 0 |
188 | 201 | search_synonyms_params.hits_per_page = hits_per_page |
|
206 | 219 | {{^isSyncClient}}async {{/isSyncClient}}def generate_secured_api_key( |
207 | 220 | self, |
208 | 221 | parent_api_key: str, |
209 | | - restrictions: Optional[Union[dict, SecuredApiKeyRestrictions]] = SecuredApiKeyRestrictions(), |
| 222 | + restrictions: Optional[Union[dict, SecuredApiKeyRestrictions]] = None, |
210 | 223 | ) -> str: |
211 | 224 | """ |
212 | 225 | Helper: Generates a secured API key based on the given `parent_api_key` and given `restrictions`. |
213 | 226 | """ |
| 227 | + if restrictions is None: |
| 228 | + restrictions = SecuredApiKeyRestrictions() |
214 | 229 | restrictions_dict = {} |
215 | 230 | if isinstance(restrictions, SecuredApiKeyRestrictions): |
216 | 231 | restrictions_dict = restrictions.to_dict() |
|
0 commit comments