code: public <T> Response<T> postFile(Endpoint endpoint, InputStream input, Class<T> responseClass, NameValuePair... fields) throws IOException {
  
          // Create the request
          HttpPost post = new HttpPost(endpoint.url());
          post.setHeaders(combineHeaders());
  
          // Add fields as text pairs
          MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
          for (NameValuePair field : fields) {
              multipartEntityBuilder.addTextBody(field.getName(), field.getValue());
          }
          // Add file as binary
          Path tempFile = Files.createTempFile("upload", ".dat");
          try (OutputStream output = Files.newOutputStream(tempFile)) {
              IOUtils.copy(input, output);
          }
          FileBody bin = new FileBody(tempFile.toFile());
          multipartEntityBuilder.addPart("file", bin);
  
          // Set the body
          post.setEntity(multipartEntityBuilder.build());
  
          // Send the request and process the response
          try (CloseableHttpResponse response = httpClient().execute(post)) {
              T body = deserialiseResponseMessage(response, responseClass);
              return new Response<>(response.getStatusLine(), body);
          }
      }
docs: Sends a POST request with a file and returns the response.
  
  @param endpoint      The endpoint to send the request to.
  @param input         The file data to upload
  @param responseClass The class to deserialise the Json response to. Can be null if no response message is expected.
  @param fields        Any name-value pairs to serialise
  @param <T>           The type to deserialise the response to.
  @return A {@link Response} containing the deserialised body, if any.
  @throws IOException If an error occurs.
  @see MultipartEntityBuilder