apaas-oapi-client 0.1.7 → 0.1.8

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.
Files changed (2) hide show
  1. package/UserManual.md +103 -3
  2. package/package.json +3 -2
package/UserManual.md CHANGED
@@ -7,8 +7,10 @@ aPaaS 平台有完整的 Open API 能力,但是目前这些能力全都以单
7
7
 
8
8
  - ✅ 获取 accessToken,自动管理 token 有效期
9
9
 
10
- - ✅ record 单条查询、 records 记录列表查询(支持分页迭代)
11
-
10
+ - ✅ record 单条查询、批量查询(支持分页迭代)
11
+
12
+ - ✅ record 单条创建、批量创建(支持分页迭代)
13
+
12
14
  - ✅ record 单条更新、批量更新
13
15
 
14
16
  - ✅ record 单条删除、批量删除
@@ -151,6 +153,42 @@ console.log('Items:', items);
151
153
 
152
154
  <br>
153
155
 
156
+
157
+ ***
158
+
159
+ ## **➕ 创建接口**
160
+
161
+ ### **单条创建**
162
+
163
+ ```JavaScript
164
+ const res = await client.object.create.record({
165
+ object_name: 'object_event_log',
166
+ record: {
167
+ name: 'Sample text',
168
+ content: 'Sample text'
169
+ }
170
+ });
171
+ console.log(res);
172
+ ```
173
+
174
+ ### **批量创建**
175
+
176
+ > ⚠️ 每次最多创建 100 条,SDK 已自动分组限流
177
+
178
+ ```JavaScript
179
+ const { total, items } = await client.object.create.recordsWithIterator({
180
+ object_name: 'object_event_log',
181
+ records: [
182
+ { name: 'Sample text 1', content: 'Sample text 1' },
183
+ { name: 'Sample text 2', content: 'Sample text 2' }
184
+ ]
185
+ });
186
+ console.log('Total:', total);
187
+ console.log('Items:', items);
188
+ ```
189
+
190
+
191
+ <br>
154
192
  ## **✏️ 更新接口**
155
193
 
156
194
  ### **单条更新**
@@ -248,4 +286,66 @@ console.log(client.currentNamespace);
248
286
 
249
287
  > 由 [aPaaS OAPI Client SDK](https://www.npmjs.com/package/apaas-oapi-client) 提供支持,如有问题请提交 Issue 反馈。
250
288
 
251
- <br>
289
+ <br>
290
+ ***
291
+
292
+ ## **📊 对象元数据接口**
293
+
294
+ ### **获取指定对象字段元数据**
295
+
296
+ ```JavaScript
297
+ const res = await client.object.metadata.field({
298
+ object_name: '_user',
299
+ field_name: '_id'
300
+ });
301
+ console.log(res);
302
+ ```
303
+
304
+ ### **获取指定对象所有字段信息**
305
+
306
+ ```JavaScript
307
+ const res = await client.object.metadata.fields({
308
+ object_name: 'object_store'
309
+ });
310
+ console.log(res);
311
+ ```
312
+
313
+ ***
314
+
315
+ ## **🏢 部门 ID 交换**
316
+
317
+ ### **单个部门 ID 交换**
318
+
319
+ ```JavaScript
320
+ const res = await client.department.exchange({
321
+ department_id_type: 'external_department_id',
322
+ department_id: 'Y806608904'
323
+ });
324
+ console.log(res);
325
+ ```
326
+
327
+ ### **批量部门 ID 交换**
328
+
329
+ 每次最多 100 个,SDK 已自动拆分限流。
330
+
331
+ ```JavaScript
332
+ const res = await client.department.batchExchange({
333
+ department_id_type: 'external_department_id',
334
+ department_ids: ['id1', 'id2', 'id3']
335
+ });
336
+ console.log(res);
337
+ ```
338
+
339
+ ***
340
+
341
+ ## **☁️ 云函数调用**
342
+
343
+ ```JavaScript
344
+ const res = await client.function.invoke({
345
+ name: 'StoreMemberUpdate',
346
+ params: { key: 'value' }
347
+ });
348
+ console.log(res);
349
+ ```
350
+
351
+ ---
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "apaas-oapi-client",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
+ "main": "dist/index.js",
4
5
  "exports": {
6
+ ".": "./dist/index.js",
5
7
  "./node-sdk": "./dist/index.js"
6
8
  },
7
- "main": "dist/index.js",
8
9
  "types": "dist/index.d.ts",
9
10
  "type": "commonjs",
10
11
  "scripts": {