Example #1
0
 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']]
Example #2
0
 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"]]
Example #3
0
    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."""
Example #4
0
 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']]
Example #5
0
    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']]
Example #6
0
 def get(self):
     response = self._request_get('user')
     return User.construct_from(response)
Example #7
0
 def get_by_id(self, user_id):
     response = self._request_get('users/{}'.format(user_id))
     return User.construct_from(response)
Example #8
0
 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']]
Example #9
0
 def get_by_id(self, user_id):
     response = self._request_get('users/%s' % user_id)
     return User.construct_from(response)