"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.discussionsApiRequest = discussionsApiRequest;
exports.discussionsApiRequestV2 = discussionsApiRequestV2;
const request_1 = require("./utils/request");
/**
 * method that authenticates and makes requests to Discussions API
 *
 * @export
 * @template T
 * @param {string} url
 * @param {IDiscussionsRequestOptions} options
 * @return {*}  {Promise<T>}
 */
// NOTE: feasibly this could be replaced with @esi/hub-common hubApiRequest,
// if that method didn't prepend `/api/v3` to the supplied path. Additionally,
// there is the difference that hubApiRequest sets Authorization header without `Bearer`
// https://github.com/Esri/hub.js/blob/f35b1a0a868916bd07e1dfd84cb084bc2c876267/packages/common/src/request.ts#L62
function discussionsApiRequest(url, options) {
    return (0, request_1.authenticateRequest)(options).then((token) => {
        return (0, request_1.apiRequest)(url, options, "v1", token);
    });
}
/**
 * method that authenticates and makes requests to Discussions API v2
 *
 * @export
 * @template T
 * @param {string} url
 * @param {IDiscussionsRequestOptions} options
 * @return {*}  {Promise<T>}
 */
// NOTE: feasibly this could be replaced with @esi/hub-common hubApiRequest,
// if that method didn't prepend `/api/v3` to the supplied path. Additionally,
// there is the difference that hubApiRequest sets Authorization header without `Bearer`
// https://github.com/Esri/hub.js/blob/f35b1a0a868916bd07e1dfd84cb084bc2c876267/packages/common/src/request.ts#L62
function discussionsApiRequestV2(url, options) {
    return (0, request_1.authenticateRequest)(options).then((token) => {
        return (0, request_1.apiRequest)(url, options, "v2", token);
    });
}
//# sourceMappingURL=discussions-api-request.js.map