包
UPack 包:注册、列表、版本,以及按名称、版本或版本范围下载。
本组中的操作及其访问规则、重试规则、参数和响应。每个请求都需携带密钥:Authorization: Bearer <密钥>(参见“身份验证”)。
操作
列出包版本
GET HEAD /api/v1/repositories/{repository}/packages
访问: 仓库权限:package.read; 文件密钥:read · 重试: 可安全重试(读取)
列出已注册的 UPack 版本及其清单,可按 group 和 name 过滤(精确匹配,忽略大小写;group= 的值为空表示根包组,省略则选择所有包组)。sort(group、name、version)、direction(asc、desc)和 groupBy(none、group、package,后两者会添加列出该页 artifactIds 的 groups)决定结果的形态。每页包含 limit 项(1–100,默认 50);使用相同的过滤条件,将 after 设为 next 即可继续。分页不是快照:期间注册的版本可能会被漏掉,直到下一轮遍历。
参数
| 名称 | 位置 | 类型 | 必需 | 规则 |
|---|---|---|---|---|
repository | 路径 | string | 是 | 匹配 ^[a-z0-9][a-z0-9_-]{0,63}$ |
group | 查询 | string | 否 | — |
name | 查询 | string | 否 | — |
sort | 查询 | string | 否 | 取值之一:group, name, version |
direction | 查询 | string | 否 | 取值之一:asc, desc |
groupBy | 查询 | string | 否 | 取值之一:none, group, package |
after | 查询 | string | 否 | — |
limit | 查询 | integer | 否 | 1–100 |
响应 200
| 字段 | 类型 | 必需 | 规则 |
|---|---|---|---|
items | 数组(object) | 是 | — |
items[].group | string | 否 | — |
items[].name | string | 否 | — |
items[].version | string | 否 | — |
items[].artifactId | string (uuid) | 否 | — |
items[].manifest | object | 否 | — |
next | string | 是 | 可以为 null |
groups | 数组(object) | 是 | — |
groups[].group | string | 是 | — |
groups[].name | string | 是 | 可以为 null |
groups[].artifactIds | 数组(string (uuid)) | 是 | — |
响应: 200, 400, 401, 403, 404, 409, 422, 503, 507
示例
curl -X GET "$ARKVORY_URL/api/v1/repositories/$REPOSITORY/packages" \
-H "Authorization: Bearer $ARKVORY_TOKEN"按名称和版本下载包
GET HEAD /api/v1/repositories/{repository}/packages/content
访问: 仓库权限:content.read; 文件密钥:read · 重试: 可安全重试(读取)
将 name(位于 group 中,默认为根包组)解析为一个已注册的版本,并像 downloadArtifact 一样以流式返回;X-Arkvory-Artifact-Id 和 X-Arkvory-Package-Version 给出所选的结果。可按精确的 version 或 SemVer range(例如 ^1.4 或 >=1.0.0 <2.0.0)选择,也可以只限定具有 stage 的版本;两者都未给出时取最高的稳定版本,prerelease=true 允许预发布版本,order=promoted 取最近被赋予 stage 的版本。每次请求都会重新解析名称,因此续传时请把 If-Range 设为返回的 ETag,或按制品 ID 下载;resolvePackage 给出同样的选择但不返回字节。
参数
| 名称 | 位置 | 类型 | 必需 | 规则 |
|---|---|---|---|---|
repository | 路径 | string | 是 | 匹配 ^[a-z0-9][a-z0-9_-]{0,63}$ |
Range | 标头 | string | 否 | Single bytes range; multi-range is unsupported. HEAD ignores Range. |
If-Range | 标头 | string | 否 | Exact strong ETag; a mismatch causes a full response. |
If-None-Match | 标头 | string | 否 | Matching ETag returns 304, including HEAD. |
Arkvory-Download-Id | 标头 | string | 否 | 匹配 ^[A-Za-z0-9_-]{16,64}$; The client own id of one download, the same on every range of it: the queue keys the session by it instead of the client address, answers a waiting request at once with 503 download_queued, and may ask it to yield its place at a range boundary. Without it, a waiting request is held until its turn for a bounded time. |
Arkvory-Queue-Ticket | 标头 | string | 否 | 最多 80 个字符; The last Arkvory-Queue-Ticket the server sent for this download: after a server restart the download takes its old turn. A ticket that is wrong, expired or of another download is ignored. |
Arkvory-Download-Class | 标头 | string | 否 | 取值之一:interactive, release, bulk, background; Queue class of the download. Only a class lower than the caller own one applies (people: interactive, services and links: release); an unknown value is 400. The response names the class applied. |
group | 查询 | string | 否 | 最多 128 个字符 |
name | 查询 | string | 是 | 1–128 个字符 |
version | 查询 | string | 否 | 最多 128 个字符; Exact version; excludes range. |
range | 查询 | string | 否 | 最多 256 个字符; SemVer range: 1.2.3, ^1.2, ~1.2.3, 1.x, >=1.0.0 <2.0.0, a || b. |
stage | 查询 | string | 否 | 匹配 ^[a-z0-9][a-z0-9_.-]{0,31}$; Only versions promoted to this stage. |
prerelease | 查询 | string | 否 | 取值之一:true, false; Include prereleases. |
order | 查询 | string | 否 | 取值之一:version, promoted; promoted picks the most recently staged version and requires stage. |
响应: 200, 206, 304, 400, 401, 403, 404, 409, 416, 422, 503, 507
示例
curl -X GET "$ARKVORY_URL/api/v1/repositories/$REPOSITORY/packages/content?name=$NAME" \
-H "Authorization: Bearer $ARKVORY_TOKEN" \
-o file