# DO NOT EDIT THIS FILE!
#
# This code is generated off of PyCDP modules. If you need to make
# changes, edit the generator and regenerate all of the modules.

from __future__ import annotations
import typing

from ..context import get_connection_context, get_session_context

import cdp.application_cache
from cdp.application_cache import (
    ApplicationCache,
    ApplicationCacheResource,
    ApplicationCacheStatusUpdated,
    FrameWithManifest,
    NetworkStateUpdated
)


async def enable() -> None:
    '''
    Enables application cache domain notifications.
    '''
    session = get_session_context('application_cache.enable')
    return await session.execute(cdp.application_cache.enable())


async def get_application_cache_for_frame(
        frame_id: cdp.page.FrameId
    ) -> ApplicationCache:
    '''
    Returns relevant application cache data for the document in given frame.

    :param frame_id: Identifier of the frame containing document whose application cache is retrieved.
    :returns: Relevant application cache data for the document in given frame.
    '''
    session = get_session_context('application_cache.get_application_cache_for_frame')
    return await session.execute(cdp.application_cache.get_application_cache_for_frame(frame_id))


async def get_frames_with_manifests() -> typing.List[FrameWithManifest]:
    '''
    Returns array of frame identifiers with manifest urls for each frame containing a document
    associated with some application cache.

    :returns: Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
    '''
    session = get_session_context('application_cache.get_frames_with_manifests')
    return await session.execute(cdp.application_cache.get_frames_with_manifests())


async def get_manifest_for_frame(
        frame_id: cdp.page.FrameId
    ) -> str:
    '''
    Returns manifest URL for document in the given frame.

    :param frame_id: Identifier of the frame containing document whose manifest is retrieved.
    :returns: Manifest URL for document in the given frame.
    '''
    session = get_session_context('application_cache.get_manifest_for_frame')
    return await session.execute(cdp.application_cache.get_manifest_for_frame(frame_id))
