def delete_snippet(request):
  params = request.POST
  require_fields(params, ('service', 'snippet', 'token'))
  service_controllers.delete_snippet(
      params['service'], params['snippet'], params['token'])
  return success_response()
def query(request):
  params = request.GET
  require_fields(params, ('service', 'query', ('max_count', int)))
  result = algorithms.query(
      params['service'], params['query'], int(params['max_count']))
  return api_response(result)
def create_service(request):
  params = request.POST
  require_fields(params, ('service'))
  service = service_controllers.create_service(params['service'])
  return api_response(service.token)