Dispatch API request

@param string $operation Target action
@param object $paramData Request data
177615
public function request($method, $path, $paramData)
    {
        if($method == 'get' && count($paramData) > 0) {
            $path = $path . '?' . http_build_query($paramData);
            $paramData=array();
        }
        $this->setSignature($path, $paramData);
        $req = $this->client->createRequest($method, $path, array());
        if($method == 'post' || $method == 'delete') {
            foreach ($paramData as $k => $v) {
                $req->setPostField($k, $v);
            }
        }
        try {
            $res = $req->send();
            return $res->json();
        } catch (\Guzzle\Common\Exception\RuntimeException $e) {
            echo $e->getResponse()->getBody();
        }
    }
761578
@Override
    public String action(EntityActionOperation entityActionOperation)
            throws ServiceException {
        try {
            return service.action(entityActionOperation);
        } catch (UniformInterfaceException e) {
            throw processCatch(new ServiceException(e));
        } catch (ClientHandlerException e) {
            throw processCatch(new ServiceException(e));
        }
    }
1369183
@GET
  @Path("/{id}/$someCustomOperation")
  public Response someCustomOperationUsingGet(@PathParam("id") String id, String resource) throws Exception {
    return customOperation(resource, RequestTypeEnum.GET, id, "$someCustomOperation", 
            RestOperationTypeEnum.EXTENDED_OPERATION_INSTANCE);
  }
1130223
public void dispatch_event(final EventData eventData) {
        final TangoInterfaceChange interfaceChange = this;
        if (EventUtil.graphicAvailable()) {
            //   Causes doRun.run() to be executed asynchronously
            //      on the AWT event dispatching thread.
            Runnable do_work_later = new Runnable() {
                public void run() {
                    fireTangoInterfaceChangeEvent(interfaceChange, eventData);
                }
            };
            SwingUtilities.invokeLater(do_work_later);
        }
        else {
            fireTangoInterfaceChangeEvent(interfaceChange, eventData);
        }
    }
625081
public void dispatch_event(final EventData eventData) {
		final TangoQualityChange tangoQualityChange = this;
        if (EventUtil.graphicAvailable()) {
            //   Causes doRun.run() to be executed asynchronously
            //      on the AWT event dispatching thread.
            Runnable do_work_later = new Runnable() {
                public void run() {
                    fireTangoQualityChangeEvent(tangoQualityChange, eventData);
                }
            };
            SwingUtilities.invokeLater(do_work_later);
        }
        else
            fireTangoQualityChangeEvent(tangoQualityChange, eventData);
}
120488
public static function dispatch($action, array $parameters = [])
    {
        if (isset(static::$listeners[$action])) {
            foreach (static::$listeners[$action] as $callback) {
                $response = call_user_func_array($callback, $parameters);

                if ($response !== null) {
                    return $response;
                }
            }
        }
    }
607035
private function applyPatch($entity, array $operation)
    {
        if (false === $this->rightManager->authorized($entity, $operation['path'], $operation['op'])) {
            throw new UnauthorizedPatchOperationException($entity, $operation['path'], $operation['op']);
        }

        if (PatcherInterface::REPLACE_OPERATION === $operation['op']) {
            $method = $this->buildMethodName($operation['path'], 'set');
            $entity->$method($operation['value']);
        }
    }
84304
public function call($action, $params = array()) {
		$time = 0.0;
		$response = new Client\Response($action, $this->directCall($action, $params, $time), $time);
		
		if(!$response->isOk()) {
			throw new Client\Exception\ActionFailed($response, "Action '".$action->name()."' failed: ".$response->getMessage());
		}
		
		switch($action->layout('output')) {
			case 'object':
				return new Client\ResourceInstance($this->client, $action, $response);
			
			case 'object_list':
				return new Client\ResourceInstanceList($this->client, $action, $response);
			
			default:
				return $response;
		}
	}
99994
protected function translate($operation, array $params = [])
    {

        $locale     = is_null($this->locale) ? app()->getLocale() : $this->locale;
        $translator = app('translator');
        if (($name       = $this->notificationContents->find($operation, $locale)) !== false) {
            return $translator->transWith($name, $params);
        }
        return $translator->trans("antares/logger::operations.{$operation}", $params, 'messages', $locale, false);
    }
1117169
protected function dispatch(string $aggregateId, PayloadInterface $payload, array $metaData = null): void
    {
        $this
            ->getCommandDispatcher()
            ->dispatch(
                new CommandMessage(
                    $payload,
                    new PayloadType($payload),
                    $aggregateId,
                    $metaData
                )
            );
    }
461596
public function visit(
        CommandInterface $command,
        RequestInterface $request,
        Parameter $param
    ) {
        $this->jsonData[$param->getWireName()] = $this->prepareValue(
            $command[$param->getName()],
            $param
        );

        return $request->withBody(Psr7\stream_for(\GuzzleHttp\json_encode($this->jsonData)));
    }
276142
public function execute($operation, $parameter = array(), $version = null)
    {
        // remove '/' from operation
        $operation = preg_replace('/\//', '', $operation);

        $className = 'RakutenRws_Api_Definition_'.$operation;
        if (!class_exists($className)) {
            throw new LogicException('Operation is not definied.');
        }

        $api = new $className($this, $this->options);
        if ($version !== null) {
            $api->setVersion($version);
        }

        return $api->execute($parameter);
    }
