Generate a permission for an API with a Pool

@param string $name
@param string $route
@param string $icon
@param string $apiEndpoint
@param string $pool
@param array $options
@return AdminMenuBuilder
@since 2.0.0
963038
public function itemPoolApi($name, $route, $icon, $apiEndpoint, $pool, array $options = [])
    {
        return $this->itemApi($name, $route, $icon, $apiEndpoint, array_merge($options, [
            'pool' => $pool,
        ]));
    }
203665
public static function named(string $name) : Permission
    {
        if (!isset(self::$permissionCache[$name])) {
            self::$permissionCache[$name] = new self($name);
        }

        return self::$permissionCache[$name];
    }
274888
protected function createFileStorage(string $name, string $class, array $options): CacheItemPoolInterface
    {
        $path       = $options['cache_dir'];
        $denyAccess = $options['deny_access'];

        if (!is_dir($path)) {
            // Try add root
            $path = $this->config->get('path.root') . '/' . $path;
        }

        if (is_dir($path)) {
            $path = realpath($path);
        }

        $group = ($name === 'windwalker') ? null : $name;

        return $this->container->newInstance(
            $class,
            [$path, $group, $denyAccess, $options['cache_time'], $options]
        );
    }
672534
public function pathBuilder($name = null, array $options = []) {
		if ($name instanceof PathBuilderInterface) {
			$this->_pathBuilder = $name;

			return $this->_pathBuilder;
		}

		if ($name !== null) {
			$this->_pathBuilder = $this->createPathBuilder($name, $options);
		}

		return $this->_pathBuilder;
	}
66479
protected function fallbackWathProvides(Pool $pool, $name, TransportException $ex)
    {
        $providers = array();

        if (404 === $ex->getCode() && !$this->fallbackProviders) {
            $this->fallbackProviders = true;
            $repoName = Util::convertAliasName($name);
            $results = $this->search($repoName);

            foreach ($results as $item) {
                if ($name === strtolower($item['name'])) {
                    $providers = $this->whatProvides($pool, $item['name']);

                    break;
                }
            }
        }

        $this->fallbackProviders = false;
        $this->providers[$name] = $providers;
    }
377292
public function api($name)
    {
        switch ($name) {
            case 'me':
            case 'current_user':
            case 'currentUser':
                $api = new Api\CurrentUser($this);
                break;
            case 'codeOfConduct':
                $api = new Api\Miscellaneous\CodeOfConduct($this);
                break;

            case 'deployment':
            case 'deployments':
                $api = new Api\Deployment($this);
                break;

            case 'ent':
            case 'enterprise':
                $api = new Api\Enterprise($this);
                break;

            case 'emojis':
                $api = new Api\Miscellaneous\Emojis($this);
                break;

            case 'git':
            case 'git_data':
            case 'gitData':
                $api = new Api\GitData($this);
                break;

            case 'gist':
            case 'gists':
                $api = new Api\Gists($this);
                break;

            case 'gitignore':
                $api = new Api\Miscellaneous\Gitignore($this);
                break;

            case 'integration':
            case 'integrations':
                $api = new Api\Integrations($this);
                break;

            case 'apps':
                $api = new Api\Apps($this);
                break;

            case 'issue':
            case 'issues':
                $api = new Api\Issue($this);
                break;

            case 'markdown':
                $api = new Api\Markdown($this);
                break;

            case 'licenses':
                $api = new Api\Miscellaneous\Licenses($this);
                break;

            case 'notification':
            case 'notifications':
                $api = new Api\Notification($this);
                break;

            case 'organization':
            case 'organizations':
                $api = new Api\Organization($this);
                break;

            case 'org_project':
            case 'orgProject':
            case 'org_projects':
            case 'orgProjects':
            case 'organization_project':
            case 'organizationProject':
            case 'organization_projects':
            case 'organizationProjects':
                $api = new Api\Organization\Projects($this);
                break;

            case 'pr':
            case 'pulls':
            case 'pullRequest':
            case 'pull_request':
            case 'pullRequests':
            case 'pull_requests':
                $api = new Api\PullRequest($this);
                break;

            case 'rateLimit':
            case 'rate_limit':
                $api = new Api\RateLimit($this);
                break;

            case 'repo':
            case 'repos':
            case 'repository':
            case 'repositories':
                $api = new Api\Repo($this);
                break;

            case 'search':
                $api = new Api\Search($this);
                break;

            case 'team':
            case 'teams':
                $api = new Api\Organization\Teams($this);
                break;

            case 'member':
            case 'members':
                $api = new Api\Organization\Members($this);
                break;

            case 'user':
            case 'users':
                $api = new Api\User($this);
                break;

            case 'authorization':
            case 'authorizations':
                $api = new Api\Authorizations($this);
                break;

            case 'meta':
                $api = new Api\Meta($this);
                break;

            case 'graphql':
                $api = new Api\GraphQL($this);
                break;

            default:
                throw new InvalidArgumentException(sprintf('Undefined api instance called: "%s"', $name));
        }

        return $api;
    }
1102556
public function build(Route $route, $name, array $parameters = [])
    {
        $url      = $this->app['url_generator']->generate($name, $parameters, UrlGeneratorInterface::ABSOLUTE_URL);
        $request  = Request::create($url, 'GET', array_merge(['_format' => $route->getFormat()], $parameters));
        $response = $this->app->handle($request);

        $this->write(
            $this->getFilePath($route, $parameters),
            $response->getContent(),
            $request->getFormat($response->headers->get('Content-Type')),
            $route->getFileName()
        );
    }
