How to use the canvasapi.folder.Folder function in canvasapi

To help you get started, we’ve selected a few canvasapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ucfopen / canvasapi / scripts / test_validate_docstrings.py View on Github external
:calls: `GET /api/v1/folders/:id \
        `_

        :param folder: The object or ID of the folder to retrieve.
        :type folder: :class:`canvasapi.folder.Folder` or int

        :rtype: :class:`canvasapi.folder.Folder`
        """
        folder_id = obj_or_id(folder, "folder", (Folder,))

        response = self.__requester.request(
            'GET',
            'folders/{}'.format(folder_id)
        )
        return Folder(self.__requester, response.json())
github ucfopen / canvasapi / tests / test_validate_docstrings.py View on Github external
:calls: `GET /api/v1/folders/:id \
        `_

        :param folder: The object or ID of the folder to retrieve.
        :type folder: :class:`canvasapi.folder.Folder` or int

        :rtype: :class:`canvasapi.folder.Folder`
        """
        folder_id = obj_or_id(folder, "folder", (Folder,))

        response = self.__requester.request(
            'GET',
            'folders/{}'.format(folder_id)
        )
        return Folder(self.__requester, response.json())
github ucfopen / canvasapi / tests / test_group.py View on Github external
def test_create_folder(self, m):
        register_uris({"group": ["create_folder"]}, m)

        name_str = "Test String"
        response = self.group.create_folder(name=name_str)
        self.assertIsInstance(response, Folder)
github ucfopen / canvasapi / scripts / test_validate_docstrings.py View on Github external
def passes_multiple_endpoints(self, folder):
        """
        Return the details for a folder

        :calls: `GET /api/v1/folders/:id \
        `_

        :param folder: The object or ID of the folder to retrieve.
        :type folder: :class:`canvasapi.folder.Folder` or int

        :rtype: :class:`canvasapi.folder.Folder`
        """
        folder_id = obj_or_id(folder, "folder", (Folder,))

        response = self.__requester.request(
            'GET',
            'folders/{}'.format(folder_id)
        )
        return Folder(self.__requester, response.json())
github ucfopen / canvasapi / canvasapi / group.py View on Github external
Creates a folder in this group.

        :calls: `POST /api/v1/groups/:group_id/folders \
        `_

        :param name: The name of the folder.
        :type name: str
        :rtype: :class:`canvasapi.folder.Folder`
        """
        response = self._requester.request(
            "POST",
            "groups/{}/folders".format(self.id),
            name=name,
            _kwargs=combine_kwargs(**kwargs),
        )
        return Folder(self._requester, response.json())
github ucfopen / canvasapi / canvasapi / folder.py View on Github external
def get_folders(self, **kwargs):
        """
        Returns the paginated list of folders in the folder.

        :calls: `GET /api/v1/folders/:id/folders \
        `_

        :rtype: :class:`canvasapi.paginated_list.PaginatedList` of
            :class:`canvasapi.folder.Folder`
        """
        return PaginatedList(
            Folder,
            self._requester,
            'GET',
            'folders/{}/folders'.format(self.id)
        )
github ucfopen / canvasapi / canvasapi / folder.py View on Github external
:calls: `PUT /api/v1/folders/:id \
        `_

        :rtype: :class:`canvasapi.folder.Folder`
        """
        response = self._requester.request(
            'PUT',
            'folders/{}'.format(self.id),
            _kwargs=combine_kwargs(**kwargs)
        )

        if 'name' in response.json():
            super(Folder, self).set_attributes(response.json())

        return Folder(self._requester, response.json())
github ucfopen / canvasapi / canvasapi / user.py View on Github external
def get_folders(self, **kwargs):
        """
        Returns the paginated list of all folders for the given user. This will be returned as a
        flat list containing all subfolders as well.

        :calls: `GET /api/v1/users/:user_id/folders \
        `_

        :rtype: :class:`canvasapi.paginated_list.PaginatedList` of
            :class:`canvasapi.folder.Folder`
        """
        return PaginatedList(
            Folder,
            self._requester,
            "GET",
            "users/{}/folders".format(self.id),
            _kwargs=combine_kwargs(**kwargs),
        )
github ucfopen / canvasapi / canvasapi / folder.py View on Github external
"""
        Updates a folder.

        :calls: `PUT /api/v1/folders/:id \
        `_

        :rtype: :class:`canvasapi.folder.Folder`
        """
        response = self._requester.request(
            'PUT',
            'folders/{}'.format(self.id),
            _kwargs=combine_kwargs(**kwargs)
        )

        if 'name' in response.json():
            super(Folder, self).set_attributes(response.json())

        return Folder(self._requester, response.json())
github ucfopen / canvasapi / canvasapi / course.py View on Github external
Returns the details for a course folder

        :calls: `GET /api/v1/courses/:course_id/folders/:id \
        `_

        :param folder: The object or ID of the folder to retrieve.
        :type folder: :class:`canvasapi.folder.Folder` or int

        :rtype: :class:`canvasapi.folder.Folder`
        """
        folder_id = obj_or_id(folder, "folder", (Folder,))

        response = self._requester.request(
            "GET", "courses/{}/folders/{}".format(self.id, folder_id)
        )
        return Folder(self._requester, response.json())