Returns users list

@param array $filter
@param null  $page
@param null  $limit

@throws \RetailCrm\Exception\InvalidJsonException
@throws \RetailCrm\Exception\CurlException
@throws \InvalidArgumentException

@return \RetailCrm\Response\ApiResponse
357876
public function usersList(array $filter = [], $page = null, $limit = null)
    {
        $parameters = [];

        if (count($filter)) {
            $parameters['filter'] = $filter;
        }
        if (null !== $page) {
            $parameters['page'] = (int)$page;
        }
        if (null !== $limit) {
            $parameters['limit'] = (int)$limit;
        }

        /** @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            '/users',
            "GET",
            $parameters
        );
    }
413045
public function getUserAgents($limit = 0)
    {
        $counter = 0;

        foreach ($this->loadFromPath() as $row) {
            if ($limit && $counter >= $limit) {
                return;
            }

            $row = json_decode($row, false);
            yield trim($row->user_agent);
            ++$counter;
        }
    }
1323999
public function objectsList($filter = null, $params = null)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();

        //====================================================================//
        // Prepare Query Builder
        /** @var QueryBuilder $queryBuilder */
        $queryBuilder = $this->repository->createQueryBuilder('c');
        // Setup Results Offset
        if (isset($params['offset']) && is_int($params['offset'])) {
            $queryBuilder->setFirstResult($params['offset']);
        }
        // Limit Results Number
        if (isset($params['max']) && is_int($params['max'])) {
            $queryBuilder->setMaxResults($params['max']);
        }

        //====================================================================//
        // Add List Filters
        if (!empty($filter)) {
        }

        //====================================================================//
        // Load Objects List
        $rawData = $queryBuilder->getQuery()->getResult();

        //====================================================================//
        // Parse Data on Result Array
        $response = array();
        foreach ($rawData as $object) {
            $response[] = $this->getObjectListArray($object);
        }

        //====================================================================//
        // Parse Meta Infos on Result Array
        $response['meta'] = array(
            'total' => count($rawData),
            'current' => $this->getTotalCount(),
        );

        //====================================================================//
        // Return result
        return $response;
    }
