// Path: api/src/main/java/com/jfrog/bintray/client/api/BintrayCallException.java
// public class BintrayCallException extends HttpResponseException {
// 
//     private int statusCode;
//     private String reason;
//     private String message;
// 
//     public BintrayCallException(int statusCode, String reason, String message) {
//         super(statusCode, reason);
//         this.statusCode = statusCode;
//         this.reason = reason;
//         this.message = message;
//     }
// 
//     public BintrayCallException(HttpResponse response) {
//         super(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase());
//         String message = " ";
//         String entity = null;
//         int statusCode = response.getStatusLine().getStatusCode();
//         if (response.getEntity() != null && statusCode != 405 && statusCode != 500) {
//             try {
//                 entity = IOUtils.toString(response.getEntity().getContent());
//                 ObjectMapper mapper = ObjectMapperHelper.get();
//                 JsonNode node = mapper.readTree(entity);
//                 message = node.get("message").getTextValue();
//             } catch (IOException | NullPointerException e) {
//                 //Null entity?
//                 if (entity != null) {
//                     message = entity;
//                 }
//             }
//         }
//         this.statusCode = statusCode;
//         this.reason = response.getStatusLine().getReasonPhrase();
//         this.message = message;
//     }
// 
//     public BintrayCallException(Exception e) {
//         super(HttpStatus.SC_BAD_REQUEST, e.getMessage());
//         this.statusCode = HttpStatus.SC_BAD_REQUEST;
//         this.reason = e.getMessage();
//         this.message = (e.getCause() == null) ? " " : " : " + e.getCause().getMessage();
//     }
// 
//     public int getStatusCode() {
//         return statusCode;
//     }
// 
//     public String getReason() {
//         return reason;
//     }
// 
//     @Override
//     public String getMessage() {
//         return message;
//     }
// 
//     public void setMessage(String newMessage) {
//         this.message = newMessage;
//     }
// 
//     @Override
//     public String toString() {
//         return statusCode + ", " + reason + " " + message;
//     }
// 
// }
// 
// Path: api/src/main/java/com/jfrog/bintray/client/api/MultipleBintrayCallException.java
// public class MultipleBintrayCallException extends Exception {
// 
//     List<BintrayCallException> exceptions;
// 
//     public MultipleBintrayCallException() {
//         super();
//         exceptions = new ArrayList<>();
//     }
// 
//     public MultipleBintrayCallException(List<BintrayCallException> exceptions) {
//         super();
//         this.exceptions = exceptions;
//     }
// 
//     public List<BintrayCallException> getExceptions() {
//         return exceptions;
//     }
// 
// 
// }


import com.jfrog.bintray.client.api.BintrayCallException;
import com.jfrog.bintray.client.api.MultipleBintrayCallException;
import org.apache.http.HttpResponse;
import java.io.Closeable;
import java.io.InputStream;
import java.util.Map;
package com.jfrog.bintray.client.api.handle;



/**
 * @author Noam Y. Tenne
 */
public interface Bintray extends Closeable {

    SubjectHandle subject(String subject);

    RepositoryHandle repository(String repositoryPath);

    PackageHandle pkg(String packagePath);

    VersionHandle version(String versionPath);

    /**
     * Following are generic HTTP requests you can perform against Bintray's API, as defined in your created client
     * (so the uri parameter should be the required path after api.bintray.com).
     * You can also optionally add your own headers to the requests.
     */

    HttpResponse get(String uri, Map<String, String> headers) throws BintrayCallException;

    HttpResponse head(String uri, Map<String, String> headers) throws BintrayCallException;

    HttpResponse post(String uri, Map<String, String> headers, InputStream elementInputStream) throws BintrayCallException;

    HttpResponse patch(String uri, Map<String, String> headers, InputStream elementInputStream) throws BintrayCallException;

    HttpResponse delete(String uri, Map<String, String> headers) throws BintrayCallException;

    /**
     * PUT single item
     */
    HttpResponse put(String uri, Map<String, String> headers, InputStream elementInputStream) throws BintrayCallException;

