@@ -75,16 +75,33 @@ public function create($folder_name, $parent_folder_id = 0)
75
75
/**
76
76
* Method to get items inside a folder. Same info can be found inside `getFolderInfo` method as well.
77
77
* @param $folder_id integer Id of the folder for which the items has to be listed.
78
+ * @param $fields array of fields which has to be included in response
79
+ * @param $limit integer Variable to limit the response items
80
+ * @param $offset integer Variable to offset the response items
78
81
* @throws \InvalidArgumentException
79
82
* @return \GuzzleHttp\Psr7\Response
80
83
*/
81
- public function getFolderItems ($ folder_id = 0 )
84
+ public function getFolderItems ($ folder_id = 0 , $ fields = [], $ limit = 100 , $ offset = 0 )
82
85
{
83
86
Assert::integerish ($ folder_id , "The folder id must be an integer. Got: %s " );
87
+ Assert::integerish ($ limit , "The limit must be an integer. Got: %s " );
88
+ Assert::integerish ($ offset , "The offset must be an integer. Got: %s " );
89
+
90
+ $ query_fields = "?fields= " ;
91
+
92
+ foreach ($ fields as $ field ) {
93
+ if (trim ($ field )) {
94
+ $ query_fields = $ query_fields . $ field . ", " ;
95
+ }
96
+ }
97
+
98
+ $ query_fields .= rtrim ($ query_fields , ', ' );
99
+ $ query_fields .= "&limit= " . $ limit ;
100
+ $ query_fields .= "&offset= " . $ offset ;
84
101
85
102
return $ this ->guzzle_client ->request (
86
103
'GET ' ,
87
- BAP ::BASE_FOLDER_URL . BAP ::URL_SEPARATOR . $ folder_id . BAP ::URL_SEPARATOR . "items " ,
104
+ BAP ::BASE_FOLDER_URL . BAP ::URL_SEPARATOR . $ folder_id . BAP ::URL_SEPARATOR . "items " . $ query_fields ,
88
105
[
89
106
'headers ' => [
90
107
"Authorization " => "Bearer " . $ this ->app_auth ->getTokenInfo ()->access_token
0 commit comments