def get_group_category(self, cat_id): """ Get a single group category. :calls: `GET /api/v1/group_categories/:group_category_id \ <https://canvas.instructure.com/doc/api/group_categories.html#method.group_categories.show>`_ :rtype: :class:`canvasapi.group.GroupCategory` """ response = self.__requester.request('GET', 'group_categories/%s' % (cat_id)) return GroupCategory(self.__requester, response.json())
def get_group_category(self, category): """ Get a single group category. :calls: `GET /api/v1/group_categories/:group_category_id \ <https://canvas.instructure.com/doc/api/group_categories.html#method.group_categories.show>`_ :param category: The object or ID of the category. :type category: :class:`canvasapi.group.GroupCategory` or int :rtype: :class:`canvasapi.group.GroupCategory` """ category_id = obj_or_id(category, "category", (GroupCategory, )) response = self.__requester.request( 'GET', 'group_categories/{}'.format(category_id)) return GroupCategory(self.__requester, response.json())
def create_group_category(self, name, **kwargs): """ Create a Group Category :calls: `POST /api/v1/accounts/:account_id/group_categories \ <https://canvas.instructure.com/doc/api/group_categories.html#method.group_categories.create>`_ :param name: Name of group category. :type name: str :rtype: :class:`canvasapi.group.GroupCategory` """ from canvasapi.group import GroupCategory response = self._requester.request( 'POST', 'accounts/{}/group_categories'.format(self.id), name=name, _kwargs=combine_kwargs(**kwargs)) return GroupCategory(self._requester, response.json())