001package com.box.sdkgen.managers.uploads;
002
003import java.io.InputStream;
004
005public class UploadFileVersionRequestBody {
006
007  /**
008   * The additional attributes of the file being uploaded. Mainly the name and the parent folder.
009   * These attributes are part of the multi part request body and are in JSON format.
010   *
011   * <p>&lt;Message warning&gt;
012   *
013   * <p>The `attributes` part of the body must come **before** the `file` part. Requests that do not
014   * follow this format when uploading the file will receive a HTTP `400` error with a
015   * `metadata_after_file_contents` error code.
016   *
017   * <p>&lt;/Message&gt;
018   */
019  public final UploadFileVersionRequestBodyAttributesField attributes;
020
021  /**
022   * The content of the file to upload to Box.
023   *
024   * <p>&lt;Message warning&gt;
025   *
026   * <p>The `attributes` part of the body must come **before** the `file` part. Requests that do not
027   * follow this format when uploading the file will receive a HTTP `400` error with a
028   * `metadata_after_file_contents` error code.
029   *
030   * <p>&lt;/Message&gt;
031   */
032  public final InputStream file;
033
034  public String fileFileName;
035
036  public String fileContentType;
037
038  public UploadFileVersionRequestBody(
039      UploadFileVersionRequestBodyAttributesField attributes, InputStream file) {
040    this.attributes = attributes;
041    this.file = file;
042  }
043
044  protected UploadFileVersionRequestBody(Builder builder) {
045    this.attributes = builder.attributes;
046    this.file = builder.file;
047    this.fileFileName = builder.fileFileName;
048    this.fileContentType = builder.fileContentType;
049  }
050
051  public UploadFileVersionRequestBodyAttributesField getAttributes() {
052    return attributes;
053  }
054
055  public InputStream getFile() {
056    return file;
057  }
058
059  public String getFileFileName() {
060    return fileFileName;
061  }
062
063  public String getFileContentType() {
064    return fileContentType;
065  }
066
067  public static class Builder {
068
069    protected final UploadFileVersionRequestBodyAttributesField attributes;
070
071    protected final InputStream file;
072
073    protected String fileFileName;
074
075    protected String fileContentType;
076
077    public Builder(UploadFileVersionRequestBodyAttributesField attributes, InputStream file) {
078      this.attributes = attributes;
079      this.file = file;
080    }
081
082    public Builder fileFileName(String fileFileName) {
083      this.fileFileName = fileFileName;
084      return this;
085    }
086
087    public Builder fileContentType(String fileContentType) {
088      this.fileContentType = fileContentType;
089      return this;
090    }
091
092    public UploadFileVersionRequestBody build() {
093      return new UploadFileVersionRequestBody(this);
094    }
095  }
096}