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

from __future__ import annotations

from typing import List, Type, cast
from typing_extensions import Literal

import httpx

from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ...._utils import path_template, 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 ....pagination import SyncSinglePage, AsyncSinglePage
from .events.events import (
    EventsResource,
    AsyncEventsResource,
    EventsResourceWithRawResponse,
    AsyncEventsResourceWithRawResponse,
    EventsResourceWithStreamingResponse,
    AsyncEventsResourceWithStreamingResponse,
)
from ...._base_client import AsyncPaginator, make_request_options
from .snapshots.snapshots import (
    SnapshotsResource,
    AsyncSnapshotsResource,
    SnapshotsResourceWithRawResponse,
    AsyncSnapshotsResourceWithRawResponse,
    SnapshotsResourceWithStreamingResponse,
    AsyncSnapshotsResourceWithStreamingResponse,
)
from ....types.magic_transit import (
    connector_edit_params,
    connector_list_params,
    connector_create_params,
    connector_update_params,
)
from ....types.magic_transit.connector_get_response import ConnectorGetResponse
from ....types.magic_transit.connector_edit_response import ConnectorEditResponse
from ....types.magic_transit.connector_list_response import ConnectorListResponse
from ....types.magic_transit.connector_create_response import ConnectorCreateResponse
from ....types.magic_transit.connector_delete_response import ConnectorDeleteResponse
from ....types.magic_transit.connector_update_response import ConnectorUpdateResponse

__all__ = ["ConnectorsResource", "AsyncConnectorsResource"]


