Skip to content

Commit 9d424e8

Browse files
committed
Add get group/room member profile api
1 parent 9a58fb3 commit 9d424e8

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

api.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,60 @@ def get_profile(self, user_id, timeout=None):
179179

180180
return Profile.new_from_json_dict(response.json)
181181

182+
def get_group_member_profile(self, group_id, user_id, timeout=None):
183+
"""Call get group member profile API.
184+
185+
https://devdocs.line.me/en/#get-group-room-member-profile
186+
187+
Gets the user profile of a member of a group that
188+
the bot is in. This can be the user ID of a user who has
189+
not added the bot as a friend or has blocked the bot.
190+
191+
:param str user_id: User ID
192+
:param str group_id: Group ID
193+
:param timeout: (optional) How long to wait for the server
194+
to send data before giving up, as a float,
195+
or a (connect timeout, readtimeout) float tuple.
196+
Default is self.http_client.timeout
197+
:type timeout: float | tuple(float, float)
198+
:rtype: :py:class:`linebot.models.responses.Profile`
199+
:return: Profile instance
200+
"""
201+
response = self._get(
202+
'/v2/bot/group/{group_id}/member/{user_id}'.format(user_id=user_id,
203+
group_id=group_id),
204+
timeout=timeout
205+
)
206+
207+
return Profile.new_from_json_dict(response.json)
208+
209+
def get_room_member_profile(self, room_id, user_id, timeout=None):
210+
"""Call get room member profile API.
211+
212+
https://devdocs.line.me/en/#get-group-room-member-profile
213+
214+
Gets the user profile of a member of a room that
215+
the bot is in. This can be the user ID of a user who has
216+
not added the bot as a friend or has blocked the bot.
217+
218+
:param str user_id: User ID
219+
:param str room_id: Room ID
220+
:param timeout: (optional) How long to wait for the server
221+
to send data before giving up, as a float,
222+
or a (connect timeout, readtimeout) float tuple.
223+
Default is self.http_client.timeout
224+
:type timeout: float | tuple(float, float)
225+
:rtype: :py:class:`linebot.models.responses.Profile`
226+
:return: Profile instance
227+
"""
228+
response = self._get(
229+
'/v2/bot/room/{room_id}/member/{user_id}'.format(user_id=user_id,
230+
room_id=room_id),
231+
timeout=timeout
232+
)
233+
234+
return Profile.new_from_json_dict(response.json)
235+
182236
def get_message_content(self, message_id, timeout=None):
183237
"""Call get content API.
184238

0 commit comments

Comments
 (0)