def get_timed_out_users(self, community_id, limit=10, cursor=None): if limit > 100: raise TwitchAttributeException( 'Maximum number of objects returned in one request is 100') params = {'limit': limit, 'cursor': cursor} response = self._request_get( 'communities/{}/timeouts'.format(community_id), params=params) return [User.construct_from(x) for x in response['timed_out_users']]
def get_timed_out_users(self, community_id, limit=10, cursor=None): if limit > 100: raise TwitchAttributeException( "Maximum number of objects returned in one request is 100" ) params = {"limit": limit, "cursor": cursor} response = self._request_get( "communities/{}/timeouts".format(community_id), params=params ) return [User.construct_from(x) for x in response["timed_out_users"]]
sensor.DOMAIN: { "platform": "twitch", CONF_CLIENT_ID: "1234", "channels": ["channel123"], } } CONFIG_WITH_OAUTH = { sensor.DOMAIN: { "platform": "twitch", CONF_CLIENT_ID: "1234", "channels": ["channel123"], "token": "9876", } } USER_ID = User({"id": 123, "display_name": "channel123", "logo": "logo.png"}) STREAM_OBJECT_ONLINE = Stream( { "channel": {"game": "Good Game", "status": "Title"}, "preview": {"medium": "stream-medium.png"}, } ) CHANNEL_OBJECT = Channel({"followers": 42, "views": 24}) OAUTH_USER_ID = User({"id": 987}) SUB_ACTIVE = Subscription({"created_at": "2020-01-20T21:22:42", "is_gift": False}) FOLLOW_ACTIVE = Follow({"created_at": "2020-01-20T21:22:42"}) async def test_init(hass): """Test initial config."""
def get_editors(self, channel_id): response = self._request_get('channels/{}/editors'.format(channel_id)) return [User.construct_from(x) for x in response['users']]
def translate_usernames_to_ids(self, usernames): if isinstance(usernames, list): usernames = ','.join(usernames) response = self._request_get('users?login={}'.format(usernames)) return [User.construct_from(x) for x in response['users']]
def get(self): response = self._request_get('user') return User.construct_from(response)
def get_by_id(self, user_id): response = self._request_get('users/{}'.format(user_id)) return User.construct_from(response)
def get_moderators(self, community_id): response = self._request_get( 'communities/{}/moderators'.format(community_id)) return [User.construct_from(x) for x in response['moderators']]
def get_by_id(self, user_id): response = self._request_get('users/%s' % user_id) return User.construct_from(response)