public function create(Credentials $credentials, Definition $definition)
 {
     $url = $this->projectionManagementUrl() . sprintf('%s?name=%s&emit=%s&checkpoints=%s&enabled=%s', $definition->mode(), $definition->name(), $definition->mayEmitNewEvents() === true ? 'yes' : 'no', $definition->mode() === Definition::MODE_CONTINUOUS ? 'yes' : 'no', $definition->enabled() ? 'yes' : 'no');
     $request = new Request('POST', $url, ['Content-Type' => 'application/json;charset=UTF-8', 'Authorization' => 'Basic ' . $credentials->basicAuthentication()], $definition->query());
     $this->sendRequest($request);
     $this->ensureStatusCodeIsGood($url);
     if ($this->lastResponse->getStatusCode() != 201) {
         throw new \Exception('Failed to create projection');
     }
 }