239043
public function amOnAction($action, $params = [])
    {
        $route = $this->getRouteByAction($action);
        $absolute = !is_null($route->domain());
        $url = $this->app['url']->action($action, $params, $absolute);

        $this->amOnPage($url);
    }
840302
public function dispatch($action, array $parameters = [])
    {
        $parameters['key'] = $this->config('public_key');
        $parameters['sum'] = $this->summary(array_merge($parameters, [
            'action'  => $action,
            'version' => self::VERSION,
        ]));
        $uri = (new UriTemplate())->expand(self::HOST.'{/segments*}{?parameters*}', [
            'segments'   => [
                self::VERSION, $action,
            ],
            'parameters' => $parameters,
        ]);

        return (new Client())->get($uri);
    }
12499
private <T> T execute(Operation<T> operation) throws Exception {
    return execute(operation, null);
  }
776464
public function run($action = null, $params = [])
    {
        $this->action = $action;
        $this->params = $params;

        /*
         * Check security token.
         */
        if (!$this->verifyCsrfToken()) {
            return Response::make(Lang::get('backend::lang.page.invalid_token.label'), 403);
        }

        /*
         * Check forced HTTPS protocol.
         */
        if (!$this->verifyForceSecure()) {
            return Redirect::secure(Request::path());
        }

        /*
         * Determine if this request is a public action.
         */
        $isPublicAction = in_array($action, $this->publicActions);

        /*
         * Check that user is logged in and has permission to view this page
         */
        if (!$isPublicAction) {

            /*
             * Not logged in, redirect to login screen or show ajax error.
             */
            if (!BackendAuth::check()) {
                return Request::ajax()
                    ? Response::make(Lang::get('backend::lang.page.access_denied.label'), 403)
                    : Backend::redirectGuest('backend/auth');
            }

            /*
             * Check access groups against the page definition
             */
            if ($this->requiredPermissions && !$this->user->hasAnyAccess($this->requiredPermissions)) {
                return Response::make(View::make('backend::access_denied'), 403);
            }
        }

        /*
         * Extensibility
         */
        if ($event = $this->fireSystemEvent('backend.page.beforeDisplay', [$action, $params])) {
            return $event;
        }

        /*
         * Set the admin preference locale
         */
        BackendPreference::setAppLocale();
        BackendPreference::setAppFallbackLocale();

        /*
         * Execute AJAX event
         */
        if ($ajaxResponse = $this->execAjaxHandlers()) {
            return $ajaxResponse;
        }

        /*
         * Execute postback handler
         */
        if (
            ($handler = post('_handler')) &&
            ($handlerResponse = $this->runAjaxHandler($handler)) &&
            $handlerResponse !== true
        ) {
            return $handlerResponse;
        }

        /*
         * Execute page action
         */
        $result = $this->execPageAction($action, $params);

        if (!is_string($result)) {
            return $result;
        }

        return Response::make($result, $this->statusCode);
    }
555704
public function execute(OperationInterface $op)
  {
    try {
      if ($op instanceof DeleteOperationInterface) {
        $response = $this->httpClient->delete($op->getEndpoint(), [
          'headers' => $op->getHeaders(),
        ]);
      } elseif ($op instanceof PostOperationInterface) {
        $response = $this->httpClient->post($op->getEndpoint(), [
          'headers' => $op->getHeaders(),
          'body' => $op->getData(),
        ]);
      } elseif ($op instanceof PatchOperationInterface) {
        $response = $this->httpClient->patch($op->getEndpoint(), [
          'headers' => $op->getHeaders(),
          'body' => $op->getData(),
        ]);
      } elseif ($op instanceof PutOperationInterface) {
        $response = $this->httpClient->put($op->getEndpoint(), [
          'headers' => $op->getHeaders(),
          'body' => $op->getData(),
        ]);
      } else {
        $response = $this->httpClient->get($op->getEndpoint());
      }
    } catch (GuzzleHttp\Exception\ClientException $e) {
      throw new Exception\ClientException('ClientException occurred in request to Orchestrate: ' . $e->getMessage(), $e->getCode(), $e);
    } catch (GuzzleHttp\Exception\ServerException $e) {
      throw new Exception\ServerException('ServerException occurred in request to Orchestrate: ' . $e->getMessage(), $e->getCode(), $e);
    }

    $refLink = null;
    $location = null;

    if ($response->hasHeader('ETag')) {
      $refLink = str_replace('"', '', $response->getHeaderLine('ETag'));
    } elseif ($response->hasHeader('Link')) {
      $refLink = str_replace(
        ['<', '>; rel="next"'],
        ['', ''],
        $response->getHeaderLine('Link')
      );
    }

    if ($response->hasHeader('Location')) {
      $location = $response->getHeaderLine('Location');
    }
    $rawValue = $response->getBody(true);
    $value = json_decode($rawValue, true);

    return $op->getObjectFromResponse($refLink, $location, $value, $rawValue);
  }