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]]);
 }
 /**
  * @dataProvider formatProvider
  */
 public function testFormatsJson($def, $args, $result)
 {
     $j = new JsonBody(new Service([], function () {
         return [];
     }));
     $shape = Shape::create($def, new ShapeMap([]));
     $this->assertEquals($result, $j->build($shape, $args));
 }
 protected function payload(RequestInterface $request, Shape $member, array $value)
 {
     $request->setHeader('Content-Type', $this->contentType);
     $request->setBody(Stream::factory($this->jsonFormatter->build($member, $value)));
 }