/** * @param Pipeline $pipeline * * @return Request */ public function prepareRequest(Pipeline $pipeline) { $statements = []; foreach ($pipeline->statements() as $statement) { $st = ['statement' => $statement->text(), 'resultDataContents' => ['REST', 'GRAPH'], 'includeStats' => true]; if (!empty($statement->parameters())) { $st['parameters'] = $this->formatParams($statement->parameters()); } $statements[] = $st; } $body = json_encode(['statements' => $statements]); $headers = [['X-Stream' => true, 'Content-Type' => 'application/json']]; return new Request('POST', sprintf('%s/db/data/transaction/commit', $this->uri), $headers, $body); }