from typing import List
import requests
import json


def get_research_outputs(
    pure_api_key: str, pure_api_url: str, size: int, offset: int
) -> List[dict]:
    """Get a list of research outputs.

    Pure API identifies a series by the following parameters:
    The *size* parameter defines the length of the series.
    The *offset* parameter defines the offset of the series.
    Return [] if the GET request is not OK.
    """
    headers = {
        "api-key": pure_api_key,
        "accept": "application/json",
    }
    url = pure_api_url + "research-outputs?size={}&offset={}".format(
        str(size), str(offset)
    )
    response = requests.get(url, headers=headers)
    if response.status_code == 200:
        response_json = json.loads(response.text)
        items = response_json["items"]
        return items
    else:
        return []