33import com .fasterxml .jackson .databind .JavaType ;
44import com .fasterxml .jackson .databind .ObjectMapper ;
55import com .google .gson .Gson ;
6+ import com .google .gson .GsonBuilder ;
67import com .google .gson .JsonElement ;
78import com .google .gson .JsonParser ;
89import com .google .gson .reflect .TypeToken ;
@@ -119,37 +120,37 @@ public Result updateFileDetail(FileUpdateRequest fileUpdateRequest)
119120 return result ;
120121 }
121122
122- public ResultList getFileList (Map < String , String > options ) throws ForbiddenException , TooManyRequestsException ,
123+ public ResultList getFileList (GetFileListRequest getFileListRequest ) throws ForbiddenException , TooManyRequestsException ,
123124 InternalServerException , UnauthorizedException , BadRequestException , UnknownException , InstantiationException , IllegalAccessException {
124125 ResultList resultList = new ResultList ();
125126 Map <String , String > headers = Utils .getHeaders (imageKit );
126127
127128 QueryMaker queryMaker = new QueryMaker ();
128- // Map<String, String> options = new HashMap<>();
129- // if (getFileListRequest.getType() != null) {
130- // options.put("type", getFileListRequest.getType());
131- // }
132- // if (getFileListRequest.getSort() != null) {
133- // options.put("sort", getFileListRequest.getSort());
134- // }
135- // if (getFileListRequest.getPath() != null) {
136- // options.put("path", getFileListRequest.getPath());
137- // }
138- // if (getFileListRequest.getSearchQuery() != null) {
139- // options.put("searchQuery", getFileListRequest.getSearchQuery());
140- // }
141- // if (getFileListRequest.getFileType() != null) {
142- // options.put("fileType", getFileListRequest.getFileType());
143- // }
144- // if (getFileListRequest.getLimit() != null) {
145- // options.put("limit", getFileListRequest.getLimit());
146- // }
147- // if (getFileListRequest.getSkip() != null) {
148- // options.put("skip", getFileListRequest.getSkip());
149- // }
150- // if (getFileListRequest.getTags() != null) {
151- // options.put("tags", Arrays.toString(getFileListRequest.getTags()));
152- // }
129+ Map <String , String > options = new HashMap <>();
130+ if (getFileListRequest .getType () != null ) {
131+ options .put ("type" , getFileListRequest .getType ());
132+ }
133+ if (getFileListRequest .getSort () != null ) {
134+ options .put ("sort" , getFileListRequest .getSort ());
135+ }
136+ if (getFileListRequest .getPath () != null ) {
137+ options .put ("path" , getFileListRequest .getPath ());
138+ }
139+ if (getFileListRequest .getSearchQuery () != null ) {
140+ options .put ("searchQuery" , getFileListRequest .getSearchQuery ());
141+ }
142+ if (getFileListRequest .getFileType () != null ) {
143+ options .put ("fileType" , getFileListRequest .getFileType ());
144+ }
145+ if (getFileListRequest .getLimit () != null ) {
146+ options .put ("limit" , getFileListRequest .getLimit ());
147+ }
148+ if (getFileListRequest .getSkip () != null ) {
149+ options .put ("skip" , getFileListRequest .getSkip ());
150+ }
151+ if (getFileListRequest .getTags () != null ) {
152+ options .put ("tags" , Arrays .toString (getFileListRequest .getTags ()));
153+ }
153154 System .out .println ("options:==> " + options );
154155 for (Map .Entry <String , String > entry : options .entrySet ()) {
155156 queryMaker .put (String .format ("%s=%s" , entry .getKey (), entry .getValue ()));
@@ -167,7 +168,7 @@ public ResultList getFileList(Map<String, String> options) throws ForbiddenExcep
167168 String respBody = "" ;
168169 if (response .code () == 200 ) {
169170 respBody = response .body ().string ();
170- // System.out.println("respBody:==> " + respBody);
171+ System .out .println ("respBody:==> " + respBody );
171172 List <BaseFile > files = new Gson ().fromJson (respBody ,
172173 new TypeToken <List <BaseFile >>() {
173174 }.getType ());
0 commit comments