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

from __future__ import annotations

import typing_extensions
from typing import List, Union, Mapping, Iterable, cast
from datetime import datetime
from typing_extensions import Literal

import httpx

from ..types import (
    transformation_list_params,
    transformation_create_params,
    transformation_delete_params,
    transformation_update_params,
    transformation_list_errors_params,
    transformation_deprecated_update_params,
)
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import extract_files, maybe_transform, deepcopy_minimal, 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 .._base_client import make_request_options
from ..types.transformation_list_response import TransformationListResponse
from ..types.transformation_create_response import TransformationCreateResponse
from ..types.transformation_delete_response import TransformationDeleteResponse
from ..types.update_transformation_response import UpdateTransformationResponse
from ..types.transformation_list_errors_response import TransformationListErrorsResponse

__all__ = ["TransformationsResource", "AsyncTransformationsResource"]


class TransformationsResource(SyncAPIResource):
    @cached_property
    def with_raw_response(self) -> TransformationsResourceWithRawResponse:
        """
        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/bem-team/bem-sdk-python#accessing-raw-response-data-eg-headers
        """
        return TransformationsResourceWithRawResponse(self)

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

        For more information, see https://www.github.com/bem-team/bem-sdk-python#with_streaming_response
        """
        return TransformationsResourceWithStreamingResponse(self)

    def create(
        self,
        *,
        pipeline_id: str,
        transformations: Iterable[transformation_create_params.Transformation],
        # 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,
    ) -> TransformationCreateResponse:
        """
        Creates a batch of new transformations, each with a content and input type, and
        queues them up in bem's servers. Bem supports both `application/json` and
        `multipart/form-data` requests, where the latter is useful for large files.

        Args:
          pipeline_id: ID of the desired pipeline to transform the input content. Generated by bem.

          transformations: An array of objects containing all the transformations you want to create.

          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
        """
        body = deepcopy_minimal(
            {
                "pipeline_id": pipeline_id,
                "transformations": transformations,
            }
        )
        files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
        if files:
            # It should be noted that the actual Content-Type header that will be
            # sent to the server will contain a `boundary` parameter, e.g.
            # multipart/form-data; boundary=---abc--
            extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
        return self._post(
            "/v1-beta/transformations",
            body=maybe_transform(body, transformation_create_params.TransformationCreateParams),
            files=files,
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=TransformationCreateResponse,
        )

    def update(
        self,
        *,
        transformations: Iterable[transformation_update_params.Transformation] | NotGiven = NOT_GIVEN,
        # 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,
    ) -> UpdateTransformationResponse:
        """
        Updates a transformation with feedback on the corrected transformation value.

        Args:
          transformations: An array of objects containing all the transformations you want to patch.

          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
        """
        return self._put(
            "/v1-beta/transformations",
            body=maybe_transform(
                {"transformations": transformations}, transformation_update_params.TransformationUpdateParams
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=UpdateTransformationResponse,
        )

    def list(
        self,
        *,
        ending_before: str | NotGiven = NOT_GIVEN,
        item_offset: int | NotGiven = NOT_GIVEN,
        limit: int | NotGiven = NOT_GIVEN,
        pipeline_id: str | NotGiven = NOT_GIVEN,
        published: bool | NotGiven = NOT_GIVEN,
        published_after: Union[str, datetime] | NotGiven = NOT_GIVEN,
        published_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
        reference_ids: List[str] | NotGiven = NOT_GIVEN,
        sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
        starting_after: str | NotGiven = NOT_GIVEN,
        transformation_ids: List[str] | NotGiven = NOT_GIVEN,
        # 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,
    ) -> TransformationListResponse:
        """
        Lists all performed transformations, with either pagination or specific
        reference IDs.

        Args:
          ending_before: A cursor to use in pagination. `endingBefore` is a transform ID that defines
              your place in the list. For example, if you make a list request and receive 50
              objects, starting with `tr_2bxoJPNdSD4LgRT4YVC4gt72hlI`, your subsequent call
              can include `endingBefore=tr_2bxoJPNdSD4LgRT4YVC4gt72hlI` to fetch the previous
              page of the list.

          item_offset: Filters based on the index of the page of the document you had transformed. For
              CSV transformations, this offset represents starting row of the CSV for which
              you want to fetch transformations for. For PDF transformations, this offset
              represents the starting page of the PDF. This applies for a specific reference
              ID of a transformation. Note that this only applies if you specify one reference
              ID in `referenceIDs` and if you have `independentDocumentProcessingEnabled` set
              to `true` in your pipeline configuration. Note that this is zero-indexed.

          limit: This specifies a limit on the number of objects to return, ranging between 1
              and 100.

          pipeline_id: The unique ID for a given pipeline. Will filter to just the transformations
              processed by the given pipeline. If left out, will query over ALL
              transformations for your account.

          published: Boolean that toggles filtering whether or not transformations were successfully
              published via webhook.

          published_after: Filters to transformations successfully published via webhook after the
              specified date. Must be in RFC 3339 format.

          published_before: Filters to transformations successfully published via webhook before the
              specified date. Must be in RFC 3339 format.

          reference_ids: Array with the reference IDs of the transformed data points. Formatted as a CSV
              array.

          sort_order: Specifies sorting behavior. The two options are `asc` and `desc` to sort
              ascending and descending respectively, with default sort being ascending. Paging
              works in both directions.

          starting_after: A cursor to use in pagination. `startingAfter` is a transform ID that defines
              your place in the list. For example, if you make a list request and receive 50
              objects, ending with `tr_2bxoJPNdSD4LgRT4YVC4gt72hlI`, your subsequent call can
              include `startingAfter=tr_2bxoJPNdSD4LgRT4YVC4gt72hlI` to fetch the next page of
              the list.

          transformation_ids: Array with the transform IDs of the transformed data points. Formatted as a CSV
              array.

          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
        """
        return self._get(
            "/v1-beta/transformations",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {
                        "ending_before": ending_before,
                        "item_offset": item_offset,
                        "limit": limit,
                        "pipeline_id": pipeline_id,
                        "published": published,
                        "published_after": published_after,
                        "published_before": published_before,
                        "reference_ids": reference_ids,
                        "sort_order": sort_order,
                        "starting_after": starting_after,
                        "transformation_ids": transformation_ids,
                    },
                    transformation_list_params.TransformationListParams,
                ),
            ),
            cast_to=TransformationListResponse,
        )

    def delete(
        self,
        *,
        pipeline_id: str | NotGiven = NOT_GIVEN,
        reference_ids: List[str] | NotGiven = NOT_GIVEN,
        transformation_ids: List[str] | NotGiven = NOT_GIVEN,
        # 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,
    ) -> TransformationDeleteResponse:
        """
        Deletes transformations by specifying pipeline ID, list of reference IDs, or
        list of transformation IDs. Will delete intersection of all params specified.

        Args:
          pipeline_id: The unique ID for a given pipeline. Will filter to just the transformations
              processed by the given pipeline. If left out, will query over ALL
              transformations for your account.

          reference_ids: Array with the reference IDs of the transformed data points. Formatted as a CSV
              array.

          transformation_ids: Array with the transform IDs of the transformed data points. Formatted as a CSV
              array.

          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
        """
        return self._delete(
            "/v1-beta/transformations",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {
                        "pipeline_id": pipeline_id,
                        "reference_ids": reference_ids,
                        "transformation_ids": transformation_ids,
                    },
                    transformation_delete_params.TransformationDeleteParams,
                ),
            ),
            cast_to=TransformationDeleteResponse,
        )

    @typing_extensions.deprecated("deprecated")
    def deprecated_update(
        self,
        *,
        transformations: Iterable[transformation_deprecated_update_params.Transformation] | NotGiven = NOT_GIVEN,
        # 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,
    ) -> UpdateTransformationResponse:
        """Deprecating will be replaced by put.

        Updates a transformation with feedback on
        the corrected transformation value.

        Args:
          transformations: An array of objects containing all the transformations you want to patch.

          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
        """
        return self._patch(
            "/v1-beta/transformations",
            body=maybe_transform(
                {"transformations": transformations},
                transformation_deprecated_update_params.TransformationDeprecatedUpdateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=UpdateTransformationResponse,
        )

    def list_errors(
        self,
        *,
        reference_ids: List[str],
        ending_before: str | NotGiven = NOT_GIVEN,
        limit: int | NotGiven = NOT_GIVEN,
        pipeline_id: str | NotGiven = NOT_GIVEN,
        sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
        starting_after: str | NotGiven = NOT_GIVEN,
        # 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,
    ) -> TransformationListErrorsResponse:
        """
        Lists all errors encountered while attempting to transform data, with either
        pagination or specific reference IDs.

        Args:
          reference_ids: Array with the reference IDs of the transformed data points. Formatted as a CSV
              array.

          ending_before: A cursor to use in pagination. `endingBefore` is a transform ID that defines
              your place in the list. For example, if you make a list request and receive 50
              objects, starting with `tr_2bxoJPNdSD4LgRT4YVC4gt72hlI`, your subsequent call
              can include `endingBefore=tr_2bxoJPNdSD4LgRT4YVC4gt72hlI` to fetch the previous
              page of the list.

          limit: This specifies a limit on the number of objects to return, ranging between 1
              and 100.

          pipeline_id: The unique ID for a given pipeline. Will filter to just the transformations
              processed by the given pipeline. If left out, will query over ALL
              transformations for your account.

          sort_order: Specifies sorting behavior. The two options are `asc` and `desc` to sort
              ascending and descending respectively, with default sort being ascending. Paging
              works in both directions.

          starting_after: A cursor to use in pagination. `startingAfter` is a transform ID that defines
              your place in the list. For example, if you make a list request and receive 50
              objects, ending with `tr_2bxoJPNdSD4LgRT4YVC4gt72hlI`, your subsequent call can
              include `startingAfter=tr_2bxoJPNdSD4LgRT4YVC4gt72hlI` to fetch the next page of
              the list.

          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
        """
        return self._get(
            "/v1-beta/transformations/errors",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {
                        "reference_ids": reference_ids,
                        "ending_before": ending_before,
                        "limit": limit,
                        "pipeline_id": pipeline_id,
                        "sort_order": sort_order,
                        "starting_after": starting_after,
                    },
                    transformation_list_errors_params.TransformationListErrorsParams,
                ),
            ),
            cast_to=TransformationListErrorsResponse,
        )


class AsyncTransformationsResource(AsyncAPIResource):
    @cached_property
    def with_raw_response(self) -> AsyncTransformationsResourceWithRawResponse:
        """
        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/bem-team/bem-sdk-python#accessing-raw-response-data-eg-headers
        """
        return AsyncTransformationsResourceWithRawResponse(self)

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

        For more information, see https://www.github.com/bem-team/bem-sdk-python#with_streaming_response
        """
        return AsyncTransformationsResourceWithStreamingResponse(self)

    async def create(
        self,
        *,
        pipeline_id: str,
        transformations: Iterable[transformation_create_params.Transformation],
        # 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,
    ) -> TransformationCreateResponse:
        """
        Creates a batch of new transformations, each with a content and input type, and
        queues them up in bem's servers. Bem supports both `application/json` and
        `multipart/form-data` requests, where the latter is useful for large files.

        Args:
          pipeline_id: ID of the desired pipeline to transform the input content. Generated by bem.

          transformations: An array of objects containing all the transformations you want to create.

          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
        """
        body = deepcopy_minimal(
            {
                "pipeline_id": pipeline_id,
                "transformations": transformations,
            }
        )
        files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
        if files:
            # It should be noted that the actual Content-Type header that will be
            # sent to the server will contain a `boundary` parameter, e.g.
            # multipart/form-data; boundary=---abc--
            extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
        return await self._post(
            "/v1-beta/transformations",
            body=await async_maybe_transform(body, transformation_create_params.TransformationCreateParams),
            files=files,
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=TransformationCreateResponse,
        )

    async def update(
        self,
        *,
        transformations: Iterable[transformation_update_params.Transformation] | NotGiven = NOT_GIVEN,
        # 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,
    ) -> UpdateTransformationResponse:
        """
        Updates a transformation with feedback on the corrected transformation value.

        Args:
          transformations: An array of objects containing all the transformations you want to patch.

          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
        """
        return await self._put(
            "/v1-beta/transformations",
            body=await async_maybe_transform(
                {"transformations": transformations}, transformation_update_params.TransformationUpdateParams
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=UpdateTransformationResponse,
        )

    async def list(
        self,
        *,
        ending_before: str | NotGiven = NOT_GIVEN,
        item_offset: int | NotGiven = NOT_GIVEN,
        limit: int | NotGiven = NOT_GIVEN,
        pipeline_id: str | NotGiven = NOT_GIVEN,
        published: bool | NotGiven = NOT_GIVEN,
        published_after: Union[str, datetime] | NotGiven = NOT_GIVEN,
        published_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
        reference_ids: List[str] | NotGiven = NOT_GIVEN,
        sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
        starting_after: str | NotGiven = NOT_GIVEN,
        transformation_ids: List[str] | NotGiven = NOT_GIVEN,
        # 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,
    ) -> TransformationListResponse:
        """
        Lists all performed transformations, with either pagination or specific
        reference IDs.

        Args:
          ending_before: A cursor to use in pagination. `endingBefore` is a transform ID that defines
              your place in the list. For example, if you make a list request and receive 50
              objects, starting with `tr_2bxoJPNdSD4LgRT4YVC4gt72hlI`, your subsequent call
              can include `endingBefore=tr_2bxoJPNdSD4LgRT4YVC4gt72hlI` to fetch the previous
              page of the list.

          item_offset: Filters based on the index of the page of the document you had transformed. For
              CSV transformations, this offset represents starting row of the CSV for which
              you want to fetch transformations for. For PDF transformations, this offset
              represents the starting page of the PDF. This applies for a specific reference
              ID of a transformation. Note that this only applies if you specify one reference
              ID in `referenceIDs` and if you have `independentDocumentProcessingEnabled` set
              to `true` in your pipeline configuration. Note that this is zero-indexed.

          limit: This specifies a limit on the number of objects to return, ranging between 1
              and 100.

          pipeline_id: The unique ID for a given pipeline. Will filter to just the transformations
              processed by the given pipeline. If left out, will query over ALL
              transformations for your account.

          published: Boolean that toggles filtering whether or not transformations were successfully
              published via webhook.

          published_after: Filters to transformations successfully published via webhook after the
              specified date. Must be in RFC 3339 format.

          published_before: Filters to transformations successfully published via webhook before the
              specified date. Must be in RFC 3339 format.

          reference_ids: Array with the reference IDs of the transformed data points. Formatted as a CSV
              array.

          sort_order: Specifies sorting behavior. The two options are `asc` and `desc` to sort
              ascending and descending respectively, with default sort being ascending. Paging
              works in both directions.

          starting_after: A cursor to use in pagination. `startingAfter` is a transform ID that defines
              your place in the list. For example, if you make a list request and receive 50
              objects, ending with `tr_2bxoJPNdSD4LgRT4YVC4gt72hlI`, your subsequent call can
              include `startingAfter=tr_2bxoJPNdSD4LgRT4YVC4gt72hlI` to fetch the next page of
              the list.

          transformation_ids: Array with the transform IDs of the transformed data points. Formatted as a CSV
              array.

          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
        """
        return await self._get(
            "/v1-beta/transformations",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform(
                    {
                        "ending_before": ending_before,
                        "item_offset": item_offset,
                        "limit": limit,
                        "pipeline_id": pipeline_id,
                        "published": published,
                        "published_after": published_after,
                        "published_before": published_before,
                        "reference_ids": reference_ids,
                        "sort_order": sort_order,
                        "starting_after": starting_after,
                        "transformation_ids": transformation_ids,
                    },
                    transformation_list_params.TransformationListParams,
                ),
            ),
            cast_to=TransformationListResponse,
        )

    async def delete(
        self,
        *,
        pipeline_id: str | NotGiven = NOT_GIVEN,
        reference_ids: List[str] | NotGiven = NOT_GIVEN,
        transformation_ids: List[str] | NotGiven = NOT_GIVEN,
        # 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,
    ) -> TransformationDeleteResponse:
        """
        Deletes transformations by specifying pipeline ID, list of reference IDs, or
        list of transformation IDs. Will delete intersection of all params specified.

        Args:
          pipeline_id: The unique ID for a given pipeline. Will filter to just the transformations
              processed by the given pipeline. If left out, will query over ALL
              transformations for your account.

          reference_ids: Array with the reference IDs of the transformed data points. Formatted as a CSV
              array.

          transformation_ids: Array with the transform IDs of the transformed data points. Formatted as a CSV
              array.

          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
        """
        return await self._delete(
            "/v1-beta/transformations",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform(
                    {
                        "pipeline_id": pipeline_id,
                        "reference_ids": reference_ids,
                        "transformation_ids": transformation_ids,
                    },
                    transformation_delete_params.TransformationDeleteParams,
                ),
            ),
            cast_to=TransformationDeleteResponse,
        )

    @typing_extensions.deprecated("deprecated")
    async def deprecated_update(
        self,
        *,
        transformations: Iterable[transformation_deprecated_update_params.Transformation] | NotGiven = NOT_GIVEN,
        # 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,
    ) -> UpdateTransformationResponse:
        """Deprecating will be replaced by put.

        Updates a transformation with feedback on
        the corrected transformation value.

        Args:
          transformations: An array of objects containing all the transformations you want to patch.

          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
        """
        return await self._patch(
            "/v1-beta/transformations",
            body=await async_maybe_transform(
                {"transformations": transformations},
                transformation_deprecated_update_params.TransformationDeprecatedUpdateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=UpdateTransformationResponse,
        )

    async def list_errors(
        self,
        *,
        reference_ids: List[str],
        ending_before: str | NotGiven = NOT_GIVEN,
        limit: int | NotGiven = NOT_GIVEN,
        pipeline_id: str | NotGiven = NOT_GIVEN,
        sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
        starting_after: str | NotGiven = NOT_GIVEN,
        # 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,
    ) -> TransformationListErrorsResponse:
        """
        Lists all errors encountered while attempting to transform data, with either
        pagination or specific reference IDs.

        Args:
          reference_ids: Array with the reference IDs of the transformed data points. Formatted as a CSV
              array.

          ending_before: A cursor to use in pagination. `endingBefore` is a transform ID that defines
              your place in the list. For example, if you make a list request and receive 50
              objects, starting with `tr_2bxoJPNdSD4LgRT4YVC4gt72hlI`, your subsequent call
              can include `endingBefore=tr_2bxoJPNdSD4LgRT4YVC4gt72hlI` to fetch the previous
              page of the list.

          limit: This specifies a limit on the number of objects to return, ranging between 1
              and 100.

          pipeline_id: The unique ID for a given pipeline. Will filter to just the transformations
              processed by the given pipeline. If left out, will query over ALL
              transformations for your account.

          sort_order: Specifies sorting behavior. The two options are `asc` and `desc` to sort
              ascending and descending respectively, with default sort being ascending. Paging
              works in both directions.

          starting_after: A cursor to use in pagination. `startingAfter` is a transform ID that defines
              your place in the list. For example, if you make a list request and receive 50
              objects, ending with `tr_2bxoJPNdSD4LgRT4YVC4gt72hlI`, your subsequent call can
              include `startingAfter=tr_2bxoJPNdSD4LgRT4YVC4gt72hlI` to fetch the next page of
              the list.

          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
        """
        return await self._get(
            "/v1-beta/transformations/errors",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform(
                    {
                        "reference_ids": reference_ids,
                        "ending_before": ending_before,
                        "limit": limit,
                        "pipeline_id": pipeline_id,
                        "sort_order": sort_order,
                        "starting_after": starting_after,
                    },
                    transformation_list_errors_params.TransformationListErrorsParams,
                ),
            ),
            cast_to=TransformationListErrorsResponse,
        )


