"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.PageListTicketResponseBodyList = exports.PageListRobotResponseBodyList = exports.PageListActionResponseBodyList = exports.PageListActionResponseBodyListActionContent = exports.GetUserSourceListResponseBodyResult = exports.ExecuteActivityRequestProperties = exports.CreateTicketRequestProperties = exports.PageListTicketResponse = exports.PageListTicketResponseBody = exports.PageListTicketRequest = exports.PageListTicketHeaders = exports.PageListRobotResponse = exports.PageListRobotResponseBody = exports.PageListRobotRequest = exports.PageListRobotHeaders = exports.PageListActionResponse = exports.PageListActionResponseBody = exports.PageListActionRequest = exports.PageListActionHeaders = exports.GetUserSourceListResponse = exports.GetUserSourceListResponseBody = exports.GetUserSourceListRequest = exports.GetUserSourceListHeaders = exports.ExecuteActivityResponse = exports.ExecuteActivityResponseBody = exports.ExecuteActivityRequest = exports.ExecuteActivityHeaders = exports.CreateTicketResponse = exports.CreateTicketResponseBody = exports.CreateTicketRequest = exports.CreateTicketHeaders = 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 CreateTicketHeaders 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.CreateTicketHeaders = CreateTicketHeaders;
class CreateTicketRequest extends $tea.Model {
    static names() {
        return {
            foreignId: 'foreignId',
            foreignName: 'foreignName',
            openInstanceId: 'openInstanceId',
            productionType: 'productionType',
            properties: 'properties',
            sourceId: 'sourceId',
            templateId: 'templateId',
            title: 'title',
        };
    }
    static types() {
        return {
            foreignId: 'string',
            foreignName: 'string',
            openInstanceId: 'string',
            productionType: 'number',
            properties: { 'type': 'array', 'itemType': CreateTicketRequestProperties },
            sourceId: 'string',
            templateId: 'string',
            title: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateTicketRequest = CreateTicketRequest;
class CreateTicketResponseBody extends $tea.Model {
    static names() {
        return {
            ticketId: 'ticketId',
        };
    }
    static types() {
        return {
            ticketId: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateTicketResponseBody = CreateTicketResponseBody;
class CreateTicketResponse 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: CreateTicketResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateTicketResponse = CreateTicketResponse;
class ExecuteActivityHeaders 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.ExecuteActivityHeaders = ExecuteActivityHeaders;
class ExecuteActivityRequest extends $tea.Model {
    static names() {
        return {
            activityCode: 'activityCode',
            foreignId: 'foreignId',
            foreignName: 'foreignName',
            openInstanceId: 'openInstanceId',
            productionType: 'productionType',
            properties: 'properties',
            sourceId: 'sourceId',
        };
    }
    static types() {
        return {
            activityCode: 'string',
            foreignId: 'string',
            foreignName: 'string',
            openInstanceId: 'string',
            productionType: 'number',
            properties: { 'type': 'array', 'itemType': ExecuteActivityRequestProperties },
            sourceId: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ExecuteActivityRequest = ExecuteActivityRequest;
class ExecuteActivityResponseBody extends $tea.Model {
    static names() {
        return {
            taskId: 'taskId',
        };
    }
    static types() {
        return {
            taskId: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ExecuteActivityResponseBody = ExecuteActivityResponseBody;
class ExecuteActivityResponse 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: ExecuteActivityResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ExecuteActivityResponse = ExecuteActivityResponse;
class GetUserSourceListHeaders 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.GetUserSourceListHeaders = GetUserSourceListHeaders;
class GetUserSourceListRequest extends $tea.Model {
    static names() {
        return {
            corpId: 'corpId',
            description: 'description',
            openInstanceId: 'openInstanceId',
            orgId: 'orgId',
            orgName: 'orgName',
            productionType: 'productionType',
        };
    }
    static types() {
        return {
            corpId: 'string',
            description: 'string',
            openInstanceId: 'string',
            orgId: 'number',
            orgName: 'string',
            productionType: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetUserSourceListRequest = GetUserSourceListRequest;
class GetUserSourceListResponseBody extends $tea.Model {
    static names() {
        return {
            result: 'result',
        };
    }
    static types() {
        return {
            result: { 'type': 'array', 'itemType': GetUserSourceListResponseBodyResult },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetUserSourceListResponseBody = GetUserSourceListResponseBody;
class GetUserSourceListResponse 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: GetUserSourceListResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetUserSourceListResponse = GetUserSourceListResponse;
class PageListActionHeaders 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.PageListActionHeaders = PageListActionHeaders;
class PageListActionRequest extends $tea.Model {
    static names() {
        return {
            maxResults: 'maxResults',
            nextToken: 'nextToken',
            openInstanceId: 'openInstanceId',
            productionType: 'productionType',
        };
    }
    static types() {
        return {
            maxResults: 'number',
            nextToken: 'string',
            openInstanceId: 'string',
            productionType: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListActionRequest = PageListActionRequest;
class PageListActionResponseBody extends $tea.Model {
    static names() {
        return {
            list: 'list',
            nextCursor: 'nextCursor',
            total: 'total',
        };
    }
    static types() {
        return {
            list: { 'type': 'array', 'itemType': PageListActionResponseBodyList },
            nextCursor: 'number',
            total: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListActionResponseBody = PageListActionResponseBody;
class PageListActionResponse 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: PageListActionResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListActionResponse = PageListActionResponse;
class PageListRobotHeaders 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.PageListRobotHeaders = PageListRobotHeaders;
class PageListRobotRequest extends $tea.Model {
    static names() {
        return {
            corpId: 'corpId',
            maxResults: 'maxResults',
            nextToken: 'nextToken',
            openInstanceId: 'openInstanceId',
            productionType: 'productionType',
        };
    }
    static types() {
        return {
            corpId: 'string',
            maxResults: 'number',
            nextToken: 'number',
            openInstanceId: 'string',
            productionType: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListRobotRequest = PageListRobotRequest;
class PageListRobotResponseBody extends $tea.Model {
    static names() {
        return {
            hasMore: 'hasMore',
            list: 'list',
            nextCursor: 'nextCursor',
            total: 'total',
        };
    }
    static types() {
        return {
            hasMore: 'boolean',
            list: { 'type': 'array', 'itemType': PageListRobotResponseBodyList },
            nextCursor: 'number',
            total: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListRobotResponseBody = PageListRobotResponseBody;
class PageListRobotResponse 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: PageListRobotResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListRobotResponse = PageListRobotResponse;
class PageListTicketHeaders 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.PageListTicketHeaders = PageListTicketHeaders;
class PageListTicketRequest extends $tea.Model {
    static names() {
        return {
            endTime: 'endTime',
            foreignId: 'foreignId',
            maxResults: 'maxResults',
            nextToken: 'nextToken',
            openInstanceId: 'openInstanceId',
            productionType: 'productionType',
            sourceId: 'sourceId',
            startTime: 'startTime',
            templateId: 'templateId',
            ticketId: 'ticketId',
            ticketStatus: 'ticketStatus',
        };
    }
    static types() {
        return {
            endTime: 'number',
            foreignId: 'string',
            maxResults: 'number',
            nextToken: 'string',
            openInstanceId: 'string',
            productionType: 'number',
            sourceId: 'string',
            startTime: 'number',
            templateId: 'string',
            ticketId: 'string',
            ticketStatus: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListTicketRequest = PageListTicketRequest;
class PageListTicketResponseBody extends $tea.Model {
    static names() {
        return {
            list: 'list',
            nextCursor: 'nextCursor',
            total: 'total',
        };
    }
    static types() {
        return {
            list: { 'type': 'array', 'itemType': PageListTicketResponseBodyList },
            nextCursor: 'number',
            total: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListTicketResponseBody = PageListTicketResponseBody;
class PageListTicketResponse 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: PageListTicketResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListTicketResponse = PageListTicketResponse;
class CreateTicketRequestProperties extends $tea.Model {
    static names() {
        return {
            name: 'name',
            value: 'value',
        };
    }
    static types() {
        return {
            name: 'string',
            value: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateTicketRequestProperties = CreateTicketRequestProperties;
class ExecuteActivityRequestProperties extends $tea.Model {
    static names() {
        return {
            name: 'name',
            value: 'value',
        };
    }
    static types() {
        return {
            name: 'string',
            value: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ExecuteActivityRequestProperties = ExecuteActivityRequestProperties;
class GetUserSourceListResponseBodyResult extends $tea.Model {
    static names() {
        return {
            config: 'config',
            description: 'description',
            id: 'id',
            name: 'name',
            status: 'status',
            vendor: 'vendor',
        };
    }
    static types() {
        return {
            config: 'string',
            description: 'string',
            id: 'number',
            name: 'string',
            status: 'number',
            vendor: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.GetUserSourceListResponseBodyResult = GetUserSourceListResponseBodyResult;
class PageListActionResponseBodyListActionContent extends $tea.Model {
    static names() {
        return {
            displayName: 'displayName',
            displayValue: 'displayValue',
            name: 'name',
            value: 'value',
            valueType: 'valueType',
        };
    }
    static types() {
        return {
            displayName: 'string',
            displayValue: 'string',
            name: 'string',
            value: 'string',
            valueType: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListActionResponseBodyListActionContent = PageListActionResponseBodyListActionContent;
class PageListActionResponseBodyList extends $tea.Model {
    static names() {
        return {
            actionCode: 'actionCode',
            actionContent: 'actionContent',
            operator: 'operator',
            operatorId: 'operatorId',
            operatorRole: 'operatorRole',
        };
    }
    static types() {
        return {
            actionCode: 'string',
            actionContent: { 'type': 'array', 'itemType': PageListActionResponseBodyListActionContent },
            operator: 'string',
            operatorId: 'string',
            operatorRole: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListActionResponseBodyList = PageListActionResponseBodyList;
class PageListRobotResponseBodyList extends $tea.Model {
    static names() {
        return {
            accountId: 'accountId',
            appKey: 'appKey',
            id: 'id',
            name: 'name',
            status: 'status',
        };
    }
    static types() {
        return {
            accountId: 'number',
            appKey: 'string',
            id: 'number',
            name: 'string',
            status: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListRobotResponseBodyList = PageListRobotResponseBodyList;
class PageListTicketResponseBodyList extends $tea.Model {
    static names() {
        return {
            bizDataMap: 'bizDataMap',
            foreignId: 'foreignId',
            foreignName: 'foreignName',
            gmtCreate: 'gmtCreate',
            gmtModified: 'gmtModified',
            openInstanceId: 'openInstanceId',
            productionType: 'productionType',
            sourceId: 'sourceId',
            templateId: 'templateId',
            ticketId: 'ticketId',
            ticketStatus: 'ticketStatus',
            title: 'title',
        };
    }
    static types() {
        return {
            bizDataMap: { 'type': 'map', 'keyType': 'string', 'valueType': 'any' },
            foreignId: 'string',
            foreignName: 'string',
            gmtCreate: 'string',
            gmtModified: 'string',
            openInstanceId: 'string',
            productionType: 'number',
            sourceId: 'string',
            templateId: 'string',
            ticketId: 'string',
            ticketStatus: 'string',
            title: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.PageListTicketResponseBodyList = PageListTicketResponseBodyList;
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 - CreateTicketRequest
     * @param headers - CreateTicketHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns CreateTicketResponse
     */
    async createTicketWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let body = {};
        if (!tea_util_1.default.isUnset(request.foreignId)) {
            body["foreignId"] = request.foreignId;
        }
        if (!tea_util_1.default.isUnset(request.foreignName)) {
            body["foreignName"] = request.foreignName;
        }
        if (!tea_util_1.default.isUnset(request.openInstanceId)) {
            body["openInstanceId"] = request.openInstanceId;
        }
        if (!tea_util_1.default.isUnset(request.productionType)) {
            body["productionType"] = request.productionType;
        }
        if (!tea_util_1.default.isUnset(request.properties)) {
            body["properties"] = request.properties;
        }
        if (!tea_util_1.default.isUnset(request.sourceId)) {
            body["sourceId"] = request.sourceId;
        }
        if (!tea_util_1.default.isUnset(request.templateId)) {
            body["templateId"] = request.templateId;
        }
        if (!tea_util_1.default.isUnset(request.title)) {
            body["title"] = request.title;
        }
        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: "CreateTicket",
            version: "customerService_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/customerService/tickets`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new CreateTicketResponse({}));
    }
    /**
     * 创建工单
     *
     * @param request - CreateTicketRequest
     * @returns CreateTicketResponse
     */
    async createTicket(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new CreateTicketHeaders({});
        return await this.createTicketWithOptions(request, headers, runtime);
    }
    /**
     * 执行工单活动
     *
     * @param request - ExecuteActivityRequest
     * @param headers - ExecuteActivityHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns ExecuteActivityResponse
     */
    async executeActivityWithOptions(ticketId, request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let body = {};
        if (!tea_util_1.default.isUnset(request.activityCode)) {
            body["activityCode"] = request.activityCode;
        }
        if (!tea_util_1.default.isUnset(request.foreignId)) {
            body["foreignId"] = request.foreignId;
        }
        if (!tea_util_1.default.isUnset(request.foreignName)) {
            body["foreignName"] = request.foreignName;
        }
        if (!tea_util_1.default.isUnset(request.openInstanceId)) {
            body["openInstanceId"] = request.openInstanceId;
        }
        if (!tea_util_1.default.isUnset(request.productionType)) {
            body["productionType"] = request.productionType;
        }
        if (!tea_util_1.default.isUnset(request.properties)) {
            body["properties"] = request.properties;
        }
        if (!tea_util_1.default.isUnset(request.sourceId)) {
            body["sourceId"] = request.sourceId;
        }
        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: "ExecuteActivity",
            version: "customerService_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/customerService/tickets/${ticketId}`,
            method: "PUT",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new ExecuteActivityResponse({}));
    }
    /**
     * 执行工单活动
     *
     * @param request - ExecuteActivityRequest
     * @returns ExecuteActivityResponse
     */
    async executeActivity(ticketId, request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new ExecuteActivityHeaders({});
        return await this.executeActivityWithOptions(ticketId, request, headers, runtime);
    }
    /**
     * 获取source列表
     *
     * @param request - GetUserSourceListRequest
     * @param headers - GetUserSourceListHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns GetUserSourceListResponse
     */
    async getUserSourceListWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.corpId)) {
            query["corpId"] = request.corpId;
        }
        if (!tea_util_1.default.isUnset(request.description)) {
            query["description"] = request.description;
        }
        if (!tea_util_1.default.isUnset(request.openInstanceId)) {
            query["openInstanceId"] = request.openInstanceId;
        }
        if (!tea_util_1.default.isUnset(request.orgId)) {
            query["orgId"] = request.orgId;
        }
        if (!tea_util_1.default.isUnset(request.orgName)) {
            query["orgName"] = request.orgName;
        }
        if (!tea_util_1.default.isUnset(request.productionType)) {
            query["productionType"] = request.productionType;
        }
        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: "GetUserSourceList",
            version: "customerService_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/customerService/customers/sources`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new GetUserSourceListResponse({}));
    }
    /**
     * 获取source列表
     *
     * @param request - GetUserSourceListRequest
     * @returns GetUserSourceListResponse
     */
    async getUserSourceList(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new GetUserSourceListHeaders({});
        return await this.getUserSourceListWithOptions(request, headers, runtime);
    }
    /**
     * 查询动作记录
     *
     * @param request - PageListActionRequest
     * @param headers - PageListActionHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns PageListActionResponse
     */
    async pageListActionWithOptions(ticketId, request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.maxResults)) {
            query["maxResults"] = request.maxResults;
        }
        if (!tea_util_1.default.isUnset(request.nextToken)) {
            query["nextToken"] = request.nextToken;
        }
        if (!tea_util_1.default.isUnset(request.openInstanceId)) {
            query["openInstanceId"] = request.openInstanceId;
        }
        if (!tea_util_1.default.isUnset(request.productionType)) {
            query["productionType"] = request.productionType;
        }
        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: "PageListAction",
            version: "customerService_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/customerService/tickets/${ticketId}/actions`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new PageListActionResponse({}));
    }
    /**
     * 查询动作记录
     *
     * @param request - PageListActionRequest
     * @returns PageListActionResponse
     */
    async pageListAction(ticketId, request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new PageListActionHeaders({});
        return await this.pageListActionWithOptions(ticketId, request, headers, runtime);
    }
    /**
     * 分页查询机器人信息
     *
     * @param request - PageListRobotRequest
     * @param headers - PageListRobotHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns PageListRobotResponse
     */
    async pageListRobotWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.corpId)) {
            query["corpId"] = request.corpId;
        }
        if (!tea_util_1.default.isUnset(request.maxResults)) {
            query["maxResults"] = request.maxResults;
        }
        if (!tea_util_1.default.isUnset(request.nextToken)) {
            query["nextToken"] = request.nextToken;
        }
        if (!tea_util_1.default.isUnset(request.openInstanceId)) {
            query["openInstanceId"] = request.openInstanceId;
        }
        if (!tea_util_1.default.isUnset(request.productionType)) {
            query["productionType"] = request.productionType;
        }
        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: "PageListRobot",
            version: "customerService_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/customerService/robots`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new PageListRobotResponse({}));
    }
    /**
     * 分页查询机器人信息
     *
     * @param request - PageListRobotRequest
     * @returns PageListRobotResponse
     */
    async pageListRobot(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new PageListRobotHeaders({});
        return await this.pageListRobotWithOptions(request, headers, runtime);
    }
    /**
     * 分页查询工单
     *
     * @param request - PageListTicketRequest
     * @param headers - PageListTicketHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns PageListTicketResponse
     */
    async pageListTicketWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let query = {};
        if (!tea_util_1.default.isUnset(request.endTime)) {
            query["endTime"] = request.endTime;
        }
        if (!tea_util_1.default.isUnset(request.foreignId)) {
            query["foreignId"] = request.foreignId;
        }
        if (!tea_util_1.default.isUnset(request.maxResults)) {
            query["maxResults"] = request.maxResults;
        }
        if (!tea_util_1.default.isUnset(request.nextToken)) {
            query["nextToken"] = request.nextToken;
        }
        if (!tea_util_1.default.isUnset(request.openInstanceId)) {
            query["openInstanceId"] = request.openInstanceId;
        }
        if (!tea_util_1.default.isUnset(request.productionType)) {
            query["productionType"] = request.productionType;
        }
        if (!tea_util_1.default.isUnset(request.sourceId)) {
            query["sourceId"] = request.sourceId;
        }
        if (!tea_util_1.default.isUnset(request.startTime)) {
            query["startTime"] = request.startTime;
        }
        if (!tea_util_1.default.isUnset(request.templateId)) {
            query["templateId"] = request.templateId;
        }
        if (!tea_util_1.default.isUnset(request.ticketId)) {
            query["ticketId"] = request.ticketId;
        }
        if (!tea_util_1.default.isUnset(request.ticketStatus)) {
            query["ticketStatus"] = request.ticketStatus;
        }
        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: "PageListTicket",
            version: "customerService_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/customerService/tickets`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "json",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new PageListTicketResponse({}));
    }
    /**
     * 分页查询工单
     *
     * @param request - PageListTicketRequest
     * @returns PageListTicketResponse
     */
    async pageListTicket(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new PageListTicketHeaders({});
        return await this.pageListTicketWithOptions(request, headers, runtime);
    }
}
exports.default = Client;
//# sourceMappingURL=client.js.map