aipodcast-20250228/main.tea (198 lines of code) (raw):

/** * */ import Util; import OpenApi; import OpenApiUtil; import EndpointUtil; extends OpenApi; init(config: OpenApi.Config){ super(config); @endpointRule = ''; checkConfig(config); @endpoint = getEndpoint('aipodcast', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint); } function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{ if (!Util.empty(endpoint)) { return endpoint; } if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) { return endpointMap[regionId]; } return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix); } model PodcastTaskResultQueryRequest { taskId?: string(name='taskId', description='This parameter is required.', example='63c4e0eaab3b4c0db208ecafa990e8d1'), workspaceId?: string(name='workspaceId', description='This parameter is required.', example='llm-ep8ba0dr6seiddri'), } model PodcastTaskResultQueryResponseBody = { code?: string(name='code', example='"success"'), data?: { resultUrl?: any(name='resultUrl', example='{ "audio": "http://note-ai-file.oss-cn-beijing.aliyuncs.com/202503241702148295/audio.mp3?OSSAccessKeyId=LTAI5tPLWJfJHNkZbfnQv245&Expires=1742810788&Signature=b5p83nh443Gr7foqdvgrI4%2FKZVM%3D", "script": "http://note-ai-file.oss-cn-beijing.aliyuncs.com/202503241702148295/script.txt?OSSAccessKeyId=LTAI5tPLWJfJHNkZbfnQv245&Expires=1742810622&Signature=TBBdikHzOWW3YqDw3sNMTXiMo6A%3D" }'), script?: string(name='script'), taskId?: string(name='taskId', example='63c4e0eaab3b4c0db208ecafa990e8d1'), taskStatus?: string(name='taskStatus', example='SUCCEEDED'), }(name='data'), httpStatusCode?: string(name='httpStatusCode', example='200'), message?: string(name='message', example='"success"'), requestId?: string(name='requestId', example='C38F034D-7F36-531C-95AC-0C752F80E840'), success?: boolean(name='success', example='True'), } model PodcastTaskResultQueryResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: PodcastTaskResultQueryResponseBody(name='body'), } /** * @summary ai播客生成任务结果查询 * * @param request PodcastTaskResultQueryRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return PodcastTaskResultQueryResponse */ async function podcastTaskResultQueryWithOptions(request: PodcastTaskResultQueryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PodcastTaskResultQueryResponse { Util.validateModel(request); var body : map[string]any = {}; if (!Util.isUnset(request.taskId)) { body['taskId'] = request.taskId; } if (!Util.isUnset(request.workspaceId)) { body['workspaceId'] = request.workspaceId; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'PodcastTaskResultQuery', version = '2025-02-28', protocol = 'HTTPS', pathname = `/podcast/task`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) { return callApi(params, req, runtime); } else { return execute(params, req, runtime); } } /** * @summary ai播客生成任务结果查询 * * @param request PodcastTaskResultQueryRequest * @return PodcastTaskResultQueryResponse */ async function podcastTaskResultQuery(request: PodcastTaskResultQueryRequest): PodcastTaskResultQueryResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return podcastTaskResultQueryWithOptions(request, headers, runtime); } model PodcastTaskSubmitRequest { counts?: int32(name='counts', example='2'), fileUrls?: [ string ](name='fileUrls'), text?: string(name='text'), topic?: string(name='topic'), voices?: [ string ](name='voices'), workspaceId?: string(name='workspaceId', description='This parameter is required.', example='llm-ep8ba0dr6seiddxx'), } model PodcastTaskSubmitShrinkRequest { counts?: int32(name='counts', example='2'), fileUrlsShrink?: string(name='fileUrls'), text?: string(name='text'), topic?: string(name='topic'), voicesShrink?: string(name='voices'), workspaceId?: string(name='workspaceId', description='This parameter is required.', example='llm-ep8ba0dr6seiddxx'), } model PodcastTaskSubmitResponseBody = { code?: string(name='code', example='"success"'), data?: { taskId?: string(name='taskId', example='63c4e0eaab3b4c0db208ecafa990e8d1'), taskStatus?: string(name='taskStatus', example='SUCCEEDED'), }(name='data'), httpStatusCode?: string(name='httpStatusCode', example='200'), message?: string(name='message', example='"success"'), requestId?: string(name='requestId', example='9CE5B91A-6E6B-55FB-A1AF-037DF01C84B3'), success?: boolean(name='success', example='True'), } model PodcastTaskSubmitResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: PodcastTaskSubmitResponseBody(name='body'), } /** * @summary ai播客生成任务提交 * * @param tmpReq PodcastTaskSubmitRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return PodcastTaskSubmitResponse */ async function podcastTaskSubmitWithOptions(tmpReq: PodcastTaskSubmitRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PodcastTaskSubmitResponse { Util.validateModel(tmpReq); var request = new PodcastTaskSubmitShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.fileUrls)) { request.fileUrlsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.fileUrls, 'fileUrls', 'json'); } if (!Util.isUnset(tmpReq.voices)) { request.voicesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.voices, 'voices', 'json'); } var body : map[string]any = {}; if (!Util.isUnset(request.counts)) { body['counts'] = request.counts; } if (!Util.isUnset(request.fileUrlsShrink)) { body['fileUrls'] = request.fileUrlsShrink; } if (!Util.isUnset(request.text)) { body['text'] = request.text; } if (!Util.isUnset(request.topic)) { body['topic'] = request.topic; } if (!Util.isUnset(request.voicesShrink)) { body['voices'] = request.voicesShrink; } if (!Util.isUnset(request.workspaceId)) { body['workspaceId'] = request.workspaceId; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'PodcastTaskSubmit', version = '2025-02-28', protocol = 'HTTPS', pathname = `/podcast/task/submit`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) { return callApi(params, req, runtime); } else { return execute(params, req, runtime); } } /** * @summary ai播客生成任务提交 * * @param request PodcastTaskSubmitRequest * @return PodcastTaskSubmitResponse */ async function podcastTaskSubmit(request: PodcastTaskSubmitRequest): PodcastTaskSubmitResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return podcastTaskSubmitWithOptions(request, headers, runtime); }