Beispiel #1
0
    def delete_external_feed(self, feed_id):
        """
        Deletes the external feed.

        :calls: `DELETE /api/v1/groups/:group_id/external_feeds/:external_feed_id \
        <https://canvas.instructure.com/doc/api/announcement_external_feeds.html#method.external_feeds.destroy>`_

        :param feed_id: The id of the feed to be deleted.
        :type feed_id: int
        :rtype: :class:`canvasapi.external_feed.ExternalFeed`
        """
        from canvasapi.external_feed import ExternalFeed
        response = self._requester.request(
            'DELETE', 'groups/%s/external_feeds/%s' % (self.id, feed_id))
        return ExternalFeed(self._requester, response.json())
Beispiel #2
0
    def create_external_feed(self, url, **kwargs):
        """
        Create a new external feed for the group.

        :calls: `POST /api/v1/groups/:group_id/external_feeds \
        <https://canvas.instructure.com/doc/api/announcement_external_feeds.html#method.external_feeds.create>`_

        :param url: The urlof the external rss or atom feed
        :type url: str
        :rtype: :class:`canvasapi.external_feed.ExternalFeed`
        """
        from canvasapi.external_feed import ExternalFeed
        response = self._requester.request('POST',
                                           'groups/{}/external_feeds'.format(
                                               self.id),
                                           url=url,
                                           _kwargs=combine_kwargs(**kwargs))
        return ExternalFeed(self._requester, response.json())
Beispiel #3
0
    def delete_external_feed(self, feed):
        """
        Deletes the external feed.

        :calls: `DELETE /api/v1/groups/:group_id/external_feeds/:external_feed_id \
        <https://canvas.instructure.com/doc/api/announcement_external_feeds.html#method.external_feeds.destroy>`_

        :param feed: The object or id of the feed to be deleted.
        :type feed: :class:`canvasapi.external_feed.ExternalFeed` or int

        :rtype: :class:`canvasapi.external_feed.ExternalFeed`
        """
        from canvasapi.external_feed import ExternalFeed

        feed_id = obj_or_id(feed, "feed", (ExternalFeed, ))

        response = self._requester.request(
            "DELETE", "groups/{}/external_feeds/{}".format(self.id, feed_id))
        return ExternalFeed(self._requester, response.json())