Skip to content

Commit 71a6817

Browse files
authored
docs(integration): add introduce to new intehration method (#95)
1 parent 9ac7516 commit 71a6817

8 files changed

Lines changed: 89 additions & 11 deletions

File tree

content/guides/pro/api.mdx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,21 @@ This page lists common Univer Server APIs. The default base URL is `http://local
3131
type: 'string',
3232
required: true,
3333
description: 'Creator id',
34+
}, {
35+
name: 'idempotencyKey',
36+
type: 'string',
37+
required: false,
38+
description: 'Introduced since v0.20.0. Optional idempotency key; The total byte size must be ≤ 64.',
39+
}, {
40+
name: 'metaData',
41+
type: 'string',
42+
required: false,
43+
description: 'Introduced since v0.20.0. User-defined information, bound to the created unit, will be transparently passed through in subsequent synchronization events and USIP calls. The total byte size must be ≤ 1024.',
3444
}],
3545
example: `curl http://localhost:8000/universer-api/snapshot/{type}/unit/-/create \\
3646
-X POST \\
3747
-H 'Content-Type: application/json' \\
38-
--data-raw '{"type":2,"name":"New Sheet By Univer","creator":"userID"}'`,
48+
--data-raw '{"type":2,"name":"New Sheet By Univer","creator":"userID","idempotencyKey":"a-idgenerator-unique-id","metaData":"tenant12345"}'`,
3949
}}
4050
response={{
4151
type: 'application/json',
@@ -292,10 +302,20 @@ This page lists common Univer Server APIs. The default base URL is `http://local
292302
type: 'int',
293303
required: true,
294304
description: 'Minimum columns; import validates column count',
305+
}, {
306+
name: 'idempotencyKey',
307+
type: 'string',
308+
required: false,
309+
description: 'Introduced since v0.20.0. Optional idempotency key; The total byte size must be ≤ 64.',
310+
}, {
311+
name: 'metaData',
312+
type: 'string',
313+
required: false,
314+
description: 'Introduced since v0.20.0. User-defined information, bound to the imported unit, will be transparently passed through in subsequent synchronization events and USIP calls. The total byte size must be ≤ 1024.',
295315
}],
296316
example: `curl -X POST 'http://localhost:8000/universer-api/exchange/2/import' \\
297317
-H 'Content-Type: application/json' \\
298-
--data-raw '{"fileID":"123","outputType":1,"minSheetRowCount":1000,"minSheetColumnCount":20}'`,
318+
--data-raw '{"fileID":"123","outputType":1,"minSheetRowCount":1000,"minSheetColumnCount":20,"idempotencyKey":"a-idgenerator-unique-id","metaData":"tenant12345"}'`,
299319
}}
300320
response={{
301321
type: 'application/json',

content/guides/pro/api.zh-CN.mdx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,21 @@ title: API
3131
type: 'string',
3232
required: true,
3333
description: '创建者 id',
34+
}, {
35+
name: 'idempotencyKey',
36+
type: 'string',
37+
required: false,
38+
description: 'v0.20.0开始引入,可选幂等键, 字符数需要<=64',
39+
}, {
40+
name: 'metaData',
41+
type: 'string',
42+
required: false,
43+
description: 'v0.20.0开始引入,用户自定义信息,会绑定到创建的unit,之后的同步事件和USIP调用会透传,总字节数需要<=1024',
3444
}],
3545
example: `curl http://localhost:8000/universer-api/snapshot/{type}/unit/-/create \\
3646
-X POST \\
3747
-H 'Content-Type: application/json' \\
38-
--data-raw '{"type":2,"name":"New Sheet By Univer","creator":"userID"}'`,
48+
--data-raw '{"type":2,"name":"New Sheet By Univer","creator":"userID","idempotencyKey":"a-idgenerator-unique-id","metaData":"tenant12345"}'`,
3949
}}
4050
response={{
4151
type: 'application/json',
@@ -292,10 +302,20 @@ title: API
292302
type: 'int',
293303
required: true,
294304
description: '最小列数,导入时会检查表格列数是否满足要求',
305+
}, {
306+
name: 'idempotencyKey',
307+
type: 'string',
308+
required: false,
309+
description: 'v0.20.0开始引入,可选幂等键, 字符数需要<=64',
310+
}, {
311+
name: 'metaData',
312+
type: 'string',
313+
required: false,
314+
description: 'v0.20.0开始引入,用户自定义信息,会绑定到导入的unit,之后的同步事件和USIP调用会透传,总字节数需要<=1024',
295315
}],
296316
example: `curl -X POST 'http://localhost:8000/universer-api/exchange/2/import' \\
297317
-H 'Content-Type: application/json' \\
298-
--data-raw '{"fileID":"123","outputType":1,"minSheetRowCount":1000,"minSheetColumnCount":20}'`,
318+
--data-raw '{"fileID":"123","outputType":1,"minSheetRowCount":1000,"minSheetColumnCount":20,"idempotencyKey":"a-idgenerator-unique-id","metaData":"tenant12345"}'`,
299319
}}
300320
response={{
301321
type: 'application/json',

content/guides/pro/event-sync.ja-JP.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ message EventSyncData {
5353
univer.ChangesetAck csAckEvent = 4;
5454
// more event types in the future.
5555
}
56+
optional string unitMetaData = 99; // Introduced since v0.20.0, customer setted metadata of the unit(created by CreateUnit request or Import request)
5657
}
5758

5859
message ChangesetAck {

content/guides/pro/event-sync.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ message EventSyncData {
5353
univer.ChangesetAck csAckEvent = 4;
5454
// more event types in the future.
5555
}
56+
optional string unitMetaData = 99; // Introduced since v0.20.0, customer setted metadata of the unit(created by CreateUnit request or Import request)
5657
}
5758

5859
message ChangesetAck {

content/guides/pro/event-sync.zh-CN.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ message EventSyncData {
5353
univer.ChangesetAck csAckEvent = 4;
5454
// more event types in the future.
5555
}
56+
optional string unitMetaData = 99; // Introduced since v0.20.0, customer setted metadata of the unit(created by CreateUnit request or Import request)
5657
}
5758

5859
message ChangesetAck {

content/guides/pro/event-sync.zh-TW.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ message EventSyncData {
5353
univer.ChangesetAck csAckEvent = 4;
5454
// more event types in the future.
5555
}
56+
optional string unitMetaData = 99; // Introduced since v0.20.0, customer setted metadata of the unit(created by CreateUnit request or Import request)
5657
}
5758

5859
message ChangesetAck {

content/guides/pro/usip.mdx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ To determine permissions for reading/editing a document.
149149
type: 'string',
150150
example: 'acff-adebc125e45b',
151151
description: 'Document ID',
152+
}, {
153+
name: 'metaData',
154+
type: 'string',
155+
example: '{"tenantId":"company1"}',
156+
description: 'metadata associated with the unit. Introduced since v0.20.0',
152157
}],
153158
example: 'curl -X GET "http://sample.univer.ai/role?unitID=acff-adebc125e45b&userID=acd5455e44fc5bb55"',
154159
}}
@@ -194,9 +199,15 @@ Required when selecting users for protected ranges or sheets.
194199
type: 'array[string]',
195200
example: '["unit_id1", "unit_id2"]',
196201
description: 'Document IDs',
202+
}, {
203+
name: 'unitsMetaDatas',
204+
type: 'object',
205+
example: '{"unit_id1":"metadata of unit_id1","unit_id2":"metadata of unit_id2"}',
206+
description: 'metadata of each unit in the unitIDs param, introduced since v0.20.0',
197207
}],
198208
example: JSON.stringify({
199-
unitIDs: ['unit_id1', 'unit_id2', 'unit_id3'],
209+
unitIDs: ['unit_id1', 'unit_id2'],
210+
unitsMetaDatas: { unit_id1: 'metadata of unit_id1', unit_id2: 'metadata of unit_id2' },
200211
}, null, 2),
201212
}}
202213
response={{
@@ -300,10 +311,16 @@ For your system to display last edit time.
300311
type: 'int',
301312
example: '1762591632345',
302313
description: 'Unix timestamp in milliseconds',
314+
}, {
315+
name: 'metaData',
316+
type: 'string',
317+
example: '{"tenantId":"company1"}',
318+
description: 'metadata associated with the unit. Introduced since v0.20.0',
303319
}],
304320
example: JSON.stringify({
305321
unitID: 'unit_id1',
306322
editTimeUnixMs: 1762591632345,
323+
metaData: { tenantId: 'company1' },
307324
}, null, 2),
308325
}}
309326
response={{
@@ -360,7 +377,7 @@ If your USIP service is exposed on the public network, to ensure API request sec
360377
361378
Univer uses RBAC with fixed roles: `owner`, `editor`, `reader`. You can override minimum role requirements for permission points.
362379

363-
Default permission points:
380+
Default permission points and minimum role requirements are as follows:
364381

365382
| Permission | Enum | Description | Minimum Role | Role Enum |
366383
|:-------|:---------|:-------|:-------|:-------|
@@ -415,7 +432,7 @@ universer:
415432

416433
### Object Permission Inheritance
417434

418-
By default, document owners do not automatically own all protected ranges/sheets. To enable inheritance:
435+
By default, the owner of a document does not automatically have owner permissions for all "protected areas / sub-tables" within that document. If you want the document owner to unconditionally have full permissions over all sub-objects within the document, you can enable permission inheritance by configuring the following settings:
419436

420437
```properties title=".env.custom"
421438
AUTH_PERMISSION_ENABLE_OBJ_INHERIT=true

content/guides/pro/usip.zh-CN.mdx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ Univer Pro 默认不内置账户体系。若需要身份认证、权限控制或
149149
type: 'string',
150150
example: 'acff-adebc125e45b',
151151
description: '文档 ID',
152+
}, {
153+
name: 'metaData',
154+
type: 'string',
155+
example: '{"tenantId":"company1"}',
156+
description: '文档关联的由客户系统设置的自定义metadata,从v0.20.0开始引入',
152157
}],
153158
example: 'curl -X GET "http://sample.univer.ai/role?unitID=acff-adebc125e45b&userID=acd5455e44fc5bb55"',
154159
}}
@@ -194,9 +199,15 @@ Univer Pro 默认不内置账户体系。若需要身份认证、权限控制或
194199
type: 'array[string]',
195200
example: '["unit_id1", "unit_id2"]',
196201
description: '文档 ID 数组',
202+
}, {
203+
name: 'unitsMetaDatas',
204+
type: 'object',
205+
example: '{"unit_id1":"metadata of unit_id1","unit_id2":"metadata of unit_id2"}',
206+
description: '参数unitIDs数组中每个unit的metadata,从v0.20.0开始引入',
197207
}],
198208
example: JSON.stringify({
199-
unitIDs: ['unit_id1', 'unit_id2', 'unit_id3'],
209+
unitIDs: ['unit_id1', 'unit_id2'],
210+
unitsMetaDatas: { unit_id1: 'metadata of unit_id1', unit_id2: 'metadata of unit_id2' },
200211
}, null, 2),
201212
}}
202213
response={{
@@ -300,10 +311,16 @@ Univer Pro 默认不内置账户体系。若需要身份认证、权限控制或
300311
type: 'int',
301312
example: '1762591632345',
302313
description: 'unix 时间戳(毫秒)',
314+
}, {
315+
name: 'metaData',
316+
type: 'string',
317+
example: '{"tenantId":"company1"}',
318+
description: '文档关联的由客户系统设置的自定义metadata,从v0.20.0开始引入',
303319
}],
304320
example: JSON.stringify({
305321
unitID: 'unit_id1',
306322
editTimeUnixMs: 1762591632345,
323+
metaData: { tenantId: 'company1' },
307324
}, null, 2),
308325
}}
309326
response={{
@@ -360,9 +377,9 @@ Univer Pro 默认不内置账户体系。若需要身份认证、权限控制或
360377
361378
## Univer 权限模型
362379
363-
Univer 使用 RBAC 模型,固定角色为 `owner`、`editor`、`reader`。可以通过配置为某些权限点位设置最低角色
380+
Univer 使用 RBAC 模型,固定角色为 `owner`、`editor`、`reader`。可以通过配置为某些权限点位设置最低角色要求
364381

365-
默认权限点位与最低角色如下
382+
默认权限点位与最低角色要求如下
366383

367384
| 权限点位 | 权限点位枚举值 | 点位含义 | 最低角色要求 | 角色枚举值 |
368385
|:-------|:---------|:-------|:-------|:-------|
@@ -417,7 +434,7 @@ universer:
417434

418435
### 对象权限继承
419436

420-
默认情况下,文档的 owner 并不自动拥有该文档内所有“保护区/子表”的 owner 权限。若需要开启继承
437+
默认情况下,文档的 owner 并不自动拥有该文档内所有“保护区/子表”的 owner 权限。如果你希望文档的owner无条件地拥有文档内所有子对象的所有权限,可以如下配置来开启权限的继承
421438

422439
```properties title=".env.custom"
423440
AUTH_PERMISSION_ENABLE_OBJ_INHERIT=true

0 commit comments

Comments
 (0)