"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.ListActivityResponseBodyList = exports.CreateActivityRequestDetail = exports.CreateActivityRequestDetailAddress = exports.ListActivityResponse = exports.ListActivityResponseBody = exports.ListActivityRequest = exports.ListActivityHeaders = exports.CreateActivityResponse = exports.CreateActivityResponseBody = exports.CreateActivityRequest = exports.CreateActivityHeaders = 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 CreateActivityHeaders 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.CreateActivityHeaders = CreateActivityHeaders;
class CreateActivityRequest extends $tea.Model {
    static names() {
        return {
            detail: 'detail',
        };
    }
    static types() {
        return {
            detail: CreateActivityRequestDetail,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateActivityRequest = CreateActivityRequest;
class CreateActivityResponseBody extends $tea.Model {
    static names() {
        return {
            activityId: 'activityId',
        };
    }
    static types() {
        return {
            activityId: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateActivityResponseBody = CreateActivityResponseBody;
class CreateActivityResponse 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: CreateActivityResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateActivityResponse = CreateActivityResponse;
class ListActivityHeaders 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.ListActivityHeaders = ListActivityHeaders;
class ListActivityRequest extends $tea.Model {
    static names() {
        return {
            maxResults: 'maxResults',
            nextToken: 'nextToken',
        };
    }
    static types() {
        return {
            maxResults: 'number',
            nextToken: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListActivityRequest = ListActivityRequest;
class ListActivityResponseBody extends $tea.Model {
    static names() {
        return {
            list: 'list',
            maxResults: 'maxResults',
            nextToken: 'nextToken',
        };
    }
    static types() {
        return {
            list: { 'type': 'array', 'itemType': ListActivityResponseBodyList },
            maxResults: 'string',
            nextToken: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListActivityResponseBody = ListActivityResponseBody;
class ListActivityResponse 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: ListActivityResponseBody,
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListActivityResponse = ListActivityResponse;
class CreateActivityRequestDetailAddress extends $tea.Model {
    static names() {
        return {
            district: 'district',
            lat: 'lat',
            lng: 'lng',
            name: 'name',
        };
    }
    static types() {
        return {
            district: 'string',
            lat: 'string',
            lng: 'string',
            name: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateActivityRequestDetailAddress = CreateActivityRequestDetailAddress;
class CreateActivityRequestDetail extends $tea.Model {
    static names() {
        return {
            address: 'address',
            bannerMediaId: 'bannerMediaId',
            endTime: 'endTime',
            foreignId: 'foreignId',
            industry: 'industry',
            roleName: 'roleName',
            source: 'source',
            startTime: 'startTime',
            title: 'title',
            type: 'type',
            url: 'url',
        };
    }
    static types() {
        return {
            address: CreateActivityRequestDetailAddress,
            bannerMediaId: 'string',
            endTime: 'number',
            foreignId: 'string',
            industry: 'string',
            roleName: 'string',
            source: 'string',
            startTime: 'number',
            title: 'string',
            type: 'number',
            url: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.CreateActivityRequestDetail = CreateActivityRequestDetail;
class ListActivityResponseBodyList extends $tea.Model {
    static names() {
        return {
            activityId: 'activityId',
            bannerMediaId: 'bannerMediaId',
            endTime: 'endTime',
            foreignId: 'foreignId',
            startTime: 'startTime',
            status: 'status',
            title: 'title',
            type: 'type',
            url: 'url',
        };
    }
    static types() {
        return {
            activityId: 'string',
            bannerMediaId: 'string',
            endTime: 'number',
            foreignId: 'string',
            startTime: 'number',
            status: 'string',
            title: 'string',
            type: 'string',
            url: 'string',
        };
    }
    constructor(map) {
        super(map);
    }
}
exports.ListActivityResponseBodyList = ListActivityResponseBodyList;
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 - CreateActivityRequest
     * @param headers - CreateActivityHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns CreateActivityResponse
     */
    async createActivityWithOptions(request, headers, runtime) {
        tea_util_1.default.validateModel(request);
        let body = {};
        if (!tea_util_1.default.isUnset(request.detail)) {
            body["detail"] = request.detail;
        }
        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: "CreateActivity",
            version: "activity_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/activity/meta`,
            method: "POST",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new CreateActivityResponse({}));
    }
    /**
     * 创建活动
     *
     * @param request - CreateActivityRequest
     * @returns CreateActivityResponse
     */
    async createActivity(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new CreateActivityHeaders({});
        return await this.createActivityWithOptions(request, headers, runtime);
    }
    /**
     * 查询活动列表
     *
     * @param request - ListActivityRequest
     * @param headers - ListActivityHeaders
     * @param runtime - runtime options for this request RuntimeOptions
     * @returns ListActivityResponse
     */
    async listActivityWithOptions(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;
        }
        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: "ListActivity",
            version: "activity_1.0",
            protocol: "HTTP",
            pathname: `/v1.0/activity/metaLists`,
            method: "GET",
            authType: "AK",
            style: "ROA",
            reqBodyType: "none",
            bodyType: "json",
        });
        return $tea.cast(await this.execute(params, req, runtime), new ListActivityResponse({}));
    }
    /**
     * 查询活动列表
     *
     * @param request - ListActivityRequest
     * @returns ListActivityResponse
     */
    async listActivity(request) {
        let runtime = new $Util.RuntimeOptions({});
        let headers = new ListActivityHeaders({});
        return await this.listActivityWithOptions(request, headers, runtime);
    }
}
exports.default = Client;
//# sourceMappingURL=client.js.map