22# https://dev.twitch.tv/docs/v5/reference/streams/
33
44from twitch import keys
5- from twitch .api .parameters import StreamType , Language
5+ from twitch .api .parameters import Boolean , StreamType , Language , Platform
66from twitch .queries import V5Query as Qry
77from twitch .queries import query
88
@@ -17,15 +17,21 @@ def by_id(channel_id, stream_type=StreamType.LIVE):
1717
1818
1919# required scope: none
20+ # platform undocumented / unsupported
2021@query
2122def get_all (game = None , channel_ids = None , community_id = None , language = Language .ALL ,
22- stream_type = StreamType .LIVE , limit = 25 , offset = 0 ):
23+ stream_type = StreamType .LIVE , platform = Platform . ALL , limit = 25 , offset = 0 ):
2324 q = Qry ('streams' )
2425 q .add_param (keys .GAME , game )
2526 q .add_param (keys .CHANNEL , channel_ids )
2627 q .add_param (keys .COMMUNITY_ID , community_id )
2728 q .add_param (keys .LANGUAGE , Language .validate (language ), Language .ALL )
2829 q .add_param (keys .STREAM_TYPE , StreamType .validate (stream_type ), StreamType .LIVE )
30+ platform = Platform .validate (platform )
31+ if platform == Platform .XBOX_ONE :
32+ q .add_param (keys .XBOX_HEARTBEAT , Boolean .TRUE )
33+ elif platform == Platform .PS4 :
34+ q .add_param (keys .SCE_PLATFORM , 'PS4' )
2935 q .add_param (keys .LIMIT , limit , 25 )
3036 q .add_param (keys .OFFSET , offset , 0 )
3137 return q
0 commit comments