Send an API request and wrap it in the corresponding Entity object.

@param \Hussainweb\DrupalApi\Request\Request $request
The request to send.

@return Entity|EntityCollection
The entity or the collection for the request.
495459
public function getEntity(Request $request)
    {
        $response = $this->send($request);
        $entity_class = $request->getEntityClass();
        return $entity_class::fromResponse($response);
    }
209205
public function cgetAction(Request $request)
    {
        $filter = $this->getManager()->getFilters($request);
        $locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));

        if ($request->get('flat') == 'true') {
            $filterFieldDescriptors = $this->getManager()->getFilterFieldDescriptors();
            $fieldDescriptors = $this->getManager()->getFieldDescriptors(
                $locale
            );

            $list = $this->flatResponse(
                $request,
                $filter,
                $filterFieldDescriptors,
                $fieldDescriptors,
                static::$entityName
            );
        } elseif ($request->get('ids') !== '') {
            $list = new CollectionRepresentation(
                $this->getManager()->findAllByIdsAndLocale($locale, $request->get('ids')),
                self::$entityKey
            );
        } else {
            $list = new CollectionRepresentation(
                $this->getManager()->findAllByLocale($locale, $filter),
                self::$entityKey
            );
        }

        $view = $this->view($list, 200);

        return $this->handleView($view);
    }
688609
public function createEntityRequest(
        RequestInterface $request,
        ContainerInterface $container
    ): EntityRequestInterface
    {
        /** @var EntityRequestInterface $er */
        $er = new $this->entityRequest($request);
        $er->setContainer($container);

        return $er;
    }
861091
public function send(Request $request)
    {
        $response   = new GetSchemaResponse();
        $rpbGetReq  = $this->createRpbMessage($request);
        $rpbGetResp = $this->client->send($rpbGetReq, RiakMessageCodes::YOKOZUNA_SCHEMA_GET_REQ, RiakMessageCodes::YOKOZUNA_SCHEMA_GET_RESP);

        if ( ! $rpbGetResp instanceof RpbYokozunaSchemaGetResp) {
            return $response;
        }

        if ( ! $rpbGetResp->hasSchema()) {
            return $response;
        }

        $response->name    = $rpbGetResp->schema->name;
        $response->content = $rpbGetResp->schema->content;

        return $response;
    }
781760
public function send(Request $request)
    {
        $curlOptions = [
            CURLOPT_CUSTOMREQUEST => $request->getMethod(),
            CURLOPT_URL => $request->getUri(),
        ];

        if (\in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true)) {
            $curlOptions[CURLOPT_POSTFIELDS] = $request->getBody();
        }

        $response = $this->exec($curlOptions, $request->getHeaders());
        if (!$response->isOkay()) {
            $this->logger->warning(
                \sprintf('REQUEST=%s, RESPONSE=%s', $request, $response)
            );
        }

        return $response;
    }
1279098
public function sendRequest(Request $request)
    {
        $response = $this->httpClient->send($request);

        $this->checkErrorResponse($response);

        return $response;
    }
1327469
public function postAction(Request $request)
    {
        try {
            $data = $request->request->all();
            $data['type'] = OrderType::MANUAL;

            $order = $this->getManager()->save(
                $data,
                $this->getLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale')),
                $this->getUser()->getId()
            );

            $view = $this->view($order, 200);
        } catch (OrderDependencyNotFoundException $exc) {
            $exception = new EntityNotFoundException($exc->getEntityName(), $exc->getId());
            $view = $this->view($exception->toArray(), 400);
        } catch (MissingOrderAttributeException $exc) {
            $exception = new MissingArgumentException($this->getOrderEntityName(), $exc->getAttribute());
            $view = $this->view($exception->toArray(), 400);
        }

        return $this->handleView($view);
    }
629078
public function resolveCollection($collection, $request = null)
    {
        return $collection->map(function ($item) use ($request) {
            return (new static($item))->toArray($request);
        })->all();
    }
662324
public function toResponse($request)
    {
        $resource = new FractalItem(
            $this->item,
            app()->make('InetStudio\PollsPackage\Polls\Contracts\Transformers\Back\Resource\ShowTransformerContract')
        );

        $serializer = app()->make('InetStudio\AdminPanel\Base\Contracts\Serializers\SimpleDataArraySerializerContract');

        $manager = new Manager();
        $manager->setSerializer($serializer);

        $transformation = $manager->createData($resource)->toArray();
        $transformation['success'] = ((bool) $transformation['id']);

        return response()->json($transformation);
    }