class TransformationsResourceWithRawResponse:
    def __init__(self, transformations: TransformationsResource) -> None:
        self._transformations = transformations

        self.create = to_raw_response_wrapper(
            transformations.create,
        )
        self.update = to_raw_response_wrapper(
            transformations.update,
        )
        self.list = to_raw_response_wrapper(
            transformations.list,
        )
        self.delete = to_raw_response_wrapper(
            transformations.delete,
        )
        self.deprecated_update = (  # pyright: ignore[reportDeprecated]
            to_raw_response_wrapper(
                transformations.deprecated_update  # pyright: ignore[reportDeprecated],
            )
        )
        self.list_errors = to_raw_response_wrapper(
            transformations.list_errors,
        )


class AsyncTransformationsResourceWithRawResponse:
    def __init__(self, transformations: AsyncTransformationsResource) -> None:
        self._transformations = transformations

        self.create = async_to_raw_response_wrapper(
            transformations.create,
        )
        self.update = async_to_raw_response_wrapper(
            transformations.update,
        )
        self.list = async_to_raw_response_wrapper(
            transformations.list,
        )
        self.delete = async_to_raw_response_wrapper(
            transformations.delete,
        )
        self.deprecated_update = (  # pyright: ignore[reportDeprecated]
            async_to_raw_response_wrapper(
                transformations.deprecated_update  # pyright: ignore[reportDeprecated],
            )
        )
        self.list_errors = async_to_raw_response_wrapper(
            transformations.list_errors,
        )


