跳到正文

事件 ​

游标之后的安装事件流,以及事件类型列表。

本组中的操作及其访问规则、重试规则、参数和响应。每个请求都需携带密钥:Authorization: Bearer <密钥>(参见“身份验证”)。

操作 ​

读取安装的事件 ​

GET HEAD /api/v1/events

访问: 任何有效的密钥或会话 · 重试: 可安全重试(读取)

按从旧到新的顺序,以 CloudEvents 1.0 格式返回游标 after 之后的最多 limit 个事件(1–500,默认 100):调用方可列出(artifact.list)的每个仓库中的发布、删除、文件修订、包注册、注解、附件、阶段、晋级,以及镜像、npm 和 Git LFS 的变更。不传 after 时,从保留的最早事件开始。要继续读取,请将 next 作为 after 传入:它也会越过调用方无权看到的事件,每个请求最多 5000 个。types 保留指定的类型或 artifact.* 这样的前缀,repository 只保留一个仓库。早于 oldest 的游标返回 410 events_cursor_expired;属于另一个 epoch 的游标(服务器已从备份恢复)返回 409 events_epoch_changed;两者都在 events 中带有当前的 epoch、oldest 和 head。请按 id 去重;事件只是提示,当前状态请通过常规路由读取。

参数

名称位置类型必需规则
after查询string否匹配 ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:(0|[1-9][0-9]{0,18})$; Event id or next of a page; without it the feed starts at oldest
limit查询integer否1–500
types查询string否最多 2048 个字符; Comma-separated names or prefixes such as artifact.*
repository查询string否匹配 ^[a-z0-9][a-z0-9_-]{0,63}$

响应 200

字段类型必需规则
epochstring (uuid)是—
items数组(object)是最多 500 项
items[].specversionstring是取值之一:1.0
items[].idstring是匹配 ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:(0|[1-9][0-9]{0,18})$; 事件 ID,<epoch>:<position>;按它去重
items[].sourcestring是—
items[].typestring是—
items[].subjectstring是制品 ID,文件事件则为路径
items[].timestring (date-time)是—
items[].datacontenttypestring是取值之一:application/json
items[].dataschemastring是—
items[].partitionkeystring是repository:<repository>;同一分区的事件保持提交顺序
items[].arkvorypositionstring是用十进制数字表示的整数,以字符串形式发送
items[].arkvoryepochstring (uuid)是—
items[].dataobject是该类型的数据;其 JSON Schema 见类型列表
nextstring是匹配 ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:(0|[1-9][0-9]{0,18})$
headstring是用十进制数字表示的整数,以字符串形式发送
oldeststring是用十进制数字表示的整数,以字符串形式发送

响应: 200, 400, 401, 403, 404, 409, 410, 422, 503, 507

示例

bash
curl -X GET "$ARKVORY_URL/api/v1/events" \
  -H "Authorization: Bearer $ARKVORY_TOKEN"

列出事件类型 ​

GET HEAD /api/v1/events/types

访问: 任何有效的密钥或会话 · 重试: 可安全重试(读取)

返回此服务器写入的每种事件类型:名称、schemaVersion、范围、读取者所需的权限、保持其顺序的分区,以及 data 的 JSON Schema。CloudEvents 的 type 为 arkvory.<name>.v<schemaVersion>。

响应 200

字段类型必需规则
items数组(object)是—
items[].namestring是—
items[].schemaVersioninteger是不小于 1
items[].scopestring是取值之一:repository, system
items[].permissionstring是取值之一:artifact.list, administrator
items[].partitionstring是—
items[].descriptionstring是—
items[].dataSchemaobject否—

响应: 200, 400, 401, 403, 404, 409, 422, 503, 507

示例

bash
curl -X GET "$ARKVORY_URL/api/v1/events/types" \
  -H "Authorization: Bearer $ARKVORY_TOKEN"

Arkvory · ProAnimaStudio