774504
public function usersGroups($page = null, $limit = null)
    {
        $parameters = [];

        if (null !== $page) {
            $parameters['page'] = (int)$page;
        }
        if (null !== $limit) {
            $parameters['limit'] = (int)$limit;
        }

        /** @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            '/user-groups',
            "GET",
            $parameters
        );
    }
753024
public function listResources($filter)
    {
        $alias = 'resource';
        $collection = $this->getThisCollection();

        $queryBuilder = $this->getRepository()
            ->createQueryBuilder($alias);

        // Build the filter on resources
        $this->filterQueryBuilder($queryBuilder, $filter, $collection, $alias);

        // Count the total number of resources
        $countQueryBuilder = clone $queryBuilder;
        $collectionIdentifier = $collection->getIdentifier();
        $totalNumberOfRows = $countQueryBuilder
            ->select($countQueryBuilder->expr()->count($alias . '.' . $collectionIdentifier))
            ->getQuery()
            ->getSingleScalarResult();

        // Paginate resources
        $this->paginateQueryBuilder($queryBuilder, $filter);

        // Finally, select all fields
        $queryBuilder->select($alias);

        $returnedResources = $this->loadResourcesFromQueryBuilder($queryBuilder, $this->getThisCollection());

        return Resource::formatResourcesJsonApi($returnedResources, $totalNumberOfRows);
    }
464336
public function getSearchRequest($filter, $limit = 1, $conditions = [])
    {
        if (isset($filter['id'])) {
            $ids = is_array($filter['id']) ? $filter['id'] : [$filter['id']];
            return $this->getReadRequest($ids);
        }
        
        return new StorageDataRequest();
    }
137700
public function getPagedResults($limit = 25, $page = 0)
    {
        $template = self::DQL_ALL;
        $dql = sprintf($template, Application::class);

        return $this->getPaginator($dql, $limit, $page, []);
    }
372580
public function getAll($service, $page = 1, $perPage = 25)
    {
        $params = array(
            'page' => $page,
            'per_page' => $perPage
        );

        return $this->_user->get('account/identity/limit/' . $service, $params);
    }
755908
public function retrieveAll(array $filters = array(), $limit = null, $offset = null)
    {
        $result = clone $this->entityCollection;
        if (!empty($filters)) {
            $result = $result->search($filters);
        }
        if ($offset) {
            $result = $result->cslice($offset, $limit);
        }
        if ($limit && !$offset) {
            $result = $result->chunk($limit);
        }

        return $result;
    }
886198
public function pagination($page, $limit, $query = null, $orderBy = null, $sort = 'ASC', $filter = null)
    {
        $entityClassAlias = $this->getEntityClassAlias();

        // Create a Doctrine Collection
        $queryBuilder = $this->getObjectManager()->createQueryBuilder();
        $queryBuilder->select($entityClassAlias)
                     ->from($this->getEntityClass(), $entityClassAlias);

        $paramCounter = 0;

        if (is_array($filter)) {
            $paramCounter = $this->addFilterToQueryBuilder($filter, $queryBuilder);
        }

        //Add joins to query builder
        $this->addJoinTablesToQueryBuilder($queryBuilder);

        if (null !== $query) {
            $properties    = $this->getQueryableProperties();
            $orExpressions = array();
            $paramCounter++;

            foreach ($properties as $property) {
                $orExpressions[] = $queryBuilder->expr()->like($property, '?' . $paramCounter);
            }

            $queryBuilder->andWhere(
                call_user_func_array(array($queryBuilder->expr(), "orX"), $orExpressions)
            );

            $queryBuilder->setParameter($paramCounter, $query);
        }

        if ($orderBy) {
            $orderByIdentifier = $this->getOrderByIdentifier($orderBy);

            if (!$sort) {
                $sort = 'ASC';
            }
            $queryBuilder->orderBy($orderByIdentifier, $sort);
        }

        // Create the paginator itself
        $paginator = new Paginator(
            new DoctrinePaginator(new ORMPaginator($queryBuilder))
        );

        $paginator->setCurrentPageNumber($page)
                  ->setItemCountPerPage($limit)
                  ->setPageRange(5);

        return $paginator;
    }
1025973
function contacts_getList ($filter = NULL, $page = NULL, $per_page = NULL)
    {
        /** http://www.flickr.com/services/api/flickr.contacts.getList.html */
        $this->request('flickr.contacts.getList', array('filter'=>$filter, 'page'=>$page, 'per_page'=>$per_page));
        return $this->parsed_response ? $this->parsed_response['contacts'] : false;
    }
344464
public function getAuths(CardPayments\Authorization $auth = null, CardPayments\Filter $filter = null)
    {
        $queryStr = array();
        if($auth && $auth->merchantRefNum) {
            $queryStr['merchantRefNum'] = $auth->merchantRefNum;
        }
        if($filter) {
            if(isset($filter->limit)) {
                $queryStr['limit'] = $filter->limit;
            }
            if(isset($filter->offset)) {
                $queryStr['offset'] = $filter->offset;
            }
            if(isset($filter->startDate)) {
                $queryStr['startDate'] = $filter->startDate;
            }
            if(isset($filter->endDate)) {
                $queryStr['endDate'] = $filter->endDate;
            }
        }
        $request = new Request(array(
             'method' => Request::GET,
             'uri' => $this->prepareURI("/auths"),
             'queryStr' => $queryStr
        ));

        $response = $this->client->processRequest($request);

        return new CardPayments\Pagerator($this->client, $response, '\Paysafe\CardPayments\Authorization');
    }
981126
private function getSearchResult(array $filters, $limit, $page, $pageSize, $locale, $webspaceKey)
    {
        $repository = $this->searchManager->getRepository($this->articleDocumentClass);
        $search = $this->createSearch($repository->createSearch(), $filters, $locale);
        if (!$search) {
            return new \ArrayIterator([]);
        }

        $this->addPagination($search, $pageSize, $page, $limit);

        if (array_key_exists('sortBy', $filters) && is_array($filters['sortBy'])) {
            $sortMethod = array_key_exists('sortMethod', $filters) ? $filters['sortMethod'] : 'asc';
            $this->appendSortBy($filters['sortBy'], $sortMethod, $search);
        }

        if ($webspaceKey) {
            $webspaceQuery = new BoolQuery();

            // check for mainWebspace
            $webspaceQuery->add(new TermQuery('main_webspace', $webspaceKey), BoolQuery::SHOULD);

            // check for additionalWebspaces
            $webspaceQuery->add(new TermQuery('additional_webspaces', $webspaceKey), BoolQuery::SHOULD);

            $search->addQuery($webspaceQuery);
        }

        return $repository->findDocuments($search);
    }
