DsmResponseFields.java 15 KB
Newer Older
敖文武 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
package responses.filestation;

import requests.filestation.DsmRequestParameters;

import java.util.List;

public class DsmResponseFields {

    private DsmResponseFields() { }

    public static class Owner {
        /**
         * User name of file owner.
         */
        private String user;
        /**
         * Group name of file group.
         */
        private String group;
        /**
         * File UID.
         */
        private Long uid;
        /**
         * File GID.
         */
        private Long gid;

        public String getUser() {
            return user;
        }

        public String getGroup() {
            return group;
        }

        public Long getUid() {
            return uid;
        }

        public Long getGid() {
            return gid;
        }
    }

    public static class VolumeStatus {
        /**
         * Byte size of free space of a volume where a shared
         * folder is located.
         */
        private Long freespace;
        /**
         * Byte size of total space of a volume where a shared
         * folder is located.
         */
        private Long totalspace;
        /**
         * true: A volume where a shared folder is located is
         * read-only; false: It’s writable.
         */
        private boolean readonly;

        public Long getFreespace() {
            return freespace;
        }

        public Long getTotalspace() {
            return totalspace;
        }

        public boolean isReadonly() {
            return readonly;
        }
    }

    public static class Acl {
        /**
         * If a logged-in user has a privilege to append data or
         * create folders within this folder or not.
         */
        boolean append;
        /**
         * If a logged-in user has a privilege to delete a file/a
         * folder within this folder or not.
         */
        boolean del;
        /**
         * If a logged-in user has a privilege to execute
         * files/traverse folders within this folder or not.
         */
        boolean exec;
        /**
         * If a logged-in user has a privilege to read data or list
         * folder within this folder or not.
         */
        boolean read;
        /**
         * If a logged-in user has a privilege to write data or
         * create files within this folder or not.
         */
        boolean write;

        public boolean isAppend() {
            return append;
        }

        public boolean isDel() {
            return del;
        }

        public boolean isExec() {
            return exec;
        }

        public boolean isRead() {
            return read;
        }

        public boolean isWrite() {
            return write;
        }
    }

    public static class AdvanceRight {
        /**
         * If a non-administrator user can download files in this
         * shared folder through SYNO.FileStation.Download
         * API or not.
         */
        boolean disable_down_load;
        /**
         * If a non-administrator user can enumerate files in
         * this shared folder though SYNO.FileStation.List API
         * with list method or not.
         */
        boolean disable_list;
        /**
         * If a non-administrator user can modify or overwrite
         * files in this shared folder or not.
         */
        boolean disable_modify;

        public boolean isDisable_down_load() {
            return disable_down_load;
        }

        public boolean isDisable_list() {
            return disable_list;
        }

        public boolean isDisable_modify() {
            return disable_modify;
        }
    }

    public static class Perm {
        /**
         * “RW: The shared folder is writable; RO: the shared
         * folder is read-only.
         */
        private String share_right;
        /**
         * POSIX file permission, For example, 777 means
         * owner, group or other has all permission; 764 means
         * owner has all permission, group has read/write
         * permission, other has read permission.
         */
        private Integer posix;
        /**
         * Specail privelge of the shared folder
         */
        private AdvanceRight adv_right;
        /**
         * If the configure of Windows ACL privilege of the
         * shared folder is enabled or not
         */
        boolean acl_enable;
        /**
         * true: The privilege of the shared folder is set to be
         * ACL-mode. false: The privilege of the shared folder
         * is set to be POSIX-mode.
         */
        boolean is_acl_mode;
        /**
         * Windows ACL privilege. If a shared folder is set to be
         * POSIX-mode, these values of Windows ACL
         * privileges are derived from the POSIX privilege.
         */
        private Acl acl;

        public String getShare_right() {
            return share_right;
        }

        public Integer getPosix() {
            return posix;
        }

        public AdvanceRight getAdv_right() {
            return adv_right;
        }

        public boolean isAcl_enable() {
            return acl_enable;
        }

        public boolean isIs_acl_mode() {
            return is_acl_mode;
        }

        public Acl getAcl() {
            return acl;
        }
    }

    public static class Time {
        /**
         * Linux timestamp of last access in second
         */
        private Long atime;
        /**
         * Linux timestamp of last modification in second.
         */
        private Long mtime;
        /**
         * Linux timestamp of last change in second.
         */
        private Long ctime;
        /**
         * Linux timestamp of create time in second.
         */
        private Long crtime;

        public Long getAtime() {
            return atime;
        }

        public Long getMtime() {
            return mtime;
        }

        public Long getCtime() {
            return ctime;
        }

        public Long getCrtime() {
            return crtime;
        }
    }

    public  static class AdditionalListShare {
        /**
         * Real path of a shared folder in a volume space
         */
        String real_path;

        private Owner owner;
        /**
         * Time information of file including last access time,
         * last modified time, last change time, and creation
         * time.
         */
        private Time time;
        /**
         * File permission information
         */
        private Perm perm;
        /**
         * Type of a virtual file system of a mount point.
         */
        private String mount_point_type;
        /**
         * Volume status including free space, total space and
         * read-only status.
         */
        private DsmResponseFields.VolumeStatus volume_status;

        public String getReal_path() {
            return real_path;
        }

        public Owner getOwner() {
            return owner;
        }

        public Time getTime() {
            return time;
        }

        public Perm getPerm() {
            return perm;
        }

        public String getMount_point_type() {
            return mount_point_type;
        }

        public VolumeStatus getVolume_status() {
            return volume_status;
        }
    }

