# This file was auto-generated by Fern from our API Definition.

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.metadata_response import MetadataResponse
from ..types.uuid_ import Uuid
from .raw_client import AsyncRawMetadataClient, RawMetadataClient
from .types.bulk_update_metadata_params_data import BulkUpdateMetadataParamsData

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class MetadataClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawMetadataClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawMetadataClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawMetadataClient
        """
        return self._raw_client

    def show(
        self,
        account_id: Uuid,
        file_id: Uuid,
        *,
        show_null: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> MetadataResponse:
        """
        Show the metadata of a file.
              <br><br>
              This endpoint has been added to `Current Version` of the API.
              <br><br>
              Please see https://developer.adobe.com/frameio/api/current/#tag/Files/operation/metadata.show.
              <br><br>
              Rate Limits: 100 calls per 1.00 minute(s) per account

        Parameters
        ----------
        account_id : Uuid


        file_id : Uuid


        show_null : typing.Optional[bool]


        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        MetadataResponse
            OK

        Examples
        --------
        from frameio_experimental import FrameioExperimental

        client = FrameioExperimental(
            api_version="YOUR_API_VERSION",
            token="YOUR_TOKEN",
        )
        client.metadata.show(
            account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
            file_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
            show_null=True,
        )
        """
        _response = self._raw_client.show(account_id, file_id, show_null=show_null, request_options=request_options)
        return _response.data

    def bulk_update(
        self,
        account_id: Uuid,
        project_id: Uuid,
        *,
        data: BulkUpdateMetadataParamsData,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Update metadata values across multiple files.
            <br><br>
              This endpoint has been added to `Current Version` of the API.
              <br><br>
              Please see https://developer.adobe.com/frameio/api/current/#tag/Files/operation/metadata.bulk_update.
              <br><br>
              Rate Limits: 10 calls per 1.00 minute(s) per account

        Parameters
        ----------
        account_id : Uuid


        project_id : Uuid


        data : BulkUpdateMetadataParamsData

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from frameio_experimental import FrameioExperimental
        from frameio_experimental.metadata import (
            BulkUpdateMetadataParamsData,
            BulkUpdateMetadataParamsDataValuesItem,
        )

        client = FrameioExperimental(
            api_version="YOUR_API_VERSION",
            token="YOUR_TOKEN",
        )
        client.metadata.bulk_update(
            account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
            project_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
            data=BulkUpdateMetadataParamsData(
                file_ids=[
                    "206b7d42-f777-4825-9e25-dd39ba952191",
                    "f2eb1a9c-29f8-477b-abb6-eb266ce8180c",
                ],
                values=[
                    BulkUpdateMetadataParamsDataValuesItem(
                        field_definition_id="8a4e278d-73f2-4bef-8dd1-97932579da55",
                        value="active",
                    ),
                    BulkUpdateMetadataParamsDataValuesItem(
                        field_definition_id="ed91529f-a6a6-44a9-94cd-7111117b0a98",
                        value=5,
                    ),
                    BulkUpdateMetadataParamsDataValuesItem(
                        field_definition_id="d53404d6-c952-450d-9b59-12d21d4539df",
                        value="f16cceeb-a543-43a8-9dd8-34d2549e58d6",
                    ),
                ],
            ),
        )
        """
        _response = self._raw_client.bulk_update(account_id, project_id, data=data, request_options=request_options)
        return _response.data


class AsyncMetadataClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawMetadataClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawMetadataClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawMetadataClient
        """
        return self._raw_client

    async def show(
        self,
        account_id: Uuid,
        file_id: Uuid,
        *,
        show_null: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> MetadataResponse:
        """
        Show the metadata of a file.
              <br><br>
              This endpoint has been added to `Current Version` of the API.
              <br><br>
              Please see https://developer.adobe.com/frameio/api/current/#tag/Files/operation/metadata.show.
              <br><br>
              Rate Limits: 100 calls per 1.00 minute(s) per account

        Parameters
        ----------
        account_id : Uuid


        file_id : Uuid


        show_null : typing.Optional[bool]


        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        MetadataResponse
            OK

        Examples
        --------
        import asyncio

        from frameio_experimental import AsyncFrameioExperimental

        client = AsyncFrameioExperimental(
            api_version="YOUR_API_VERSION",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.metadata.show(
                account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
                file_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
                show_null=True,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.show(
            account_id, file_id, show_null=show_null, request_options=request_options
        )
        return _response.data

    async def bulk_update(
        self,
        account_id: Uuid,
        project_id: Uuid,
        *,
        data: BulkUpdateMetadataParamsData,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Update metadata values across multiple files.
            <br><br>
              This endpoint has been added to `Current Version` of the API.
              <br><br>
              Please see https://developer.adobe.com/frameio/api/current/#tag/Files/operation/metadata.bulk_update.
              <br><br>
              Rate Limits: 10 calls per 1.00 minute(s) per account

        Parameters
        ----------
        account_id : Uuid


        project_id : Uuid


        data : BulkUpdateMetadataParamsData

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from frameio_experimental import AsyncFrameioExperimental
        from frameio_experimental.metadata import (
            BulkUpdateMetadataParamsData,
            BulkUpdateMetadataParamsDataValuesItem,
        )

        client = AsyncFrameioExperimental(
            api_version="YOUR_API_VERSION",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.metadata.bulk_update(
                account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
                project_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
                data=BulkUpdateMetadataParamsData(
                    file_ids=[
                        "206b7d42-f777-4825-9e25-dd39ba952191",
                        "f2eb1a9c-29f8-477b-abb6-eb266ce8180c",
                    ],
                    values=[
                        BulkUpdateMetadataParamsDataValuesItem(
                            field_definition_id="8a4e278d-73f2-4bef-8dd1-97932579da55",
                            value="active",
                        ),
                        BulkUpdateMetadataParamsDataValuesItem(
                            field_definition_id="ed91529f-a6a6-44a9-94cd-7111117b0a98",
                            value=5,
                        ),
                        BulkUpdateMetadataParamsDataValuesItem(
                            field_definition_id="d53404d6-c952-450d-9b59-12d21d4539df",
                            value="f16cceeb-a543-43a8-9dd8-34d2549e58d6",
                        ),
                    ],
                ),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.bulk_update(
            account_id, project_id, data=data, request_options=request_options
        )
        return _response.data
