@@ -8,6 +8,15 @@ async def author(self):
88 resp = await self .client .api .call ("/users/" + self .authorId )
99 return User (self .client , resp ["data" ])
1010
11+ async def favorite (self ):
12+ '''
13+ Returns favorite object
14+ '''
15+
16+ resp = await self .client .api .call ("/favorites" , "POST" , params = {"type" : types .FavoriteType .Avatar ,\
17+ "favoriteId" : self .id })
18+ return Favorite (resp ["data" ])
19+
1120## User
1221
1322class LimitedUser (o .LimitedUser ):
@@ -44,6 +53,15 @@ async def friend(self):
4453 resp = await self .client .api .call ("/user/" + self .id + "/friendRequest" , "POST" )
4554 return o .Notification (self .client , resp ["data" ])
4655
56+ async def favorite (self ):
57+ '''
58+ Returns favorite object
59+ '''
60+
61+ resp = await self .client .api .call ("/favorites" , "POST" , params = {"type" : types .FavoriteType .Friend ,\
62+ "favoriteId" : self .id })
63+ return Favorite (resp ["data" ])
64+
4765class User (o .User , LimitedUser ):
4866 async def fetch_full (self ):
4967 user = await LimitedUser .fetch_full (self )
@@ -60,6 +78,10 @@ async def friend(self):
6078 notif = await LimitedUser .friend ()
6179 return notif
6280
81+ async def favorite (self ):
82+ resp = await LimitedUser .favorite (self )
83+ return resp
84+
6385class CurrentUser (o .CurrentUser , User ):
6486 obj = "CurrentUser"
6587
@@ -77,6 +99,12 @@ async def unfriend(self):
7799 async def friend (self ):
78100 raise AttributeError ("'CurrentUser' object has no attribute 'friend'" )
79101
102+ async def favorite (self ):
103+ raise AttributeError ("'CurrentUser' object has no attribute 'favorite'" )
104+
105+ async def remove_favorite (self , id ):
106+ resp = await self .client .api .call ("/favorites/" + id , "DELETE" )
107+
80108 async def update_info (self , email = None , status = None ,\
81109 statusDescription = None , bio = None , bioLinks = None ):
82110
@@ -153,6 +181,15 @@ async def author(self):
153181 resp = await self .client .api .call ("/users/" + self .authorId )
154182 return User (self .client , resp ["data" ])
155183
184+ async def favorite (self ):
185+ '''
186+ Returns favorite object
187+ '''
188+
189+ resp = await self .client .api .call ("/favorites" , "POST" , params = {"type" : types .FavoriteType .World ,\
190+ "favoriteId" : self .id })
191+ return Favorite (resp ["data" ])
192+
156193class World (o .World , LimitedWorld ):
157194 async def author (self ):
158195 resp = await super (LimitedWorld , self ).author ()
@@ -169,6 +206,10 @@ async def fetch_instance(self, id):
169206 resp = await self .client .api .call ("/instances/" + self .id + ":" + id )
170207 return Instance (self .client , resp ["data" ])
171208
209+ async def favorite (self ):
210+ resp = await LimitedWorld .favorite (self )
211+ return resp
212+
172213 async def __cinit__ (self ):
173214 instances = []
174215 for instance in self .instances :
0 commit comments