def detect_version(endpoint: str) -> str:
    """
    Detect the api version from endpoint url.
    Currently cachet only has a single "v1" endpoint but this may change in the future.
    """
    if endpoint.endswith("/v1"):
        return "1"

    raise ValueError(
        "Cannot determine api version based on endpoint '{}'. "
        "If the api version is not present in the url, "
        "please supply it on client creation.".format(endpoint)
    )