# 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.audits

async def get_encoded_response(
        request_id: cdp.network.RequestId,
        encoding: str,
        quality: typing.Optional[float] = None,
        size_only: typing.Optional[bool] = None
    ) -> typing.Tuple[typing.Optional[str], int, int]:
    '''
    Returns the response body and size if it were re-encoded with the specified settings. Only
    applies to images.

    :param request_id: Identifier of the network request to get content for.
    :param encoding: The encoding to use.
    :param quality: *(Optional)* The quality of the encoding (0-1). (defaults to 1)
    :param size_only: *(Optional)* Whether to only return the size information (defaults to false).
    :returns: A tuple with the following items:

        0. **body** – *(Optional)* The encoded body as a base64 string. Omitted if sizeOnly is true.
        1. **originalSize** – Size before re-encoding.
        2. **encodedSize** – Size after re-encoding.
    '''
    session = get_session_context('audits.get_encoded_response')
    return await session.execute(cdp.audits.get_encoded_response(request_id, encoding, quality, size_only))
