// This file is auto-generated, don't edit it /** */ import Util, * as $Util from '@alicloud/tea-util'; import GatewayClient from '@alicloud/gateway-dingtalk'; import OpenApi, * as $OpenApi from '@alicloud/openapi-client'; import OpenApiUtil from '@alicloud/openapi-util'; import * as $tea from '@alicloud/tea-typescript'; export class CountWorkRecordHeaders extends $tea.Model { commonHeaders?: { [key: string]: string }; xAcsDingtalkAccessToken?: string; static names(): { [key: string]: string } { return { commonHeaders: 'commonHeaders', xAcsDingtalkAccessToken: 'x-acs-dingtalk-access-token', }; } static types(): { [key: string]: any } { return { commonHeaders: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' }, xAcsDingtalkAccessToken: 'string', }; } constructor(map?: { [key: string]: any }) { super(map); } } export class CountWorkRecordRequest extends $tea.Model { /** * @remarks * This parameter is required. */ userId?: string; static names(): { [key: string]: string } { return { userId: 'userId', }; } static types(): { [key: string]: any } { return { userId: 'string', }; } constructor(map?: { [key: string]: any }) { super(map); } } export class CountWorkRecordResponseBody extends $tea.Model { /** * @remarks * This parameter is required. * * @example * 10 */ undoCount?: number; static names(): { [key: string]: string } { return { undoCount: 'undoCount', }; } static types(): { [key: string]: any } { return { undoCount: 'number', }; } constructor(map?: { [key: string]: any }) { super(map); } } export class CountWorkRecordResponse extends $tea.Model { headers?: { [key: string]: string }; statusCode?: number; body?: CountWorkRecordResponseBody; static names(): { [key: string]: string } { return { headers: 'headers', statusCode: 'statusCode', body: 'body', }; } static types(): { [key: string]: any } { return { headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' }, statusCode: 'number', body: CountWorkRecordResponseBody, }; } constructor(map?: { [key: string]: any }) { super(map); } } export default class Client extends OpenApi { constructor(config: $OpenApi.Config) { super(config); let gatewayClient = new GatewayClient(); this._spi = gatewayClient; this._endpointRule = ""; if (Util.empty(this._endpoint)) { this._endpoint = "api.dingtalk.com"; } } /** * 查询个人单企业待办数 * * @param request - CountWorkRecordRequest * @param headers - CountWorkRecordHeaders * @param runtime - runtime options for this request RuntimeOptions * @returns CountWorkRecordResponse */ async countWorkRecordWithOptions(request: CountWorkRecordRequest, headers: CountWorkRecordHeaders, runtime: $Util.RuntimeOptions): Promise { Util.validateModel(request); let query : {[key: string ]: any} = { }; if (!Util.isUnset(request.userId)) { query["userId"] = request.userId; } let realHeaders : {[key: string ]: string} = { }; if (!Util.isUnset(headers.commonHeaders)) { realHeaders = headers.commonHeaders; } if (!Util.isUnset(headers.xAcsDingtalkAccessToken)) { realHeaders["x-acs-dingtalk-access-token"] = Util.toJSONString(headers.xAcsDingtalkAccessToken); } let req = new $OpenApi.OpenApiRequest({ headers: realHeaders, query: OpenApiUtil.query(query), }); let params = new $OpenApi.Params({ action: "CountWorkRecord", version: "workrecord_1.0", protocol: "HTTP", pathname: `/v1.0/workrecord/counts`, method: "GET", authType: "AK", style: "ROA", reqBodyType: "json", bodyType: "json", }); return $tea.cast(await this.execute(params, req, runtime), new CountWorkRecordResponse({})); } /** * 查询个人单企业待办数 * * @param request - CountWorkRecordRequest * @returns CountWorkRecordResponse */ async countWorkRecord(request: CountWorkRecordRequest): Promise { let runtime = new $Util.RuntimeOptions({ }); let headers = new CountWorkRecordHeaders({ }); return await this.countWorkRecordWithOptions(request, headers, runtime); } }