private function paginate ($type, $offset, $limit)
    {
        // Ensure the limit is within range.
        if ($limit < 1) {
            $limit = 1;
        } elseif ($limit > 20) {
            $limit = 20;
        }

        // Send query.
        $json = json_decode(
            $this->client->send(
                new Request(
                    'POST',
                    'https://api.weixin.qq.com/cgi-bin/material/batchget_material',
                    [],
                    json_encode([
                        'type'   => $type,
                        'offset' => $offset,
                        'count'  => $limit,
                    ])
                )
            )->getBody()
        );

        // Ensure response formatting.
        if (! isset($json->total_count, $json->item)) {
            throw new Exception("bad response: expecting properties `total_count`, `item_count`, `item`");
        }
        
        return $json;
    }
private function paginate ($type, $offset, $limit)
    {
        // Ensure the limit is within range.
        if ($limit < 1) {
            $limit = 1;
        } elseif ($limit > 20) {
            $limit = 20;
        }

        // Send query.
        $json = json_decode(
            $this->client->send(
                new Request(
                    'POST',
                    'https://api.weixin.qq.com/cgi-bin/material/batchget_material',
                    [],
                    json_encode([
                        'type'   => $type,
                        'offset' => $offset,
                        'count'  => $limit,
                    ])
                )
            )->getBody()
        );

        // Ensure response formatting.
        if (! isset($json->total_count, $json->item)) {
            throw new Exception("bad response: expecting properties `total_count`, `item_count`, `item`");
        }
        
        return $json;
    }
private function paginate ( $ type , $ offset , $ limit ) { // Ensure the limit is within range. if ( $ limit < 1 ) { $ limit = 1 ; } elseif ( $ limit > 20 ) { $ limit = 20 ; } // Send query. $ json = json_decode ( $ this -> client -> send ( new Request ( 'POST' , 'https://api.weixin.qq.com/cgi-bin/material/batchget_material' , [ ] , json_encode ( [ 'type' => $ type , 'offset' => $ offset , 'count' => $ limit , ] ) ) ) -> getBody ( ) ) ; // Ensure response formatting. if ( ! isset ( $ json -> total_count , $ json -> item ) ) { throw new Exception ( "bad response: expecting properties `total_count`, `item_count`, `item`" ) ; } return $ json ; }
Performs the actual pagination request for the given item type.

@param string $type - The type of media item to paginate.
@param int    $offset - The offset from which to start showing items.
@param int    $limit - The number of items to show.

@return \stdClass
@throws Exception
Performs the actual pagination request for the given item type .