# 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.training_courses_get_training_courses_response_body import TrainingCoursesGetTrainingCoursesResponseBody
from .raw_client import AsyncRawTrainingCoursesClient, RawTrainingCoursesClient


class TrainingCoursesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawTrainingCoursesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawTrainingCoursesClient
        """
        return self._raw_client

    def get_training_courses(
        self,
        *,
        after: typing.Optional[str] = None,
        course_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        category_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        status: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TrainingCoursesGetTrainingCoursesResponseBody:
        """
        Returns all training courses data. Results are paginated.
         Courses in the ‘draft’ status are excluded from the data returned by this endpoint.

         <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

        To use this endpoint, select **Read Training Courses** under the Training Courses 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>


         **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.

        Parameters
        ----------
        after : typing.Optional[str]
             If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.

        course_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Optional string of comma separated course IDs. If course ID is present, training assignments for the specified course ID(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `courseIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`

        category_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Optional string of comma separated course category IDs. If courseCategoryId is present, training courses for the specified course category(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses.  Example: `categoryIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`

        status : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Optional string of comma separated values. If status is present, training courses with the specified status(s) will be returned. Valid values: “published”, “deleted”, “archived”. Defaults to returning all courses.

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

        Returns
        -------
        TrainingCoursesGetTrainingCoursesResponseBody
            OK response.

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

        client = Samsara(
            token="YOUR_TOKEN",
        )
        client.training_courses.get_training_courses()
        """
        _response = self._raw_client.get_training_courses(
            after=after,
            course_ids=course_ids,
            category_ids=category_ids,
            status=status,
            request_options=request_options,
        )
        return _response.data


class AsyncTrainingCoursesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawTrainingCoursesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawTrainingCoursesClient
        """
        return self._raw_client

    async def get_training_courses(
        self,
        *,
        after: typing.Optional[str] = None,
        course_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        category_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        status: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TrainingCoursesGetTrainingCoursesResponseBody:
        """
        Returns all training courses data. Results are paginated.
         Courses in the ‘draft’ status are excluded from the data returned by this endpoint.

         <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

        To use this endpoint, select **Read Training Courses** under the Training Courses 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>


         **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.

        Parameters
        ----------
        after : typing.Optional[str]
             If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.

        course_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Optional string of comma separated course IDs. If course ID is present, training assignments for the specified course ID(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `courseIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`

        category_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Optional string of comma separated course category IDs. If courseCategoryId is present, training courses for the specified course category(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses.  Example: `categoryIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`

        status : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Optional string of comma separated values. If status is present, training courses with the specified status(s) will be returned. Valid values: “published”, “deleted”, “archived”. Defaults to returning all courses.

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

        Returns
        -------
        TrainingCoursesGetTrainingCoursesResponseBody
            OK response.

        Examples
        --------
        import asyncio

        from samsara import AsyncSamsara

        client = AsyncSamsara(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.training_courses.get_training_courses()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_training_courses(
            after=after,
            course_ids=course_ids,
            category_ids=category_ids,
            status=status,
            request_options=request_options,
        )
        return _response.data
