public function fetchBatches(BatchFilter $filter = null)
    {
        return new Api\Pages(
            function ($page) use ($filter) {
                $params = ["page=$page"];

                if (!is_null($filter)) {
                    if (null != $filter->getPageSize()) {
                        array_push(
                            $params, 'page_size=' . $filter->getPageSize()
                        );
                    }

                    if (null != $filter->getSenders()) {
                        $val = urlencode(join(',', $filter->getSenders()));
                        array_push($params, 'from=' . $val);
                    }

                    if (null != $filter->getTags()) {
                        $val = urlencode(join(',', $filter->getTags()));
                        array_push($params, 'tags=' . $val);
                    }

                    if (null != $filter->getStartDate()) {
                        $val = $filter->getStartDate()->format('Y-m-d');
                        array_push($params, 'start_date=' . $val);
                    }

                    if (null != $filter->getEndDate()) {
                        $val = $filter->getEndDate()->format('Y-m-d');
                        array_push($params, 'end_date=' . $val);
                    }
                }

                $q = join('&', $params);
                $result = $this->_get($this->_url('/batches?' . $q));
                return Deserialize::batchesPage($result);
            }
        );
    }
public function fetchBatches(BatchFilter $filter = null)
    {
        return new Api\Pages(
            function ($page) use ($filter) {
                $params = ["page=$page"];

                if (!is_null($filter)) {
                    if (null != $filter->getPageSize()) {
                        array_push(
                            $params, 'page_size=' . $filter->getPageSize()
                        );
                    }

                    if (null != $filter->getSenders()) {
                        $val = urlencode(join(',', $filter->getSenders()));
                        array_push($params, 'from=' . $val);
                    }

                    if (null != $filter->getTags()) {
                        $val = urlencode(join(',', $filter->getTags()));
                        array_push($params, 'tags=' . $val);
                    }

                    if (null != $filter->getStartDate()) {
                        $val = $filter->getStartDate()->format('Y-m-d');
                        array_push($params, 'start_date=' . $val);
                    }

                    if (null != $filter->getEndDate()) {
                        $val = $filter->getEndDate()->format('Y-m-d');
                        array_push($params, 'end_date=' . $val);
                    }
                }

                $q = join('&', $params);
                $result = $this->_get($this->_url('/batches?' . $q));
                return Deserialize::batchesPage($result);
            }
        );
    }
public function fetchBatches ( BatchFilter $ filter = null ) { return new Api \ Pages ( function ( $ page ) use ( $ filter ) { $ params = [ "page=$page" ] ; if ( ! is_null ( $ filter ) ) { if ( null != $ filter -> getPageSize ( ) ) { array_push ( $ params , 'page_size=' . $ filter -> getPageSize ( ) ) ; } if ( null != $ filter -> getSenders ( ) ) { $ val = urlencode ( join ( ',' , $ filter -> getSenders ( ) ) ) ; array_push ( $ params , 'from=' . $ val ) ; } if ( null != $ filter -> getTags ( ) ) { $ val = urlencode ( join ( ',' , $ filter -> getTags ( ) ) ) ; array_push ( $ params , 'tags=' . $ val ) ; } if ( null != $ filter -> getStartDate ( ) ) { $ val = $ filter -> getStartDate ( ) -> format ( 'Y-m-d' ) ; array_push ( $ params , 'start_date=' . $ val ) ; } if ( null != $ filter -> getEndDate ( ) ) { $ val = $ filter -> getEndDate ( ) -> format ( 'Y-m-d' ) ; array_push ( $ params , 'end_date=' . $ val ) ; } } $ q = join ( '&' , $ params ) ; $ result = $ this -> _get ( $ this -> _url ( '/batches?' . $ q ) ) ; return Deserialize :: batchesPage ( $ result ) ; } ) ; }
Fetch the batches matching the given filter.

Note, calling this method does not actually cause any network
traffic. Listing batches in XMS may return the result over
multiple pages and this call therefore returns an object of the
type {@link \Clx\Xms\Api\Pages}, which will fetch result pages
as needed.

@param BatchFilter|null $filter the batch filter

@return Api\Pages the result pages
Fetch the batches matching the given filter .