1003931
public function send(Request $request)
    {
        foreach ($this->cookies as $cookie) {
            $request->addCookie($cookie);
        }

        $response = $this->client->request($request);

        if ($response->getCookies()) {
            $this->cookies = $response->getCookies();
        }

        return $response;
    }
1285830
public function send(Request $request)
    {
        $response    = new GetResponse();
        $httpRequest = $this->createHttpRequest($request);

        try {
            $httpResponse = $this->client->send($httpRequest);
            $code         = $httpResponse->getStatusCode();
        } catch (RequestException $e) {
            if ($e->getCode() == 404 && $request->notfoundOk) {
                return $response;
            }

            throw $e;
        }

        if ( ! isset($this->validResponseCodes[$code])) {
            throw RiakTransportException::unexpectedStatusCode($code);
        }

        $json    = $httpResponse->json();
        $context = isset($json['context']) ? $json['context'] : null;
        $value   = $json['value'];
        $type    = $json['type'];

        $response->type    = $type;
        $response->context = $context;
        $response->value   = $this->opConverter->fromArray($type, $value);

        return $response;
    }
612633
protected function createEntityForm(Request $request = NULL)
    {
        $form = $this->createForm($this->type, $this->entity);

        return $request ? $form->handleRequest($request) : $form;
    }
1305804
public function send(Request $request)
    {
        $response     = new GetSchemaResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);

        $response->name    = $request->name;
        $response->content = (string) $httpResponse->getBody();

        return $response;
    }
992763
public function clientes(Request $request)
    {
        $envelope  = new Envelope();
        $documento = $request->get('q');
        $clientes  = $this
            ->getDoctrine()
            ->getManager()
            ->getRepository(Cliente::class)
            ->findByDocumento("{$documento}%");
        
        $envelope->setData($clientes);

        return $this->json($envelope);
    }
1358941
public function send(Request $request)
    {
        $response     = new MapReduceResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);
        $code         = $httpResponse->getStatusCode();

        if ( ! isset($this->validResponseCodes[$code])) {
            throw RiakTransportException::unexpectedStatusCode($code);
        }

        $multipartIterator  = new MultipartResponseIterator($httpResponse);
        $mapReduceIterator  = new HttpMapReduceResponseIterator($multipartIterator);
        $response->iterator = $mapReduceIterator;

        return $response;
    }
1302215
public function cgetAction(Request $request)
    {
        if ('true' == $request->get('flat')) {
            /** @var RestHelperInterface $restHelper */
            $restHelper = $this->get('sulu_core.doctrine_rest_helper');

            /** @var DoctrineListBuilderFactory $factory */
            $factory = $this->get('sulu_core.doctrine_list_builder_factory');

            $tagEntityName = $this->getParameter('sulu.model.tag.class');

            $fieldDescriptors = $this->get('sulu_core.list_builder.field_descriptor_factory')
                ->getFieldDescriptors('tags');
            $listBuilder = $factory->create($tagEntityName);

            $names = array_filter(explode(',', $request->get('names', '')));
            if (count($names) > 0) {
                $listBuilder->in($fieldDescriptors['name'], $names);
            }

            $restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);

            $list = new ListRepresentation(
                $listBuilder->execute(),
                self::$entityKey,
                'get_tags',
                $request->query->all(),
                $listBuilder->getCurrentPage(),
                $listBuilder->getLimit(),
                $listBuilder->count()
            );
            $view = $this->view($list, 200);
        } else {
            $list = new CollectionRepresentation($this->getManager()->findAll(), self::$entityKey);

            $context = new Context();
            $context->setGroups(['partialTag']);
            $view = $this->view($list, 200)->setContext($context);
        }

        return $this->handleView($view);
    }
667783
public function send(Request $request)
    {
        $request->configure($this->config);

        $httpClient = new \GuzzleHttp\Client();

        $r = $httpClient->request('POST', $this->getUrl(), [
            'body' => \GuzzleHttp\Psr7\stream_for((string) $request),
        ]);

        return Response::create($r->getBody()->getContents());
    }