def get_oat_package_list(
    token: str, start_time: str, end_time: str, pipeline_id: str
) -> Tuple[int, List[Dict[str, str]]]:
    """Get OAT package list
    Args:
        token (str): account token
        start_time (str): The beginning of the time interval
        end_time (str): The end of the time interval
        pipeline_id (str): Unique alphanumeric string that identifies a data pipeline.
    Returns:
        Tuple[int, List[Dict[str, str]]]: Number of items retrieved and package list
    """

    query_params = {
        "startDateTime": start_time,
        "endDateTime": end_time,
    }
    url = f"{XDR_HOST_URL}/v1.0/preview/ath/oat/dataPipelines/{pipeline_id}/packages"
    headers = get_header(
        {
            "Authorization": f"Bearer {token}",
            "Content-Type": "application/json",
        }
    )
    logger.info(f"Get oat package list: {url}\nquery params: {query_params}")
    response = requests.get(url, headers=headers, params=query_params)
    logger.info(
        f"Get oat package list response: {response.text}, "
        f"response headers: {get_trace_log(response.headers)}"
    )

    if response.status_code == requests.codes.bad_request:
        response_data = response.json()
        if (
            response_data.get("error", {}).get("innererror", {}).get("code", "")
            == "OutOfRetentionTime"
        ):
            logger.warning(
                "The OAT file is out of retention time, "
                f"start_time: {start_time}, end_time: {end_time}"
            )
            return 0, []
    if response.status_code in [requests.codes.forbidden, requests.codes.not_found]:
        logger.error(f"response status code: {response.status_code}")
        return 0, []

    response.raise_for_status()

    response_data = response.json()
    package_list = response_data["items"]
    count = response_data["count"]

    return count, package_list
Get OAT package list
    Args:
        token (str): account token
        start_time (str): The beginning of the time interval
        end_time (str): The end of the time interval
        pipeline_id (str): Unique alphanumeric string that identifies a data pipeline.
    Returns:
        Tuple[int, List[Dict[str, str]]]: Number of items retrieved and package list
    
Solutions/Trend Micro Vision One/Data Connectors/AzureFunctionTrendMicroXDR/shared_code/services/oat_service.py