class TransformationsResourceWithStreamingResponse:
    def __init__(self, transformations: TransformationsResource) -> None:
        self._transformations = transformations

        self.create = to_streamed_response_wrapper(
            transformations.create,
        )
        self.update = to_streamed_response_wrapper(
            transformations.update,
        )
        self.list = to_streamed_response_wrapper(
            transformations.list,
        )
        self.delete = to_streamed_response_wrapper(
            transformations.delete,
        )
        self.deprecated_update = (  # pyright: ignore[reportDeprecated]
            to_streamed_response_wrapper(
                transformations.deprecated_update  # pyright: ignore[reportDeprecated],
            )
        )
        self.list_errors = to_streamed_response_wrapper(
            transformations.list_errors,
        )


class AsyncTransformationsResourceWithStreamingResponse:
    def __init__(self, transformations: AsyncTransformationsResource) -> None:
        self._transformations = transformations

        self.create = async_to_streamed_response_wrapper(
            transformations.create,
        )
        self.update = async_to_streamed_response_wrapper(
            transformations.update,
        )
        self.list = async_to_streamed_response_wrapper(
            transformations.list,
        )
        self.delete = async_to_streamed_response_wrapper(
            transformations.delete,
        )
        self.deprecated_update = (  # pyright: ignore[reportDeprecated]
            async_to_streamed_response_wrapper(
                transformations.deprecated_update  # pyright: ignore[reportDeprecated],
            )
        )
        self.list_errors = async_to_streamed_response_wrapper(
            transformations.list_errors,
        )
