1- from typing import Optional , Union , Dict , Any
1+ import warnings
2+ from typing import Optional , Union
23
34from algoliasearch .configs import RecommendationConfig
45from algoliasearch .helpers import is_async_available
@@ -12,13 +13,25 @@ class RecommendationClient(object):
1213 def __init__ (self , transporter , config ):
1314 # type: (Transporter, RecommendationConfig) -> None
1415
16+ warnings .warn (
17+ "`%s.%s` is deprecated, use `%s.%s` instead."
18+ % ("RecommendationClient" , "init" , "PersonalizationClient" , "init" ,),
19+ DeprecationWarning ,
20+ )
21+
1522 self ._transporter = transporter
1623 self ._config = config
1724
1825 @staticmethod
1926 def create (app_id = None , api_key = None , region = None ):
2027 # type: (Optional[str], Optional[str], Optional[str]) -> RecommendationClient # noqa: E501
2128
29+ warnings .warn (
30+ "`%s.%s` is deprecated, use `%s.%s` instead."
31+ % ("RecommendationClient" , "create" , "PersonalizationClient" , "create" ,),
32+ DeprecationWarning ,
33+ )
34+
2235 config = RecommendationConfig (app_id , api_key , region )
2336
2437 return RecommendationClient .create_with_config (config )
@@ -27,6 +40,17 @@ def create(app_id=None, api_key=None, region=None):
2740 def create_with_config (config ):
2841 # type: (RecommendationConfig) -> RecommendationClient
2942
43+ warnings .warn (
44+ "`%s.%s` is deprecated, use `%s.%s` instead."
45+ % (
46+ "RecommendationClient" ,
47+ "create_with_config" ,
48+ "PersonalizationClient" ,
49+ "create_with_config" ,
50+ ),
51+ DeprecationWarning ,
52+ )
53+
3054 requester = Requester ()
3155 transporter = Transporter (requester , config )
3256
@@ -50,6 +74,17 @@ def set_personalization_strategy(
5074 ): # noqa: E501
5175 # type: (dict, Optional[Union[dict, RequestOptions]]) -> dict
5276
77+ warnings .warn (
78+ "`%s.%s` is deprecated, use `%s.%s` instead."
79+ % (
80+ "RecommendationClient" ,
81+ "set_personalization_strategy" ,
82+ "PersonalizationClient" ,
83+ "set_personalization_strategy" ,
84+ ),
85+ DeprecationWarning ,
86+ )
87+
5388 return self ._transporter .write (
5489 Verb .POST ,
5590 "1/strategies/personalization" ,
@@ -60,11 +95,28 @@ def set_personalization_strategy(
6095 def get_personalization_strategy (self , request_options = None ):
6196 # type: (Optional[Union[dict, RequestOptions]]) -> dict
6297
98+ warnings .warn (
99+ "`%s.%s` is deprecated, use `%s.%s` instead."
100+ % (
101+ "RecommendationClient" ,
102+ "get_personalization_strategy" ,
103+ "PersonalizationClient" ,
104+ "get_personalization_strategy" ,
105+ ),
106+ DeprecationWarning ,
107+ )
108+
63109 return self ._transporter .read (
64110 Verb .GET , "1/strategies/personalization" , None , request_options
65111 )
66112
67113 def close (self ):
68114 # type: () -> None
69115
116+ warnings .warn (
117+ "`%s.%s` is deprecated, use `%s.%s` instead."
118+ % ("RecommendationClient" , "close" , "PersonalizationClient" , "close" ,),
119+ DeprecationWarning ,
120+ )
121+
70122 return self ._transporter .close () # type: ignore
0 commit comments