|
| 1 | +package com.volcengine.ark.runtime.model.files; |
| 2 | + |
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 5 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 6 | +import com.volcengine.ark.runtime.exception.ArkAPIError.ArkErrorDetails; |
| 7 | + |
| 8 | +@JsonIgnoreProperties(ignoreUnknown = true) |
| 9 | +public class FileMeta { |
| 10 | + |
| 11 | + /** |
| 12 | + * The file identifier, which can be referenced in the API endpoints. |
| 13 | + * 文件标识符,可以在 API 接口中引用。 |
| 14 | + */ |
| 15 | + @JsonProperty(value = "id") |
| 16 | + private String id; |
| 17 | + |
| 18 | + /** |
| 19 | + * The object type, which is always "file". |
| 20 | + * 对象类型,始终为 "file" |
| 21 | + */ |
| 22 | + @JsonProperty(value = "object") |
| 23 | + private String object; |
| 24 | + |
| 25 | + /** |
| 26 | + * The size of the file in bytes. |
| 27 | + * 文件的字节大小 |
| 28 | + */ |
| 29 | + @JsonProperty(value = "bytes") |
| 30 | + private Integer bytes; |
| 31 | + |
| 32 | + /** |
| 33 | + * The unix timestamp for when the file was created. |
| 34 | + * 文件创建的 Unix 时间戳,默认转换为 UTC 时间。 |
| 35 | + */ |
| 36 | + @JsonProperty(value = "created_at") |
| 37 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 38 | + private String createdTime; |
| 39 | + |
| 40 | + /** |
| 41 | + * The unix timestamp for when the file will expire. |
| 42 | + * 文件过期的 Unix 时间戳,默认转换为 UTC 时间。 |
| 43 | + */ |
| 44 | + @JsonProperty(value = "expire_at") |
| 45 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 46 | + private String expireTime; |
| 47 | + |
| 48 | + /** |
| 49 | + * The name of the file. |
| 50 | + * 文件名 |
| 51 | + */ |
| 52 | + @JsonProperty(value = "filename") |
| 53 | + private String filename; |
| 54 | + |
| 55 | + /** |
| 56 | + * The intended purpose of the file. Currently, only "user_data" is supported. |
| 57 | + * 文件的预期用途。目前只支持 "user_data"。 |
| 58 | + */ |
| 59 | + @JsonProperty(value = "purpose") |
| 60 | + private String purpose; |
| 61 | + |
| 62 | + /** |
| 63 | + * The current status of the file, which can be either uploaded, processed, pending, error, deleting or deleted. |
| 64 | + * 文件的当前状态,可以是"processing", "active", "failed". |
| 65 | + */ |
| 66 | + @JsonProperty(value = "status") |
| 67 | + private String status; |
| 68 | + |
| 69 | + /** |
| 70 | + * Additional details about the status of the file. If the file is in the error state, this will include a message describing the error. |
| 71 | + * 关于文件状态的额外详细信息。如果文件处于错误状态,这将包括描述错误的消息。 |
| 72 | + */ |
| 73 | + @JsonProperty(value = "error") |
| 74 | + private ArkErrorDetails error; |
| 75 | + |
| 76 | + public FileMeta() { |
| 77 | + } |
| 78 | + |
| 79 | + |
| 80 | + @Override |
| 81 | + public String toString() { |
| 82 | + return "FileMeta{" + |
| 83 | + "id='" + id + '\'' + |
| 84 | + ", object='" + object + '\'' + |
| 85 | + ", bytes=" + bytes + |
| 86 | + ", createdTime='" + createdTime + '\'' + |
| 87 | + ", expireTime='" + expireTime + '\'' + |
| 88 | + ", filename='" + filename + '\'' + |
| 89 | + ", purpose='" + purpose + '\'' + |
| 90 | + ", status='" + status + '\'' + |
| 91 | + ", error=" + error + |
| 92 | + '}'; |
| 93 | + } |
| 94 | + |
| 95 | + public String getExpireTime() { |
| 96 | + return expireTime; |
| 97 | + } |
| 98 | + |
| 99 | + public void setExpireTime(String expireTime) { |
| 100 | + this.expireTime = expireTime; |
| 101 | + } |
| 102 | + |
| 103 | + public String getCreatedTime() { |
| 104 | + return createdTime; |
| 105 | + } |
| 106 | + |
| 107 | + public void setCreatedTime(String createdTime) { |
| 108 | + this.createdTime = createdTime; |
| 109 | + } |
| 110 | + |
| 111 | + public String getId() { |
| 112 | + return id; |
| 113 | + } |
| 114 | + |
| 115 | + public void setId(String id) { |
| 116 | + this.id = id; |
| 117 | + } |
| 118 | + |
| 119 | + public String getObject() { |
| 120 | + return object; |
| 121 | + } |
| 122 | + |
| 123 | + public void setObject(String object) { |
| 124 | + this.object = object; |
| 125 | + } |
| 126 | + |
| 127 | + public Integer getBytes() { |
| 128 | + return bytes; |
| 129 | + } |
| 130 | + |
| 131 | + public void setBytes(Integer bytes) { |
| 132 | + this.bytes = bytes; |
| 133 | + } |
| 134 | + |
| 135 | + public String getFilename() { |
| 136 | + return filename; |
| 137 | + } |
| 138 | + |
| 139 | + public void setFilename(String filename) { |
| 140 | + this.filename = filename; |
| 141 | + } |
| 142 | + |
| 143 | + public String getPurpose() { |
| 144 | + return purpose; |
| 145 | + } |
| 146 | + |
| 147 | + public void setPurpose(String purpose) { |
| 148 | + this.purpose = purpose; |
| 149 | + } |
| 150 | + |
| 151 | + public String getStatus() { |
| 152 | + return status; |
| 153 | + } |
| 154 | + |
| 155 | + public void setStatus(String status) { |
| 156 | + this.status = status; |
| 157 | + } |
| 158 | + |
| 159 | + public ArkErrorDetails getError() { |
| 160 | + return error; |
| 161 | + } |
| 162 | + |
| 163 | + public void setError(ArkErrorDetails error) { |
| 164 | + this.error = error; |
| 165 | + } |
| 166 | + |
| 167 | + |
| 168 | + public static final class FileBuilder { |
| 169 | + private String id; |
| 170 | + private String object; |
| 171 | + private Integer bytes; |
| 172 | + private String createdTime; |
| 173 | + private String expireTime; |
| 174 | + private String filename; |
| 175 | + private String purpose; |
| 176 | + private String status; |
| 177 | + private ArkErrorDetails error; |
| 178 | + |
| 179 | + private FileBuilder() { |
| 180 | + } |
| 181 | + |
| 182 | + public static FileBuilder aFile() { |
| 183 | + return new FileBuilder(); |
| 184 | + } |
| 185 | + |
| 186 | + public FileBuilder id(String id) { |
| 187 | + this.id = id; |
| 188 | + return this; |
| 189 | + } |
| 190 | + |
| 191 | + public FileBuilder object(String object) { |
| 192 | + this.object = object; |
| 193 | + return this; |
| 194 | + } |
| 195 | + |
| 196 | + public FileBuilder bytes(Integer bytes) { |
| 197 | + this.bytes = bytes; |
| 198 | + return this; |
| 199 | + } |
| 200 | + |
| 201 | + public FileBuilder createdTime(String createdTime) { |
| 202 | + this.createdTime = createdTime; |
| 203 | + return this; |
| 204 | + } |
| 205 | + |
| 206 | + public FileBuilder expireTime(String expireTime) { |
| 207 | + this.expireTime = expireTime; |
| 208 | + return this; |
| 209 | + } |
| 210 | + |
| 211 | + public FileBuilder filename(String filename) { |
| 212 | + this.filename = filename; |
| 213 | + return this; |
| 214 | + } |
| 215 | + |
| 216 | + public FileBuilder purpose(String purpose) { |
| 217 | + this.purpose = purpose; |
| 218 | + return this; |
| 219 | + } |
| 220 | + |
| 221 | + public FileBuilder status(String status) { |
| 222 | + this.status = status; |
| 223 | + return this; |
| 224 | + } |
| 225 | + |
| 226 | + public FileBuilder error(ArkErrorDetails error) { |
| 227 | + this.error = error; |
| 228 | + return this; |
| 229 | + } |
| 230 | + |
| 231 | + public FileMeta build() { |
| 232 | + FileMeta fileMeta = new FileMeta(); |
| 233 | + fileMeta.setId(id); |
| 234 | + fileMeta.setObject(object); |
| 235 | + fileMeta.setBytes(bytes); |
| 236 | + fileMeta.setCreatedTime(createdTime); |
| 237 | + fileMeta.setExpireTime(expireTime); |
| 238 | + fileMeta.setFilename(filename); |
| 239 | + fileMeta.setPurpose(purpose); |
| 240 | + fileMeta.setStatus(status); |
| 241 | + fileMeta.setError(error); |
| 242 | + return fileMeta; |
| 243 | + } |
| 244 | + } |
| 245 | +} |
0 commit comments