def user_medias_gql(
        self, user_id: str, amount: int = 0, sleep: int = 0
    ) -> List[Media]:
        """
        Get a user's media by Public Graphql API

        Parameters
        ----------
        user_id: str
        amount: int, optional
            Maximum number of media to return, default is 0 (all medias)
        sleep: int, optional
            Timeout between pages iterations, default is a random number between 1 and 3.

        Returns
        -------
        List[Media]
            A list of objects of Media
        """
        amount = int(amount)
        user_id = int(user_id)
        sleep = int(sleep)
        medias = []
        end_cursor = None
        variables = {
            "id": user_id,
            "first": 50 if not amount or amount > 50 else amount,
            # These are Instagram restrictions, you can only specify <= 50
        }
        while True:
            self.logger.info(f"user_medias_gql: {amount}, {end_cursor}")
            if end_cursor:
                variables["after"] = end_cursor

            if not sleep:
                sleep = random.randint(1, 3)

            medias_page, end_cursor = self.user_medias_paginated_gql(
                user_id, amount, sleep, end_cursor=end_cursor
            )
            medias.extend(medias_page)
            if not end_cursor or len(medias_page) == 0:
                break
            if amount and len(medias) >= amount:
                break
            time.sleep(sleep)
        if amount:
            medias = medias[:amount]
        return medias

        Get a user's media by Public Graphql API

        Parameters
        ----------
        user_id: str
        amount: int, optional
            Maximum number of media to return, default is 0 (all medias)
        sleep: int, optional
            Timeout between pages iterations, default is a random number between 1 and 3.

        Returns
        -------
        List[Media]
            A list of objects of Media
        
instagrapi/mixins/media.py