source/php/Api/Events.php
public function getEvents($request)
    {
        // Get params
        $params = $request->get_params();

        // Set display limit to -1 to get all events
        $params['display_limit'] = -1;

        // Save coordinates to location array
        if (!empty($params['lat']) && !empty($params['lng'])) {
            $params['location'] = array(
                'lat' => $params['lat'],
                'lng' => $params['lng'],
            );
        }

        // Get events
        $events = \EventManagerIntegration\Helper\QueryEvents::getEventsByInterval($params, 1);
        // Return error if result is empty
        if (empty($events)) {
            return new \WP_REST_Response(
                array(
                    'message' => __('No events could be found.', 'event-integration'),
                    'state' => 'empty_result',
                ),
                404
            );
        }

        // Set total items & pages count
        $total = count($events);
        $totalPages = 1;

        // If per page param is not unlimited, get chunk of paged items
        if ($params['per_page'] !== -1) {
            // Calculate total pages
            $totalPages = ceil($total / $params['per_page']);
            $offset = ($params['page'] - 1) * $params['per_page'];
            $offset = $offset > 0 ? $offset : 0;
            $events = array_slice($events, $offset, $params['per_page']);
        }

        // Sanitize and add meta data to items list
        $events = $this->mapEventModuleData($params['module_id'], $events);

        $response = rest_ensure_response($events);
        // Set headers with total counts
        $response->header('X-WP-Total', $total);
        $response->header('X-WP-TotalPages', $totalPages);

        return $response;
    }
public function getEvents($request)
    {
        // Get params
        $params = $request->get_params();

        // Set display limit to -1 to get all events
        $params['display_limit'] = -1;

        // Save coordinates to location array
        if (!empty($params['lat']) && !empty($params['lng'])) {
            $params['location'] = array(
                'lat' => $params['lat'],
                'lng' => $params['lng'],
            );
        }

        // Get events
        $events = \EventManagerIntegration\Helper\QueryEvents::getEventsByInterval($params, 1);
        // Return error if result is empty
        if (empty($events)) {
            return new \WP_REST_Response(
                array(
                    'message' => __('No events could be found.', 'event-integration'),
                    'state' => 'empty_result',
                ),
                404
            );
        }

        // Set total items & pages count
        $total = count($events);
        $totalPages = 1;

        // If per page param is not unlimited, get chunk of paged items
        if ($params['per_page'] !== -1) {
            // Calculate total pages
            $totalPages = ceil($total / $params['per_page']);
            $offset = ($params['page'] - 1) * $params['per_page'];
            $offset = $offset > 0 ? $offset : 0;
            $events = array_slice($events, $offset, $params['per_page']);
        }

        // Sanitize and add meta data to items list
        $events = $this->mapEventModuleData($params['module_id'], $events);

        $response = rest_ensure_response($events);
        // Set headers with total counts
        $response->header('X-WP-Total', $total);
        $response->header('X-WP-TotalPages', $totalPages);

        return $response;
    }
Get all events between two dates
@param object $request Object containing request details
@return array|\WP_REST_Response