|
38 | 38 | )
|
39 | 39 | from algoliasearch.recommend.models.recommend_models import RecommendModels
|
40 | 40 | from algoliasearch.recommend.models.recommend_rule import RecommendRule
|
| 41 | +from algoliasearch.recommend.models.recommend_updated_at_response import ( |
| 42 | + RecommendUpdatedAtResponse, |
| 43 | +) |
41 | 44 | from algoliasearch.recommend.models.search_recommend_rules_params import (
|
42 | 45 | SearchRecommendRulesParams,
|
43 | 46 | )
|
@@ -129,6 +132,98 @@ async def set_client_api_key(self, api_key: str) -> None:
|
129 | 132 | """Sets a new API key to authenticate requests."""
|
130 | 133 | self._transporter._config.set_client_api_key(api_key)
|
131 | 134 |
|
| 135 | + async def batch_recommend_rules_with_http_info( |
| 136 | + self, |
| 137 | + index_name: Annotated[ |
| 138 | + StrictStr, |
| 139 | + Field(description="Name of the index on which to perform the operation."), |
| 140 | + ], |
| 141 | + model: Annotated[ |
| 142 | + RecommendModels, |
| 143 | + Field( |
| 144 | + description="[Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). " |
| 145 | + ), |
| 146 | + ], |
| 147 | + recommend_rule: Optional[List[RecommendRule]] = None, |
| 148 | + request_options: Optional[Union[dict, RequestOptions]] = None, |
| 149 | + ) -> ApiResponse[str]: |
| 150 | + """ |
| 151 | + Create or update a batch of Recommend Rules Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). |
| 152 | +
|
| 153 | + Required API Key ACLs: |
| 154 | + - editSettings |
| 155 | +
|
| 156 | + :param index_name: Name of the index on which to perform the operation. (required) |
| 157 | + :type index_name: str |
| 158 | + :param model: [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). (required) |
| 159 | + :type model: RecommendModels |
| 160 | + :param recommend_rule: |
| 161 | + :type recommend_rule: List[RecommendRule] |
| 162 | + :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) |
| 163 | + :return: Returns the raw algoliasearch 'APIResponse' object. |
| 164 | + """ |
| 165 | + |
| 166 | + if index_name is None: |
| 167 | + raise ValueError( |
| 168 | + "Parameter `index_name` is required when calling `batch_recommend_rules`." |
| 169 | + ) |
| 170 | + |
| 171 | + if model is None: |
| 172 | + raise ValueError( |
| 173 | + "Parameter `model` is required when calling `batch_recommend_rules`." |
| 174 | + ) |
| 175 | + |
| 176 | + _data = {} |
| 177 | + if recommend_rule is not None: |
| 178 | + _data = recommend_rule |
| 179 | + |
| 180 | + return await self._transporter.request( |
| 181 | + verb=Verb.POST, |
| 182 | + path="/1/indexes/{indexName}/{model}/recommend/rules/batch".replace( |
| 183 | + "{indexName}", quote(str(index_name), safe="") |
| 184 | + ).replace("{model}", quote(str(model), safe="")), |
| 185 | + request_options=self._request_options.merge( |
| 186 | + data=dumps(bodySerializer(_data)), |
| 187 | + user_request_options=request_options, |
| 188 | + ), |
| 189 | + use_read_transporter=False, |
| 190 | + ) |
| 191 | + |
| 192 | + async def batch_recommend_rules( |
| 193 | + self, |
| 194 | + index_name: Annotated[ |
| 195 | + StrictStr, |
| 196 | + Field(description="Name of the index on which to perform the operation."), |
| 197 | + ], |
| 198 | + model: Annotated[ |
| 199 | + RecommendModels, |
| 200 | + Field( |
| 201 | + description="[Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). " |
| 202 | + ), |
| 203 | + ], |
| 204 | + recommend_rule: Optional[List[RecommendRule]] = None, |
| 205 | + request_options: Optional[Union[dict, RequestOptions]] = None, |
| 206 | + ) -> RecommendUpdatedAtResponse: |
| 207 | + """ |
| 208 | + Create or update a batch of Recommend Rules Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). |
| 209 | +
|
| 210 | + Required API Key ACLs: |
| 211 | + - editSettings |
| 212 | +
|
| 213 | + :param index_name: Name of the index on which to perform the operation. (required) |
| 214 | + :type index_name: str |
| 215 | + :param model: [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). (required) |
| 216 | + :type model: RecommendModels |
| 217 | + :param recommend_rule: |
| 218 | + :type recommend_rule: List[RecommendRule] |
| 219 | + :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) |
| 220 | + :return: Returns the deserialized response in a 'RecommendUpdatedAtResponse' result object. |
| 221 | + """ |
| 222 | + resp = await self.batch_recommend_rules_with_http_info( |
| 223 | + index_name, model, recommend_rule, request_options |
| 224 | + ) |
| 225 | + return resp.deserialize(RecommendUpdatedAtResponse, resp.raw_data) |
| 226 | + |
132 | 227 | async def custom_delete_with_http_info(
|
133 | 228 | self,
|
134 | 229 | path: Annotated[
|
@@ -977,6 +1072,98 @@ def set_client_api_key(self, api_key: str) -> None:
|
977 | 1072 | """Sets a new API key to authenticate requests."""
|
978 | 1073 | self._transporter._config.set_client_api_key(api_key)
|
979 | 1074 |
|
| 1075 | + def batch_recommend_rules_with_http_info( |
| 1076 | + self, |
| 1077 | + index_name: Annotated[ |
| 1078 | + StrictStr, |
| 1079 | + Field(description="Name of the index on which to perform the operation."), |
| 1080 | + ], |
| 1081 | + model: Annotated[ |
| 1082 | + RecommendModels, |
| 1083 | + Field( |
| 1084 | + description="[Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). " |
| 1085 | + ), |
| 1086 | + ], |
| 1087 | + recommend_rule: Optional[List[RecommendRule]] = None, |
| 1088 | + request_options: Optional[Union[dict, RequestOptions]] = None, |
| 1089 | + ) -> ApiResponse[str]: |
| 1090 | + """ |
| 1091 | + Create or update a batch of Recommend Rules Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). |
| 1092 | +
|
| 1093 | + Required API Key ACLs: |
| 1094 | + - editSettings |
| 1095 | +
|
| 1096 | + :param index_name: Name of the index on which to perform the operation. (required) |
| 1097 | + :type index_name: str |
| 1098 | + :param model: [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). (required) |
| 1099 | + :type model: RecommendModels |
| 1100 | + :param recommend_rule: |
| 1101 | + :type recommend_rule: List[RecommendRule] |
| 1102 | + :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) |
| 1103 | + :return: Returns the raw algoliasearch 'APIResponse' object. |
| 1104 | + """ |
| 1105 | + |
| 1106 | + if index_name is None: |
| 1107 | + raise ValueError( |
| 1108 | + "Parameter `index_name` is required when calling `batch_recommend_rules`." |
| 1109 | + ) |
| 1110 | + |
| 1111 | + if model is None: |
| 1112 | + raise ValueError( |
| 1113 | + "Parameter `model` is required when calling `batch_recommend_rules`." |
| 1114 | + ) |
| 1115 | + |
| 1116 | + _data = {} |
| 1117 | + if recommend_rule is not None: |
| 1118 | + _data = recommend_rule |
| 1119 | + |
| 1120 | + return self._transporter.request( |
| 1121 | + verb=Verb.POST, |
| 1122 | + path="/1/indexes/{indexName}/{model}/recommend/rules/batch".replace( |
| 1123 | + "{indexName}", quote(str(index_name), safe="") |
| 1124 | + ).replace("{model}", quote(str(model), safe="")), |
| 1125 | + request_options=self._request_options.merge( |
| 1126 | + data=dumps(bodySerializer(_data)), |
| 1127 | + user_request_options=request_options, |
| 1128 | + ), |
| 1129 | + use_read_transporter=False, |
| 1130 | + ) |
| 1131 | + |
| 1132 | + def batch_recommend_rules( |
| 1133 | + self, |
| 1134 | + index_name: Annotated[ |
| 1135 | + StrictStr, |
| 1136 | + Field(description="Name of the index on which to perform the operation."), |
| 1137 | + ], |
| 1138 | + model: Annotated[ |
| 1139 | + RecommendModels, |
| 1140 | + Field( |
| 1141 | + description="[Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). " |
| 1142 | + ), |
| 1143 | + ], |
| 1144 | + recommend_rule: Optional[List[RecommendRule]] = None, |
| 1145 | + request_options: Optional[Union[dict, RequestOptions]] = None, |
| 1146 | + ) -> RecommendUpdatedAtResponse: |
| 1147 | + """ |
| 1148 | + Create or update a batch of Recommend Rules Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). |
| 1149 | +
|
| 1150 | + Required API Key ACLs: |
| 1151 | + - editSettings |
| 1152 | +
|
| 1153 | + :param index_name: Name of the index on which to perform the operation. (required) |
| 1154 | + :type index_name: str |
| 1155 | + :param model: [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). (required) |
| 1156 | + :type model: RecommendModels |
| 1157 | + :param recommend_rule: |
| 1158 | + :type recommend_rule: List[RecommendRule] |
| 1159 | + :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) |
| 1160 | + :return: Returns the deserialized response in a 'RecommendUpdatedAtResponse' result object. |
| 1161 | + """ |
| 1162 | + resp = self.batch_recommend_rules_with_http_info( |
| 1163 | + index_name, model, recommend_rule, request_options |
| 1164 | + ) |
| 1165 | + return resp.deserialize(RecommendUpdatedAtResponse, resp.raw_data) |
| 1166 | + |
980 | 1167 | def custom_delete_with_http_info(
|
981 | 1168 | self,
|
982 | 1169 | path: Annotated[
|
|
0 commit comments