# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Dict, List, Type, Iterable, Optional, cast
from typing_extensions import Literal, overload

import httpx

from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ..._utils import required_args, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
    to_raw_response_wrapper,
    to_streamed_response_wrapper,
    async_to_raw_response_wrapper,
    async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
from ..._base_client import make_request_options
from ...types.browser_rendering import snapshot_create_params
from ...types.browser_rendering.snapshot_create_response import SnapshotCreateResponse

__all__ = ["SnapshotResource", "AsyncSnapshotResource"]


class SnapshotResource(SyncAPIResource):
    @cached_property
    def with_raw_response(self) -> SnapshotResourceWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
        """
        return SnapshotResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> SnapshotResourceWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
        """
        return SnapshotResourceWithStreamingResponse(self)

    @overload
    def create(
        self,
        *,
        account_id: str,
        html: str,
        cache_ttl: float | Omit = omit,
        action_timeout: float | Omit = omit,
        add_script_tag: Iterable[snapshot_create_params.Variant0AddScriptTag] | Omit = omit,
        add_style_tag: Iterable[snapshot_create_params.Variant0AddStyleTag] | Omit = omit,
        allow_request_pattern: SequenceNotStr[str] | Omit = omit,
        allow_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        authenticate: snapshot_create_params.Variant0Authenticate | Omit = omit,
        best_attempt: bool | Omit = omit,
        cookies: Iterable[snapshot_create_params.Variant0Cookie] | Omit = omit,
        emulate_media_type: str | Omit = omit,
        goto_options: snapshot_create_params.Variant0GotoOptions | Omit = omit,
        reject_request_pattern: SequenceNotStr[str] | Omit = omit,
        reject_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        screenshot_options: snapshot_create_params.Variant0ScreenshotOptions | Omit = omit,
        set_extra_http_headers: Dict[str, str] | Omit = omit,
        set_java_script_enabled: bool | Omit = omit,
        user_agent: str | Omit = omit,
        viewport: snapshot_create_params.Variant0Viewport | Omit = omit,
        wait_for_selector: snapshot_create_params.Variant0WaitForSelector | Omit = omit,
        wait_for_timeout: float | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[SnapshotCreateResponse]:
        """Returns the page's HTML content and screenshot.

        Control page loading with
        `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`,
        `fullPage`, `clip` and others.

        Args:
          account_id: Account ID.

          html: Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or
              `url` must be set.

          cache_ttl: Cache TTL default is 5s. Set to 0 to disable.

          action_timeout: The maximum duration allowed for the browser action to complete after the page
              has loaded (such as taking screenshots, extracting content, or generating PDFs).
              If this time limit is exceeded, the action stops and returns a timeout error.

          add_script_tag: Adds a `<script>` tag into the page with the desired URL or content.

          add_style_tag: Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a
              `<style type="text/css">` tag with the content.

          allow_request_pattern: Only allow requests that match the provided regex patterns, eg. '/^.\\**\\..(css)'.

          allow_resource_types: Only allow requests that match the provided resource types, eg. 'image' or
              'script'.

          authenticate: Provide credentials for HTTP authentication.

          best_attempt: Attempt to proceed when 'awaited' events fail or timeout.

          cookies: Check [options](https://pptr.dev/api/puppeteer.page.setcookie).

          goto_options: Check [options](https://pptr.dev/api/puppeteer.gotooptions).

          reject_request_pattern: Block undesired requests that match the provided regex patterns, eg.
              '/^.\\**\\..(css)'.

          reject_resource_types: Block undesired requests that match the provided resource types, eg. 'image' or
              'script'.

          viewport: Check [options](https://pptr.dev/api/puppeteer.page.setviewport).

          wait_for_selector: Wait for the selector to appear in page. Check
              [options](https://pptr.dev/api/puppeteer.page.waitforselector).

          wait_for_timeout: Waits for a specified timeout before continuing.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        ...

    @overload
    def create(
        self,
        *,
        account_id: str,
        url: str,
        cache_ttl: float | Omit = omit,
        action_timeout: float | Omit = omit,
        add_script_tag: Iterable[snapshot_create_params.Variant1AddScriptTag] | Omit = omit,
        add_style_tag: Iterable[snapshot_create_params.Variant1AddStyleTag] | Omit = omit,
        allow_request_pattern: SequenceNotStr[str] | Omit = omit,
        allow_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        authenticate: snapshot_create_params.Variant1Authenticate | Omit = omit,
        best_attempt: bool | Omit = omit,
        cookies: Iterable[snapshot_create_params.Variant1Cookie] | Omit = omit,
        emulate_media_type: str | Omit = omit,
        goto_options: snapshot_create_params.Variant1GotoOptions | Omit = omit,
        reject_request_pattern: SequenceNotStr[str] | Omit = omit,
        reject_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        screenshot_options: snapshot_create_params.Variant1ScreenshotOptions | Omit = omit,
        set_extra_http_headers: Dict[str, str] | Omit = omit,
        set_java_script_enabled: bool | Omit = omit,
        user_agent: str | Omit = omit,
        viewport: snapshot_create_params.Variant1Viewport | Omit = omit,
        wait_for_selector: snapshot_create_params.Variant1WaitForSelector | Omit = omit,
        wait_for_timeout: float | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[SnapshotCreateResponse]:
        """Returns the page's HTML content and screenshot.

        Control page loading with
        `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`,
        `fullPage`, `clip` and others.

        Args:
          account_id: Account ID.

          url: URL to navigate to, eg. `https://example.com`.

          cache_ttl: Cache TTL default is 5s. Set to 0 to disable.

          action_timeout: The maximum duration allowed for the browser action to complete after the page
              has loaded (such as taking screenshots, extracting content, or generating PDFs).
              If this time limit is exceeded, the action stops and returns a timeout error.

          add_script_tag: Adds a `<script>` tag into the page with the desired URL or content.

          add_style_tag: Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a
              `<style type="text/css">` tag with the content.

          allow_request_pattern: Only allow requests that match the provided regex patterns, eg. '/^.\\**\\..(css)'.

          allow_resource_types: Only allow requests that match the provided resource types, eg. 'image' or
              'script'.

          authenticate: Provide credentials for HTTP authentication.

          best_attempt: Attempt to proceed when 'awaited' events fail or timeout.

          cookies: Check [options](https://pptr.dev/api/puppeteer.page.setcookie).

          goto_options: Check [options](https://pptr.dev/api/puppeteer.gotooptions).

          reject_request_pattern: Block undesired requests that match the provided regex patterns, eg.
              '/^.\\**\\..(css)'.

          reject_resource_types: Block undesired requests that match the provided resource types, eg. 'image' or
              'script'.

          viewport: Check [options](https://pptr.dev/api/puppeteer.page.setviewport).

          wait_for_selector: Wait for the selector to appear in page. Check
              [options](https://pptr.dev/api/puppeteer.page.waitforselector).

          wait_for_timeout: Waits for a specified timeout before continuing.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        ...

    @required_args(["account_id", "html"], ["account_id", "url"])
    def create(
        self,
        *,
        account_id: str,
        html: str | Omit = omit,
        cache_ttl: float | Omit = omit,
        action_timeout: float | Omit = omit,
        add_script_tag: Iterable[snapshot_create_params.Variant0AddScriptTag]
        | Iterable[snapshot_create_params.Variant1AddScriptTag]
        | Omit = omit,
        add_style_tag: Iterable[snapshot_create_params.Variant0AddStyleTag]
        | Iterable[snapshot_create_params.Variant1AddStyleTag]
        | Omit = omit,
        allow_request_pattern: SequenceNotStr[str] | Omit = omit,
        allow_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        authenticate: snapshot_create_params.Variant0Authenticate
        | snapshot_create_params.Variant1Authenticate
        | Omit = omit,
        best_attempt: bool | Omit = omit,
        cookies: Iterable[snapshot_create_params.Variant0Cookie]
        | Iterable[snapshot_create_params.Variant1Cookie]
        | Omit = omit,
        emulate_media_type: str | Omit = omit,
        goto_options: snapshot_create_params.Variant0GotoOptions
        | snapshot_create_params.Variant1GotoOptions
        | Omit = omit,
        reject_request_pattern: SequenceNotStr[str] | Omit = omit,
        reject_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        screenshot_options: snapshot_create_params.Variant0ScreenshotOptions
        | snapshot_create_params.Variant1ScreenshotOptions
        | Omit = omit,
        set_extra_http_headers: Dict[str, str] | Omit = omit,
        set_java_script_enabled: bool | Omit = omit,
        user_agent: str | Omit = omit,
        viewport: snapshot_create_params.Variant0Viewport | snapshot_create_params.Variant1Viewport | Omit = omit,
        wait_for_selector: snapshot_create_params.Variant0WaitForSelector
        | snapshot_create_params.Variant1WaitForSelector
        | Omit = omit,
        wait_for_timeout: float | Omit = omit,
        url: str | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[SnapshotCreateResponse]:
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        return self._post(
            f"/accounts/{account_id}/browser-rendering/snapshot",
            body=maybe_transform(
                {
                    "html": html,
                    "action_timeout": action_timeout,
                    "add_script_tag": add_script_tag,
                    "add_style_tag": add_style_tag,
                    "allow_request_pattern": allow_request_pattern,
                    "allow_resource_types": allow_resource_types,
                    "authenticate": authenticate,
                    "best_attempt": best_attempt,
                    "cookies": cookies,
                    "emulate_media_type": emulate_media_type,
                    "goto_options": goto_options,
                    "reject_request_pattern": reject_request_pattern,
                    "reject_resource_types": reject_resource_types,
                    "screenshot_options": screenshot_options,
                    "set_extra_http_headers": set_extra_http_headers,
                    "set_java_script_enabled": set_java_script_enabled,
                    "user_agent": user_agent,
                    "viewport": viewport,
                    "wait_for_selector": wait_for_selector,
                    "wait_for_timeout": wait_for_timeout,
                    "url": url,
                },
                snapshot_create_params.SnapshotCreateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform({"cache_ttl": cache_ttl}, snapshot_create_params.SnapshotCreateParams),
                post_parser=ResultWrapper[Optional[SnapshotCreateResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[SnapshotCreateResponse]], ResultWrapper[SnapshotCreateResponse]),
        )


class AsyncSnapshotResource(AsyncAPIResource):
    @cached_property
    def with_raw_response(self) -> AsyncSnapshotResourceWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
        """
        return AsyncSnapshotResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> AsyncSnapshotResourceWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
        """
        return AsyncSnapshotResourceWithStreamingResponse(self)

    @overload
    async def create(
        self,
        *,
        account_id: str,
        html: str,
        cache_ttl: float | Omit = omit,
        action_timeout: float | Omit = omit,
        add_script_tag: Iterable[snapshot_create_params.Variant0AddScriptTag] | Omit = omit,
        add_style_tag: Iterable[snapshot_create_params.Variant0AddStyleTag] | Omit = omit,
        allow_request_pattern: SequenceNotStr[str] | Omit = omit,
        allow_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        authenticate: snapshot_create_params.Variant0Authenticate | Omit = omit,
        best_attempt: bool | Omit = omit,
        cookies: Iterable[snapshot_create_params.Variant0Cookie] | Omit = omit,
        emulate_media_type: str | Omit = omit,
        goto_options: snapshot_create_params.Variant0GotoOptions | Omit = omit,
        reject_request_pattern: SequenceNotStr[str] | Omit = omit,
        reject_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        screenshot_options: snapshot_create_params.Variant0ScreenshotOptions | Omit = omit,
        set_extra_http_headers: Dict[str, str] | Omit = omit,
        set_java_script_enabled: bool | Omit = omit,
        user_agent: str | Omit = omit,
        viewport: snapshot_create_params.Variant0Viewport | Omit = omit,
        wait_for_selector: snapshot_create_params.Variant0WaitForSelector | Omit = omit,
        wait_for_timeout: float | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[SnapshotCreateResponse]:
        """Returns the page's HTML content and screenshot.

        Control page loading with
        `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`,
        `fullPage`, `clip` and others.

        Args:
          account_id: Account ID.

          html: Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or
              `url` must be set.

          cache_ttl: Cache TTL default is 5s. Set to 0 to disable.

          action_timeout: The maximum duration allowed for the browser action to complete after the page
              has loaded (such as taking screenshots, extracting content, or generating PDFs).
              If this time limit is exceeded, the action stops and returns a timeout error.

          add_script_tag: Adds a `<script>` tag into the page with the desired URL or content.

          add_style_tag: Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a
              `<style type="text/css">` tag with the content.

          allow_request_pattern: Only allow requests that match the provided regex patterns, eg. '/^.\\**\\..(css)'.

          allow_resource_types: Only allow requests that match the provided resource types, eg. 'image' or
              'script'.

          authenticate: Provide credentials for HTTP authentication.

          best_attempt: Attempt to proceed when 'awaited' events fail or timeout.

          cookies: Check [options](https://pptr.dev/api/puppeteer.page.setcookie).

          goto_options: Check [options](https://pptr.dev/api/puppeteer.gotooptions).

          reject_request_pattern: Block undesired requests that match the provided regex patterns, eg.
              '/^.\\**\\..(css)'.

          reject_resource_types: Block undesired requests that match the provided resource types, eg. 'image' or
              'script'.

          viewport: Check [options](https://pptr.dev/api/puppeteer.page.setviewport).

          wait_for_selector: Wait for the selector to appear in page. Check
              [options](https://pptr.dev/api/puppeteer.page.waitforselector).

          wait_for_timeout: Waits for a specified timeout before continuing.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        ...

    @overload
    async def create(
        self,
        *,
        account_id: str,
        url: str,
        cache_ttl: float | Omit = omit,
        action_timeout: float | Omit = omit,
        add_script_tag: Iterable[snapshot_create_params.Variant1AddScriptTag] | Omit = omit,
        add_style_tag: Iterable[snapshot_create_params.Variant1AddStyleTag] | Omit = omit,
        allow_request_pattern: SequenceNotStr[str] | Omit = omit,
        allow_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        authenticate: snapshot_create_params.Variant1Authenticate | Omit = omit,
        best_attempt: bool | Omit = omit,
        cookies: Iterable[snapshot_create_params.Variant1Cookie] | Omit = omit,
        emulate_media_type: str | Omit = omit,
        goto_options: snapshot_create_params.Variant1GotoOptions | Omit = omit,
        reject_request_pattern: SequenceNotStr[str] | Omit = omit,
        reject_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        screenshot_options: snapshot_create_params.Variant1ScreenshotOptions | Omit = omit,
        set_extra_http_headers: Dict[str, str] | Omit = omit,
        set_java_script_enabled: bool | Omit = omit,
        user_agent: str | Omit = omit,
        viewport: snapshot_create_params.Variant1Viewport | Omit = omit,
        wait_for_selector: snapshot_create_params.Variant1WaitForSelector | Omit = omit,
        wait_for_timeout: float | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[SnapshotCreateResponse]:
        """Returns the page's HTML content and screenshot.

        Control page loading with
        `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`,
        `fullPage`, `clip` and others.

        Args:
          account_id: Account ID.

          url: URL to navigate to, eg. `https://example.com`.

          cache_ttl: Cache TTL default is 5s. Set to 0 to disable.

          action_timeout: The maximum duration allowed for the browser action to complete after the page
              has loaded (such as taking screenshots, extracting content, or generating PDFs).
              If this time limit is exceeded, the action stops and returns a timeout error.

          add_script_tag: Adds a `<script>` tag into the page with the desired URL or content.

          add_style_tag: Adds a `<link rel="stylesheet">` tag into the page with the desired URL or a
              `<style type="text/css">` tag with the content.

          allow_request_pattern: Only allow requests that match the provided regex patterns, eg. '/^.\\**\\..(css)'.

          allow_resource_types: Only allow requests that match the provided resource types, eg. 'image' or
              'script'.

          authenticate: Provide credentials for HTTP authentication.

          best_attempt: Attempt to proceed when 'awaited' events fail or timeout.

          cookies: Check [options](https://pptr.dev/api/puppeteer.page.setcookie).

          goto_options: Check [options](https://pptr.dev/api/puppeteer.gotooptions).

          reject_request_pattern: Block undesired requests that match the provided regex patterns, eg.
              '/^.\\**\\..(css)'.

          reject_resource_types: Block undesired requests that match the provided resource types, eg. 'image' or
              'script'.

          viewport: Check [options](https://pptr.dev/api/puppeteer.page.setviewport).

          wait_for_selector: Wait for the selector to appear in page. Check
              [options](https://pptr.dev/api/puppeteer.page.waitforselector).

          wait_for_timeout: Waits for a specified timeout before continuing.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        ...

    @required_args(["account_id", "html"], ["account_id", "url"])
    async def create(
        self,
        *,
        account_id: str,
        html: str | Omit = omit,
        cache_ttl: float | Omit = omit,
        action_timeout: float | Omit = omit,
        add_script_tag: Iterable[snapshot_create_params.Variant0AddScriptTag]
        | Iterable[snapshot_create_params.Variant1AddScriptTag]
        | Omit = omit,
        add_style_tag: Iterable[snapshot_create_params.Variant0AddStyleTag]
        | Iterable[snapshot_create_params.Variant1AddStyleTag]
        | Omit = omit,
        allow_request_pattern: SequenceNotStr[str] | Omit = omit,
        allow_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        authenticate: snapshot_create_params.Variant0Authenticate
        | snapshot_create_params.Variant1Authenticate
        | Omit = omit,
        best_attempt: bool | Omit = omit,
        cookies: Iterable[snapshot_create_params.Variant0Cookie]
        | Iterable[snapshot_create_params.Variant1Cookie]
        | Omit = omit,
        emulate_media_type: str | Omit = omit,
        goto_options: snapshot_create_params.Variant0GotoOptions
        | snapshot_create_params.Variant1GotoOptions
        | Omit = omit,
        reject_request_pattern: SequenceNotStr[str] | Omit = omit,
        reject_resource_types: List[
            Literal[
                "document",
                "stylesheet",
                "image",
                "media",
                "font",
                "script",
                "texttrack",
                "xhr",
                "fetch",
                "prefetch",
                "eventsource",
                "websocket",
                "manifest",
                "signedexchange",
                "ping",
                "cspviolationreport",
                "preflight",
                "other",
            ]
        ]
        | Omit = omit,
        screenshot_options: snapshot_create_params.Variant0ScreenshotOptions
        | snapshot_create_params.Variant1ScreenshotOptions
        | Omit = omit,
        set_extra_http_headers: Dict[str, str] | Omit = omit,
        set_java_script_enabled: bool | Omit = omit,
        user_agent: str | Omit = omit,
        viewport: snapshot_create_params.Variant0Viewport | snapshot_create_params.Variant1Viewport | Omit = omit,
        wait_for_selector: snapshot_create_params.Variant0WaitForSelector
        | snapshot_create_params.Variant1WaitForSelector
        | Omit = omit,
        wait_for_timeout: float | Omit = omit,
        url: str | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> Optional[SnapshotCreateResponse]:
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        return await self._post(
            f"/accounts/{account_id}/browser-rendering/snapshot",
            body=await async_maybe_transform(
                {
                    "html": html,
                    "action_timeout": action_timeout,
                    "add_script_tag": add_script_tag,
                    "add_style_tag": add_style_tag,
                    "allow_request_pattern": allow_request_pattern,
                    "allow_resource_types": allow_resource_types,
                    "authenticate": authenticate,
                    "best_attempt": best_attempt,
                    "cookies": cookies,
                    "emulate_media_type": emulate_media_type,
                    "goto_options": goto_options,
                    "reject_request_pattern": reject_request_pattern,
                    "reject_resource_types": reject_resource_types,
                    "screenshot_options": screenshot_options,
                    "set_extra_http_headers": set_extra_http_headers,
                    "set_java_script_enabled": set_java_script_enabled,
                    "user_agent": user_agent,
                    "viewport": viewport,
                    "wait_for_selector": wait_for_selector,
                    "wait_for_timeout": wait_for_timeout,
                    "url": url,
                },
                snapshot_create_params.SnapshotCreateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform(
                    {"cache_ttl": cache_ttl}, snapshot_create_params.SnapshotCreateParams
                ),
                post_parser=ResultWrapper[Optional[SnapshotCreateResponse]]._unwrapper,
            ),
            cast_to=cast(Type[Optional[SnapshotCreateResponse]], ResultWrapper[SnapshotCreateResponse]),
        )


class SnapshotResourceWithRawResponse:
    def __init__(self, snapshot: SnapshotResource) -> None:
        self._snapshot = snapshot

        self.create = to_raw_response_wrapper(
            snapshot.create,
        )


class AsyncSnapshotResourceWithRawResponse:
    def __init__(self, snapshot: AsyncSnapshotResource) -> None:
        self._snapshot = snapshot

        self.create = async_to_raw_response_wrapper(
            snapshot.create,
        )


class SnapshotResourceWithStreamingResponse:
    def __init__(self, snapshot: SnapshotResource) -> None:
        self._snapshot = snapshot

        self.create = to_streamed_response_wrapper(
            snapshot.create,
        )


class AsyncSnapshotResourceWithStreamingResponse:
    def __init__(self, snapshot: AsyncSnapshotResource) -> None:
        self._snapshot = snapshot

        self.create = async_to_streamed_response_wrapper(
            snapshot.create,
        )
