# 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.inline_response_2001 import InlineResponse2001
from .raw_client import AsyncRawLegacyClient, RawLegacyClient


class LegacyClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawLegacyClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawLegacyClient
        """
        return self._raw_client

    def v_1_get_all_assets(self, *, request_options: typing.Optional[RequestOptions] = None) -> InlineResponse2001:
        """
        **Note: This is a legacy endpoint, consider using [this endpoint](https://developers.samsara.com/reference/listassets) instead. The endpoint will continue to function as documented.**

         Fetch all powered and unpowered equipment.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Read Equipment** under the Equipment category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

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

        Returns
        -------
        InlineResponse2001
            List of assets.

        Examples
        --------
        from samsara import Samsara

        client = Samsara(
            token="YOUR_TOKEN",
        )
        client.legacy.v_1_get_all_assets()
        """
        _response = self._raw_client.v_1_get_all_assets(request_options=request_options)
        return _response.data


class AsyncLegacyClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawLegacyClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawLegacyClient
        """
        return self._raw_client

    async def v_1_get_all_assets(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> InlineResponse2001:
        """
        **Note: This is a legacy endpoint, consider using [this endpoint](https://developers.samsara.com/reference/listassets) instead. The endpoint will continue to function as documented.**

         Fetch all powered and unpowered equipment.

         **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

        To use this endpoint, select **Read Equipment** under the Equipment category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>

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

        Returns
        -------
        InlineResponse2001
            List of assets.

        Examples
        --------
        import asyncio

        from samsara import AsyncSamsara

        client = AsyncSamsara(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.legacy.v_1_get_all_assets()


        asyncio.run(main())
        """
        _response = await self._raw_client.v_1_get_all_assets(request_options=request_options)
        return _response.data
