index request

@param JsonApiRepository $repository
@param Parameters $parameters
@return Model[]|\Serializable[]|Collection|array
165465
public function index(JsonApiRepository $repository, Parameters $parameters)
    {
        $this->applyFilters($this->filters, $this->filterFactory, $repository);

        return $repository->get();
    }
1190068
public function find(Repository $repository = null): array
    {
        if (!$repository && !($repository = $this->repository)) {
            throw new \RuntimeException('The current Query object is not tied to any Repository');
        }

        return $repository->find($this->compileParameters());
    }
867845
public function listUserRepositories(string $username, string $type = AbstractApi::TYPE_OWNER,
                                         string $sort = AbstractApi::SORT_FULL_NAME,
                                         string $direction = AbstractApi::DIRECTION_DESC): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/users/:username/repos?:args', $username,
            http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction])));
    }
607071
public function index(ApiRequest $request)
    {
        $this->crude = CrudeInstance::get($request->crudeName);

        $page = $request->input('page', 1);
        $numRows = $request->input('numRows', config('crude.defaults.numRows'));
        $sortAttr = $request->input('sortAttr', config('crude.defaults.sortAttr'));
        $sortOrder = $request->input('sortOrder', config('crude.defaults.sortOrder'));
        $searchAttr = $request->input('searchAttr', config('crude.defaults.searchAttr'));
        $searchValue = $request->input('searchValue', '');
        $richFilters = $request->input('richFilters', []);

        $count = $this->crude->countFiltered($searchAttr, $searchValue, $richFilters);
        $numPages = $numRows > 0
            ? ceil($count / $numRows)
            : 1;

        if ($page < 1)
            $page = 1;
        if ($page > $numPages)
            $page = $numPages;

        $collection = $this->crude->getFiltered($page, $numRows, $sortAttr, $sortOrder, $searchAttr, $searchValue, $richFilters);

        return $this->successResponse([
            'collection' => $collection,
            'pagination' => [
                'page' => $page,
                'numRows' => $numRows,
                'numPages' => $numPages,
                'count' => $count,
            ],
            'sort' => [
                'attr' => $sortAttr,
                'order' => $sortOrder
            ],
            'search' => [
                'attr' => $searchAttr,
                'value' => $searchValue
            ],

            'setup' => $this->crude->getCrudeSetupData()
        ]);
    }
1071747
public function getEntities($repository = null)
    {
        return $repository ? $this->_entities->getRepositoryEntities($repository) : $this->_entities;
    }
198747
public function addRepositories(array $repositories)
    {
        foreach ($repositories as $key => $repository) {
            $this->addRepository($key, $repository);
        }
        return $this;
    }
113906
public function listYourRepositories(string $type = AbstractApi::TYPE_ALL,
                                         string $sort = AbstractApi::SORT_FULL_NAME,
                                         string $direction = AbstractApi::DIRECTION_DESC): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/user/repos?:args',
            http_build_query(['type' => $type, 'sort' => $sort, 'direction' => $direction])));
    }
1302263
public function addRepositories($repositories)
    {
        if (!is_array($repositories) && (!is_object($repositories) || !$repositories instanceof \Traversable)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid argument provided for $repositories, expecting either an array or Traversable object, but' .
                ' "%s" given',
                is_object($repositories) ? get_class($repositories) : gettype($repositories)
            ));
        }
        foreach ($repositories as $repo) {
            $this->addRepository($repo);
        }
    }
1206131
public function indexRelationship($resourceId, $relationshipName, EncodingParametersInterface $parameters)
    {
        $resource = $this->read($resourceId);

        /** @var Relation $relation */
        $relation = $resource->{$relationshipName}();

        $result = $this->paginateBuilder($relation->getQuery(), $parameters);

        $this->applyIndexPolicy($result->getData());

        return $result;
    }
869246
protected function getSlugsToReset(Repository $repository)
    {
        if ($this->validSlugProvided($repository)) {
            return collect([$this->argument('slug')]);
        }

        if ($this->option('force')) {
            return $repository->all()->pluck('slug');
        }

        return $repository->enabled()->pluck('slug');
    }
328718
public function searchRepositories(string $q, string $sort = null,
                                       string $order = AbstractApi::DIRECTION_DESC): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/search/repositories?:args',
            http_build_query(['q' => $q, 'sort' => $sort, 'order' => $order])));
    }
1256399
public function index(IndexRequest $request)
    {
        $user = $request->user();
        $pageSize = 20;
        $page = $request->get('page', 1);
        list($items, $unreadCount) = $this->repository->getItems($user, $page, $pageSize);
        return $this->sendResponse([
            'items'  => $items,
            'unread' => $unreadCount
        ], '');
    }
393023
public function fetchRepository(Repository $repository)
    {
        $response = $this->getResponse(
            sprintf('%s/%s/metrics',
                $repository->getType(),
                $repository->getSlug()
            )
        );

        if (!$response || isset($repositoryArray['error'])) {
            throw new \UnexpectedValueException(sprintf('Response is empty for url %s', $response));
        }

        $repository = $this->hydrate($repository, $response['values']);
        $repository->setBranch($response['branch']);


        return $repository;
    }
344741
protected function doFilterWithRepository(
        Collection $collection,
        Repository $repository,
        WhereExpressionCollector $whereExpressionCollector,
        &$params
    ) {
        if ($this->isNumeric) {
            $equals = new MySqlEquals($this->columnName, $this->equalTo);
            return $equals->doFilterWithRepository($collection, $repository, $whereExpressionCollector, $params);
        }

        return true;
    }
945900
public function getTags($repository)
    {
        /* @var $response Response */
        $response = $this->client->get('repos/'.$repository.'/tags')->send();

        return json_decode($response->getBody(true), true);
    }
695581
protected function doCanFilterWithRepository(
        Collection $collection,
        Repository $repository
    ) {
        if (!$this->filter->canFilterWithRepository($collection, $repository)) {
            return false;
        }

        return true;
    }
606700
public static function fromRepository($repository)
    {
        $message = sprintf(
            'Could not add invalid OptionRepository of type "%1$s" to AggregateOptionRepository.',
            is_object($repository)
                ? get_class($repository)
                : gettype($repository)
        );

        return new static($message);
    }