Skip to content

Commit 726f268

Browse files
committed
added formatting fix and few version regarding changes
1 parent a079589 commit 726f268

24 files changed

+1281
-1503
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ allprojects {
4444
Step 2. Add the dependency on project's `build.gradle`:
4545
```
4646
dependencies {
47-
implementation 'com.github.imagekit-developer:imagekit-java:1.0.3'
47+
implementation 'com.github.imagekit-developer:imagekit-java:2.0.0'
4848
}
4949
```
5050
### Maven users
@@ -62,7 +62,7 @@ Step 2. Add the dependency in POM file:
6262
<dependency>
6363
<groupId>com.github.imagekit-developer</groupId>
6464
<artifactId>imagekit-java</artifactId>
65-
<version>1.0.3</version>
65+
<version>2.0.0</version>
6666
</dependency>
6767
```
6868

imagekit-sdk/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group 'io.imagekit.sdk'
7-
version '1.0.3'
7+
version '2.0.0'
88

99
sourceCompatibility = 1.8
1010

imagekit-sdk/src/main/java/io/imagekit/sdk/ImageKit.java

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ public String getUrl(Map<String, Object> options) {
8787
* @param fileCreateRequest is a object which contains file and other parameters
8888
* @return object of Result class
8989
*/
90-
public Result upload(FileCreateRequest fileCreateRequest) throws InternalServerException, BadRequestException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
90+
public Result upload(FileCreateRequest fileCreateRequest) throws InternalServerException, BadRequestException,
91+
UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
9192
return restClient.upload(fileCreateRequest);
9293
}
9394

@@ -96,7 +97,9 @@ public Result upload(FileCreateRequest fileCreateRequest) throws InternalServerE
9697
* @param fileUpdateRequest is a object which contains parameters and fileId
9798
* @return object of Result class
9899
*/
99-
public Result updateFileDetail(FileUpdateRequest fileUpdateRequest) throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
100+
public Result updateFileDetail(FileUpdateRequest fileUpdateRequest)
101+
throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException,
102+
BadRequestException, UnknownException {
100103
return restClient.updateDetail(fileUpdateRequest);
101104
}
102105

@@ -106,7 +109,8 @@ public Result updateFileDetail(FileUpdateRequest fileUpdateRequest) throws Forbi
106109
* "includeFolder", "name", "limit", "skip"]
107110
* @return ResultList class that contains list of BaseFile
108111
*/
109-
public ResultList getFileList(Map<String, String> options) throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
112+
public ResultList getFileList(Map<String, String> options) throws ForbiddenException, TooManyRequestsException,
113+
InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
110114
return restClient.getFileList(options);
111115
}
112116

@@ -115,7 +119,8 @@ public ResultList getFileList(Map<String, String> options) throws ForbiddenExcep
115119
* @param fileId is a unique file id
116120
* @return Result class
117121
*/
118-
public Result getFileDetail(String fileId) throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
122+
public Result getFileDetail(String fileId) throws ForbiddenException, TooManyRequestsException,
123+
InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
119124
return restClient.getFileDetail(fileId);
120125
}
121126

@@ -124,7 +129,8 @@ public Result getFileDetail(String fileId) throws ForbiddenException, TooManyReq
124129
* @param fileId is a unique file id
125130
* @return ResultMetaData class
126131
*/
127-
public ResultMetaData getFileMetadata(String fileId) throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
132+
public ResultMetaData getFileMetadata(String fileId) throws ForbiddenException, TooManyRequestsException,
133+
InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
128134
return restClient.getFileMetaData(fileId);
129135
}
130136

@@ -133,7 +139,8 @@ public ResultMetaData getFileMetadata(String fileId) throws ForbiddenException,
133139
* @param url is a remote image url
134140
* @return ResultMetaData class
135141
*/
136-
public ResultMetaData getRemoteFileMetadata(String url) throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
142+
public ResultMetaData getRemoteFileMetadata(String url) throws ForbiddenException, TooManyRequestsException,
143+
InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
137144
return restClient.getRemoteFileMetaData(url);
138145
}
139146

@@ -142,7 +149,8 @@ public ResultMetaData getRemoteFileMetadata(String url) throws ForbiddenExceptio
142149
* @param fileId is a unique file id
143150
* @return Result class
144151
*/
145-
public Result deleteFile(String fileId) throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
152+
public Result deleteFile(String fileId) throws ForbiddenException, TooManyRequestsException,
153+
InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
146154
return restClient.deleteFile(fileId);
147155
}
148156

@@ -151,7 +159,9 @@ public Result deleteFile(String fileId) throws ForbiddenException, TooManyReques
151159
* @param fileIds is a list of unique file id
152160
* @return Result class
153161
*/
154-
public ResultFileDelete bulkDeleteFiles(List<String> fileIds) throws ForbiddenException, TooManyRequestsException, InternalServerException, PartialSuccessException, UnauthorizedException, NotFoundException, BadRequestException, UnknownException {
162+
public ResultFileDelete bulkDeleteFiles(List<String> fileIds)
163+
throws ForbiddenException, TooManyRequestsException, InternalServerException, PartialSuccessException,
164+
UnauthorizedException, NotFoundException, BadRequestException, UnknownException {
155165
return restClient.bulkDeleteFiles(fileIds);
156166
}
157167

@@ -160,7 +170,8 @@ public ResultFileDelete bulkDeleteFiles(List<String> fileIds) throws ForbiddenEx
160170
* @param url is image url
161171
* @return ResultCache class
162172
*/
163-
public ResultCache purgeCache(String url) throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
173+
public ResultCache purgeCache(String url) throws ForbiddenException, TooManyRequestsException,
174+
InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
164175
return restClient.purgeCache(url);
165176
}
166177

@@ -169,7 +180,8 @@ public ResultCache purgeCache(String url) throws ForbiddenException, TooManyRequ
169180
* @param requestId is cache request id
170181
* @return ResultCacheStatus class
171182
*/
172-
public ResultCacheStatus getPurgeCacheStatus(String requestId) throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
183+
public ResultCacheStatus getPurgeCacheStatus(String requestId) throws ForbiddenException, TooManyRequestsException,
184+
InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
173185
return restClient.getPurgeCacheStatus(requestId);
174186
}
175187

@@ -218,7 +230,8 @@ public int pHashDistance(String firstHex, String secondHex) {
218230
* @return ArrayList of String
219231
*/
220232
public ResultTags addTags(TagsRequest tagsRequest)
221-
throws NotFoundException, PartialSuccessException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
233+
throws NotFoundException, PartialSuccessException, BadRequestException, InternalServerException,
234+
UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
222235
return restClient.manageTags(tagsRequest, "addTags");
223236
}
224237

@@ -229,7 +242,8 @@ public ResultTags addTags(TagsRequest tagsRequest)
229242
* @return ArrayList of String
230243
*/
231244
public ResultTags removeAITags(AITagsRequest aiTagsRequest)
232-
throws PartialSuccessException, NotFoundException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
245+
throws PartialSuccessException, NotFoundException, BadRequestException, InternalServerException,
246+
UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
233247
return restClient.removeAITags(aiTagsRequest);
234248
}
235249

@@ -240,7 +254,8 @@ public ResultTags removeAITags(AITagsRequest aiTagsRequest)
240254
* @return ArrayList of String
241255
*/
242256
public ResultTags removeTags(TagsRequest tagsRequest)
243-
throws NotFoundException, PartialSuccessException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
257+
throws NotFoundException, PartialSuccessException, BadRequestException, InternalServerException,
258+
UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
244259
return restClient.manageTags(tagsRequest, "removeTags");
245260
}
246261

@@ -261,7 +276,8 @@ public ResultCustomMetaDataFieldList getCustomMetaDataFields(boolean includeDele
261276
* @return ResultCustomMetaData with ResultCustomMetaDataField
262277
*/
263278
public ResultCustomMetaDataField createCustomMetaDataFields(
264-
CustomMetaDataFieldCreateRequest customMetaDataFieldCreateRequest) throws BadRequestException, UnknownException {
279+
CustomMetaDataFieldCreateRequest customMetaDataFieldCreateRequest)
280+
throws BadRequestException, UnknownException {
265281
return restClient.createCustomMetaDataFields(customMetaDataFieldCreateRequest);
266282
}
267283

@@ -293,7 +309,8 @@ public ResultCustomMetaDataField updateCustomMetaDataFields(
293309
* @return Result class
294310
*/
295311
public ResultNoContent deleteFileVersion(DeleteFileVersionRequest deleteFileVersionRequest)
296-
throws BadRequestException, NotFoundException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
312+
throws BadRequestException, NotFoundException, InternalServerException, UnknownException,
313+
ForbiddenException, TooManyRequestsException, UnauthorizedException {
297314
return restClient.deleteFileVersion(deleteFileVersionRequest);
298315
}
299316

@@ -303,7 +320,8 @@ public ResultNoContent deleteFileVersion(DeleteFileVersionRequest deleteFileVers
303320
* @return Result class
304321
*/
305322
public ResultNoContent copyFile(CopyFileRequest copyFileRequest)
306-
throws NotFoundException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
323+
throws NotFoundException, BadRequestException, InternalServerException, UnknownException,
324+
ForbiddenException, TooManyRequestsException, UnauthorizedException {
307325
return restClient.copyFile(copyFileRequest);
308326
}
309327

@@ -313,7 +331,8 @@ public ResultNoContent copyFile(CopyFileRequest copyFileRequest)
313331
* @return Result class
314332
*/
315333
public ResultNoContent moveFile(MoveFileRequest moveFileRequest)
316-
throws NotFoundException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
334+
throws NotFoundException, BadRequestException, InternalServerException, UnknownException,
335+
ForbiddenException, TooManyRequestsException, UnauthorizedException {
317336
return restClient.moveFile(moveFileRequest);
318337
}
319338

@@ -322,8 +341,9 @@ public ResultNoContent moveFile(MoveFileRequest moveFileRequest)
322341
* @param renameFileRequest class
323342
* @return Result class
324343
*/
325-
public ResultRenameFile renameFile(RenameFileRequest renameFileRequest)
326-
throws ConflictException, PartialSuccessException, NotFoundException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
344+
public ResultRenameFile renameFile(RenameFileRequest renameFileRequest) throws ConflictException,
345+
PartialSuccessException, NotFoundException, BadRequestException, InternalServerException, UnknownException,
346+
ForbiddenException, TooManyRequestsException, UnauthorizedException {
327347
return restClient.renameFile(renameFileRequest);
328348
}
329349

@@ -344,7 +364,8 @@ public ResultEmptyBlock createFolder(CreateFolderRequest createFolderRequest) th
344364
* @return Result class
345365
*/
346366
public ResultNoContent deleteFolder(DeleteFolderRequest deleteFolderRequest)
347-
throws NotFoundException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
367+
throws NotFoundException, BadRequestException, InternalServerException, UnknownException,
368+
ForbiddenException, TooManyRequestsException, UnauthorizedException {
348369
return restClient.deleteFolder(deleteFolderRequest);
349370
}
350371

@@ -355,7 +376,8 @@ public ResultNoContent deleteFolder(DeleteFolderRequest deleteFolderRequest)
355376
* @return Result class
356377
*/
357378
public ResultOfFolderActions copyFolder(CopyFolderRequest copyFolderRequest)
358-
throws NotFoundException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
379+
throws NotFoundException, BadRequestException, InternalServerException, UnknownException,
380+
ForbiddenException, TooManyRequestsException, UnauthorizedException {
359381
return restClient.copyFolder(copyFolderRequest);
360382
}
361383

@@ -365,7 +387,8 @@ public ResultOfFolderActions copyFolder(CopyFolderRequest copyFolderRequest)
365387
* @return Result class
366388
*/
367389
public ResultOfFolderActions moveFolder(MoveFolderRequest moveFolderRequest)
368-
throws NotFoundException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
390+
throws NotFoundException, BadRequestException, InternalServerException, UnknownException,
391+
ForbiddenException, TooManyRequestsException, UnauthorizedException {
369392
return restClient.moveFolder(moveFolderRequest);
370393
}
371394

@@ -374,7 +397,8 @@ public ResultOfFolderActions moveFolder(MoveFolderRequest moveFolderRequest)
374397
* @param jobId
375398
* @return a Result class
376399
*/
377-
public ResultBulkJobStatus getBulkJobStatus(String jobId) throws ForbiddenException, TooManyRequestsException, InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
400+
public ResultBulkJobStatus getBulkJobStatus(String jobId) throws ForbiddenException, TooManyRequestsException,
401+
InternalServerException, UnauthorizedException, BadRequestException, UnknownException {
378402
return restClient.getBulkJobStatus(jobId);
379403
}
380404

@@ -384,7 +408,8 @@ public ResultBulkJobStatus getBulkJobStatus(String jobId) throws ForbiddenExcept
384408
* @return a Result class
385409
*/
386410
public ResultFileVersions getFileVersions(String fileId)
387-
throws NotFoundException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
411+
throws NotFoundException, BadRequestException, InternalServerException, UnknownException,
412+
ForbiddenException, TooManyRequestsException, UnauthorizedException {
388413
return restClient.getFileVersions(fileId);
389414
}
390415

@@ -394,7 +419,8 @@ public ResultFileVersions getFileVersions(String fileId)
394419
* @return a Result class
395420
*/
396421
public ResultFileVersionDetails getFileVersionDetails(String fileId, String versionId)
397-
throws NotFoundException, BadRequestException, InternalServerException, UnknownException, ForbiddenException, TooManyRequestsException, UnauthorizedException {
422+
throws NotFoundException, BadRequestException, InternalServerException, UnknownException,
423+
ForbiddenException, TooManyRequestsException, UnauthorizedException {
398424
return restClient.getFileVersionDetails(fileId, versionId);
399425
}
400426
}

imagekit-sdk/src/main/java/io/imagekit/sdk/config/Configuration.java

Lines changed: 56 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,60 @@
44
* Configuration class contains sdk configuration
55
*/
66
public class Configuration {
7-
private String publicKey;
8-
private String privateKey;
9-
private String urlEndpoint;
10-
11-
public Configuration() {
12-
13-
}
14-
15-
public Configuration(String publicKey, String privateKey, String urlEndpoint) {
16-
this.publicKey = publicKey;
17-
this.privateKey = privateKey;
18-
this.urlEndpoint = urlEndpoint;
19-
}
20-
21-
public String getPublicKey() {
22-
return publicKey;
23-
}
24-
25-
public void setPublicKey(String publicKey) {
26-
this.publicKey = publicKey;
27-
}
28-
29-
public String getPrivateKey() {
30-
return privateKey;
31-
}
32-
33-
public void setPrivateKey(String privateKey) {
34-
this.privateKey = privateKey;
35-
}
36-
37-
public String getUrlEndpoint() {
38-
return urlEndpoint;
39-
}
40-
41-
public void setUrlEndpoint(String urlEndpoint) {
42-
this.urlEndpoint = urlEndpoint;
43-
}
44-
45-
@Override
46-
public String toString() {
47-
return "Configuration{" +
48-
"publicKey='" + publicKey + '\'' +
49-
", privateKey='" + privateKey + '\'' +
50-
", urlEndpoint='" + urlEndpoint + '\'' +
51-
'}';
52-
}
53-
54-
public boolean validate(){
55-
if (urlEndpoint==null){
56-
throw new RuntimeException("UrlEndpoint not found in config.properties");
57-
}
58-
if (privateKey==null){
59-
throw new RuntimeException("PrivateKey not found in config.properties");
60-
}
61-
if (publicKey==null){
62-
throw new RuntimeException("PublicKey not found in config.properties");
63-
}
64-
return true;
65-
}
7+
private String publicKey;
8+
private String privateKey;
9+
private String urlEndpoint;
10+
11+
public Configuration() {
12+
13+
}
14+
15+
public Configuration(String publicKey, String privateKey, String urlEndpoint) {
16+
this.publicKey = publicKey;
17+
this.privateKey = privateKey;
18+
this.urlEndpoint = urlEndpoint;
19+
}
20+
21+
public String getPublicKey() {
22+
return publicKey;
23+
}
24+
25+
public void setPublicKey(String publicKey) {
26+
this.publicKey = publicKey;
27+
}
28+
29+
public String getPrivateKey() {
30+
return privateKey;
31+
}
32+
33+
public void setPrivateKey(String privateKey) {
34+
this.privateKey = privateKey;
35+
}
36+
37+
public String getUrlEndpoint() {
38+
return urlEndpoint;
39+
}
40+
41+
public void setUrlEndpoint(String urlEndpoint) {
42+
this.urlEndpoint = urlEndpoint;
43+
}
44+
45+
@Override
46+
public String toString() {
47+
return "Configuration{" + "publicKey='" + publicKey + '\'' + ", privateKey='" + privateKey + '\''
48+
+ ", urlEndpoint='" + urlEndpoint + '\'' + '}';
49+
}
50+
51+
public boolean validate() {
52+
if (urlEndpoint == null) {
53+
throw new RuntimeException("UrlEndpoint not found in config.properties");
54+
}
55+
if (privateKey == null) {
56+
throw new RuntimeException("PrivateKey not found in config.properties");
57+
}
58+
if (publicKey == null) {
59+
throw new RuntimeException("PublicKey not found in config.properties");
60+
}
61+
return true;
62+
}
6663
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package io.imagekit.sdk.constants;
22

33
public class Version {
4-
public static final String VERSION_CODE="java-1.0.3";
4+
public static final String VERSION_CODE="java-2.0.0";
55
}

0 commit comments

Comments
 (0)