1082901
protected function prefixedResource( $name, $controller, array $options )
	{
		list( $name, $prefix ) = $this->getResourcePrefix( $name );

		// We need to extract the base resource from the resource name. Nested resources
		// are supported in the framework, but we need to know what name to use for a
		// place-holder on the route parameters, which should be the base resources.
		$callback = function ( $me ) use ( $name, $controller, $options )
		{
			$me->resource( $name, $controller, $options );
		};

		$this->router->group( compact( 'prefix' ), $callback );
	}
600205
public function storePubliclyAs($path, $name, $options = [])
    {
        $options = $this->parseOptions($options);

        $options['visibility'] = 'public';

        return $this->storeAs($path, $name, $options);
    }
1219716
public function compose($name = null, $options = array())
    {
        if (!self::$menuInstance) {

            $id       = from_route('customfields');
            $category = from_route('category');
            $fields   = FieldView::query()->get(['id', 'category_name'])->groupBy('category_name');
            $menu     = app('antares.widget')->make('menu.customfields.pane');
            foreach ($fields as $name => $items) {
                $active = false;
                if (!is_null($id)) {
                    foreach ($items as $item) {
                        if ($item->id != $id) {
                            continue;
                        }
                        $active = true;
                        break;
                    }
                } else {
                    $active = $category == $name;
                }

                $menu->add($name)
                        ->link(handles('antares::customfields/' . $name . '/index'))
                        ->title(ucfirst($name) . ' (' . $items->count() . ')')
                        ->active($active);
            }
            self::$menuInstance = $menu;
            $app                = Container::getInstance();
            $pane               = $app->make('antares.widget')->make('pane.left');
            $pane->add('logger')->content(view('antares/customfields::admin.partials._left_pane'));
        }
    }
459864
protected function appendBreadcrumb($name, $label, $route = null, array $parameters = [])
    {
        $this->container->get('ekyna_admin.menu.builder')->breadcrumbAppend($name, $label, $route, $parameters);
    }
1164384
private function createServiceFromLazyServiceDelegator(string $name, array $options = null)
    {

        $creationCallback = $this->delegatorCallbackCache[$name] ?? null;
        if ($creationCallback) {
            $object = $creationCallback($this->creationContext, $name, $creationCallback, $options);
            return $object;
        }
        $creationCallback = function () use ($name, $options) {
            return $this->createServiceFromFactory($name, $options);
        };

        $delegatorFactory = $this->delegators[$name][0];
        if (is_string($delegatorFactory)) {
            $delegatorFactory = $this->createLazyServiceDelegatorFactory();
            $this->delegators[$name][0] = $delegatorFactory;
        }

        $creationCallback = function () use ($delegatorFactory, $name, $creationCallback, $options) {
            return $delegatorFactory($this->creationContext, $name, $creationCallback, $options);
        };

        //cache the callback for later requests
        $this->delegatorCallbackCache[$name] = $creationCallback;
        return $creationCallback($this->creationContext, $name, $creationCallback, $options);
    }
512576
protected function setResourceCreate($name, $controller, $action, $options = [])
    {
        return $this->mapResource('post', $name, $controller, 'post' . ucfirst($action));
    }
555351
protected function buildRequest(Route $route, $name = null, array $parameters = array())
    {
        if (null !== $name) {
            $uri = $this->router->generate($name, $parameters);
        } else {
            $uri = $route->getPath();
        }

        return new Request(
            [], // GET
            [], // POST
            [], // Attributes
            [], // Cookies
            [], // Files
            [
                'REQUEST_URI'     => $uri,
                'DOCUMENT_URI'    => $uri,
                'SCRIPT_FILENAME' => realpath($this->kernel->getRootDir().'/../web').$this->baseUrl.'/app.php',
                'SCRIPT_NAME'     => $this->baseUrl.'/app.php'
            ], // Server
            null // Content
        );
    }
219179
protected function buildPaginatedRoute(Route $route, $name)
    {
        $contentType = $route->getContent();
        $contents    = $this->app['content_repository']->listContents($contentType);
        $paginator   = new Paginator($contents, $route->getPerPage());

        $this->logger->log(sprintf(
            'Building route <comment>%s</comment> for <info>%s</info> pages',
            $name,
            $paginator->count()
        ));
        $this->logger->getProgress($paginator->count());
        $this->logger->start();

        foreach ($paginator as $index => $contents) {
            $this->builder->build($route, $name, ['page' => $index + 1]);
            $this->logger->advance();
        }

        $this->logger->finish();
    }
1056325
public function api($name)
    {
        switch ($name) {
            case 'action':
            case 'actions':
                $api = new Api\Action($this);
                break;
            case 'board':
            case 'boards':
                $api = new Api\Board($this);
                break;
            case 'card':
            case 'cards':
                $api = new Api\Card($this);
                break;
            case 'checklist':
            case 'checklists':
                $api = new Api\Checklist($this);
                break;
            case 'list':
            case 'lists':
                $api = new Api\Cardlist($this);
                break;
            case 'member':
            case 'members':
                $api = new Api\Member($this);
                break;
            case 'notification':
            case 'notifications':
                $api = new Api\Notification($this);
                break;
            case 'organization':
            case 'organizations':
                $api = new Api\Organization($this);
                break;
            case 'token':
            case 'tokens':
                $api = new Api\Token($this);
                break;
            case 'webhook':
            case 'webhooks':
                $api = new Api\Webhook($this);
                break;
            default:
                throw new InvalidArgumentException(sprintf('Undefined api called: "%s"', $name));
        }

        return $api;
    }
1082003
public function resource($name, $controller, array $options = array())
    {
        $registrar = $this->getRegistrar();

        $registrar->register($name, $controller, $options);
    }