from typing import Dict
import requests


def fetch_table_of_contents(host: str) -> Dict[str, Dict[str, str]]: 
    """
    Fetch the table of contents from the host homepage 

    :param host: URL of updoc host
    :return: Table of contents of all documentations available on the host 
    """
    # get table of contents 
    # home_endpt = f'{host}/available'
    home_endpt = host + '/available'
    res = requests.get(home_endpt)
    table_of_contents = res.json() 
    return {
        item['category']: {
            doc['doc_name']: doc['doc_path'] 
            for doc in item['documents']
        }
        for item in table_of_contents
    }