public function testValidation() { $endpoint = new EndpointIdentifier('POST', 1, 'core', 'show'); $this->assertEquals('POST', $endpoint->getMethod()); $this->assertEquals(1, $endpoint->getVersion()); $this->assertEquals('core', $endpoint->getPackage()); $this->assertEquals('show', $endpoint->getApiAction()); $this->assertEquals('v1/core/show', $endpoint->getUrl()); }
/** * Create link to specified api endpoint * * @param EndpointIdentifier $endpoint * @param array $params * * @return string */ public function link(EndpointIdentifier $endpoint, $params = []) { $params = array_merge(['version' => $endpoint->getVersion(), 'package' => $endpoint->getPackage(), 'apiAction' => $endpoint->getApiAction()], $params); return $this->linkGenerator->link('Api:Api:default', $params); }