"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPortalApiUrl = getPortalApiUrl;
const get_portal_url_1 = require("./get-portal-url");
/**
 * ```js
 * import { getPortalApiUrl } from "@esri/hub-common";
 * // from a portal base URL
 * let portalApiUrl = getPortalApiUrl("https://org.maps.arcgis.com"); // https://org.maps.arcgis.com/sharing/rest
 * // from an enterprise portal self response (IPortal)
 * let portalSelf = { isPortal: true, portalHostname: "server.example.org" };
 * portalApiUrl = getPortalApiUrl(portalSelf); // https://server.example.org/sharing/rest
 * // from an online portal self response (IPortal)
 * portalSelf = { isPortal: false, urlKey: "org", customBaseUrl: "maps.arcgis.com" };
 * portalApiUrl = getPortalApiUrl(portalSelf); // https://org.maps.arcgis.com/sharing/rest
 * // from hub request options (IHubRequestOptions) with a portal self (IPortal)
 * let requestOptions = { isPortal: false, portalSelf };
 * portalApiUrl = getPortalApiUrl(requestOptions); // https://org.maps.arcgis.com/sharing/rest
 * // from request options (IRequestOptions) with a portal (string)
 * requestOptions = { portal: "https://org.maps.arcgis.com/sharing/rest" };
 * portalApiUrl = getPortalApiUrl(requestOptions); // https://org.maps.arcgis.com/sharing/rest
 * ```
 * Derive a portal's API URL from the portal's base URL, a portal object, or request options
 * @param urlOrObject a portal base URL, a portal object, or request options containing either of those
 * @returns The portal API URL, defaults to `https://www.arcgis.com/sharing/rest`
 */
function getPortalApiUrl(urlOrObject) {
    return `${(0, get_portal_url_1.getPortalUrl)(urlOrObject)}/sharing/rest`;
}
//# sourceMappingURL=get-portal-api-url.js.map