Create a new Action linked to this endpoint with the given args.
509722
def new_action(self, method='GET', **kwargs):
        
        if method not in self.methods:
            raise TypeError('{} not in valid method(s): {}.'.format(method, self.methods))
        return Action(self, method, **kwargs)
137259
def action(context, request, action=None, resource=None, uid=None):
    

    # allow to set the method via the header
    if action is None:
        action = request.get_header("HTTP_X_HTTP_METHOD_OVERRIDE", "CREATE").lower()

    # Fetch and call the action function of the API
    func_name = "{}_items".format(action)
    action_func = getattr(api, func_name, None)
    if action_func is None:
        api.fail(500, "API has no member named '{}'".format(func_name))

    portal_type = api.resource_to_portal_type(resource)
    items = action_func(portal_type=portal_type, uid=uid)

    return {
        "count": len(items),
        "items": items,
        "url": api.url_for("senaite.jsonapi.v1.action", action=action),
    }
774653
def shortcut_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/shortcuts"
        return self.call(api_path, method="POST", data=data, **kwargs)
967384
def execute(method, *args)
      new_args = args

      @pre_request.each do |middleware|
        new_args = middleware.call(*new_args)
      end

      path = new_args.empty? ? '' : new_args.shift

      req = proc do ||
        @resource[path].send(method, *new_args)
      end

      post = proc do |result|
        @post_request.each do |middleware|
          result = middleware.call(result)
        end

        result
      end

      Concurrent::Promise.new(&req).on_success(&post)
    end
1349223
function createNextFunction (action, resolver) {
  return function next (...args) {
    var path = typeof args[0] === 'string' ? args[0] : null;
    var arg = path ? args[1] : args[0];

    var result = {
      path: path ? path : action.defaultOutput,
      args: arg
    };

    if (resolver) {
      resolver(result);
    } else {
      next._result = result;
    }
  };
}
441258
def _add_route(self, method, path, middleware=None):
        """"""
        if middleware is not None:
            self.add(method, path, middleware)
            return self
        else:
            # return a lambda that will return the 'func' argument
            return lambda func: (
                self.add(method, path, func),
                func
            )[1]
573498
def execute(self, request, target_route):
		
		presenter = self.create_presenter(request, target_route)
		presenter_name = target_route.presenter_name()
		action_name = target_route.presenter_action()
		presenter_args = target_route.presenter_args()

		if hasattr(presenter, action_name) is False:
			raise RuntimeError('No such action "%s" for "%s" presenter' % (action_name, presenter_name))

		action = getattr(presenter, action_name)
		if ismethod(action) is False:
			raise RuntimeError(
				'Unable to execute "%s" action for "%s" presenter' % (action_name, presenter_name)
			)

		args_spec = getfullargspec(action)
		defaults = len(args_spec.defaults) if args_spec.defaults is not None else 0
		action_args = list()
		action_kwargs = dict()

		for i in range(len(args_spec.args)):
			arg = args_spec.args[i]
			if arg == 'self':
				continue

			is_kwarg = i >= (len(args_spec.args) - defaults)

			if is_kwarg is False:
				action_args.append(presenter_args[arg])
			elif arg in presenter_args:
				action_kwargs[arg] = presenter_args[arg]

		return action(*action_args, **action_kwargs)
1317726
function () {
            var self = this;
            base._create.apply(self, arguments);

            if (self.options.actions.listAction) {
                self._adaptListActionforAbp();
            }

            if (self.options.actions.createAction) {
                self._adaptCreateActionforAbp();
            }

            if (self.options.actions.updateAction) {
                self._adaptUpdateActionforAbp();
            }

            if (self.options.actions.deleteAction) {
                self._adaptDeleteActionforAbp();
            }
        }
482970
def dispatch(self, *args, **kwargs):
        """"""
        action = kwargs.pop('action', 'default')
        action_method = getattr(self, str(action), self.default)
        return action_method(*args, **kwargs)
1347026
def Execute(self, action, *args, **kw):
        
        action = self.Action(action, *args, **kw)
        result = action([], [], self)
        if isinstance(result, SCons.Errors.BuildError):
            errstr = result.errstr
            if result.filename:
                errstr = result.filename + ': ' + errstr
            sys.stderr.write("scons: *** %s\n" % errstr)
            return result.status
        else:
            return result
840878
function makeAction (controller, method, opts) {
  let action = {action: controller + '@' + method};
  return extend (action, opts);
}
13900
def call_action(self, service_name, action_name, **kwargs):
        """"""
        action = self.services[service_name].actions[action_name]
        return action.execute(**kwargs)
1333712
def _createAction(self, widget, iconFileName, text, shortcut, slot):
        
        icon = qutepart.getIcon(iconFileName)
        action = QAction(icon, text, widget)
        action.setShortcut(QKeySequence(shortcut))
        action.setShortcutContext(Qt.WidgetShortcut)
        action.triggered.connect(slot)

        widget.addAction(action)

        return action
863189
def create(self, parameters):
        
        response = self._client.session.post(
            '{url}/new'.format(url=self.endpoint_url), data=parameters
        )
        return self.process_response(response)
365576
def add(self, action):
        """"""
        self._state_machine.transition_to_add()
        self._actions.append(action)
1312166
function addActionCreator(path, actionMap, filePath) {

  const {node, parentPath} = path;
  if (node.arguments.length && parentPath.node && parentPath.node.id) {

    const action = parentPath.node.id.name;
    const firstArg = node.arguments[0];
    const actionType = firstArg.property ? firstArg.property.name : firstArg.name;

    const {loc} = parentPath.node
    actionMap[actionType] = actionMap[actionType] || createActionNode(actionType);
    actionMap[actionType].action = {name: action, path: `${filePath}#L${loc.start.line}-L${loc.end.line}`};
  }
}
389601
def as_view(cls, action_map=None, **initkwargs):
        

        # Needs to re-implement the method but contains all the things the parent does.
        if not action_map:  # actions must not be empty
            raise TypeError("action_map is a required argument.")

        def view(request):
            self = cls(**initkwargs)
            self.request = request
            self.lookup_url_kwargs = self.request.matchdict
            self.action_map = action_map
            self.action = self.action_map.get(self.request.method.lower())

            for method, action in action_map.items():
                handler = getattr(self, action)
                setattr(self, method, handler)

            return self.dispatch(self.request, **self.request.matchdict)

        return view