diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2d96bbb --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Imagekit + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index e2eac1d..c608840 100644 --- a/README.md +++ b/README.md @@ -473,6 +473,9 @@ The SDK provides a simple interface for all the [media APIs mentioned here](http Accepts an object of class `GetFileListRequest` specifying the parameters to be used to list and search files. All parameters specified in the [documentation here](https://docs.imagekit.io/api-reference/media-api/list-and-search-files) can be passed via their setter functions to get the results. +#### Applying Filters +Filter out the files by specifying the parameters. + ```java String[] tags = new String[3]; tags[0] = "Software"; @@ -482,7 +485,6 @@ GetFileListRequest getFileListRequest = new GetFileListRequest(); getFileListRequest.setType("file"); getFileListRequest.setSort("ASC_CREATED"); getFileListRequest.setPath("/"); -getFileListRequest.setSearchQuery("createdAt >= '2d' OR size < '2mb' OR format='png'"); getFileListRequest.setFileType("all"); getFileListRequest.setLimit("4"); getFileListRequest.setSkip("1"); @@ -496,6 +498,23 @@ System.out.println("Map Response:"); System.out.println(resultList.getResponseMetaData().getMap()); ``` +#### Advance Search +In addition, you can fine-tune your query by specifying various filters by generating a query string in a Lucene-like syntax and setting this generated string to the `GetFileListRequest` object using `setSearchQuery` function. + +```java +GetFileListRequest getFileListRequest = new GetFileListRequest(); +getFileListRequest.setSearchQuery("createdAt >= '2d' OR size < '2mb' OR format='png'"); +ResultList resultList = ImageKit.getInstance().getFileList(getFileListRequest); +System.out.println("======FINAL RESULT======="); +System.out.println(resultList); +System.out.println("Raw Response:"); +System.out.println(resultList.getResponseMetaData().getRaw()); +System.out.println("Map Response:"); +System.out.println(resultList.getResponseMetaData().getMap()); +``` + +Detailed documentation can be found here for [advance search queries](https://docs.imagekit.io/api-reference/media-api/list-and-search-files#advanced-search-queries). + **2. Get File Details** Accepts the file ID and fetches the details as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/get-file-details)