class ConnectorsResource(SyncAPIResource):
    @cached_property
    def events(self) -> EventsResource:
        return EventsResource(self._client)

    @cached_property
    def snapshots(self) -> SnapshotsResource:
        return SnapshotsResource(self._client)

    @cached_property
    def with_raw_response(self) -> ConnectorsResourceWithRawResponse:
        """
        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 ConnectorsResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> ConnectorsResourceWithStreamingResponse:
        """
        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 ConnectorsResourceWithStreamingResponse(self)

    def create(
        self,
        *,
        account_id: str,
        device: connector_create_params.Device,
        activated: bool | Omit = omit,
        interrupt_window_days_of_week: List[
            Literal["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
        ]
        | Omit = omit,
        interrupt_window_duration_hours: float | Omit = omit,
        interrupt_window_embargo_dates: SequenceNotStr[str] | Omit = omit,
        interrupt_window_hour_of_day: float | Omit = omit,
        notes: str | Omit = omit,
        timezone: 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,
    ) -> ConnectorCreateResponse:
        """
        Add a connector to your account

        Args:
          account_id: Account identifier

          device: Exactly one of id, serial_number, or provision_license must be provided.

          interrupt_window_days_of_week: Allowed days of the week for upgrades. Default is all days.

          interrupt_window_embargo_dates: List of dates (YYYY-MM-DD) when upgrades are blocked.

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        return self._post(
            path_template("/accounts/{account_id}/magic/connectors", account_id=account_id),
            body=maybe_transform(
                {
                    "device": device,
                    "activated": activated,
                    "interrupt_window_days_of_week": interrupt_window_days_of_week,
                    "interrupt_window_duration_hours": interrupt_window_duration_hours,
                    "interrupt_window_embargo_dates": interrupt_window_embargo_dates,
                    "interrupt_window_hour_of_day": interrupt_window_hour_of_day,
                    "notes": notes,
                    "timezone": timezone,
                },
                connector_create_params.ConnectorCreateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorCreateResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorCreateResponse], ResultWrapper[ConnectorCreateResponse]),
        )

    def update(
        self,
        connector_id: str,
        *,
        account_id: str,
        activated: bool | Omit = omit,
        interrupt_window_days_of_week: List[
            Literal["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
        ]
        | Omit = omit,
        interrupt_window_duration_hours: float | Omit = omit,
        interrupt_window_embargo_dates: SequenceNotStr[str] | Omit = omit,
        interrupt_window_hour_of_day: float | Omit = omit,
        notes: str | Omit = omit,
        provision_license: bool | Omit = omit,
        timezone: 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,
    ) -> ConnectorUpdateResponse:
        """
        Replace Connector or Re-provision License Key

        Args:
          account_id: Account identifier

          interrupt_window_days_of_week: Allowed days of the week for upgrades. Default is all days.

          interrupt_window_embargo_dates: List of dates (YYYY-MM-DD) when upgrades are blocked.

          provision_license: When true, regenerate license key for the connector.

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not connector_id:
            raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
        return self._put(
            path_template(
                "/accounts/{account_id}/magic/connectors/{connector_id}",
                account_id=account_id,
                connector_id=connector_id,
            ),
            body=maybe_transform(
                {
                    "activated": activated,
                    "interrupt_window_days_of_week": interrupt_window_days_of_week,
                    "interrupt_window_duration_hours": interrupt_window_duration_hours,
                    "interrupt_window_embargo_dates": interrupt_window_embargo_dates,
                    "interrupt_window_hour_of_day": interrupt_window_hour_of_day,
                    "notes": notes,
                    "provision_license": provision_license,
                    "timezone": timezone,
                },
                connector_update_params.ConnectorUpdateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorUpdateResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorUpdateResponse], ResultWrapper[ConnectorUpdateResponse]),
        )

    def list(
        self,
        *,
        account_id: str,
        device_type: Literal["MANAGED", "LICENSED"] | 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,
    ) -> SyncSinglePage[ConnectorListResponse]:
        """
        List Connectors

        Args:
          account_id: Account identifier

          device_type: Filter connectors by device type.

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        return self._get_api_list(
            path_template("/accounts/{account_id}/magic/connectors", account_id=account_id),
            page=SyncSinglePage[ConnectorListResponse],
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform({"device_type": device_type}, connector_list_params.ConnectorListParams),
            ),
            model=ConnectorListResponse,
        )

    def delete(
        self,
        connector_id: str,
        *,
        account_id: str,
        # 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,
    ) -> ConnectorDeleteResponse:
        """
        Remove a connector from your account

        Args:
          account_id: Account identifier

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not connector_id:
            raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
        return self._delete(
            path_template(
                "/accounts/{account_id}/magic/connectors/{connector_id}",
                account_id=account_id,
                connector_id=connector_id,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorDeleteResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorDeleteResponse], ResultWrapper[ConnectorDeleteResponse]),
        )

    def edit(
        self,
        connector_id: str,
        *,
        account_id: str,
        activated: bool | Omit = omit,
        interrupt_window_days_of_week: List[
            Literal["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
        ]
        | Omit = omit,
        interrupt_window_duration_hours: float | Omit = omit,
        interrupt_window_embargo_dates: SequenceNotStr[str] | Omit = omit,
        interrupt_window_hour_of_day: float | Omit = omit,
        notes: str | Omit = omit,
        provision_license: bool | Omit = omit,
        timezone: 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,
    ) -> ConnectorEditResponse:
        """
        Edit Connector to update specific properties or Re-provision License Key

        Args:
          account_id: Account identifier

          interrupt_window_days_of_week: Allowed days of the week for upgrades. Default is all days.

          interrupt_window_embargo_dates: List of dates (YYYY-MM-DD) when upgrades are blocked.

          provision_license: When true, regenerate license key for the connector.

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not connector_id:
            raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
        return self._patch(
            path_template(
                "/accounts/{account_id}/magic/connectors/{connector_id}",
                account_id=account_id,
                connector_id=connector_id,
            ),
            body=maybe_transform(
                {
                    "activated": activated,
                    "interrupt_window_days_of_week": interrupt_window_days_of_week,
                    "interrupt_window_duration_hours": interrupt_window_duration_hours,
                    "interrupt_window_embargo_dates": interrupt_window_embargo_dates,
                    "interrupt_window_hour_of_day": interrupt_window_hour_of_day,
                    "notes": notes,
                    "provision_license": provision_license,
                    "timezone": timezone,
                },
                connector_edit_params.ConnectorEditParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorEditResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorEditResponse], ResultWrapper[ConnectorEditResponse]),
        )

    def get(
        self,
        connector_id: str,
        *,
        account_id: str,
        # 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,
    ) -> ConnectorGetResponse:
        """
        Fetch Connector

        Args:
          account_id: Account identifier

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not connector_id:
            raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
        return self._get(
            path_template(
                "/accounts/{account_id}/magic/connectors/{connector_id}",
                account_id=account_id,
                connector_id=connector_id,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorGetResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorGetResponse], ResultWrapper[ConnectorGetResponse]),
        )


