PGBRequest.java 1.99 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.http.impl.client.HttpClientBuilder
 */
package com.adobe.cq.mobile.phonegap.impl.build;

import com.adobe.cq.mobile.phonegap.impl.build.PGBuildUserAccount;
import org.apache.http.impl.client.HttpClientBuilder;

public class PGBRequest {
    private static final int DEFAULT_PORT = 443;
    private final boolean ssl;
    private HttpClientBuilder httpClientBuilder = null;
    private String host = null;
    private int port = 443;
    private PGBuildUserAccount pgBuildUserAccount = null;

    public PGBRequest(HttpClientBuilder httpClientBuilder, String host, int port, PGBuildUserAccount pgBuildUserAccount, boolean ssl) {
        this.httpClientBuilder = httpClientBuilder;
        this.host = host;
        this.port = port;
        this.ssl = ssl;
        this.pgBuildUserAccount = pgBuildUserAccount;
    }

    public HttpClientBuilder getHttpClientBuilder() {
        return this.httpClientBuilder;
    }

    public String getHost() {
        return this.host;
    }

    public int getPort() {
        return this.port;
    }

    public String getUserId() {
        return this.pgBuildUserAccount == null ? null : this.pgBuildUserAccount.getUserId();
    }

    public String getPassWord() {
        return this.pgBuildUserAccount == null ? null : this.pgBuildUserAccount.getPassword();
    }

    public String getRootServiceURL() {
        return (this.ssl ? "https" : "http") + "://" + this.host + ":" + this.port + "/api/v1";
    }

    public String getAppsServiceURL() {
        return this.getRootServiceURL() + "/apps";
    }

    public String getAppURL(String appId) {
        return this.getAppsServiceURL() + "/" + appId;
    }

    public String getAccountProfileURL() {
        return this.getRootServiceURL() + "/me";
    }

    public String toString() {
        return "PGBRequest{url='" + this.getRootServiceURL() + '\'' + ", userId='" + this.getUserId() + '\'' + ", passWord='" + "********" + '\'' + '}';
    }
}