def create_appointment_group(self, appointment_group, **kwargs): """ Create a new Appointment Group. :calls: `POST /api/v1/appointment_groups \ <https://canvas.instructure.com/doc/api/appointment_groups.html#method.appointment_groups.create>`_ :param appointment_group: The attributes of the appointment group. :type appointment_group: `dict` :param title: The title of the appointment group. :type title: `str` :rtype: :class:`canvasapi.appointment_group.AppointmentGroup` """ from canvasapi.appointment_group import AppointmentGroup if (isinstance(appointment_group, dict) and 'context_codes' in appointment_group and 'title' in appointment_group): kwargs['appointment_group'] = appointment_group elif (isinstance(appointment_group, dict) and 'context_codes' not in appointment_group): raise RequiredFieldMissing( "Dictionary with key 'context_codes' is missing.") elif isinstance(appointment_group, dict) and 'title' not in appointment_group: raise RequiredFieldMissing( "Dictionary with key 'title' is missing.") response = self.__requester.request('POST', 'appointment_groups', **combine_kwargs(**kwargs)) return AppointmentGroup(self.__requester, response.json())
def get_appointment_group(self, appointment_group_id): """ Return single Appointment Group by id :calls: `GET /api/v1/appointment_groups/:id \ <https://canvas.instructure.com/doc/api/appointment_groups.html#method.appointment_groups.show>`_ :param appointment_group_id: The ID of the appointment group. :type appointment_group_id: `int` :rtype: :class:`canvasapi.appointment_group.AppointmentGroup` """ from canvasapi.appointment_group import AppointmentGroup response = self.__requester.request( 'GET', 'appointment_groups/%s' % (appointment_group_id)) return AppointmentGroup(self.__requester, response.json())
def get_appointment_group(self, appointment_group): """ Return single Appointment Group by id :calls: `GET /api/v1/appointment_groups/:id \ <https://canvas.instructure.com/doc/api/appointment_groups.html#method.appointment_groups.show>`_ :param appointment_group: The ID of the appointment group. :type appointment_group: :class:`canvasapi.appointment_group.AppointmentGroup` or int :rtype: :class:`canvasapi.appointment_group.AppointmentGroup` """ from canvasapi.appointment_group import AppointmentGroup appointment_group_id = obj_or_id(appointment_group, "appointment_group", (AppointmentGroup, )) response = self.__requester.request( "GET", "appointment_groups/{}".format(appointment_group_id)) return AppointmentGroup(self.__requester, response.json())