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

from __future__ import annotations

from .webhook import (
    WebhookResource,
    AsyncWebhookResource,
    WebhookResourceWithRawResponse,
    AsyncWebhookResourceWithRawResponse,
    WebhookResourceWithStreamingResponse,
    AsyncWebhookResourceWithStreamingResponse,
)
from ....._compat import cached_property
from ....._resource import SyncAPIResource, AsyncAPIResource

__all__ = ["ContentfulResource", "AsyncContentfulResource"]


class ContentfulResource(SyncAPIResource):
    @cached_property
    def webhook(self) -> WebhookResource:
        return WebhookResource(self._client)

    @cached_property
    def with_raw_response(self) -> ContentfulResourceWithRawResponse:
        """
        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/alisytsma/ali-test-mcp#accessing-raw-response-data-eg-headers
        """
        return ContentfulResourceWithRawResponse(self)

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

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#with_streaming_response
        """
        return ContentfulResourceWithStreamingResponse(self)


class AsyncContentfulResource(AsyncAPIResource):
    @cached_property
    def webhook(self) -> AsyncWebhookResource:
        return AsyncWebhookResource(self._client)

    @cached_property
    def with_raw_response(self) -> AsyncContentfulResourceWithRawResponse:
        """
        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/alisytsma/ali-test-mcp#accessing-raw-response-data-eg-headers
        """
        return AsyncContentfulResourceWithRawResponse(self)

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

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#with_streaming_response
        """
        return AsyncContentfulResourceWithStreamingResponse(self)


class ContentfulResourceWithRawResponse:
    def __init__(self, contentful: ContentfulResource) -> None:
        self._contentful = contentful

    @cached_property
    def webhook(self) -> WebhookResourceWithRawResponse:
        return WebhookResourceWithRawResponse(self._contentful.webhook)


class AsyncContentfulResourceWithRawResponse:
    def __init__(self, contentful: AsyncContentfulResource) -> None:
        self._contentful = contentful

    @cached_property
    def webhook(self) -> AsyncWebhookResourceWithRawResponse:
        return AsyncWebhookResourceWithRawResponse(self._contentful.webhook)


class ContentfulResourceWithStreamingResponse:
    def __init__(self, contentful: ContentfulResource) -> None:
        self._contentful = contentful

    @cached_property
    def webhook(self) -> WebhookResourceWithStreamingResponse:
        return WebhookResourceWithStreamingResponse(self._contentful.webhook)


class AsyncContentfulResourceWithStreamingResponse:
    def __init__(self, contentful: AsyncContentfulResource) -> None:
        self._contentful = contentful

    @cached_property
    def webhook(self) -> AsyncWebhookResourceWithStreamingResponse:
        return AsyncWebhookResourceWithStreamingResponse(self._contentful.webhook)