class AsyncConnectorsResource(AsyncAPIResource):
    @cached_property
    def events(self) -> AsyncEventsResource:
        return AsyncEventsResource(self._client)

    @cached_property
    def snapshots(self) -> AsyncSnapshotsResource:
        return AsyncSnapshotsResource(self._client)

    @cached_property
    def with_raw_response(self) -> AsyncConnectorsResourceWithRawResponse:
        """
        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 AsyncConnectorsResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> AsyncConnectorsResourceWithStreamingResponse:
        """
        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 AsyncConnectorsResourceWithStreamingResponse(self)

    async def create(
        self,
        *,
        account_id: str,
        device: connector_create_params.Device,
        activated: bool | Omit = omit,
        interrupt_window_days_of_week: List[
            Literal["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
        ]
        | Omit = omit,
        interrupt_window_duration_hours: float | Omit = omit,
        interrupt_window_embargo_dates: SequenceNotStr[str] | Omit = omit,
        interrupt_window_hour_of_day: float | Omit = omit,
        notes: str | Omit = omit,
        timezone: 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,
    ) -> ConnectorCreateResponse:
        """
        Add a connector to your account

        Args:
          account_id: Account identifier

          device: Exactly one of id, serial_number, or provision_license must be provided.

          interrupt_window_days_of_week: Allowed days of the week for upgrades. Default is all days.

          interrupt_window_embargo_dates: List of dates (YYYY-MM-DD) when upgrades are blocked.

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        return await self._post(
            path_template("/accounts/{account_id}/magic/connectors", account_id=account_id),
            body=await async_maybe_transform(
                {
                    "device": device,
                    "activated": activated,
                    "interrupt_window_days_of_week": interrupt_window_days_of_week,
                    "interrupt_window_duration_hours": interrupt_window_duration_hours,
                    "interrupt_window_embargo_dates": interrupt_window_embargo_dates,
                    "interrupt_window_hour_of_day": interrupt_window_hour_of_day,
                    "notes": notes,
                    "timezone": timezone,
                },
                connector_create_params.ConnectorCreateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorCreateResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorCreateResponse], ResultWrapper[ConnectorCreateResponse]),
        )

    async def update(
        self,
        connector_id: str,
        *,
        account_id: str,
        activated: bool | Omit = omit,
        interrupt_window_days_of_week: List[
            Literal["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
        ]
        | Omit = omit,
        interrupt_window_duration_hours: float | Omit = omit,
        interrupt_window_embargo_dates: SequenceNotStr[str] | Omit = omit,
        interrupt_window_hour_of_day: float | Omit = omit,
        notes: str | Omit = omit,
        provision_license: bool | Omit = omit,
        timezone: 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,
    ) -> ConnectorUpdateResponse:
        """
        Replace Connector or Re-provision License Key

        Args:
          account_id: Account identifier

          interrupt_window_days_of_week: Allowed days of the week for upgrades. Default is all days.

          interrupt_window_embargo_dates: List of dates (YYYY-MM-DD) when upgrades are blocked.

          provision_license: When true, regenerate license key for the connector.

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not connector_id:
            raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
        return await self._put(
            path_template(
                "/accounts/{account_id}/magic/connectors/{connector_id}",
                account_id=account_id,
                connector_id=connector_id,
            ),
            body=await async_maybe_transform(
                {
                    "activated": activated,
                    "interrupt_window_days_of_week": interrupt_window_days_of_week,
                    "interrupt_window_duration_hours": interrupt_window_duration_hours,
                    "interrupt_window_embargo_dates": interrupt_window_embargo_dates,
                    "interrupt_window_hour_of_day": interrupt_window_hour_of_day,
                    "notes": notes,
                    "provision_license": provision_license,
                    "timezone": timezone,
                },
                connector_update_params.ConnectorUpdateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorUpdateResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorUpdateResponse], ResultWrapper[ConnectorUpdateResponse]),
        )

    def list(
        self,
        *,
        account_id: str,
        device_type: Literal["MANAGED", "LICENSED"] | 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,
    ) -> AsyncPaginator[ConnectorListResponse, AsyncSinglePage[ConnectorListResponse]]:
        """
        List Connectors

        Args:
          account_id: Account identifier

          device_type: Filter connectors by device type.

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        return self._get_api_list(
            path_template("/accounts/{account_id}/magic/connectors", account_id=account_id),
            page=AsyncSinglePage[ConnectorListResponse],
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform({"device_type": device_type}, connector_list_params.ConnectorListParams),
            ),
            model=ConnectorListResponse,
        )

    async def delete(
        self,
        connector_id: str,
        *,
        account_id: str,
        # 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,
    ) -> ConnectorDeleteResponse:
        """
        Remove a connector from your account

        Args:
          account_id: Account identifier

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not connector_id:
            raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
        return await self._delete(
            path_template(
                "/accounts/{account_id}/magic/connectors/{connector_id}",
                account_id=account_id,
                connector_id=connector_id,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorDeleteResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorDeleteResponse], ResultWrapper[ConnectorDeleteResponse]),
        )

    async def edit(
        self,
        connector_id: str,
        *,
        account_id: str,
        activated: bool | Omit = omit,
        interrupt_window_days_of_week: List[
            Literal["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
        ]
        | Omit = omit,
        interrupt_window_duration_hours: float | Omit = omit,
        interrupt_window_embargo_dates: SequenceNotStr[str] | Omit = omit,
        interrupt_window_hour_of_day: float | Omit = omit,
        notes: str | Omit = omit,
        provision_license: bool | Omit = omit,
        timezone: 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,
    ) -> ConnectorEditResponse:
        """
        Edit Connector to update specific properties or Re-provision License Key

        Args:
          account_id: Account identifier

          interrupt_window_days_of_week: Allowed days of the week for upgrades. Default is all days.

          interrupt_window_embargo_dates: List of dates (YYYY-MM-DD) when upgrades are blocked.

          provision_license: When true, regenerate license key for the connector.

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not connector_id:
            raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
        return await self._patch(
            path_template(
                "/accounts/{account_id}/magic/connectors/{connector_id}",
                account_id=account_id,
                connector_id=connector_id,
            ),
            body=await async_maybe_transform(
                {
                    "activated": activated,
                    "interrupt_window_days_of_week": interrupt_window_days_of_week,
                    "interrupt_window_duration_hours": interrupt_window_duration_hours,
                    "interrupt_window_embargo_dates": interrupt_window_embargo_dates,
                    "interrupt_window_hour_of_day": interrupt_window_hour_of_day,
                    "notes": notes,
                    "provision_license": provision_license,
                    "timezone": timezone,
                },
                connector_edit_params.ConnectorEditParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorEditResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorEditResponse], ResultWrapper[ConnectorEditResponse]),
        )

    async def get(
        self,
        connector_id: str,
        *,
        account_id: str,
        # 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,
    ) -> ConnectorGetResponse:
        """
        Fetch Connector

        Args:
          account_id: Account identifier

          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
        """
        if not account_id:
            raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
        if not connector_id:
            raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
        return await self._get(
            path_template(
                "/accounts/{account_id}/magic/connectors/{connector_id}",
                account_id=account_id,
                connector_id=connector_id,
            ),
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                post_parser=ResultWrapper[ConnectorGetResponse]._unwrapper,
            ),
            cast_to=cast(Type[ConnectorGetResponse], ResultWrapper[ConnectorGetResponse]),
        )


class ConnectorsResourceWithRawResponse:
    def __init__(self, connectors: ConnectorsResource) -> None:
        self._connectors = connectors

        self.create = to_raw_response_wrapper(
            connectors.create,
        )
        self.update = to_raw_response_wrapper(
            connectors.update,
        )
        self.list = to_raw_response_wrapper(
            connectors.list,
        )
        self.delete = to_raw_response_wrapper(
            connectors.delete,
        )
        self.edit = to_raw_response_wrapper(
            connectors.edit,
        )
        self.get = to_raw_response_wrapper(
            connectors.get,
        )

    @cached_property
    def events(self) -> EventsResourceWithRawResponse:
        return EventsResourceWithRawResponse(self._connectors.events)

    @cached_property
    def snapshots(self) -> SnapshotsResourceWithRawResponse:
        return SnapshotsResourceWithRawResponse(self._connectors.snapshots)


class AsyncConnectorsResourceWithRawResponse:
    def __init__(self, connectors: AsyncConnectorsResource) -> None:
        self._connectors = connectors

        self.create = async_to_raw_response_wrapper(
            connectors.create,
        )
        self.update = async_to_raw_response_wrapper(
            connectors.update,
        )
        self.list = async_to_raw_response_wrapper(
            connectors.list,
        )
        self.delete = async_to_raw_response_wrapper(
            connectors.delete,
        )
        self.edit = async_to_raw_response_wrapper(
            connectors.edit,
        )
        self.get = async_to_raw_response_wrapper(
            connectors.get,
        )

    @cached_property
    def events(self) -> AsyncEventsResourceWithRawResponse:
        return AsyncEventsResourceWithRawResponse(self._connectors.events)

    @cached_property
    def snapshots(self) -> AsyncSnapshotsResourceWithRawResponse:
        return AsyncSnapshotsResourceWithRawResponse(self._connectors.snapshots)


class ConnectorsResourceWithStreamingResponse:
    def __init__(self, connectors: ConnectorsResource) -> None:
        self._connectors = connectors

        self.create = to_streamed_response_wrapper(
            connectors.create,
        )
        self.update = to_streamed_response_wrapper(
            connectors.update,
        )
        self.list = to_streamed_response_wrapper(
            connectors.list,
        )
        self.delete = to_streamed_response_wrapper(
            connectors.delete,
        )
        self.edit = to_streamed_response_wrapper(
            connectors.edit,
        )
        self.get = to_streamed_response_wrapper(
            connectors.get,
        )

    @cached_property
    def events(self) -> EventsResourceWithStreamingResponse:
        return EventsResourceWithStreamingResponse(self._connectors.events)

    @cached_property
    def snapshots(self) -> SnapshotsResourceWithStreamingResponse:
        return SnapshotsResourceWithStreamingResponse(self._connectors.snapshots)


class AsyncConnectorsResourceWithStreamingResponse:
    def __init__(self, connectors: AsyncConnectorsResource) -> None:
        self._connectors = connectors

        self.create = async_to_streamed_response_wrapper(
            connectors.create,
        )
        self.update = async_to_streamed_response_wrapper(
            connectors.update,
        )
        self.list = async_to_streamed_response_wrapper(
            connectors.list,
        )
        self.delete = async_to_streamed_response_wrapper(
            connectors.delete,
        )
        self.edit = async_to_streamed_response_wrapper(
            connectors.edit,
        )
        self.get = async_to_streamed_response_wrapper(
            connectors.get,
        )

    @cached_property
    def events(self) -> AsyncEventsResourceWithStreamingResponse:
        return AsyncEventsResourceWithStreamingResponse(self._connectors.events)

    @cached_property
    def snapshots(self) -> AsyncSnapshotsResourceWithStreamingResponse:
        return AsyncSnapshotsResourceWithStreamingResponse(self._connectors.snapshots)
