requestFactory ->createRequest('POST', 'https://firebasedynamiclinks.googleapis.com/v1/shortLinks') ->withBody($this->streamFactory->createStream(Json::encode($action, JSON_FORCE_OBJECT))) ->withHeader('Content-Type', 'application/json; charset=UTF-8') ; } public function createStatisticsRequest(GetStatisticsForDynamicLink $action): RequestInterface { $url = sprintf( 'https://firebasedynamiclinks.googleapis.com/v1/%s/linkStats?durationDays=%d', rawurlencode($action->dynamicLink()), $action->durationInDays(), ); return $this->requestFactory ->createRequest('GET', $url) ->withHeader('Content-Type', 'application/json; charset=UTF-8') ; } public function createShortenLinkRequest(ShortenLongDynamicLink $action): RequestInterface { return $this->requestFactory ->createRequest('POST', 'https://firebasedynamiclinks.googleapis.com/v1/shortLinks') ->withBody($this->streamFactory->createStream(Json::encode($action, JSON_FORCE_OBJECT))) ->withHeader('Content-Type', 'application/json; charset=UTF-8') ; } /** * @param array $options * * @throws ClientExceptionInterface */ public function send(RequestInterface $request, array $options = []): ResponseInterface { return $this->client->send($request, $options); } }