@open-dy/ai_coding_sdk 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,22 +8,9 @@ exports.queryVideoTask = queryVideoTask;
8
8
  exports.waitVideoTask = waitVideoTask;
9
9
  exports.streamGenerate = streamGenerate;
10
10
  const core_1 = require("./core");
11
- const AI_PLATFORM_SOURCE = 4;
12
11
  function sleep(ms) {
13
12
  return new Promise(resolve => setTimeout(resolve, ms));
14
13
  }
15
- function withDefaultGenerateSource(req) {
16
- return { ...req, Source: AI_PLATFORM_SOURCE };
17
- }
18
- function withDefaultStreamSource(req) {
19
- return { ...req, source: AI_PLATFORM_SOURCE };
20
- }
21
- function withDefaultImageSource(req) {
22
- return { ...req, Source: AI_PLATFORM_SOURCE };
23
- }
24
- function withDefaultVideoSource(req) {
25
- return { ...req, Source: AI_PLATFORM_SOURCE };
26
- }
27
14
  class AIPlatformLLMClient {
28
15
  constructor(options = {}) {
29
16
  this.appEnv = (0, core_1.getAIPlatformAppEnv)();
@@ -35,7 +22,7 @@ class AIPlatformLLMClient {
35
22
  this.gatewayOrigin = options.gatewayOrigin ?? (0, core_1.getAIPlatformGatewayOrigin)(this.appEnv);
36
23
  }
37
24
  async generate(req) {
38
- return (0, core_1.postAIPlatformJSON)(this.gatewayOrigin, '/dy_open_api/ai_platform/llm_gen/generate/', withDefaultGenerateSource(req), {
25
+ return (0, core_1.postAIPlatformJSON)(this.gatewayOrigin, '/dy_open_api/ai_platform/llm_gen/generate/', req, {
39
26
  accessToken: this.accessToken,
40
27
  defaultHeaders: this.defaultHeaders,
41
28
  appEnv: this.appEnv,
@@ -43,7 +30,7 @@ class AIPlatformLLMClient {
43
30
  });
44
31
  }
45
32
  async generateImage(req) {
46
- return (0, core_1.postAIPlatformJSON)(this.gatewayOrigin, '/dy_open_api/ai_platform/llm_gen/image_generate/', withDefaultImageSource(req), {
33
+ return (0, core_1.postAIPlatformJSON)(this.gatewayOrigin, '/dy_open_api/ai_platform/llm_gen/image_generate/', req, {
47
34
  accessToken: this.accessToken,
48
35
  defaultHeaders: this.defaultHeaders,
49
36
  appEnv: this.appEnv,
@@ -51,7 +38,7 @@ class AIPlatformLLMClient {
51
38
  });
52
39
  }
53
40
  async generateVideo(req) {
54
- return (0, core_1.postAIPlatformJSON)(this.gatewayOrigin, '/dy_open_api/ai_platform/llm_gen/video_generate/', withDefaultVideoSource(req), {
41
+ return (0, core_1.postAIPlatformJSON)(this.gatewayOrigin, '/dy_open_api/ai_platform/llm_gen/video_generate/', req, {
55
42
  accessToken: this.accessToken,
56
43
  defaultHeaders: this.defaultHeaders,
57
44
  appEnv: this.appEnv,
@@ -83,7 +70,7 @@ class AIPlatformLLMClient {
83
70
  }
84
71
  }
85
72
  async *streamGenerate(req) {
86
- for await (const event of (0, core_1.streamAIPlatform)(this.gatewayOrigin, '/dy_open_api/ai_platform/llm_gen/stream_generate/', withDefaultStreamSource(req), {
73
+ for await (const event of (0, core_1.streamAIPlatform)(this.gatewayOrigin, '/dy_open_api/ai_platform/llm_gen/stream_generate/', req, {
87
74
  accessToken: this.accessToken,
88
75
  defaultHeaders: this.defaultHeaders,
89
76
  appEnv: this.appEnv,
@@ -60,6 +60,7 @@ export interface StreamGenerateRequest {
60
60
  parameters: string;
61
61
  }>;
62
62
  extra?: Record<string, string>;
63
+ source: number;
63
64
  }
64
65
  export interface GenerateMessage {
65
66
  Role: Role;
@@ -108,6 +109,7 @@ export interface GenerateRequest {
108
109
  Parameters: string;
109
110
  }>;
110
111
  Extra?: Record<string, string>;
112
+ Source: number;
111
113
  }
112
114
  /**
113
115
  * 图片生成请求。
@@ -142,6 +144,7 @@ export interface GenerateImageRequest {
142
144
  Prompt: string;
143
145
  ModelTenant: string;
144
146
  ModelKey: string;
147
+ Source: number;
145
148
  /**
146
149
  * 字段语义依模型而变:
147
150
  * - `glm-image`:可选图片输入
@@ -198,6 +201,7 @@ export interface GenerateVideoRequest {
198
201
  Prompt: string;
199
202
  ModelTenant: string;
200
203
  ModelKey: string;
204
+ Source: number;
201
205
  /**
202
206
  * 示例:
203
207
  * - Seedance Pro:首帧、首尾帧或参考图
@@ -18,5 +18,6 @@ async function getUserCertLabelsInfo(params, options) {
18
18
  method: 'GET',
19
19
  queryParams: params,
20
20
  domain: 'open.douyin.com',
21
+ requiresUserAuth: true,
21
22
  }, options);
22
23
  }
@@ -21,6 +21,7 @@ async function getUserItemData(params, options) {
21
21
  method: 'GET',
22
22
  queryParams: params,
23
23
  domain: 'open.douyin.com',
24
+ requiresUserAuth: true,
24
25
  }, options);
25
26
  }
26
27
  /**
@@ -37,6 +38,7 @@ async function getUserFansData(params, options) {
37
38
  method: 'GET',
38
39
  queryParams: params,
39
40
  domain: 'open.douyin.com',
41
+ requiresUserAuth: true,
40
42
  }, options);
41
43
  }
42
44
  /**
@@ -55,6 +57,7 @@ async function getUserLikeData(params, options) {
55
57
  method: 'GET',
56
58
  queryParams: params,
57
59
  domain: 'open.douyin.com',
60
+ requiresUserAuth: true,
58
61
  }, options);
59
62
  }
60
63
  /**
@@ -73,6 +76,7 @@ async function getUserCommentData(params, options) {
73
76
  method: 'GET',
74
77
  queryParams: params,
75
78
  domain: 'open.douyin.com',
79
+ requiresUserAuth: true,
76
80
  }, options);
77
81
  }
78
82
  /**
@@ -89,6 +93,7 @@ async function getUserShareData(params, options) {
89
93
  method: 'GET',
90
94
  queryParams: params,
91
95
  domain: 'open.douyin.com',
96
+ requiresUserAuth: true,
92
97
  }, options);
93
98
  }
94
99
  /**
@@ -105,5 +110,6 @@ async function getUserProfileData(params, options) {
105
110
  method: 'GET',
106
111
  queryParams: params,
107
112
  domain: 'open.douyin.com',
113
+ requiresUserAuth: true,
108
114
  }, options);
109
115
  }
@@ -4,6 +4,8 @@ export interface UserHashMobileParams {
4
4
  open_id: string;
5
5
  }
6
6
  export interface UserHashMobileResponse {
7
+ /** 单向哈希加密后的手机号(实际接口返回字段) */
8
+ hash_mobile?: string;
7
9
  /** 单向哈希加密后的手机号 */
8
10
  mobile_hash?: string;
9
11
  }
@@ -13,10 +13,20 @@ const core_1 = require("../core");
13
13
  * @remarks 返回的是经过单向哈希处理的手机号,无法还原为明文。
14
14
  */
15
15
  async function getUserHashMobile(params, options) {
16
- return (0, core_1.callOpenAPI)({
16
+ const response = await (0, core_1.callOpenAPI)({
17
17
  path: '/api/douyin/v1/user/get_user_hash_mobile/',
18
18
  method: 'GET',
19
19
  queryParams: params,
20
20
  domain: 'open.douyin.com',
21
+ requiresUserAuth: true,
21
22
  }, options);
23
+ const hashMobile = response.data?.hash_mobile ?? response.data?.mobile_hash;
24
+ if (hashMobile) {
25
+ response.data = {
26
+ ...response.data,
27
+ hash_mobile: hashMobile,
28
+ mobile_hash: hashMobile,
29
+ };
30
+ }
31
+ return response;
22
32
  }
@@ -18,5 +18,6 @@ async function getUserPublicInfo(params, options) {
18
18
  method: 'GET',
19
19
  queryParams: params,
20
20
  domain: 'open.douyin.com',
21
+ requiresUserAuth: true,
21
22
  }, options);
22
23
  }
@@ -18,5 +18,6 @@ async function getRealNameInfo(params, options) {
18
18
  method: 'GET',
19
19
  queryParams: params,
20
20
  domain: 'open.douyin.com',
21
+ requiresUserAuth: true,
21
22
  }, options);
22
23
  }
@@ -19,6 +19,7 @@ async function queryActivityUserCompletionStatus(body, options) {
19
19
  method: 'POST',
20
20
  body,
21
21
  domain: 'open.douyin.com',
22
+ requiresUserAuth: true,
22
23
  }, options);
23
24
  }
24
25
  /**
@@ -18,5 +18,6 @@ async function getVideoPack(params, options) {
18
18
  method: 'GET',
19
19
  queryParams: params,
20
20
  domain: 'open.douyin.com',
21
+ requiresUserAuth: true,
21
22
  }, options);
22
23
  }
@@ -4,8 +4,41 @@ export interface CallOpenAPIParams {
4
4
  queryParams?: Record<string, string | number | undefined> | any;
5
5
  body?: Record<string, unknown> | any;
6
6
  domain?: string;
7
+ /**
8
+ * 当前 OpenAPI 是否需要用户授权。
9
+ *
10
+ * @remarks
11
+ * 当该值为 `true` 时:
12
+ * - SDK 会请求 `open.douyin.com`
13
+ * - 需要在 header 中传入用户授权后的 `access-token`
14
+ *
15
+ * 注意这里的 `access-token` 不是 SDK 自动生成的,必须先调用 `auth` 模块
16
+ * (如 `getUserAccessToken` / `refreshUserAccessToken`)获取,再通过 `CallOptions.accessToken`
17
+ * 传入当前 OpenAPI 调用。
18
+ *
19
+ * `access-token` 在有效期内可以缓存并重复使用,不需要每次调用 OpenAPI 都重新生成;
20
+ * 仅在 token 过期或即将过期时,再调用 `auth` 模块相关接口刷新或重新获取。
21
+ */
22
+ requiresUserAuth?: boolean;
7
23
  }
8
24
  export interface CallOptions {
25
+ /**
26
+ * 用户授权后的 access_token。
27
+ *
28
+ * @remarks
29
+ * 仅对“需要用户授权”的 OpenAPI 生效。该 token 不能由普通上游请求参数直接透传替代,
30
+ * 需要先通过 SDK 的 `auth` 模块完成 OAuth 换 token 后获取。
31
+ *
32
+ * 获取后可在有效期内保存并重复使用,不需要每次调用 OpenAPI 都重新生成;当 token
33
+ * 过期或即将过期时,再调用 `refreshUserAccessToken` 等接口刷新即可。
34
+ */
35
+ accessToken?: string;
36
+ /**
37
+ * `accessToken` 的兼容别名。
38
+ *
39
+ * @deprecated 请改用 `accessToken`。对于需要用户授权的 OpenAPI,这里传入的值本质上也应当是
40
+ * 用户授权后的 `access_token`,而不是任意上游透传 token。
41
+ */
9
42
  delegateToken?: string;
10
43
  logid?: string;
11
44
  ppeEnv?: string;
@@ -17,10 +17,13 @@ function isCloudEnvironment() {
17
17
  function getCloudCallDomain(originalDomain) {
18
18
  return CLOUD_CALL_DOMAIN_MAP[originalDomain] || originalDomain;
19
19
  }
20
- function buildUrl(path, queryParams, domain = 'open.douyin.com') {
21
- const isCloud = isCloudEnvironment();
22
- const finalDomain = isCloud ? getCloudCallDomain(domain) : domain;
23
- const protocol = isCloud ? 'http' : 'https';
20
+ function shouldUseCloudCall(domain, requiresUserAuth) {
21
+ return isCloudEnvironment() && !requiresUserAuth && domain in CLOUD_CALL_DOMAIN_MAP;
22
+ }
23
+ function buildUrl(path, queryParams, domain = 'open.douyin.com', requiresUserAuth) {
24
+ const useCloudCall = shouldUseCloudCall(domain, requiresUserAuth);
25
+ const finalDomain = useCloudCall ? getCloudCallDomain(domain) : domain;
26
+ const protocol = useCloudCall ? 'http' : 'https';
24
27
  const url = new URL(`${protocol}://${finalDomain}${path}`);
25
28
  if (queryParams) {
26
29
  Object.entries(queryParams).forEach(([key, value]) => {
@@ -39,12 +42,12 @@ function buildUrl(path, queryParams, domain = 'open.douyin.com') {
39
42
  function isFormDataBody(body) {
40
43
  return typeof FormData !== 'undefined' && body instanceof FormData;
41
44
  }
42
- function buildHeaders(delegateToken, ppeEnv, extraHeaders = {}, body) {
45
+ function buildHeaders(accessToken, ppeEnv, extraHeaders = {}, body, requiresUserAuth) {
43
46
  const headers = isFormDataBody(body)
44
47
  ? { ...extraHeaders }
45
48
  : { 'Content-Type': 'application/json', ...extraHeaders };
46
- if (!isCloudEnvironment() && delegateToken) {
47
- headers['access-token'] = delegateToken;
49
+ if (accessToken && (!isCloudEnvironment() || requiresUserAuth)) {
50
+ headers['access-token'] = accessToken;
48
51
  }
49
52
  if (ppeEnv) {
50
53
  headers['x-tt-env'] = ppeEnv;
@@ -58,17 +61,48 @@ function maskHeaders(headers) {
58
61
  ...(headers['access-token'] ? { 'access-token': '***' } : {}),
59
62
  };
60
63
  }
64
+ function isRecord(value) {
65
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
66
+ }
67
+ function getNumericValue(value) {
68
+ if (typeof value === 'number' && Number.isFinite(value)) {
69
+ return value;
70
+ }
71
+ if (typeof value === 'string' && value.trim() !== '') {
72
+ const parsed = Number(value);
73
+ if (Number.isFinite(parsed)) {
74
+ return parsed;
75
+ }
76
+ }
77
+ return undefined;
78
+ }
79
+ function getStringValue(value) {
80
+ return typeof value === 'string' ? value : undefined;
81
+ }
82
+ function stripLegacyDataMeta(value) {
83
+ if (!isRecord(value)) {
84
+ return value;
85
+ }
86
+ const { error_code: _errorCode, description: _description, ...rest } = value;
87
+ return rest;
88
+ }
89
+ function buildOpenAPIErrorMessage(errMsg, errNo, logId, subErrMsg, subErrNo) {
90
+ const subErrorSuffix = subErrNo && subErrNo !== 0
91
+ ? `, sub_error: ${subErrMsg || 'N/A'} (${subErrNo})`
92
+ : '';
93
+ return `OpenAPI Error: ${errMsg || 'Unknown error'} (${errNo})${subErrorSuffix}, x-tt-logid: ${logId}`;
94
+ }
61
95
  async function callOpenAPI(params, options) {
62
- const { path, method = 'GET', queryParams, body, domain = 'open.douyin.com', } = params;
63
- const delegateToken = options?.delegateToken;
96
+ const { path, method = 'GET', queryParams, body, domain = 'open.douyin.com', requiresUserAuth, } = params;
97
+ const accessToken = options?.accessToken ?? options?.delegateToken;
64
98
  const envPpeEnv = process.env.APP_ENV?.startsWith('ppe_') ? process.env.APP_ENV : undefined;
65
99
  const ppeEnv = options?.ppeEnv || envPpeEnv;
66
100
  const extraHeaders = options?.logid ? { 'x-tt-logid': options.logid } : {};
67
- const url = buildUrl(path, queryParams, domain);
68
- const headers = buildHeaders(delegateToken, ppeEnv, extraHeaders, body);
101
+ const url = buildUrl(path, queryParams, domain, requiresUserAuth);
102
+ const headers = buildHeaders(accessToken, ppeEnv, extraHeaders, body, requiresUserAuth);
69
103
  console.log(`[OpenAPI] ${method} ${url}`);
70
104
  console.log('[OpenAPI] Headers:', maskHeaders(headers), body);
71
- console.log('[OpenAPI] Is Cloud Environment:', isCloudEnvironment());
105
+ console.log('[OpenAPI] Is Cloud Environment:', isCloudEnvironment(), 'Requires User Auth:', Boolean(requiresUserAuth));
72
106
  const requestOptions = {
73
107
  method,
74
108
  headers,
@@ -88,19 +122,67 @@ async function callOpenAPI(params, options) {
88
122
  if (!response.ok) {
89
123
  throw new Error(`HTTP Error: ${response.status} ${response.statusText}, x-tt-logid: ${response.headers.get('x-tt-logid') || 'N/A'}`);
90
124
  }
91
- if (!rawData ||
92
- typeof rawData !== 'object' ||
93
- !("err_no" in rawData) ||
94
- !("err_msg" in rawData)) {
125
+ if (!isRecord(rawData)) {
95
126
  throw new Error(`Invalid OpenAPI response, x-tt-logid: ${response.headers.get('x-tt-logid') || 'N/A'}`);
96
127
  }
97
128
  const dataAny = rawData;
98
- if (typeof dataAny.err_no === 'number' && dataAny.err_no !== 0) {
99
- throw new Error(`OpenAPI Error: ${String(dataAny.err_msg)} (${String(dataAny.err_no)}), x-tt-logid: ${response.headers.get('x-tt-logid') || 'N/A'}`);
129
+ const responseLogId = response.headers.get('x-tt-logid') || 'N/A';
130
+ const topLevelLogId = getStringValue(dataAny.log_id);
131
+ const dataPayload = dataAny.data;
132
+ const payloadRecord = isRecord(dataPayload) ? dataPayload : undefined;
133
+ const topErrNo = getNumericValue(dataAny.err_no);
134
+ const topErrMsg = getStringValue(dataAny.err_msg);
135
+ const payloadErrNo = getNumericValue(payloadRecord?.error_code);
136
+ const payloadErrMsg = getStringValue(payloadRecord?.description);
137
+ const extraRecord = isRecord(dataAny.extra) ? dataAny.extra : undefined;
138
+ const extraErrNo = getNumericValue(extraRecord?.error_code);
139
+ const extraErrMsg = getStringValue(extraRecord?.description);
140
+ const payloadExtraRecord = payloadRecord && isRecord(payloadRecord.extra) ? payloadRecord.extra : undefined;
141
+ const payloadExtraErrNo = getNumericValue(payloadExtraRecord?.error_code);
142
+ const payloadExtraErrMsg = getStringValue(payloadExtraRecord?.description);
143
+ const payloadExtraSubErrNo = getNumericValue(payloadExtraRecord?.sub_error_code);
144
+ const payloadExtraSubErrMsg = getStringValue(payloadExtraRecord?.sub_description);
145
+ const logId = response.headers.get('x-tt-logid')
146
+ || getStringValue(extraRecord?.logid)
147
+ || getStringValue(payloadRecord?.log_id)
148
+ || topLevelLogId
149
+ || responseLogId;
150
+ // 兼容两类返回协议:
151
+ // 1. 标准协议:顶层 err_no / err_msg / data
152
+ // 2. 授权类老协议:data.error_code / description + extra
153
+ if (topErrNo === undefined &&
154
+ topErrMsg === undefined &&
155
+ payloadErrNo === undefined &&
156
+ extraErrNo === undefined) {
157
+ throw new Error(`Invalid OpenAPI response, x-tt-logid: ${logId}`);
158
+ }
159
+ if (topErrNo !== undefined && topErrNo !== 0) {
160
+ throw new Error(buildOpenAPIErrorMessage(topErrMsg, topErrNo, logId));
161
+ }
162
+ if (payloadExtraErrNo !== undefined && payloadExtraErrNo !== 0) {
163
+ throw new Error(buildOpenAPIErrorMessage(payloadExtraErrMsg, payloadExtraErrNo, logId, payloadExtraSubErrMsg, payloadExtraSubErrNo));
164
+ }
165
+ if (topErrNo === undefined) {
166
+ const normalizedErrNo = payloadErrNo ?? extraErrNo ?? 0;
167
+ const normalizedErrMsg = payloadErrMsg ?? extraErrMsg ?? '';
168
+ if (normalizedErrNo !== 0) {
169
+ throw new Error(buildOpenAPIErrorMessage(normalizedErrMsg, normalizedErrNo, logId));
170
+ }
171
+ const normalized = {
172
+ err_no: normalizedErrNo,
173
+ err_msg: normalizedErrMsg,
174
+ data: stripLegacyDataMeta((dataPayload ?? {})),
175
+ };
176
+ console.log('[OpenAPI] Response:', JSON.stringify(normalized).slice(0, 500));
177
+ return normalized;
100
178
  }
101
179
  const normalized = (() => {
102
180
  if (dataAny.data !== undefined) {
103
- return dataAny;
181
+ return {
182
+ err_no: topErrNo,
183
+ err_msg: topErrMsg ?? '',
184
+ data: stripLegacyDataMeta(dataAny.data),
185
+ };
104
186
  }
105
187
  const { err_no, err_msg, ...rest } = dataAny;
106
188
  return {
@@ -21,6 +21,7 @@ async function getRoomRealTimeData(params, body, options) {
21
21
  queryParams: params,
22
22
  body: body ?? {},
23
23
  domain: 'open.douyin.com',
24
+ requiresUserAuth: true,
24
25
  }, options);
25
26
  }
26
27
  /**
@@ -38,5 +39,6 @@ async function queryRoomData(params, body, options) {
38
39
  queryParams: params,
39
40
  body,
40
41
  domain: 'open.douyin.com',
42
+ requiresUserAuth: true,
41
43
  }, options);
42
44
  }
@@ -16,5 +16,6 @@ async function getMusicCollectionList(params, options) {
16
16
  method: 'GET',
17
17
  queryParams: params,
18
18
  domain: 'open.douyin.com',
19
+ requiresUserAuth: true,
19
20
  }, options);
20
21
  }
@@ -19,6 +19,7 @@ async function getFansSource(params, options) {
19
19
  method: 'GET',
20
20
  queryParams: params,
21
21
  domain: 'open.douyin.com',
22
+ requiresUserAuth: true,
22
23
  }, options);
23
24
  }
24
25
  /**
@@ -35,6 +36,7 @@ async function getFansProfile(params, options) {
35
36
  method: 'GET',
36
37
  queryParams: params,
37
38
  domain: 'open.douyin.com',
39
+ requiresUserAuth: true,
38
40
  }, options);
39
41
  }
40
42
  /**
@@ -51,6 +53,7 @@ async function getUserFansProfile(params, options) {
51
53
  method: 'GET',
52
54
  queryParams: params,
53
55
  domain: 'open.douyin.com',
56
+ requiresUserAuth: true,
54
57
  }, options);
55
58
  }
56
59
  /**
@@ -67,5 +70,6 @@ async function getFansFavourite(params, options) {
67
70
  method: 'GET',
68
71
  queryParams: params,
69
72
  domain: 'open.douyin.com',
73
+ requiresUserAuth: true,
70
74
  }, options);
71
75
  }
@@ -20,6 +20,7 @@ async function checkFans(params, options) {
20
20
  method: 'GET',
21
21
  queryParams: params,
22
22
  domain: 'open.douyin.com',
23
+ requiresUserAuth: true,
23
24
  }, options);
24
25
  }
25
26
  /**
@@ -36,5 +37,6 @@ async function getFriendList(params, options) {
36
37
  method: 'GET',
37
38
  queryParams: params,
38
39
  domain: 'open.douyin.com',
40
+ requiresUserAuth: true,
39
41
  }, options);
40
42
  }
@@ -0,0 +1,36 @@
1
+ import type { CallOptions, OpenAPIResponse } from '../core';
2
+ export interface UploadSitemapRequest {
3
+ /** 小程序 app_id */
4
+ app_id: string;
5
+ /** 页面路径列表 */
6
+ page_paths: string[];
7
+ }
8
+ export interface DeleteIndexRequest {
9
+ /** 小程序 app_id */
10
+ app_id: string;
11
+ /** 在控制台显示的文件名称 */
12
+ name: string;
13
+ /** 待删除路径集合 */
14
+ path_list: string[];
15
+ }
16
+ export interface WebSearchOperationResponse {
17
+ err_no: number;
18
+ err_msg: string;
19
+ log_id: string;
20
+ }
21
+ /**
22
+ * 提交小程序页面路径
23
+ * - Path: `/api/apps/v1/search/upload_sitemap/`
24
+ * - Capability: `ma.web.search`
25
+ * - Scope: `ma.search`
26
+ * - 需要用户授权: `否`
27
+ */
28
+ export declare function uploadSitemap(params: UploadSitemapRequest, options?: CallOptions): Promise<OpenAPIResponse<WebSearchOperationResponse>>;
29
+ /**
30
+ * 删除索引
31
+ * - Path: `/api/apps/v1/search/delete_index/`
32
+ * - Capability: `ma.web.search`
33
+ * - Scope: `ma.search`
34
+ * - 需要用户授权: `否`
35
+ */
36
+ export declare function deleteIndex(params: DeleteIndexRequest, options?: CallOptions): Promise<OpenAPIResponse<WebSearchOperationResponse>>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadSitemap = uploadSitemap;
4
+ exports.deleteIndex = deleteIndex;
5
+ const core_1 = require("../core");
6
+ /**
7
+ * 提交小程序页面路径
8
+ * - Path: `/api/apps/v1/search/upload_sitemap/`
9
+ * - Capability: `ma.web.search`
10
+ * - Scope: `ma.search`
11
+ * - 需要用户授权: `否`
12
+ */
13
+ async function uploadSitemap(params, options) {
14
+ return (0, core_1.callOpenAPI)({
15
+ path: '/api/apps/v1/search/upload_sitemap/',
16
+ method: 'POST',
17
+ body: params,
18
+ domain: 'open.douyin.com',
19
+ }, options);
20
+ }
21
+ /**
22
+ * 删除索引
23
+ * - Path: `/api/apps/v1/search/delete_index/`
24
+ * - Capability: `ma.web.search`
25
+ * - Scope: `ma.search`
26
+ * - 需要用户授权: `否`
27
+ */
28
+ async function deleteIndex(params, options) {
29
+ return (0, core_1.callOpenAPI)({
30
+ path: '/api/apps/v1/search/delete_index/',
31
+ method: 'POST',
32
+ body: params,
33
+ domain: 'open.douyin.com',
34
+ }, options);
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-dy/ai_coding_sdk",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "AI Coding SDK — 抖音开放平台 OpenAPI 客户端与工具集",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",