def followup_get(self, request): """ Exposes an API endpoint to get a followup. """ user = auth_user(self.request_state.headers) if request.id is None: raise endpoints.BadRequestException('id field is required.') followup = FollowUp.get_by_id(request.id) if followup is None: raise endpoints.NotFoundException('No follow up entity with the id "%s" exists.' % request.id) return followup.to_message()
def followup_delete(self, request): """ Exposes an API endpoint to delete an existing follow up. """ user = auth_user(self.request_state.headers) if request.id is None: raise endpoints.BadRequestException('id field is required.') followup = FollowUp.get_by_id(request.id) if followup is None: raise endpoints.NotFoundException('No follow up entity with the id "%s" exists.' % request.id) anno = followup.anno_key.get() followup.key.delete() anno.followup_count -= 1 anno.put() return message_types.VoidMessage()