示例#1
0
    def get_friends(self,
                    name: t.Optional[str] = None,
                    uuid: t.Optional[str] = None) -> friends.Friends:
        """
        Get the List of Friends of a Hypixel Player and their Info.

        Parameters
        ----------
        name: `t.Optional[str]`
            The Optional string value for the Username of a hypixel player.. Defaults to None.
        uuid: `t.Optional[str]`
            The UUID of a Certain Hypixel Player. Defaults to None.

        Returns
        -------
        `friends.Friends`
            Returns the Friend Data Model, Which has the List of Friends, each with a list of attributes.
        """
        uuid = self._filter_name_uuid(name, uuid)
        json = self._fetch(self.url["friends"], {"uuid": uuid})

        return friends.Friends(json["records"])
示例#2
0
    def get_friends(self, uuid: t.Optional[str] = None) -> friends.Friends:
        """
        Get the List of Friends of a Hypixel Player and their Info.

        Parameters:
            uuid (t.Optional[str]): The UUID of a Certain Hypixel Player.

        Returns:
            friends (Friends):
                Returns the Friend Data Model, Which has the List of Friends, Each with a List of Attributes.
        """
        if uuid:
            json, success = self._fetch("/friends", {"uuid": uuid})
        else:
            raise InvalidArgumentError(
                "Please provide a Named argument of the player's UUID")

        if not success:
            raise HypixelAPIError(
                "The Key given is invalid, or something else has problem.")

        return friends.Friends(json["records"])