001package com.box.sdk;
002
003import java.net.URL;
004import okhttp3.MediaType;
005
006/**
007 * <p>Used to make HTTP multipart requests to the Box API.</p>
008 *
009 * <p>This class partially implements the HTTP multipart standard in order to upload files to Box. The body of this
010 * request type cannot be set directly. Instead, it can be modified by adding multipart fields and setting file
011 * contents. The body of multipart requests will not be logged since they are likely to contain binary data.</p>
012 */
013public class BoxMultipartRequest extends AbstractBoxMultipartRequest {
014
015    /**
016     * Constructs an authenticated BoxMultipartRequest using a provided BoxAPIConnection.
017     *
018     * @param api an API connection for authenticating the request.
019     * @param url the URL of the request.
020     */
021    public BoxMultipartRequest(BoxAPIConnection api, URL url) {
022        super(api, url);
023    }
024
025    @Override
026    protected String getPartName() {
027        return "file";
028    }
029
030    @Override
031    protected MediaType getPartContentType(String filename) {
032        return MediaType.parse("application/octet-stream");
033    }
034}