예제 #1
0
    async def get_friends_own_batch(
            self,
            xuids: List[str],
            decoration_fields: List[PeopleDecoration] = None
    ) -> PeopleResponse:
        """
        Get friends metadata by providing a list of XUIDs

        Args:
            xuids: List of XUIDs

        Returns:
            :class:`PeopleResponse`: People Response
        """
        if not decoration_fields:
            decoration_fields = [
                PeopleDecoration.PREFERRED_COLOR,
                PeopleDecoration.DETAIL,
                PeopleDecoration.MULTIPLAYER_SUMMARY,
                PeopleDecoration.PRESENCE_DETAIL,
            ]
        decoration = self.SEPERATOR.join(decoration_fields)

        url = f"{self.PEOPLE_URL}/users/me/people/batch/decoration/{decoration}"
        resp = await self.client.session.post(url,
                                              json={"xuids": xuids},
                                              headers=self._headers)
        resp.raise_for_status()
        return PeopleResponse.parse_raw(await resp.text())
예제 #2
0
    async def get_friends_by_xuid(
            self,
            xuid: str,
            decoration_fields: List[PeopleDecoration] = None,
            **kwargs) -> PeopleResponse:
        """
        Get friendlist of own profile

        Returns:
            :class:`PeopleResponse`: People Response
        """
        if not decoration_fields:
            decoration_fields = [
                PeopleDecoration.PREFERRED_COLOR,
                PeopleDecoration.DETAIL,
                PeopleDecoration.MULTIPLAYER_SUMMARY,
                PeopleDecoration.PRESENCE_DETAIL,
            ]
        decoration = self.SEPERATOR.join(decoration_fields)

        url = f"{self.PEOPLE_URL}/users/xuid({xuid})/people/social/decoration/{decoration}"
        resp = await self.client.session.get(url,
                                             headers=self._headers,
                                             **kwargs)
        resp.raise_for_status()
        return PeopleResponse.parse_raw(await resp.text())
예제 #3
0
    async def get_friend_recommendations(self) -> PeopleResponse:
        """
        Get recommended friends

        Returns:
            :class:`PeopleResponse`: People Response
        """
        url = f"{self.PEOPLE_URL}/users/me/people/recommendations"
        resp = await self.client.session.get(url, headers=self._headers)
        resp.raise_for_status()
        return PeopleResponse.parse_raw(await resp.text())