public function onInit(InitEvent $event) { $command = $event->getCommand(); $operation = $this->api->getOperation($command->getName()); $fn = $this->validator; $fn($command->getName(), $operation->getInput(), $command->toArray()); }
public function __invoke(CommandTransaction $trans) { $command = $trans->command; $name = $command->getName(); $operation = $this->api->getOperation($name); return $trans->client->createRequest($operation['http']['method'], $this->endpoint, ['headers' => ['Content-Type' => $this->contentType], 'body' => $this->jsonFormatter->build($operation->getInput(), $command->toArray()), 'config' => ['command' => $command]]); }
public function __invoke(CommandTransaction $trans) { $command = $trans->command; $operation = $this->api->getOperation($command->getName()); $args = $command->toArray(); $request = $trans->client->createRequest($operation['http']['method'], $this->buildEndpoint($operation, $args), ['config' => ['command' => $command]]); // Ensure that query string lists are serialized as duplicates. $request->getQuery()->setAggregator($this->aggregator); return $this->serialize($request, $operation, $args); }
/** * @expectedException \InvalidArgumentException */ public function testEnsuresOperationExists() { $s = new Service([], function () { return []; }); $s->getOperation('foo'); }