@@ -706,6 +706,14 @@ async def get_channel_schedule(
706706 utc_offset : Optional [int ] = None ,
707707 first : int = 20 ,
708708 ):
709+ if first > 25 or first < 1 :
710+ raise ValueError ("The parameter 'first' was malformed: the value must be less than or equal to 25" )
711+ if segment_ids is not None and len (segment_ids ) > 100 :
712+ raise ValueError ("segment_id can only have 100 entries" )
713+ if start_time :
714+ start_time = start_time .strftime ("%Y-%m-%dT%H:%M:%SZ" )
715+ if utc_offset :
716+ utc_offset = str (utc_offset )
709717 q = [
710718 x
711719 for x in [
@@ -860,7 +868,12 @@ async def get_polls(
860868 poll_ids : Optional [List [str ]] = None ,
861869 first : Optional [int ] = 20 ,
862870 ):
871+ if poll_ids and len (poll_ids ) > 100 :
872+ raise ValueError ("poll_ids can only have up to 100 entries" )
873+ if first and (first > 25 or first < 1 ):
874+ raise ValueError ("first can only be between 1 and 20" )
863875 q = [("broadcaster_id" , broadcaster_id ), ("first" , first )]
876+
864877 if poll_ids :
865878 q .extend (("id" , poll_id ) for poll_id in poll_ids )
866879 return await self .request (Route ("GET" , "polls" , query = q , token = token ), paginate = False , full_body = True )
@@ -877,6 +890,20 @@ async def post_poll(
877890 channel_points_voting_enabled : Optional [bool ] = False ,
878891 channel_points_per_vote : Optional [int ] = None ,
879892 ):
893+
894+ if len (title ) > 60 :
895+ raise ValueError ("title must be less than or equal to 60 characters" )
896+ if len (choices ) < 2 or len (choices ) > 5 :
897+ raise ValueError ("You must have between 2 and 5 choices" )
898+ for c in choices :
899+ if len (c ) > 25 :
900+ raise ValueError ("choice title must be less than or equal to 25 characters" )
901+ if duration < 15 or duration > 1800 :
902+ raise ValueError ("duration must be between 15 and 1800 seconds" )
903+ if bits_per_vote and bits_per_vote > 10000 :
904+ raise ValueError ("bits_per_vote must bebetween 0 and 10000" )
905+ if channel_points_per_vote and channel_points_per_vote > 1000000 :
906+ raise ValueError ("channel_points_per_vote must bebetween 0 and 1000000" )
880907 body = {
881908 "broadcaster_id" : broadcaster_id ,
882909 "title" : title ,
0 commit comments