    public static class Share {
        /**
         * Path of a shared folder.
         */
        private String path;
        /**
         * Name of a shared folder.
         */
        private String name;

        private AdditionalListShare additional;

        public String getPath() {
            return path;
        }

        public String getName() {
            return name;
        }

        public AdditionalListShare getAdditional() {
            return additional;
        }
    }

    public static class AdditionalListFolder {
        /**
         * Real path started with a volume path.
         */
        private String real_path;
        /**
         * File size.
         */
        private Long size;
        /**
         * File owner information including user name, group name, UID and GID.
         */
        private DsmResponseFields.Owner owner;
        /**
         * Time information of file including last access time,
         * last modified time, last change time and create time.
         */
        private DsmResponseFields.Time time;
        /**
         * File permission information.
         */
        private DsmResponseFields.Perm perm;
        /**
         * A type of a virtual file system of a mount point.
         */
        private String mount_point_type;
        /**
         * File extension.
         */
        private String type;

        public String getReal_path() {
            return real_path;
        }

        public Long getSize() {
            return size;
        }

        public Owner getOwner() {
            return owner;
        }

        public Time getTime() {
            return time;
        }

        public Perm getPerm() {
            return perm;
        }

        public String getMount_point_type() {
            return mount_point_type;
        }

        public String getType() {
            return type;
        }
    }

    public static class Children {
        /**
         * Total number of files.
         */
        private Integer total;
        /**
         * Requested offset
         */
        private Integer offset;
        /**
         * Array of <file> objects.
         */
        private Files files;

        public Integer getTotal() {
            return total;
        }

        public Integer getOffset() {
            return offset;
        }

        public Files getFiles() {
            return files;
        }
    }

    public static class Favorite {

        public enum Status {
            valid,
            broken
        }
        private String path;
        private String name;
        private DsmResponseFields.SharingLink.Status status;
        private DsmResponseFields.AdditionalListFolder additional;

        public String getPath() {
            return path;
        }

        public String getName() {
            return name;
        }

        public DsmResponseFields.SharingLink.Status getStatus() {
            return status;
        }

        public DsmResponseFields.AdditionalListFolder getAdditional() {
            return additional;
        }
    }

    public static class Files {
        /**
         * Folder/file path started with a shared folder.
         */
        private String path;
        /**
         * File name.
         */
        private String name;
        /**
         * If this file is folder or not.
         */
        private boolean isdir;
        /**
         * File list within a folder which is described by a <file>
         * object. The value is returned, only if goto_path
         * parameter is given.
         */
        private List<DsmResponseFields.Children> children;
        /**
         * File additional object.
         */
        private DsmResponseFields.AdditionalListFolder additional;

        public String getPath() {
            return path;
        }

        public String getName() {
            return name;
        }

        public boolean isIsdir() {
            return isdir;
        }

        public List<Children> getChildren() {
            return children;
        }

        public DsmResponseFields.AdditionalListFolder getAdditional() {
            return additional;
        }
    }

    public  static class SharingLink {

        /**
         * The accessibility status of the sharing link might be
         * one of the following:
         */
        public enum Status {
            valid, // the sharing link is active
            invalid, // the sharing link is not active because the available date has not arrived yet
            expired, // the sharing link expired.
            broken, //the sharing link broke due to a change in the file path or access permission
            inactive
        }

        /**
         * A unique ID of a sharing link.
         */
        private String id;
        /**
         * A URL of a sharing link.
         */
        private String url;
        /**
         * A user name of a sharing link owner
         */
        private String link_owner;
        /**
         * A file or folder path of a sharing link.
         */
        private String path;
        /**
         * Whether the sharing link is for a folder
         */
        private String isFolder;
        /**
         * Whether the sharing link has password.
         */
        private boolean has_password;
        /**
         * The expiration date of the sharing link in the format
         * YYYY-MM-DD. If the value is set to 0, the link will
         * be permanent.
         */
        private String date_expired;
        /**
         * The date when the sharing link becomes active in
         * the format YYYY-MM-DD. If the value is set to 0,
         * the file sharing link will be active immediately after
         * creation.
         */
        private String date_available;
        /**
         * The accessibility status of the sharing link might be
         * one of the following:
         * (1) valid: the sharing link is active.
         * (2) invalid: the sharing link is not active because
         * the available date has not arrived yet.
         * (3) expired: the sharing link expired.
         * (4) broken: the sharing link broke due to a change
         * in the file path or access permission.
         */
        private Status status;

        public String getId() {
            return id;
        }

        public String getUrl() {
            return url;
        }

        public String getLink_owner() {
            return link_owner;
        }

        public String getPath() {
            return path;
        }

        public String getIsFolder() {
            return isFolder;
        }

        public boolean isHas_password() {
            return has_password;
        }

        public String getDate_expired() {
            return date_expired;
        }

        public String getDate_available() {
            return date_available;
        }

        public Status getStatus() {
            return status;
        }
    }

    public static class SharedLink {
        /**
         * A file/folder path of the sharing link.
         */
        private String path;
        /**
         * A created URL of the sharing link.
         */
        private String url;
        /**
         * A created unique ID of the sharing link.
         */
        private String id;
        /**
         * Base64-encoded image of QR code describing
         * the URL of the sharing link
         */
        private String qrcode;

        /**
         * 0 for creating it successfully, otherwise is the
         * error code for failed to create it.
         */
        private Integer error;

        public String getPath() {
            return path;
        }

        public String getUrl() {
            return url;
        }

        public String getId() {
            return id;
        }

        public String getQrcode() {
            return qrcode;
        }

        public Integer getError() {
            return error;
        }
    }
}