Get user groups

@param null $page
@param null $limit

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

@return \RetailCrm\Response\ApiResponse
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
        );
    }
269403
public function findAllPaged($page = 0, $limit = 20) {
    $results = $this->findAllWithoutFetchPaged($page, $limit);
    $return = $this->hydrate($results);

    return $return;
  }
264884
public function getUsers($page = 1, $count = 10, $sortField = 'id', $sortOrder = 'asc')
    {
        $request = $this->client->get(
            $this->customer['url']
            .'/api/users?page='.$page
            .'&count='.$count
            .'&sort_by='.$sortField
            .'&sort_order='.$sortOrder
        );

        $request->setAuth($this->customer['username'], $this->customer['password']);
        $response = $request->send();

        return json_decode((string) $response->getBody(true));
    }
992588
public function getSimple(int $page, int $limit = 10, bool $isClount = false): \Illuminate\Contracts\Pagination\Paginator
    {
        if (!$this->_columns && !$this->_query) {
            return null;
        }
        if ($isClount) {
            $countTotal = $this->_query->count();
        }
        $this->_query->skip(($page - 1) * $page)->take($page + 1);
        $this->_data = $this->_query->simplePaginate($limit);
        if ($isClount) {
            $this->_data->totalCount = $countTotal;
        }
        foreach ($this->_data->items() as $key => $instance) {
            if ($instance instanceof \Illuminate\Database\Eloquent\Model) {
                $_listRow = [];
                foreach ($this->_columns->getColumns() as $column) {
                    $_listRow[$column->getKey()] = $column->getValues($instance);
                    if ($column->getKey() === 'preview') {
                    }
                }
                $buttons = $this->_columns->filterActions($instance);
                if (count($buttons)) {
                    $_listRow = array_merge($_listRow, [Column::ACTION_NAME => implode('', $buttons)]);
                }
                $this->_data->offsetSet($key, $_listRow);
            }
        }

        return $this->_data;
    }
620854
public function findAllCurrent($limit = 1000, $page = 1)
    {
        try {
            $qb = $this->getValidSpecialPriceQuery();

            $adapter = new DoctrineORMAdapter($qb);
            $pagerfanta = new Pagerfanta($adapter);
            $pagerfanta->setMaxPerPage($limit);
            $pagerfanta->setCurrentPage($page);

            return $pagerfanta;
        } catch (NoResultException $exc) {
            return null;
        }
    }
689061
public function getByGroupId($value, $limit = 1000, $useConnection = 'read')
    {
        if (is_null($value)) {
            throw new \Exception('Value passed to ' . __FUNCTION__ . ' cannot be null.');
        }

        $query = 'SELECT * FROM `project` WHERE `group_id` = :group_id ORDER BY title LIMIT :limit';
        $stmt = Database::getConnection($useConnection)->prepare($query);
        $stmt->bindValue(':group_id', $value);
        $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT);

        if ($stmt->execute()) {
            $res = $stmt->fetchAll(\PDO::FETCH_ASSOC);

            $map = function ($item) {
                return new Project($item);
            };
            $rtn = array_map($map, $res);

            $count = count($rtn);

            return array('items' => $rtn, 'count' => $count);
        } else {
            return array('items' => array(), 'count' => 0);
        }
    }
459638
public function lines($page = null)
    {
        $url = sprintf('buckets/%d/chats/%d/lines.json', $this->bucket, $this->parent);

        $lines = $this->client->get($url, [
            'query' => [
                'page' => $page,
            ]
        ]);

        return $this->indexResponse($lines, CampfireLine::class);
    }
108815
public function createPager($page, $limit = null)
    {
        $limit = $limit !== null ? $limit : $this->defaultLimit;

        return new Pager($page, $limit);
    }
679482
public function index($page = null)
    {
        $url = sprintf('buckets/%d/client/recordings/%d/replies.json', $this->bucket, $this->parent);

        $replies = $this->client->get($url, [
            'page' => $page,
        ]);

        return $this->indexResponse($replies, ClientReply::class);
    }
1225283
public function getMemberInfo($limit = null, $offset = 0, $memberRoleFilter = null, $memberInfoFilter = null, $appDefinedDataFilter = null)
    {
        $request = new GetGroupMemberInfoRequest($this->groupId, $limit, $offset, $memberRoleFilter, $memberInfoFilter, $appDefinedDataFilter);
        $response = new GetGroupMemberInfoResponse();
        return $this->client->sendRequest($request, $response);
    }
628926
public function index($page = null)
    {
        $url = sprintf('buckets/%d/questionnaires/%d/questions.json', $this->bucket, $this->parent);

        $questions = $this->client->get($url, [
            'query' => [
                'page' => $page,
            ],
        ]);

        return $this->indexResponse($questions, Question::class);
    }
419832
public function index($page = null)
    {
        $url = sprintf('buckets/%d/client/correspondences.json', $this->bucket);

        $correspondences = $this->client->get($url, [
            'query' => [
                'page' => $page,
            ],
        ]);

        return $this->indexResponse($correspondences, ClientCorrespondence::class);
    }
1297640
public function getCustomers($page = '')
    {
        $customerObjects = [];
        $customers = $this->getCustomerResource()->getAll($page);

        if ($customers instanceof \Exception) {
            throw $customers;
        }

        foreach ($customers as $customer) {
            $customerObject = new Customer($this->getCustomerResource());
            $customerObjects[] = $customerObject->_setAttributes($customer);
        }

        return $customerObjects;
    }
888360
public function index($page = null)
    {
        $url = sprintf('buckets/%d/webhooks.json', $this->bucket);

        $webhooks = $this->client->get($url, [
            'query' => [
                'page' => $page,
            ]
        ]);

        return $this->indexResponse($webhooks, Webhook::class)->map(function ($webhook) {
            $webhook->inContext($this->bucket);
            return $webhook;
        });
    }
1115745
public function getAllUsers($page, $max = 20, $orderedBy = 'id', $order = null)
    {
        $query = $this->userRepo->findAll(false, $orderedBy, $order);

        return $this->pagerFactory->createPager($query, $page, $max);
    }
801610
public function getList(int $page, int $limit, Context $context, array $requestFilters, array $sort): array
    {
        --$page;
        $metaData = $this->getSetMetaData($context);

        $isoList = $this->createIsoList($metaData);
        $languageFiles = $this->getSnippetFilesByIso($isoList);

        $fileSnippets = $this->getFileSnippets($languageFiles, $isoList);
        $dbSnippets = $this->databaseSnippetsToArray($this->findSnippetInDatabase(new Criteria(), $context), $fileSnippets);

        $snippets = array_replace_recursive($fileSnippets, $dbSnippets);
        $snippets = $this->fillBlankSnippets($snippets, $isoList);

        foreach ($requestFilters as $requestFilterName => $requestFilterValue) {
            $snippets = $this->snippetFilterFactory->getFilter($requestFilterName)->filter($snippets, $requestFilterValue);
        }

        $snippets = $this->sortSnippets($sort, $snippets);

        $total = 0;
        foreach ($snippets as $setId => &$set) {
            $total = $total > 0 ? $total : count($set['snippets']);
            $set['snippets'] = array_chunk($set['snippets'], $limit, true)[$page] ?? [];
        }

        return [
            'total' => $total,
            'data' => $this->mergeSnippetsComparison($snippets),
        ];
    }
909229
public function page($page = null) {
        if ($page === null) {
            return $this->page;
        }

        $this->page = (int) $page;

        return $this;
    }