    /**
     * Concurrently executes a list of {@link org.apache.http.client.methods.HttpPut} requests, which are not handled by
     * the default response handler to avoid any BintrayCallExceptions being thrown before all requests have executed.
     *
     * @return A list of all errors thrown while performing the requests or empty list if all requests finished OK
     */
// Path: api/src/main/java/com/jfrog/bintray/client/api/BintrayCallException.java
// public class BintrayCallException extends HttpResponseException {
// 
//     private int statusCode;
//     private String reason;
//     private String message;
// 
//     public BintrayCallException(int statusCode, String reason, String message) {
//         super(statusCode, reason);
//         this.statusCode = statusCode;
//         this.reason = reason;
//         this.message = message;
//     }
// 
//     public BintrayCallException(HttpResponse response) {
//         super(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase());
//         String message = " ";
//         String entity = null;
//         int statusCode = response.getStatusLine().getStatusCode();
//         if (response.getEntity() != null && statusCode != 405 && statusCode != 500) {
//             try {
//                 entity = IOUtils.toString(response.getEntity().getContent());
//                 ObjectMapper mapper = ObjectMapperHelper.get();
//                 JsonNode node = mapper.readTree(entity);
//                 message = node.get("message").getTextValue();
//             } catch (IOException | NullPointerException e) {
//                 //Null entity?
//                 if (entity != null) {
//                     message = entity;
//                 }
//             }
//         }
//         this.statusCode = statusCode;
//         this.reason = response.getStatusLine().getReasonPhrase();
//         this.message = message;
//     }
// 
//     public BintrayCallException(Exception e) {
//         super(HttpStatus.SC_BAD_REQUEST, e.getMessage());
//         this.statusCode = HttpStatus.SC_BAD_REQUEST;
//         this.reason = e.getMessage();
//         this.message = (e.getCause() == null) ? " " : " : " + e.getCause().getMessage();
//     }
// 
//     public int getStatusCode() {
//         return statusCode;
//     }
// 
//     public String getReason() {
//         return reason;
//     }
// 
//     @Override
//     public String getMessage() {
//         return message;
//     }
// 
//     public void setMessage(String newMessage) {
//         this.message = newMessage;
//     }
// 
//     @Override
//     public String toString() {
//         return statusCode + ", " + reason + " " + message;
//     }
// 
// }
// 
// Path: api/src/main/java/com/jfrog/bintray/client/api/MultipleBintrayCallException.java
// public class MultipleBintrayCallException extends Exception {
// 
//     List<BintrayCallException> exceptions;
// 
//     public MultipleBintrayCallException() {
//         super();
//         exceptions = new ArrayList<>();
//     }
// 
//     public MultipleBintrayCallException(List<BintrayCallException> exceptions) {
//         super();
//         this.exceptions = exceptions;
//     }
// 
//     public List<BintrayCallException> getExceptions() {
//         return exceptions;
//     }
// 
// 
// }


// Path: api/src/main/java/com/jfrog/bintray/client/api/handle/Bintray.java
import com.jfrog.bintray.client.api.BintrayCallException;
import com.jfrog.bintray.client.api.MultipleBintrayCallException;
import org.apache.http.HttpResponse;
import java.io.Closeable;
import java.io.InputStream;
import java.util.Map;

package com.jfrog.bintray.client.api.handle;



/**
 * @author Noam Y. Tenne
 */
public interface Bintray extends Closeable {

    SubjectHandle subject(String subject);

    RepositoryHandle repository(String repositoryPath);

    PackageHandle pkg(String packagePath);

    VersionHandle version(String versionPath);

    /**
     * Following are generic HTTP requests you can perform against Bintray's API, as defined in your created client
     * (so the uri parameter should be the required path after api.bintray.com).
     * You can also optionally add your own headers to the requests.
     */

    HttpResponse get(String uri, Map<String, String> headers) throws BintrayCallException;

    HttpResponse head(String uri, Map<String, String> headers) throws BintrayCallException;

    HttpResponse post(String uri, Map<String, String> headers, InputStream elementInputStream) throws BintrayCallException;

    HttpResponse patch(String uri, Map<String, String> headers, InputStream elementInputStream) throws BintrayCallException;

    HttpResponse delete(String uri, Map<String, String> headers) throws BintrayCallException;

    /**
     * PUT single item
     */
    HttpResponse put(String uri, Map<String, String> headers, InputStream elementInputStream) throws BintrayCallException;

    /**
     * Concurrently executes a list of {@link org.apache.http.client.methods.HttpPut} requests, which are not handled by
     * the default response handler to avoid any BintrayCallExceptions being thrown before all requests have executed.
     *
     * @return A list of all errors thrown while performing the requests or empty list if all requests finished OK
     */
    HttpResponse put(Map<String, InputStream> uriAndStreamMap, Map<String, String> headers) throws MultipleBintrayCallException;