# 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.include_total_count import IncludeTotalCount
from ..types.projects_with_includes_response import ProjectsWithIncludesResponse
from ..types.request_after_opaque_cursor import RequestAfterOpaqueCursor
from ..types.request_page_size import RequestPageSize
from ..types.uuid_ import Uuid
from .raw_client import AsyncRawProjectsClient, RawProjectsClient
from .types.account_projects_index_request_sort import AccountProjectsIndexRequestSort
from .types.projects_index_request_sort import ProjectsIndexRequestSort


class ProjectsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawProjectsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawProjectsClient
        """
        return self._raw_client

    def account_projects_index(
        self,
        account_id: Uuid,
        *,
        include: typing.Optional[typing.Literal["owner"]] = None,
        sort: typing.Optional[AccountProjectsIndexRequestSort] = None,
        after: typing.Optional[RequestAfterOpaqueCursor] = None,
        page_size: typing.Optional[RequestPageSize] = None,
        include_total_count: typing.Optional[IncludeTotalCount] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectsWithIncludesResponse:
        """
        List all projects the authenticated user has access to within the specified account. <br/>Rate Limits: 100 calls per 1.00 minute(s) per account_user

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


        include : typing.Optional[typing.Literal["owner"]]


        sort : typing.Optional[AccountProjectsIndexRequestSort]
            Sort projects by query params

        after : typing.Optional[RequestAfterOpaqueCursor]
            Opaque Cursor query param for requests returning paginated results.
            <br/>
            NOTE: this value is auto-generated and included as part of links from a previous response. It is not intended to be human readable.

        page_size : typing.Optional[RequestPageSize]


        include_total_count : typing.Optional[IncludeTotalCount]


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

        Returns
        -------
        ProjectsWithIncludesResponse
            OK

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

        client = FrameioExperimental(
            api_version="YOUR_API_VERSION",
            token="YOUR_TOKEN",
        )
        client.projects.account_projects_index(
            account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
            sort="name_asc",
            after="<opaque_cursor>",
            page_size=10,
            include_total_count=False,
        )
        """
        _response = self._raw_client.account_projects_index(
            account_id,
            include=include,
            sort=sort,
            after=after,
            page_size=page_size,
            include_total_count=include_total_count,
            request_options=request_options,
        )
        return _response.data

    def invited_projects_index(
        self,
        account_id: Uuid,
        *,
        include: typing.Optional[typing.Literal["owner"]] = None,
        after: typing.Optional[RequestAfterOpaqueCursor] = None,
        page_size: typing.Optional[RequestPageSize] = None,
        include_total_count: typing.Optional[IncludeTotalCount] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectsWithIncludesResponse:
        """
        List projects that the current user has been invited to within the specified account,
        but does not have workspace-level access to. These are projects where the user has
        project-specific collaborator access without broader team/workspace permissions.

        Rate Limits: 100 calls per 1.00 minute(s) per account_user

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


        include : typing.Optional[typing.Literal["owner"]]


        after : typing.Optional[RequestAfterOpaqueCursor]
            Opaque Cursor query param for requests returning paginated results.
            <br/>
            NOTE: this value is auto-generated and included as part of links from a previous response. It is not intended to be human readable.

        page_size : typing.Optional[RequestPageSize]


        include_total_count : typing.Optional[IncludeTotalCount]


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

        Returns
        -------
        ProjectsWithIncludesResponse
            OK

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

        client = FrameioExperimental(
            api_version="YOUR_API_VERSION",
            token="YOUR_TOKEN",
        )
        client.projects.invited_projects_index(
            account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
            after="<opaque_cursor>",
            page_size=10,
            include_total_count=False,
        )
        """
        _response = self._raw_client.invited_projects_index(
            account_id,
            include=include,
            after=after,
            page_size=page_size,
            include_total_count=include_total_count,
            request_options=request_options,
        )
        return _response.data

    def index(
        self,
        account_id: Uuid,
        workspace_id: Uuid,
        *,
        include: typing.Optional[typing.Literal["owner"]] = None,
        sort: typing.Optional[ProjectsIndexRequestSort] = None,
        after: typing.Optional[RequestAfterOpaqueCursor] = None,
        page_size: typing.Optional[RequestPageSize] = None,
        include_total_count: typing.Optional[IncludeTotalCount] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectsWithIncludesResponse:
        """
        List projects in a given workspace. <br/>Rate Limits: 100 calls per 1.00 minute(s) per account_user

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


        workspace_id : Uuid


        include : typing.Optional[typing.Literal["owner"]]


        sort : typing.Optional[ProjectsIndexRequestSort]
            Sort projects by query params

        after : typing.Optional[RequestAfterOpaqueCursor]
            Opaque Cursor query param for requests returning paginated results.
            <br/>
            NOTE: this value is auto-generated and included as part of links from a previous response. It is not intended to be human readable.

        page_size : typing.Optional[RequestPageSize]


        include_total_count : typing.Optional[IncludeTotalCount]


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

        Returns
        -------
        ProjectsWithIncludesResponse
            OK

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

        client = FrameioExperimental(
            api_version="YOUR_API_VERSION",
            token="YOUR_TOKEN",
        )
        client.projects.index(
            account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
            workspace_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
            sort="name_asc",
            after="<opaque_cursor>",
            page_size=10,
            include_total_count=False,
        )
        """
        _response = self._raw_client.index(
            account_id,
            workspace_id,
            include=include,
            sort=sort,
            after=after,
            page_size=page_size,
            include_total_count=include_total_count,
            request_options=request_options,
        )
        return _response.data


class AsyncProjectsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawProjectsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawProjectsClient
        """
        return self._raw_client

    async def account_projects_index(
        self,
        account_id: Uuid,
        *,
        include: typing.Optional[typing.Literal["owner"]] = None,
        sort: typing.Optional[AccountProjectsIndexRequestSort] = None,
        after: typing.Optional[RequestAfterOpaqueCursor] = None,
        page_size: typing.Optional[RequestPageSize] = None,
        include_total_count: typing.Optional[IncludeTotalCount] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectsWithIncludesResponse:
        """
        List all projects the authenticated user has access to within the specified account. <br/>Rate Limits: 100 calls per 1.00 minute(s) per account_user

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


        include : typing.Optional[typing.Literal["owner"]]


        sort : typing.Optional[AccountProjectsIndexRequestSort]
            Sort projects by query params

        after : typing.Optional[RequestAfterOpaqueCursor]
            Opaque Cursor query param for requests returning paginated results.
            <br/>
            NOTE: this value is auto-generated and included as part of links from a previous response. It is not intended to be human readable.

        page_size : typing.Optional[RequestPageSize]


        include_total_count : typing.Optional[IncludeTotalCount]


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

        Returns
        -------
        ProjectsWithIncludesResponse
            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.projects.account_projects_index(
                account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
                sort="name_asc",
                after="<opaque_cursor>",
                page_size=10,
                include_total_count=False,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.account_projects_index(
            account_id,
            include=include,
            sort=sort,
            after=after,
            page_size=page_size,
            include_total_count=include_total_count,
            request_options=request_options,
        )
        return _response.data

    async def invited_projects_index(
        self,
        account_id: Uuid,
        *,
        include: typing.Optional[typing.Literal["owner"]] = None,
        after: typing.Optional[RequestAfterOpaqueCursor] = None,
        page_size: typing.Optional[RequestPageSize] = None,
        include_total_count: typing.Optional[IncludeTotalCount] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectsWithIncludesResponse:
        """
        List projects that the current user has been invited to within the specified account,
        but does not have workspace-level access to. These are projects where the user has
        project-specific collaborator access without broader team/workspace permissions.

        Rate Limits: 100 calls per 1.00 minute(s) per account_user

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


        include : typing.Optional[typing.Literal["owner"]]


        after : typing.Optional[RequestAfterOpaqueCursor]
            Opaque Cursor query param for requests returning paginated results.
            <br/>
            NOTE: this value is auto-generated and included as part of links from a previous response. It is not intended to be human readable.

        page_size : typing.Optional[RequestPageSize]


        include_total_count : typing.Optional[IncludeTotalCount]


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

        Returns
        -------
        ProjectsWithIncludesResponse
            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.projects.invited_projects_index(
                account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
                after="<opaque_cursor>",
                page_size=10,
                include_total_count=False,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.invited_projects_index(
            account_id,
            include=include,
            after=after,
            page_size=page_size,
            include_total_count=include_total_count,
            request_options=request_options,
        )
        return _response.data

    async def index(
        self,
        account_id: Uuid,
        workspace_id: Uuid,
        *,
        include: typing.Optional[typing.Literal["owner"]] = None,
        sort: typing.Optional[ProjectsIndexRequestSort] = None,
        after: typing.Optional[RequestAfterOpaqueCursor] = None,
        page_size: typing.Optional[RequestPageSize] = None,
        include_total_count: typing.Optional[IncludeTotalCount] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectsWithIncludesResponse:
        """
        List projects in a given workspace. <br/>Rate Limits: 100 calls per 1.00 minute(s) per account_user

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


        workspace_id : Uuid


        include : typing.Optional[typing.Literal["owner"]]


        sort : typing.Optional[ProjectsIndexRequestSort]
            Sort projects by query params

        after : typing.Optional[RequestAfterOpaqueCursor]
            Opaque Cursor query param for requests returning paginated results.
            <br/>
            NOTE: this value is auto-generated and included as part of links from a previous response. It is not intended to be human readable.

        page_size : typing.Optional[RequestPageSize]


        include_total_count : typing.Optional[IncludeTotalCount]


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

        Returns
        -------
        ProjectsWithIncludesResponse
            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.projects.index(
                account_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
                workspace_id="b2702c44-c6da-4bb6-8bbd-be6e547ccf1b",
                sort="name_asc",
                after="<opaque_cursor>",
                page_size=10,
                include_total_count=False,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.index(
            account_id,
            workspace_id,
            include=include,
            sort=sort,
            after=after,
            page_size=page_size,
            include_total_count=include_total_count,
            request_options=request_options,
        )
        return _response.data
