"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.ListSearchTabsByOrgIdResponseBodySearchTabResult = exports.GetSearchItemsByKeyWordResponseBodyValue = exports.BatchInsertSearchItemRequestSearchItemModels = exports.UpdateSearchTabResponse = exports.UpdateSearchTabRequest = exports.UpdateSearchTabHeaders = exports.ListSearchTabsByOrgIdResponse = exports.ListSearchTabsByOrgIdResponseBody = exports.ListSearchTabsByOrgIdHeaders = exports.InsertSearchItemResponse = exports.InsertSearchItemRequest = exports.InsertSearchItemHeaders = exports.GetSearchTabResponse = exports.GetSearchTabResponseBody = exports.GetSearchTabHeaders = exports.GetSearchItemsByKeyWordResponse = exports.GetSearchItemsByKeyWordResponseBody = exports.GetSearchItemsByKeyWordRequest = exports.GetSearchItemsByKeyWordHeaders = exports.GetSearchItemResponse = exports.GetSearchItemResponseBody = exports.GetSearchItemHeaders = exports.DeleteSearchTabResponse = exports.DeleteSearchTabHeaders = exports.DeleteSearchItemResponse = exports.DeleteSearchItemHeaders = exports.CreateSearchTabResponse = exports.CreateSearchTabResponseBody = exports.CreateSearchTabRequest = exports.CreateSearchTabHeaders = exports.BatchInsertSearchItemResponse = exports.BatchInsertSearchItemRequest = exports.BatchInsertSearchItemHeaders = 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 BatchInsertSearchItemHeaders 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.BatchInsertSearchItemHeaders = BatchInsertSearchItemHeaders;
class BatchInsertSearchItemRequest extends $tea.Model {
    static names() {
        return {
            searchItemModels: 'searchItemModels',
        };
    }
    static types() {
        return {
            searchItemModels: { 'type': 'array', 'itemType': BatchInsertSearchItemRequestSearchItemModels },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.BatchInsertSearchItemRequest = BatchInsertSearchItemRequest;
class BatchInsertSearchItemResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.BatchInsertSearchItemResponse = BatchInsertSearchItemResponse;
class CreateSearchTabHeaders 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.CreateSearchTabHeaders = CreateSearchTabHeaders;
class CreateSearchTabRequest extends $tea.Model {
    static names() {
        return {
            darkIcon: 'darkIcon',
            icon: 'icon',
            name: 'name',
            priority: 'priority',
            source: 'source',
            status: 'status',
        };
    }
    static types() {
        return {
            darkIcon: 'string',
            icon: 'string',
            name: 'string',
            priority: 'number',
            source: 'string',
            status: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateSearchTabRequest = CreateSearchTabRequest;
class CreateSearchTabResponseBody extends $tea.Model {
    static names() {
        return {
            tabId: 'tabId',
        };
    }
    static types() {
        return {
            tabId: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateSearchTabResponseBody = CreateSearchTabResponseBody;
class CreateSearchTabResponse 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: CreateSearchTabResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateSearchTabResponse = CreateSearchTabResponse;
class DeleteSearchItemHeaders 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.DeleteSearchItemHeaders = DeleteSearchItemHeaders;
class DeleteSearchItemResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.DeleteSearchItemResponse = DeleteSearchItemResponse;
class DeleteSearchTabHeaders 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.DeleteSearchTabHeaders = DeleteSearchTabHeaders;
class DeleteSearchTabResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.DeleteSearchTabResponse = DeleteSearchTabResponse;
class GetSearchItemHeaders 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.GetSearchItemHeaders = GetSearchItemHeaders;
class GetSearchItemResponseBody extends $tea.Model {
    static names() {
        return {
            footer: 'footer',
            gmtCreate: 'gmtCreate',
            gmtModified: 'gmtModified',
            icon: 'icon',
            itemId: 'itemId',
            mobileUrl: 'mobileUrl',
            pcUrl: 'pcUrl',
            summary: 'summary',
            tabId: 'tabId',
            title: 'title',
            url: 'url',
        };
    }
    static types() {
        return {
            footer: 'string',
            gmtCreate: 'string',
            gmtModified: 'string',
            icon: 'string',
            itemId: 'string',
            mobileUrl: 'string',
            pcUrl: 'string',
            summary: 'string',
            tabId: 'number',
            title: 'string',
            url: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetSearchItemResponseBody = GetSearchItemResponseBody;
class GetSearchItemResponse 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: GetSearchItemResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetSearchItemResponse = GetSearchItemResponse;
class GetSearchItemsByKeyWordHeaders 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.GetSearchItemsByKeyWordHeaders = GetSearchItemsByKeyWordHeaders;
class GetSearchItemsByKeyWordRequest extends $tea.Model {
    static names() {
        return {
            keyWord: 'keyWord',
            maxResults: 'maxResults',
            nextToken: 'nextToken',
        };
    }
    static types() {
        return {
            keyWord: 'string',
            maxResults: 'number',
            nextToken: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetSearchItemsByKeyWordRequest = GetSearchItemsByKeyWordRequest;
class GetSearchItemsByKeyWordResponseBody extends $tea.Model {
    static names() {
        return {
            nextToken: 'nextToken',
            totalCount: 'totalCount',
            value: 'value',
        };
    }
    static types() {
        return {
            nextToken: 'string',
            totalCount: 'number',
            value: { 'type': 'array', 'itemType': GetSearchItemsByKeyWordResponseBodyValue },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetSearchItemsByKeyWordResponseBody = GetSearchItemsByKeyWordResponseBody;
class GetSearchItemsByKeyWordResponse 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: GetSearchItemsByKeyWordResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetSearchItemsByKeyWordResponse = GetSearchItemsByKeyWordResponse;
class GetSearchTabHeaders 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.GetSearchTabHeaders = GetSearchTabHeaders;
class GetSearchTabResponseBody extends $tea.Model {
    static names() {
        return {
            darkIcon: 'darkIcon',
            gmtCreate: 'gmtCreate',
            gmtModified: 'gmtModified',
            icon: 'icon',
            name: 'name',
            priority: 'priority',
            source: 'source',
            status: 'status',
            tabId: 'tabId',
        };
    }
    static types() {
        return {
            darkIcon: 'string',
            gmtCreate: 'string',
            gmtModified: 'string',
            icon: 'string',
            name: 'string',
            priority: 'number',
            source: 'string',
            status: 'number',
            tabId: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetSearchTabResponseBody = GetSearchTabResponseBody;
class GetSearchTabResponse 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: GetSearchTabResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetSearchTabResponse = GetSearchTabResponse;
class InsertSearchItemHeaders 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.InsertSearchItemHeaders = InsertSearchItemHeaders;
class InsertSearchItemRequest extends $tea.Model {
    static names() {
        return {
            footer: 'footer',
            icon: 'icon',
            itemId: 'itemId',
            mobileUrl: 'mobileUrl',
            pcUrl: 'pcUrl',
            summary: 'summary',
            title: 'title',
            url: 'url',
        };
    }
    static types() {
        return {
            footer: 'string',
            icon: 'string',
            itemId: 'string',
            mobileUrl: 'string',
            pcUrl: 'string',
            summary: 'string',
            title: 'string',
            url: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InsertSearchItemRequest = InsertSearchItemRequest;
class InsertSearchItemResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.InsertSearchItemResponse = InsertSearchItemResponse;
class ListSearchTabsByOrgIdHeaders 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.ListSearchTabsByOrgIdHeaders = ListSearchTabsByOrgIdHeaders;
class ListSearchTabsByOrgIdResponseBody extends $tea.Model {
    static names() {
        return {
            searchTabResult: 'searchTabResult',
        };
    }
    static types() {
        return {
            searchTabResult: { 'type': 'array', 'itemType': ListSearchTabsByOrgIdResponseBodySearchTabResult },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListSearchTabsByOrgIdResponseBody = ListSearchTabsByOrgIdResponseBody;
class ListSearchTabsByOrgIdResponse 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: ListSearchTabsByOrgIdResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListSearchTabsByOrgIdResponse = ListSearchTabsByOrgIdResponse;
class UpdateSearchTabHeaders 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.UpdateSearchTabHeaders = UpdateSearchTabHeaders;
class UpdateSearchTabRequest extends $tea.Model {
    static names() {
        return {
            darkIcon: 'darkIcon',
            icon: 'icon',
            name: 'name',
            priority: 'priority',
            source: 'source',
            status: 'status',
        };
    }
    static types() {
        return {
            darkIcon: 'string',
            icon: 'string',
            name: 'string',
            priority: 'number',
            source: 'string',
            status: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.UpdateSearchTabRequest = UpdateSearchTabRequest;
class UpdateSearchTabResponse extends $tea.Model {
    static names() {
        return {
            headers: 'headers',
            statusCode: 'statusCode',
        };
    }
    static types() {
        return {
            headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
            statusCode: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.UpdateSearchTabResponse = UpdateSearchTabResponse;
class BatchInsertSearchItemRequestSearchItemModels extends $tea.Model {
    static names() {
        return {
            footer: 'footer',
            icon: 'icon',
            itemId: 'itemId',
            mobileUrl: 'mobileUrl',
            pcUrl: 'pcUrl',
            summary: 'summary',
            title: 'title',
            url: 'url',
        };
    }
    static types() {
        return {
            footer: 'string',
            icon: 'string',
            itemId: 'string',
            mobileUrl: 'string',
            pcUrl: 'string',
            summary: 'string',
            title: 'string',
            url: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.BatchInsertSearchItemRequestSearchItemModels = BatchInsertSearchItemRequestSearchItemModels;
class GetSearchItemsByKeyWordResponseBodyValue extends $tea.Model {
    static names() {
        return {
            footer: 'footer',
            gmtCreate: 'gmtCreate',
            gmtModified: 'gmtModified',
            icon: 'icon',
            itemId: 'itemId',
            mobileUrl: 'mobileUrl',
            pcUrl: 'pcUrl',
            summary: 'summary',
            tabId: 'tabId',
            title: 'title',
            url: 'url',
        };
    }
    static types() {
        return {
            footer: 'string',
            gmtCreate: 'string',
            gmtModified: 'string',
            icon: 'string',
            itemId: 'string',
            mobileUrl: 'string',
            pcUrl: 'string',
            summary: 'string',
            tabId: 'number',
            title: 'string',
            url: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetSearchItemsByKeyWordResponseBodyValue = GetSearchItemsByKeyWordResponseBodyValue;
class ListSearchTabsByOrgIdResponseBodySearchTabResult extends $tea.Model {
    static names() {
        return {
            darkIcon: 'darkIcon',
            gmtCreate: 'gmtCreate',
            gmtModified: 'gmtModified',
            icon: 'icon',
            name: 'name',
            priority: 'priority',
            source: 'source',
            status: 'status',
            tabId: 'tabId',
        };
    }
    static types() {
        return {
            darkIcon: 'string',
            gmtCreate: 'string',
            gmtModified: 'string',
            icon: 'string',
            name: 'string',
            priority: 'number',
            source: 'string',
            status: 'number',
            tabId: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListSearchTabsByOrgIdResponseBodySearchTabResult = ListSearchTabsByOrgIdResponseBodySearchTabResult;
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 - BatchInsertSearchItemRequest
     * @param headers - BatchInsertSearchItemHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns BatchInsertSearchItemResponse
     */
    async batchInsertSearchItemWithOptions(tabId, request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let body = {};
        if (!tea_util_1.default.isUnset(request.searchItemModels)) {
            body["searchItemModels"] = request.searchItemModels;
        }
        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,
            body: openapi_util_1.default.parseToMap(body),
        });
        let params = new $OpenApi.Params({
            action: "BatchInsertSearchItem",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs/${tabId}/items/batch`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "none",
        });
        return $tea.cast(await this.execute(params, req, runtime), new BatchInsertSearchItemResponse({}));
    }
    /**
     * 为指定的数据源批量添加数据项
     *
     * @param request - BatchInsertSearchItemRequest
     * @returns BatchInsertSearchItemResponse
     */
    async batchInsertSearchItem(tabId, request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new BatchInsertSearchItemHeaders({});
        return await this.batchInsertSearchItemWithOptions(tabId, request, headers, runtime);
    }
    /**
     * 创建搜索数据源
     *
     * @param request - CreateSearchTabRequest
     * @param headers - CreateSearchTabHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns CreateSearchTabResponse
     */
    async createSearchTabWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let body = {};
        if (!tea_util_1.default.isUnset(request.darkIcon)) {
            body["darkIcon"] = request.darkIcon;
        }
        if (!tea_util_1.default.isUnset(request.icon)) {
            body["icon"] = request.icon;
        }
        if (!tea_util_1.default.isUnset(request.name)) {
            body["name"] = request.name;
        }
        if (!tea_util_1.default.isUnset(request.priority)) {
            body["priority"] = request.priority;
        }
        if (!tea_util_1.default.isUnset(request.source)) {
            body["source"] = request.source;
        }
        if (!tea_util_1.default.isUnset(request.status)) {
            body["status"] = request.status;
        }
        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,
            body: openapi_util_1.default.parseToMap(body),
        });
        let params = new $OpenApi.Params({
            action: "CreateSearchTab",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new CreateSearchTabResponse({}));
    }
    /**
     * 创建搜索数据源
     *
     * @param request - CreateSearchTabRequest
     * @returns CreateSearchTabResponse
     */
    async createSearchTab(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new CreateSearchTabHeaders({});
        return await this.createSearchTabWithOptions(request, headers, runtime);
    }
    /**
     * 从指定的数据源中删除一条数据项
     *
     * @param headers - DeleteSearchItemHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns DeleteSearchItemResponse
     */
    async deleteSearchItemWithOptions(tabId, itemId, 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: "DeleteSearchItem",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs/${tabId}/items/${itemId}`,
            method: "DELETE",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new DeleteSearchItemResponse({}));
    }
    /**
     * 从指定的数据源中删除一条数据项
     * @returns DeleteSearchItemResponse
     */
    async deleteSearchItem(tabId, itemId) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new DeleteSearchItemHeaders({});
        return await this.deleteSearchItemWithOptions(tabId, itemId, headers, runtime);
    }
    /**
     * 删除搜索数据源
     *
     * @param headers - DeleteSearchTabHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns DeleteSearchTabResponse
     */
    async deleteSearchTabWithOptions(tabId, 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: "DeleteSearchTab",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs/${tabId}`,
            method: "DELETE",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new DeleteSearchTabResponse({}));
    }
    /**
     * 删除搜索数据源
     * @returns DeleteSearchTabResponse
     */
    async deleteSearchTab(tabId) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new DeleteSearchTabHeaders({});
        return await this.deleteSearchTabWithOptions(tabId, headers, runtime);
    }
    /**
     * 获取指定数据源中的一条数据项
     *
     * @param headers - GetSearchItemHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns GetSearchItemResponse
     */
    async getSearchItemWithOptions(tabId, itemId, 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: "GetSearchItem",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs/${tabId}/items/${itemId}`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new GetSearchItemResponse({}));
    }
    /**
     * 获取指定数据源中的一条数据项
     * @returns GetSearchItemResponse
     */
    async getSearchItem(tabId, itemId) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new GetSearchItemHeaders({});
        return await this.getSearchItemWithOptions(tabId, itemId, headers, runtime);
    }
    /**
     * 根据搜索关键词获取相关数据项
     *
     * @param request - GetSearchItemsByKeyWordRequest
     * @param headers - GetSearchItemsByKeyWordHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns GetSearchItemsByKeyWordResponse
     */
    async getSearchItemsByKeyWordWithOptions(tabId, request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.keyWord)) {
            query["keyWord"] = request.keyWord;
        }
        if (!tea_util_1.default.isUnset(request.maxResults)) {
            query["maxResults"] = request.maxResults;
        }
        if (!tea_util_1.default.isUnset(request.nextToken)) {
            query["nextToken"] = request.nextToken;
        }
        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: "GetSearchItemsByKeyWord",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs/${tabId}/items`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new GetSearchItemsByKeyWordResponse({}));
    }
    /**
     * 根据搜索关键词获取相关数据项
     *
     * @param request - GetSearchItemsByKeyWordRequest
     * @returns GetSearchItemsByKeyWordResponse
     */
    async getSearchItemsByKeyWord(tabId, request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new GetSearchItemsByKeyWordHeaders({});
        return await this.getSearchItemsByKeyWordWithOptions(tabId, request, headers, runtime);
    }
    /**
     * 获取搜索数据源
     *
     * @param headers - GetSearchTabHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns GetSearchTabResponse
     */
    async getSearchTabWithOptions(tabId, 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: "GetSearchTab",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs/${tabId}`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new GetSearchTabResponse({}));
    }
    /**
     * 获取搜索数据源
     * @returns GetSearchTabResponse
     */
    async getSearchTab(tabId) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new GetSearchTabHeaders({});
        return await this.getSearchTabWithOptions(tabId, headers, runtime);
    }
    /**
     * 为指定的数据源添加一条数据项
     *
     * @param request - InsertSearchItemRequest
     * @param headers - InsertSearchItemHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns InsertSearchItemResponse
     */
    async insertSearchItemWithOptions(tabId, request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let body = {};
        if (!tea_util_1.default.isUnset(request.footer)) {
            body["footer"] = request.footer;
        }
        if (!tea_util_1.default.isUnset(request.icon)) {
            body["icon"] = request.icon;
        }
        if (!tea_util_1.default.isUnset(request.itemId)) {
            body["itemId"] = request.itemId;
        }
        if (!tea_util_1.default.isUnset(request.mobileUrl)) {
            body["mobileUrl"] = request.mobileUrl;
        }
        if (!tea_util_1.default.isUnset(request.pcUrl)) {
            body["pcUrl"] = request.pcUrl;
        }
        if (!tea_util_1.default.isUnset(request.summary)) {
            body["summary"] = request.summary;
        }
        if (!tea_util_1.default.isUnset(request.title)) {
            body["title"] = request.title;
        }
        if (!tea_util_1.default.isUnset(request.url)) {
            body["url"] = request.url;
        }
        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,
            body: openapi_util_1.default.parseToMap(body),
        });
        let params = new $OpenApi.Params({
            action: "InsertSearchItem",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs/${tabId}/items`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "none",
        });
        return $tea.cast(await this.execute(params, req, runtime), new InsertSearchItemResponse({}));
    }
    /**
     * 为指定的数据源添加一条数据项
     *
     * @param request - InsertSearchItemRequest
     * @returns InsertSearchItemResponse
     */
    async insertSearchItem(tabId, request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new InsertSearchItemHeaders({});
        return await this.insertSearchItemWithOptions(tabId, request, headers, runtime);
    }
    /**
     * 列出企业所有的搜索数据源
     *
     * @param headers - ListSearchTabsByOrgIdHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns ListSearchTabsByOrgIdResponse
     */
    async listSearchTabsByOrgIdWithOptions(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: "ListSearchTabsByOrgId",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new ListSearchTabsByOrgIdResponse({}));
    }
    /**
     * 列出企业所有的搜索数据源
     * @returns ListSearchTabsByOrgIdResponse
     */
    async listSearchTabsByOrgId() {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new ListSearchTabsByOrgIdHeaders({});
        return await this.listSearchTabsByOrgIdWithOptions(headers, runtime);
    }
    /**
     * 更新搜索数据源
     *
     * @param request - UpdateSearchTabRequest
     * @param headers - UpdateSearchTabHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns UpdateSearchTabResponse
     */
    async updateSearchTabWithOptions(tabId, request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let body = {};
        if (!tea_util_1.default.isUnset(request.darkIcon)) {
            body["darkIcon"] = request.darkIcon;
        }
        if (!tea_util_1.default.isUnset(request.icon)) {
            body["icon"] = request.icon;
        }
        if (!tea_util_1.default.isUnset(request.name)) {
            body["name"] = request.name;
        }
        if (!tea_util_1.default.isUnset(request.priority)) {
            body["priority"] = request.priority;
        }
        if (!tea_util_1.default.isUnset(request.source)) {
            body["source"] = request.source;
        }
        if (!tea_util_1.default.isUnset(request.status)) {
            body["status"] = request.status;
        }
        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,
            body: openapi_util_1.default.parseToMap(body),
        });
        let params = new $OpenApi.Params({
            action: "UpdateSearchTab",
            version: "search_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/search/tabs/${tabId}`,
            method: "PUT",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "none",
        });
        return $tea.cast(await this.execute(params, req, runtime), new UpdateSearchTabResponse({}));
    }
    /**
     * 更新搜索数据源
     *
     * @param request - UpdateSearchTabRequest
     * @returns UpdateSearchTabResponse
     */
    async updateSearchTab(tabId, request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new UpdateSearchTabHeaders({});
        return await this.updateSearchTabWithOptions(tabId, request, headers, runtime);
    }
}
exports.default = Client;
//# sourceMappingURL=client.js.map