import requests


def get_opensea_collection(collection: str) -> list:
    """Retrieve all assets of collection on OpenSea and return a list of all assets found."""

    def get_page(offset: int):
        """Retrieve one page of 50 assets at offset."""
        opensea_url = "https://api.opensea.io/api/v1/assets"
        querystring = {
            "order_direction": "desc",
            "offset": offset,
            "limit": "50",
            "collection": collection,
        }
        return requests.request("GET", opensea_url, params=querystring)

    assets = []
    offset = 0
    while True:
        print(offset, end=", ")
        response = get_page(offset)
        if not response.ok:
            print(f"\nDone ({response.status_code} {response.reason})")
            break
        assets.extend(response.json()["assets"])
        offset += 50

    return assets