Skip to content

Commit ed443a7

Browse files
committed
chore: response models, MultipartBuilder and RestClient created for file operations
1 parent dbeacfe commit ed443a7

File tree

12 files changed

+2150
-0
lines changed

12 files changed

+2150
-0
lines changed
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
package io.imagekit.sdk.models;
2+
3+
import java.util.List;
4+
5+
public class BaseFile {
6+
protected String fileId;
7+
protected String name;
8+
protected String url;
9+
protected String thumbnail;
10+
protected int height;
11+
protected int width;
12+
protected long size;
13+
protected String filePath;
14+
protected List<String> tags;
15+
protected boolean isPrivateFile;
16+
protected String customCoordinates;
17+
protected String fileType;
18+
19+
public BaseFile() {
20+
}
21+
22+
public BaseFile(String fileId, String name, String url, String thumbnail, int height, int width, long size, String filePath, List<String> tags, boolean isPrivateFile, String customCoordinates, String fileType) {
23+
this.fileId = fileId;
24+
this.name = name;
25+
this.url = url;
26+
this.thumbnail = thumbnail;
27+
this.height = height;
28+
this.width = width;
29+
this.size = size;
30+
this.filePath = filePath;
31+
this.tags = tags;
32+
this.isPrivateFile = isPrivateFile;
33+
this.customCoordinates = customCoordinates;
34+
this.fileType = fileType;
35+
}
36+
37+
public String getFileId() {
38+
return fileId;
39+
}
40+
41+
public void setFileId(String fileId) {
42+
this.fileId = fileId;
43+
}
44+
45+
public String getName() {
46+
return name;
47+
}
48+
49+
public void setName(String name) {
50+
this.name = name;
51+
}
52+
53+
public String getUrl() {
54+
return url;
55+
}
56+
57+
public void setUrl(String url) {
58+
this.url = url;
59+
}
60+
61+
public String getThumbnail() {
62+
return thumbnail;
63+
}
64+
65+
public void setThumbnail(String thumbnail) {
66+
this.thumbnail = thumbnail;
67+
}
68+
69+
public int getHeight() {
70+
return height;
71+
}
72+
73+
public void setHeight(int height) {
74+
this.height = height;
75+
}
76+
77+
public int getWidth() {
78+
return width;
79+
}
80+
81+
public void setWidth(int width) {
82+
this.width = width;
83+
}
84+
85+
public long getSize() {
86+
return size;
87+
}
88+
89+
public void setSize(long size) {
90+
this.size = size;
91+
}
92+
93+
public String getFilePath() {
94+
return filePath;
95+
}
96+
97+
public void setFilePath(String filePath) {
98+
this.filePath = filePath;
99+
}
100+
101+
public List<String> getTags() {
102+
return tags;
103+
}
104+
105+
public void setTags(List<String> tags) {
106+
this.tags = tags;
107+
}
108+
109+
public boolean isPrivateFile() {
110+
return isPrivateFile;
111+
}
112+
113+
public void setPrivateFile(boolean privateFile) {
114+
isPrivateFile = privateFile;
115+
}
116+
117+
public String getCustomCoordinates() {
118+
return customCoordinates;
119+
}
120+
121+
public void setCustomCoordinates(String customCoordinates) {
122+
this.customCoordinates = customCoordinates;
123+
}
124+
125+
public String getFileType() {
126+
return fileType;
127+
}
128+
129+
public void setFileType(String fileType) {
130+
this.fileType = fileType;
131+
}
132+
133+
@Override
134+
public String toString() {
135+
return "BaseFile{" +
136+
"fileId='" + fileId + '\'' +
137+
", name='" + name + '\'' +
138+
", url='" + url + '\'' +
139+
", thumbnail='" + thumbnail + '\'' +
140+
", height=" + height +
141+
", width=" + width +
142+
", size=" + size +
143+
", filePath='" + filePath + '\'' +
144+
", tags='" + tags +'\''+
145+
", isPrivateFile=" + isPrivateFile +
146+
", customCoordinates='" + customCoordinates +'\''+
147+
", fileType='" + fileType + '\'' +
148+
'}';
149+
}
150+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
package io.imagekit.sdk.models;
2+
3+
import io.imagekit.sdk.utils.Utils;
4+
import okhttp3.MediaType;
5+
import okhttp3.MultipartBody;
6+
import okhttp3.RequestBody;
7+
8+
import java.net.URL;
9+
import java.util.List;
10+
11+
public class FileCreateRequest {
12+
public URL url;
13+
public String base64;
14+
public byte[] bytes;
15+
public String fileName;
16+
public boolean useUniqueFileName;
17+
public List<String> tags;
18+
public String folder;
19+
public boolean isPrivateFile;
20+
public String customCoordinates;
21+
public List<String> responseFields;
22+
23+
public FileCreateRequest(URL url, String fileName) {
24+
this.url = url;
25+
this.fileName = fileName;
26+
this.useUniqueFileName=true;
27+
}
28+
29+
public FileCreateRequest(String base64, String fileName) {
30+
this.base64 = base64;
31+
this.fileName = fileName;
32+
this.useUniqueFileName=true;
33+
}
34+
35+
public FileCreateRequest(byte[] bytes, String fileName) {
36+
this.bytes = bytes;
37+
this.fileName = fileName;
38+
this.useUniqueFileName=true;
39+
}
40+
41+
public String getFileName() {
42+
return fileName;
43+
}
44+
45+
public void setFileName(String fileName) {
46+
this.fileName = fileName;
47+
}
48+
49+
public boolean isUseUniqueFileName() {
50+
return useUniqueFileName;
51+
}
52+
53+
public void setUseUniqueFileName(boolean useUniqueFileName) {
54+
this.useUniqueFileName = useUniqueFileName;
55+
}
56+
57+
public List<String> getTags() {
58+
return tags;
59+
}
60+
61+
public void setTags(List<String> tags) {
62+
this.tags = tags;
63+
}
64+
65+
public String getFolder() {
66+
return folder;
67+
}
68+
69+
public void setFolder(String folder) {
70+
this.folder = folder;
71+
}
72+
73+
public boolean isPrivateFile() {
74+
return isPrivateFile;
75+
}
76+
77+
public void setPrivateFile(boolean privateFile) {
78+
isPrivateFile = privateFile;
79+
}
80+
81+
public String getCustomCoordinates() {
82+
return customCoordinates;
83+
}
84+
85+
public void setCustomCoordinates(String customCoordinates) {
86+
this.customCoordinates = customCoordinates;
87+
}
88+
89+
public List<String> getResponseFields() {
90+
return responseFields;
91+
}
92+
93+
public void setResponseFields(List<String> responseFields) {
94+
this.responseFields = responseFields;
95+
}
96+
97+
@Override
98+
public String toString() {
99+
return "FileCreateRequest{" +
100+
"fileName='" + fileName + '\'' +
101+
", useUniqueFileName=" + useUniqueFileName +
102+
", tags=" + tags +
103+
", folder='" + folder + '\'' +
104+
", isPrivateFile=" + isPrivateFile +
105+
", customCoordinates=" + customCoordinates +
106+
", responseFields=" + responseFields +
107+
'}';
108+
}
109+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package io.imagekit.sdk.models;
2+
3+
import com.google.gson.Gson;
4+
import okhttp3.MediaType;
5+
import okhttp3.RequestBody;
6+
7+
import java.util.List;
8+
9+
public class FileUpdateRequest {
10+
private String fileId;
11+
private List<String> tags;
12+
private String customCoordinates;
13+
14+
public FileUpdateRequest(String fileId) {
15+
this.fileId = fileId;
16+
}
17+
18+
public String getFileId() {
19+
return fileId;
20+
}
21+
22+
public void setFileId(String fileId) {
23+
this.fileId = fileId;
24+
}
25+
26+
public List<String> getTags() {
27+
return tags;
28+
}
29+
30+
public void setTags(List<String> tags) {
31+
this.tags = tags;
32+
}
33+
34+
public String getCustomCoordinates() {
35+
return customCoordinates;
36+
}
37+
38+
public void setCustomCoordinates(String customCoordinates) {
39+
this.customCoordinates = customCoordinates;
40+
}
41+
42+
@Override
43+
public String toString() {
44+
return "FileUpdateRequest{" +
45+
"fileId='" + fileId + '\'' +
46+
", tags=" + tags +
47+
", customCoordinates='" + customCoordinates + '\'' +
48+
'}';
49+
}
50+
}

0 commit comments

Comments
 (0)