"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.UpdateInteractiveCardResponse = exports.UpdateInteractiveCardHeaders = exports.SendSingleInteractiveCardResponse = exports.SendSingleInteractiveCardHeaders = exports.SendInteractiveCardResponse = exports.SendInteractiveCardHeaders = exports.CreateEventGroupResponse = exports.CreateEventGroupHeaders = exports.AddAttendeeToEventGroupResponse = exports.AddAttendeeToEventGroupHeaders = 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 $tea = __importStar(require("@alicloud/tea-typescript"));
class AddAttendeeToEventGroupHeaders 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.AddAttendeeToEventGroupHeaders = AddAttendeeToEventGroupHeaders;
class AddAttendeeToEventGroupResponse 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: { 'type': 'map', 'keyType': 'string', 'valueType': 'any' },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.AddAttendeeToEventGroupResponse = AddAttendeeToEventGroupResponse;
class CreateEventGroupHeaders 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.CreateEventGroupHeaders = CreateEventGroupHeaders;
class CreateEventGroupResponse 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: { 'type': 'map', 'keyType': 'string', 'valueType': 'any' },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateEventGroupResponse = CreateEventGroupResponse;
class SendInteractiveCardHeaders 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.SendInteractiveCardHeaders = SendInteractiveCardHeaders;
class SendInteractiveCardResponse 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: { 'type': 'map', 'keyType': 'string', 'valueType': 'any' },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.SendInteractiveCardResponse = SendInteractiveCardResponse;
class SendSingleInteractiveCardHeaders 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.SendSingleInteractiveCardHeaders = SendSingleInteractiveCardHeaders;
class SendSingleInteractiveCardResponse 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: { 'type': 'map', 'keyType': 'string', 'valueType': 'any' },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.SendSingleInteractiveCardResponse = SendSingleInteractiveCardResponse;
class UpdateInteractiveCardHeaders 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.UpdateInteractiveCardHeaders = UpdateInteractiveCardHeaders;
class UpdateInteractiveCardResponse 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: { 'type': 'map', 'keyType': 'string', 'valueType': 'any' },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.UpdateInteractiveCardResponse = UpdateInteractiveCardResponse;
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 headers - AddAttendeeToEventGroupHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns AddAttendeeToEventGroupResponse
     */
    async addAttendeeToEventGroupWithOptions(userId, groupId, headers, runtime) {
        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,
        });
        let params = new $OpenApi.Params({
            action: "AddAttendeeToEventGroup",
            version: "projectIntegration_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/projectIntegration/users/${userId}/eventGroups/${groupId}/members`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new AddAttendeeToEventGroupResponse({}));
    }
    /**
     * 在项目事件会话中加人
     * @returns AddAttendeeToEventGroupResponse
     */
    async addAttendeeToEventGroup(userId, groupId) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new AddAttendeeToEventGroupHeaders({});
        return await this.addAttendeeToEventGroupWithOptions(userId, groupId, headers, runtime);
    }
    /**
     * 创建项目事件会话
     *
     * @param headers - CreateEventGroupHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns CreateEventGroupResponse
     */
    async createEventGroupWithOptions(userId, headers, runtime) {
        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,
        });
        let params = new $OpenApi.Params({
            action: "CreateEventGroup",
            version: "projectIntegration_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/projectIntegration/users/${userId}/eventGroups`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new CreateEventGroupResponse({}));
    }
    /**
     * 创建项目事件会话
     * @returns CreateEventGroupResponse
     */
    async createEventGroup(userId) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new CreateEventGroupHeaders({});
        return await this.createEventGroupWithOptions(userId, headers, runtime);
    }
    /**
     * 在群会话发送项目卡片消息
     *
     * @param headers - SendInteractiveCardHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns SendInteractiveCardResponse
     */
    async sendInteractiveCardWithOptions(userId, headers, runtime) {
        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,
        });
        let params = new $OpenApi.Params({
            action: "SendInteractiveCard",
            version: "projectIntegration_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/projectIntegration/users/${userId}/groupChatCardMessages`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new SendInteractiveCardResponse({}));
    }
    /**
     * 在群会话发送项目卡片消息
     * @returns SendInteractiveCardResponse
     */
    async sendInteractiveCard(userId) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new SendInteractiveCardHeaders({});
        return await this.sendInteractiveCardWithOptions(userId, headers, runtime);
    }
    /**
     * 单聊会话发送项目卡片消息
     *
     * @param headers - SendSingleInteractiveCardHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns SendSingleInteractiveCardResponse
     */
    async sendSingleInteractiveCardWithOptions(userId, headers, runtime) {
        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,
        });
        let params = new $OpenApi.Params({
            action: "SendSingleInteractiveCard",
            version: "projectIntegration_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/projectIntegration/users/${userId}/singleChatCardMessages`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new SendSingleInteractiveCardResponse({}));
    }
    /**
     * 单聊会话发送项目卡片消息
     * @returns SendSingleInteractiveCardResponse
     */
    async sendSingleInteractiveCard(userId) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new SendSingleInteractiveCardHeaders({});
        return await this.sendSingleInteractiveCardWithOptions(userId, headers, runtime);
    }
    /**
     * 更新项目卡片消息
     *
     * @param headers - UpdateInteractiveCardHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns UpdateInteractiveCardResponse
     */
    async updateInteractiveCardWithOptions(userId, headers, runtime) {
        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,
        });
        let params = new $OpenApi.Params({
            action: "UpdateInteractiveCard",
            version: "projectIntegration_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/projectIntegration/users/${userId}/cardMessages`,
            method: "PUT",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new UpdateInteractiveCardResponse({}));
    }
    /**
     * 更新项目卡片消息
     * @returns UpdateInteractiveCardResponse
     */
    async updateInteractiveCard(userId) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new UpdateInteractiveCardHeaders({});
        return await this.updateInteractiveCardWithOptions(userId, headers, runtime);
    }
}
exports.default = Client;
//# sourceMappingURL=client.js.map