"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetCallBackFaileResultResponseBodyFailedList = exports.RePushSuiteTicketResponse = exports.RePushSuiteTicketResponseBody = exports.RePushSuiteTicketRequest = exports.InstallCoolAppResponse = exports.InstallCoolAppResponseBody = exports.InstallCoolAppShrinkRequest = exports.InstallCoolAppRequest = exports.InstallCoolAppHeaders = exports.InstallAppResponse = exports.InstallAppResponseBody = exports.InstallAppRequest = exports.InstallAppHeaders = exports.GetCallBackFaileResultResponse = exports.GetCallBackFaileResultResponseBody = exports.GetCallBackFaileResultRequest = exports.GetCallBackFaileResultHeaders = void 0;
// This file is auto-generated, don't edit it
/**
 */
const tea_util_1 = __importStar(require("@alicloud/tea-util")), $Util = tea_util_1;
const gateway_dingtalk_1 = __importDefault(require("@alicloud/gateway-dingtalk"));
const openapi_client_1 = __importStar(require("@alicloud/openapi-client")), $OpenApi = openapi_client_1;
const openapi_util_1 = __importDefault(require("@alicloud/openapi-util"));
const $tea = __importStar(require("@alicloud/tea-typescript"));
class GetCallBackFaileResultHeaders extends $tea.Model {
    static names() {
        return {
            commonHeaders: 'commonHeaders',
            xAcsDingtalkAccessToken: 'x-acs-dingtalk-access-token',
        };
    }
    static types() {
        return {
            commonHeaders: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            xAcsDingtalkAccessToken: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetCallBackFaileResultHeaders = GetCallBackFaileResultHeaders;
class GetCallBackFaileResultRequest extends $tea.Model {
    static names() {
        return {
            beginTime: 'beginTime',
            endTime: 'endTime',
        };
    }
    static types() {
        return {
            beginTime: 'number',
            endTime: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetCallBackFaileResultRequest = GetCallBackFaileResultRequest;
class GetCallBackFaileResultResponseBody extends $tea.Model {
    static names() {
        return {
            failedList: 'failedList',
            hasMore: 'hasMore',
        };
    }
    static types() {
        return {
            failedList: { 'type': 'array', 'itemType': GetCallBackFaileResultResponseBodyFailedList },
            hasMore: 'boolean',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetCallBackFaileResultResponseBody = GetCallBackFaileResultResponseBody;
class GetCallBackFaileResultResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
            body: 'body',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
            body: GetCallBackFaileResultResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetCallBackFaileResultResponse = GetCallBackFaileResultResponse;
class InstallAppHeaders extends $tea.Model {
    static names() {
        return {
            commonHeaders: 'commonHeaders',
            xAcsDingtalkAccessToken: 'x-acs-dingtalk-access-token',
        };
    }
    static types() {
        return {
            commonHeaders: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            xAcsDingtalkAccessToken: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InstallAppHeaders = InstallAppHeaders;
class InstallAppRequest extends $tea.Model {
    static names() {
        return {
            appId: 'appId',
            corpId: 'corpId',
            dingUserId: 'dingUserId',
            suiteId: 'suiteId',
        };
    }
    static types() {
        return {
            appId: 'number',
            corpId: 'string',
            dingUserId: 'string',
            suiteId: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InstallAppRequest = InstallAppRequest;
class InstallAppResponseBody extends $tea.Model {
    static names() {
        return {
            result: 'result',
        };
    }
    static types() {
        return {
            result: 'boolean',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InstallAppResponseBody = InstallAppResponseBody;
class InstallAppResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
            body: 'body',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
            body: InstallAppResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InstallAppResponse = InstallAppResponse;
class InstallCoolAppHeaders extends $tea.Model {
    static names() {
        return {
            commonHeaders: 'commonHeaders',
            xAcsDingtalkAccessToken: 'x-acs-dingtalk-access-token',
        };
    }
    static types() {
        return {
            commonHeaders: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            xAcsDingtalkAccessToken: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InstallCoolAppHeaders = InstallCoolAppHeaders;
class InstallCoolAppRequest extends $tea.Model {
    static names() {
        return {
            appId: 'appId',
            coolAppCode: 'coolAppCode',
            corpId: 'corpId',
            feature: 'feature',
            installUid: 'installUid',
            openConversationId: 'openConversationId',
            options: 'options',
            suiteId: 'suiteId',
        };
    }
    static types() {
        return {
            appId: 'number',
            coolAppCode: 'string',
            corpId: 'string',
            feature: { 'type': 'map', 'keyType': 'string', 'valueType': 'any' },
            installUid: 'string',
            openConversationId: 'string',
            options: { 'type': 'map', 'keyType': 'string', 'valueType': 'any' },
            suiteId: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InstallCoolAppRequest = InstallCoolAppRequest;
class InstallCoolAppShrinkRequest extends $tea.Model {
    static names() {
        return {
            appId: 'appId',
            coolAppCode: 'coolAppCode',
            corpId: 'corpId',
            featureShrink: 'feature',
            installUid: 'installUid',
            openConversationId: 'openConversationId',
            optionsShrink: 'options',
            suiteId: 'suiteId',
        };
    }
    static types() {
        return {
            appId: 'number',
            coolAppCode: 'string',
            corpId: 'string',
            featureShrink: 'string',
            installUid: 'string',
            openConversationId: 'string',
            optionsShrink: 'string',
            suiteId: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InstallCoolAppShrinkRequest = InstallCoolAppShrinkRequest;
class InstallCoolAppResponseBody extends $tea.Model {
    static names() {
        return {
            result: 'result',
        };
    }
    static types() {
        return {
            result: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InstallCoolAppResponseBody = InstallCoolAppResponseBody;
class InstallCoolAppResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
            body: 'body',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
            body: InstallCoolAppResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InstallCoolAppResponse = InstallCoolAppResponse;
class RePushSuiteTicketRequest extends $tea.Model {
    static names() {
        return {
            suiteId: 'suiteId',
            suiteSecret: 'suiteSecret',
        };
    }
    static types() {
        return {
            suiteId: 'number',
            suiteSecret: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.RePushSuiteTicketRequest = RePushSuiteTicketRequest;
class RePushSuiteTicketResponseBody extends $tea.Model {
    static names() {
        return {
            result: 'result',
        };
    }
    static types() {
        return {
            result: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.RePushSuiteTicketResponseBody = RePushSuiteTicketResponseBody;
class RePushSuiteTicketResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
            body: 'body',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
            body: RePushSuiteTicketResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.RePushSuiteTicketResponse = RePushSuiteTicketResponse;
class GetCallBackFaileResultResponseBodyFailedList extends $tea.Model {
    static names() {
        return {
            callBackData: 'callBackData',
            callBackTag: 'callBackTag',
            corpId: 'corpId',
            eventTime: 'eventTime',
        };
    }
    static types() {
        return {
            callBackData: 'string',
            callBackTag: 'string',
            corpId: 'string',
            eventTime: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetCallBackFaileResultResponseBodyFailedList = GetCallBackFaileResultResponseBodyFailedList;
class Client extends openapi_client_1.default {
    constructor(config) {
        super(config);
        let gatewayClient = new gateway_dingtalk_1.default();
        this._spi = gatewayClient;
        this._endpointRule = "";
        if (tea_util_1.default.empty(this._endpoint)) {
            this._endpoint = "api.dingtalk.com";
        }
    }
    /**
     * 调用本获取推送失败的变更事件。
     *
     * @param request - GetCallBackFaileResultRequest
     * @param headers - GetCallBackFaileResultHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns GetCallBackFaileResultResponse
     */
    async getCallBackFaileResultWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.beginTime)) {
            query["beginTime"] = request.beginTime;
        }
        if (!tea_util_1.default.isUnset(request.endTime)) {
            query["endTime"] = request.endTime;
        }
        let realHeaders = {};
        if (!tea_util_1.default.isUnset(headers.commonHeaders)) {
            realHeaders = headers.commonHeaders;
        }
        if (!tea_util_1.default.isUnset(headers.xAcsDingtalkAccessToken)) {
            realHeaders["x-acs-dingtalk-access-token"] = tea_util_1.default.toJSONString(headers.xAcsDingtalkAccessToken);
        }
        let req = new $OpenApi.OpenApiRequest({
            headers: realHeaders,
            query: openapi_util_1.default.query(query),
        });
        let params = new $OpenApi.Params({
            action: "GetCallBackFaileResult",
            version: "event_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/event/callbacks/failedResults`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new GetCallBackFaileResultResponse({}));
    }
    /**
     * 调用本获取推送失败的变更事件。
     *
     * @param request - GetCallBackFaileResultRequest
     * @returns GetCallBackFaileResultResponse
     */
    async getCallBackFaileResult(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new GetCallBackFaileResultHeaders({});
        return await this.getCallBackFaileResultWithOptions(request, headers, runtime);
    }
    /**
     * 安装一方应用
     *
     * @param request - InstallAppRequest
     * @param headers - InstallAppHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns InstallAppResponse
     */
    async installAppWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.appId)) {
            query["appId"] = request.appId;
        }
        if (!tea_util_1.default.isUnset(request.corpId)) {
            query["corpId"] = request.corpId;
        }
        if (!tea_util_1.default.isUnset(request.dingUserId)) {
            query["dingUserId"] = request.dingUserId;
        }
        if (!tea_util_1.default.isUnset(request.suiteId)) {
            query["suiteId"] = request.suiteId;
        }
        let realHeaders = {};
        if (!tea_util_1.default.isUnset(headers.commonHeaders)) {
            realHeaders = headers.commonHeaders;
        }
        if (!tea_util_1.default.isUnset(headers.xAcsDingtalkAccessToken)) {
            realHeaders["x-acs-dingtalk-access-token"] = tea_util_1.default.toJSONString(headers.xAcsDingtalkAccessToken);
        }
        let req = new $OpenApi.OpenApiRequest({
            headers: realHeaders,
            query: openapi_util_1.default.query(query),
        });
        let params = new $OpenApi.Params({
            action: "InstallApp",
            version: "event_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/event/elm/apps/install`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new InstallAppResponse({}));
    }
    /**
     * 安装一方应用
     *
     * @param request - InstallAppRequest
     * @returns InstallAppResponse
     */
    async installApp(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new InstallAppHeaders({});
        return await this.installAppWithOptions(request, headers, runtime);
    }
    /**
     * 安装酷应用
     *
     * @param tmpReq - InstallCoolAppRequest
     * @param headers - InstallCoolAppHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns InstallCoolAppResponse
     */
    async installCoolAppWithOptions(tmpReq, headers, runtime) {
        tea_util_1.default.validateModel(tmpReq);
        let request = new InstallCoolAppShrinkRequest({});
        openapi_util_1.default.convert(tmpReq, request);
        if (!tea_util_1.default.isUnset(tmpReq.feature)) {
            request.featureShrink = openapi_util_1.default.arrayToStringWithSpecifiedStyle(tmpReq.feature, "feature", "json");
        }
        if (!tea_util_1.default.isUnset(tmpReq.options)) {
            request.optionsShrink = openapi_util_1.default.arrayToStringWithSpecifiedStyle(tmpReq.options, "options", "json");
        }
        let query = {};
        if (!tea_util_1.default.isUnset(request.appId)) {
            query["appId"] = request.appId;
        }
        if (!tea_util_1.default.isUnset(request.coolAppCode)) {
            query["coolAppCode"] = request.coolAppCode;
        }
        if (!tea_util_1.default.isUnset(request.corpId)) {
            query["corpId"] = request.corpId;
        }
        if (!tea_util_1.default.isUnset(request.featureShrink)) {
            query["feature"] = request.featureShrink;
        }
        if (!tea_util_1.default.isUnset(request.installUid)) {
            query["installUid"] = request.installUid;
        }
        if (!tea_util_1.default.isUnset(request.openConversationId)) {
            query["openConversationId"] = request.openConversationId;
        }
        if (!tea_util_1.default.isUnset(request.optionsShrink)) {
            query["options"] = request.optionsShrink;
        }
        if (!tea_util_1.default.isUnset(request.suiteId)) {
            query["suiteId"] = request.suiteId;
        }
        let realHeaders = {};
        if (!tea_util_1.default.isUnset(headers.commonHeaders)) {
            realHeaders = headers.commonHeaders;
        }
        if (!tea_util_1.default.isUnset(headers.xAcsDingtalkAccessToken)) {
            realHeaders["x-acs-dingtalk-access-token"] = tea_util_1.default.toJSONString(headers.xAcsDingtalkAccessToken);
        }
        let req = new $OpenApi.OpenApiRequest({
            headers: realHeaders,
            query: openapi_util_1.default.query(query),
        });
        let params = new $OpenApi.Params({
            action: "InstallCoolApp",
            version: "event_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/event/elm/coolApps/install`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new InstallCoolAppResponse({}));
    }
    /**
     * 安装酷应用
     *
     * @param request - InstallCoolAppRequest
     * @returns InstallCoolAppResponse
     */
    async installCoolApp(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new InstallCoolAppHeaders({});
        return await this.installCoolAppWithOptions(request, headers, runtime);
    }
    /**
     * 重新获取suiteTicket
     *
     * @param request - RePushSuiteTicketRequest
     * @param headers - map
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns RePushSuiteTicketResponse
     */
    async rePushSuiteTicketWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.suiteId)) {
            query["suiteId"] = request.suiteId;
        }
        if (!tea_util_1.default.isUnset(request.suiteSecret)) {
            query["suiteSecret"] = request.suiteSecret;
        }
        let req = new $OpenApi.OpenApiRequest({
            headers: headers,
            query: openapi_util_1.default.query(query),
        });
        let params = new $OpenApi.Params({
            action: "RePushSuiteTicket",
            version: "event_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/event/suiteTicket/rePush`,
            method: "POST",
            authType: "Anonymous",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new RePushSuiteTicketResponse({}));
    }
    /**
     * 重新获取suiteTicket
     *
     * @param request - RePushSuiteTicketRequest
     * @returns RePushSuiteTicketResponse
     */
    async rePushSuiteTicket(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = {};
        return await this.rePushSuiteTicketWithOptions(request, headers, runtime);
    }
}
exports.default = Client;
//# sourceMappingURL=client.js.map