def METHOD_NAME(
    self,
    endpoint_info: Dict[str, Any],
    dataset_name: str,
    query_params: Dict[str, str],
    headers,
) -> List:
    url: str = endpoint_info['url']
    name: Optional[str] = (
        endpoint_info['sub_name'] if 'sub_name' in endpoint_info else dataset_name
    )
    response = None
    res = None
    data: List = []
    next_page_exists = has_next_page
    index = 1
    while not response or next_page_exists(res):
        if res:
            query_params['after'] = res['paging']['next']['after']
        response = requests.get(url, params=query_params, headers=headers)
        # throw if the request's status is not 200
        response.raise_for_status()
        res = response.json()
        # Flatten the results
        results = res.get(name)
        if results is None:
            raise HubspotConnectorException(f'Impossible to retrieve data for {name}')
        if results:
            for r in results:
                data.append(r)
        index += 1
    return data