001package com.box.sdkgen.managers.uploads;
002
003import java.io.InputStream;
004
005public class UploadFileRequestBody {
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 UploadFileRequestBodyAttributesField 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 UploadFileRequestBody(UploadFileRequestBodyAttributesField attributes, InputStream file) {
039    this.attributes = attributes;
040    this.file = file;
041  }
042
043  protected UploadFileRequestBody(Builder builder) {
044    this.attributes = builder.attributes;
045    this.file = builder.file;
046    this.fileFileName = builder.fileFileName;
047    this.fileContentType = builder.fileContentType;
048  }
049
050  public UploadFileRequestBodyAttributesField getAttributes() {
051    return attributes;
052  }
053
054  public InputStream getFile() {
055    return file;
056  }
057
058  public String getFileFileName() {
059    return fileFileName;
060  }
061
062  public String getFileContentType() {
063    return fileContentType;
064  }
065
066  public static class Builder {
067
068    protected final UploadFileRequestBodyAttributesField attributes;
069
070    protected final InputStream file;
071
072    protected String fileFileName;
073
074    protected String fileContentType;
075
076    public Builder(UploadFileRequestBodyAttributesField attributes, InputStream file) {
077      this.attributes = attributes;
078      this.file = file;
079    }
080
081    public Builder fileFileName(String fileFileName) {
082      this.fileFileName = fileFileName;
083      return this;
084    }
085
086    public Builder fileContentType(String fileContentType) {
087      this.fileContentType = fileContentType;
088      return this;
089    }
090
091    public UploadFileRequestBody build() {
092      return new UploadFileRequestBody(this);
093    }
094  }
095}