"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.QueryCallConfigResponseBodyResult = exports.QueryCallConfigResponse = exports.QueryCallConfigResponseBody = exports.QueryCallConfigRequest = exports.QueryCallConfigHeaders = exports.DelCallConfigResponse = exports.DelCallConfigResponseBody = exports.DelCallConfigRequest = exports.DelCallConfigHeaders = exports.AddCallConfigResponse = exports.AddCallConfigResponseBody = exports.AddCallConfigRequest = exports.AddCallConfigHeaders = 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 AddCallConfigHeaders 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.AddCallConfigHeaders = AddCallConfigHeaders;
class AddCallConfigRequest extends $tea.Model {
    static names() {
        return {
            corpId: 'corpId',
            isvToken: 'isvToken',
            phoneNumber: 'phoneNumber',
            scopeType: 'scopeType',
        };
    }
    static types() {
        return {
            corpId: 'string',
            isvToken: 'string',
            phoneNumber: 'string',
            scopeType: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.AddCallConfigRequest = AddCallConfigRequest;
class AddCallConfigResponseBody extends $tea.Model {
    static names() {
        return {
            token: 'token',
        };
    }
    static types() {
        return {
            token: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.AddCallConfigResponseBody = AddCallConfigResponseBody;
class AddCallConfigResponse 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: AddCallConfigResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.AddCallConfigResponse = AddCallConfigResponse;
class DelCallConfigHeaders 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.DelCallConfigHeaders = DelCallConfigHeaders;
class DelCallConfigRequest extends $tea.Model {
    static names() {
        return {
            corpId: 'corpId',
            isvToken: 'isvToken',
            phoneNumber: 'phoneNumber',
        };
    }
    static types() {
        return {
            corpId: 'string',
            isvToken: 'string',
            phoneNumber: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.DelCallConfigRequest = DelCallConfigRequest;
class DelCallConfigResponseBody extends $tea.Model {
    static names() {
        return {
            result: 'result',
        };
    }
    static types() {
        return {
            result: 'boolean',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.DelCallConfigResponseBody = DelCallConfigResponseBody;
class DelCallConfigResponse 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: DelCallConfigResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.DelCallConfigResponse = DelCallConfigResponse;
class QueryCallConfigHeaders 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.QueryCallConfigHeaders = QueryCallConfigHeaders;
class QueryCallConfigRequest extends $tea.Model {
    static names() {
        return {
            corpId: 'corpId',
            isvToken: 'isvToken',
            phoneNumber: 'phoneNumber',
            scopeType: 'scopeType',
        };
    }
    static types() {
        return {
            corpId: 'string',
            isvToken: 'string',
            phoneNumber: 'string',
            scopeType: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.QueryCallConfigRequest = QueryCallConfigRequest;
class QueryCallConfigResponseBody extends $tea.Model {
    static names() {
        return {
            result: 'result',
        };
    }
    static types() {
        return {
            result: { 'type': 'array', 'itemType': QueryCallConfigResponseBodyResult },
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.QueryCallConfigResponseBody = QueryCallConfigResponseBody;
class QueryCallConfigResponse 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: QueryCallConfigResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.QueryCallConfigResponse = QueryCallConfigResponse;
class QueryCallConfigResponseBodyResult extends $tea.Model {
    static names() {
        return {
            accountDomain: 'accountDomain',
            accountId: 'accountId',
            callInType: 'callInType',
            callOutType: 'callOutType',
            createUid: 'createUid',
            phoneNumber: 'phoneNumber',
            scopeType: 'scopeType',
            showType: 'showType',
            sourceType: 'sourceType',
            status: 'status',
        };
    }
    static types() {
        return {
            accountDomain: 'string',
            accountId: 'string',
            callInType: 'number',
            callOutType: 'number',
            createUid: 'string',
            phoneNumber: 'string',
            scopeType: 'string',
            showType: 'number',
            sourceType: 'string',
            status: 'number',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.QueryCallConfigResponseBodyResult = QueryCallConfigResponseBodyResult;
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 - AddCallConfigRequest
     * @param headers - AddCallConfigHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns AddCallConfigResponse
     */
    async addCallConfigWithOptions(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.isvToken)) {
            query["isvToken"] = request.isvToken;
        }
        if (!tea_util_1.default.isUnset(request.phoneNumber)) {
            query["phoneNumber"] = request.phoneNumber;
        }
        if (!tea_util_1.default.isUnset(request.scopeType)) {
            query["scopeType"] = request.scopeType;
        }
        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: "AddCallConfig",
            version: "dingPhone_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/dingPhone/callConfigs`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new AddCallConfigResponse({}));
    }
    /**
     * 添加外呼码号配置
     *
     * @param request - AddCallConfigRequest
     * @returns AddCallConfigResponse
     */
    async addCallConfig(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new AddCallConfigHeaders({});
        return await this.addCallConfigWithOptions(request, headers, runtime);
    }
    /**
     * 删除码号配置
     *
     * @param request - DelCallConfigRequest
     * @param headers - DelCallConfigHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns DelCallConfigResponse
     */
    async delCallConfigWithOptions(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.isvToken)) {
            query["isvToken"] = request.isvToken;
        }
        if (!tea_util_1.default.isUnset(request.phoneNumber)) {
            query["phoneNumber"] = request.phoneNumber;
        }
        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: "DelCallConfig",
            version: "dingPhone_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/dingPhone/callConfigs`,
            method: "DELETE",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new DelCallConfigResponse({}));
    }
    /**
     * 删除码号配置
     *
     * @param request - DelCallConfigRequest
     * @returns DelCallConfigResponse
     */
    async delCallConfig(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new DelCallConfigHeaders({});
        return await this.delCallConfigWithOptions(request, headers, runtime);
    }
    /**
     * 查询外呼码号配置
     *
     * @param request - QueryCallConfigRequest
     * @param headers - QueryCallConfigHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns QueryCallConfigResponse
     */
    async queryCallConfigWithOptions(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.isvToken)) {
            query["isvToken"] = request.isvToken;
        }
        if (!tea_util_1.default.isUnset(request.phoneNumber)) {
            query["phoneNumber"] = request.phoneNumber;
        }
        if (!tea_util_1.default.isUnset(request.scopeType)) {
            query["scopeType"] = request.scopeType;
        }
        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: "QueryCallConfig",
            version: "dingPhone_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/dingPhone/callConfigs`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new QueryCallConfigResponse({}));
    }
    /**
     * 查询外呼码号配置
     *
     * @param request - QueryCallConfigRequest
     * @returns QueryCallConfigResponse
     */
    async queryCallConfig(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new QueryCallConfigHeaders({});
        return await this.queryCallConfigWithOptions(request, headers, runtime);
    }
}
exports.default = Client;
//# sourceMappingURL=client.js.map