422857
public @NotNull List<Page> getPages(@Nullable final Predicate<Page> filter, @Nullable final Page basePage) {
    Resource baseResourceToUse = null;

    // detect pages page to use
    if (basePage == null) {
      PageManager pageManager = AdaptTo.notNull(request.getResourceResolver(), PageManager.class);
      Page currentPage = pageManager.getContainingPage(request.getResource());
      if (currentPage != null) {
        baseResourceToUse = currentPage.adaptTo(Resource.class);
      }
    }
    else {
      baseResourceToUse = basePage.adaptTo(Resource.class);
    }

    // filter pages (as resources)
    Predicate<Resource> resourceFilter = new Predicate<Resource>() {
      @Override
      public boolean test(Resource resource) {
        Page page = resource.adaptTo(Page.class);
        if (page == null) {
          return false;
        }
        if (filter == null) {
          return true;
        }
        return filter.test(page);
      }
    };
    List<Resource> resources = getResourcesWithBaseResource(resourceFilter, baseResourceToUse);

    // convert resources back to pages
    return Lists.transform(resources, new Function<Resource, Page>() {
      @Override
      @SuppressWarnings("null")
      public Page apply(@Nullable Resource resource) {
        return resource.adaptTo(Page.class);
      }
    });
  }
459021
public function getUsers($page = 0, $pagesize = 100, $sort = 'id', $direction = 'asc')
    {
        $result = (Object)array(
            "users" =>  array(),
            "total" => 0
        );

        $repo = $this->getRepository('erdiko\users\entities\User');

        $offset = 0;
        if ($page > 0) {
            $offset = ($page - 1) * $pagesize;
        }

        $result->users = $repo->findBy(
                                        array(),
                                        array(
                                            $sort => $direction
                                        ),
                                        $pagesize,
                                        $offset
                                    );

        // get total users count
        $result->total = (int)$repo->createQueryBuilder('u')
                                   ->select('count(u.id)')
                                   ->getQuery()
                                   ->getSingleScalarResult();

		return $result;
	}
495431
public function getSearchRequest($filter, $limit = 1, $conditions = [])
    {
        $db = $this->_getConnection();
        $table = $this->table;
        $self = $this;

        $request = new StorageDataRequest(
            [$filter, $limit],
            function ($filter, $limit) use ($db, $table, $self) {
                if (!$db) {
                    $self->logError('Missing connection on getSearchRequest on table: ' . $table);
                    return false;
                }
                
                //
                $filterBinds = [];
                foreach ($filter as $id => $filterItem) {
                    $filterBinds[$id] = $filterItem[2];  
                }
                //
                $filterBinds = $this->prepareBind($filterBinds, $db, false);
                //
                foreach ($filter as $id => &$filterItem) {
                    $filterItem[2] = $filterBinds[$id];
                } unset($filterItem);
                
                //
                $filtersWhereArray = $this->_prepapreFilters($filter);
                
                $query = 'SELECT * FROM ' . $table
                    . (!empty($filtersWhereArray) ? ' WHERE (' . implode(' ) AND (', $filtersWhereArray) . ')' : '')
                    . ' LIMIT '.$limit;

                $stmnt = $db->query($query);

                if (!$stmnt) {
                    $this->logError('Cannot execute getSearchRequest on table: ' . $table . ':' . implode(',', $db->errorInfo()), [
                        'code' => $db->errorCode(),
                    ]);

                    return false;
                }

                $result = $stmnt->fetchAll(PDO::FETCH_ASSOC);

                if (!$result && (int) $stmnt->errorCode() > 0) {
                    $this->logError('Error on execution on getSearchRequest on table: ' . $table . ':' . implode(',',
                            $stmnt->errorInfo()), [
                        'code' => $stmnt->errorCode(),
                    ]);

                    return false;
                }

                return $result;
            });

        return $request;
    }
298200
public function getPosts( $limit = 100 ) {

        return $this->parseGetPosts(
            $this->service->api( $this->getWallGetRequestUrl( $limit ), 'GET' ),
            'response',
            [
                'id',
                'text'
            ],
            [
                'service_id_author' => 'from_id',
                'service_id_post'   => 'id',
                'time_created'      => 'date',
                'content'           => 'text'
            ] );
    }