文档
历史和工作流程
项目与 Git 兼容的提交、分支、恢复、审查、GitHub 镜像和工作流程调度。
从英文自动翻译。 查看英文原文
将这些请求发送到您自己正在运行的 sidecar。值保留在此浏览器中。
这是如何运作的
sidecar 侦听启动时选择的环回端口并将其打印在其中 ready 线;使用该 URL 和 CADCAMFUN_TOKEN 它是从开始的。请求直接从该页面发送到该地址。
sidecar 仅将 CORS 标头发送到 Tauri 源并发送到 http://localhost 或 http://127.0.0.1 在任何端口上。浏览器会阻止托管文档的响应,因此请在本地运行文档(bun run dev 中 packages/web) 使用游乐场,或将请求复制为curl。要在不接触真实数据的情况下进行实验,请使用以下命令启动 sidecar CADCAMFUN_DATA_DIR 指向一个一次性目录 - 请参阅 aPI 演练.
运营
22 个端点,位于 vcs 组,由 sidecar 自己生成 开放API文档。受保护的操作需要 Authorization: Bearer $CADCAMFUN_TOKEN;看 验证。行为和限制在 子系统指南.
/api/projects
vcs.status 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
200 目的 application/json
{ branch: string head: string | null dirty: string[] }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsStatusInput
const result = await client.vcs.status({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/status" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.log 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| 转速 | 询问 | 细绳 | null | 选修的 |
| 限制 | 询问 | 细绳 | null | 选修的 |
| 小路 | 询问 | 细绳 | null | 选修的 |
200 数组<对象> application/json
Array<{ oid: string parents: string[] message: string author: { name: string email: string time: number | "Infinity" | "-Infinity" | "NaN" } }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsLogInput
const result = await client.vcs.log({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/log" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.commit 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
{ message: string authorKind?: "user" | "ai" | null files?: { [key: string]: string } | null }
201 目的 application/json
{ oid: string parents: string[] message: string author: { name: string email: string time: number | "Infinity" | "-Infinity" | "NaN" } }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsCommitInput
const result = await client.vcs.commit({
id: "<id>",
message: "",
authorKind: "user",
files: {}
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/commit" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.branches 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
200 目的 application/json
{ current: string branches: { [key: string]: string } }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsBranchesInput
const result = await client.vcs.branches({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/branches" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.createBranch 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
{ name: string from?: string | null }
201 目的 application/json
{ current: string branches: { [key: string]: string } }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsCreateBranchInput
const result = await client.vcs.createBranch({
id: "<id>",
name: "",
from: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/branches" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.checkout 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
{ branch: string }
200 目的 application/json
{ branch: string head: string | null dirty: string[] }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsCheckoutInput
const result = await client.vcs.checkout({
id: "<id>",
branch: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/checkout" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.restore 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
{ rev: string paths?: string[] | null }
200 目的 application/json
{ oid: string parents: string[] message: string author: { name: string email: string time: number | "Infinity" | "-Infinity" | "NaN" } }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsRestoreInput
const result = await client.vcs.restore({
id: "<id>",
rev: "",
paths: [
""
]
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/restore" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.diff 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| 从 | 询问 | 细绳 | null | 选修的 |
| 至 | 询问 | 细绳 | 必需的 |
200 数组<对象> application/json
Array<{ path: string kind: "drawings" | "components" | "toolpaths" | "materials" | "tools" | "machine-configs" | "costs" | "project" | "other" id?: string | null name?: string | null status: "added" | "modified" | "deleted" changes: Array<{ pointer: string before?: unknown | null after?: unknown | null }> }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsDiffInput
const result = await client.vcs.diff({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/diff?to=<to>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.listPullRequests 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| 状态 | 询问 | “打开” | “合并” | “关闭” | null | 选修的 |
200 数组<对象> application/json
Array<{ id: string projectId: string number: number | "Infinity" | "-Infinity" | "NaN" title: string body: string head: string base: string state: "open" | "merged" | "closed" authorId: string authorKind: "user" | "ai" mergeCommit: string | null remoteNumber: number | "Infinity" | "-Infinity" | "NaN" | null createdAt: string updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsListPullRequestsInput
const result = await client.vcs.listPullRequests({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/pulls" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.openPullRequest 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
{ title: string body?: string | null head: string base?: string | null authorKind?: "user" | "ai" | null }
201 目的 application/json
{ id: string projectId: string number: number | "Infinity" | "-Infinity" | "NaN" title: string body: string head: string base: string state: "open" | "merged" | "closed" authorId: string authorKind: "user" | "ai" mergeCommit: string | null remoteNumber: number | "Infinity" | "-Infinity" | "NaN" | null createdAt: string updatedAt: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsOpenPullRequestInput
const result = await client.vcs.openPullRequest({
id: "<id>",
title: "",
body: "",
head: "",
base: "",
authorKind: "user"
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/pulls" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.pullRequest 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| 数字 | 小路 | 细绳 | 必需的 |
200 目的 application/json
{ pullRequest: { id: string projectId: string number: number | "Infinity" | "-Infinity" | "NaN" title: string body: string head: string base: string state: "open" | "merged" | "closed" authorId: string authorKind: "user" | "ai" mergeCommit: string | null remoteNumber: number | "Infinity" | "-Infinity" | "NaN" | null createdAt: string updatedAt: string } reviews: Array<{ id: string pullRequestId: string reviewerId: string verdict: "comment" | "approve" | "request-changes" body: string path: string | null pointer: string | null createdAt: string }> changes: Array<{ path: string kind: "drawings" | "components" | "toolpaths" | "materials" | "tools" | "machine-configs" | "costs" | "project" | "other" id?: string | null name?: string | null status: "added" | "modified" | "deleted" changes: Array<{ pointer: string before?: unknown | null after?: unknown | null }> }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsPullRequestInput
const result = await client.vcs.pullRequest({
id: "<id>",
number: "<number>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/pulls/<number>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.review 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| 数字 | 小路 | 细绳 | 必需的 |
{ verdict: "comment" | "approve" | "request-changes" body?: string | null path?: string | null pointer?: string | null }
201 目的 application/json
{ id: string pullRequestId: string reviewerId: string verdict: "comment" | "approve" | "request-changes" body: string path: string | null pointer: string | null createdAt: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsReviewInput
const result = await client.vcs.review({
id: "<id>",
number: "<number>",
verdict: "comment",
body: "",
path: "",
pointer: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/pulls/<number>/reviews" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.mergePullRequest 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| 数字 | 小路 | 细绳 | 必需的 |
200 目的 application/json
{ id: string projectId: string number: number | "Infinity" | "-Infinity" | "NaN" title: string body: string head: string base: string state: "open" | "merged" | "closed" authorId: string authorKind: "user" | "ai" mergeCommit: string | null remoteNumber: number | "Infinity" | "-Infinity" | "NaN" | null createdAt: string updatedAt: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsMergePullRequestInput
const result = await client.vcs.mergePullRequest({
id: "<id>",
number: "<number>"
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/pulls/<number>/merge" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.closePullRequest 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| 数字 | 小路 | 细绳 | 必需的 |
200 目的 application/json
{ id: string projectId: string number: number | "Infinity" | "-Infinity" | "NaN" title: string body: string head: string base: string state: "open" | "merged" | "closed" authorId: string authorKind: "user" | "ai" mergeCommit: string | null remoteNumber: number | "Infinity" | "-Infinity" | "NaN" | null createdAt: string updatedAt: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsClosePullRequestInput
const result = await client.vcs.closePullRequest({
id: "<id>",
number: "<number>"
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/pulls/<number>/close" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.remote 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
200 目的 application/json
{ remote: string | null }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsRemoteInput
const result = await client.vcs.remote({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/remote" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.setRemote 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
{ remote: string | null }
200 目的 application/json
{ remote: string | null }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsSetRemoteInput
const result = await client.vcs.setRemote({
id: "<id>",
remote: ""
}) curl
curl --request PUT "${CADCAMFUN_URL}/api/projects/<id>/vcs/remote" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.push 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| x-github-令牌 | 标头 | 细绳 | 必需的 |
{ branch?: string | null }
200 目的 application/json
{ oid: string objects: number | "Infinity" | "-Infinity" | "NaN" }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsPushInput
const result = await client.vcs.push({
id: "<id>",
branch: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/push" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.pull 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| x-github-令牌 | 标头 | 细绳 | 必需的 |
{ branch?: string | null }
200 目的 application/json
{ kind: string oid: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsPullInput
const result = await client.vcs.pull({
id: "<id>",
branch: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/pull" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.runs 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
200 数组<对象> application/json
Array<{ id: string projectId: string workflow: string event: "push" | "pull-request" | "manual" ref: string sha: string status: "queued" | "running" | "success" | "failure" events: unknown[] startedAt: string finishedAt: string | null }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsRunsInput
const result = await client.vcs.runs({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/actions/runs" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.dispatch 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
{ ref?: string | null }
200 数组<对象> application/json
Array<{ id: string projectId: string workflow: string event: "push" | "pull-request" | "manual" ref: string sha: string status: "queued" | "running" | "success" | "failure" events: unknown[] startedAt: string finishedAt: string | null }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsDispatchInput
const result = await client.vcs.dispatch({
id: "<id>",
ref: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/actions/dispatch" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 尝试一下
vcs.listWorkflows 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| 参考 | 询问 | 细绳 | null | 选修的 |
200 数组<对象> application/json
Array<{ name: string path: string content: string problem?: string | null }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsListWorkflowsInput
const result = await client.vcs.listWorkflows({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/actions/workflows" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
vcs.workflow 需要 Authorization: Bearer <token>.
| 姓名 | 在 | 类型 | 必需的 |
|---|---|---|---|
| iD | 小路 | 细绳 | 必需的 |
| 姓名 | 小路 | 细绳 | 必需的 |
| 参考 | 询问 | 细绳 | null | 选修的 |
200 目的 application/json
{ name: string path: string content: string problem?: string | null }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// VcsWorkflowInput
const result = await client.vcs.workflow({
id: "<id>",
name: "<name>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/actions/workflows/<name>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 尝试一下
模式
可从该组的参数、主体和响应访问命名模式。一个 ? 标记可选字段; | null 标记可能存在空值的字段。
BadRequestEncoded{ _tag: "BadRequest" message: string }
ConflictEncoded{ _tag: "Conflict" message: string }
ForbiddenEncoded{ _tag: "Forbidden" message: string }
InternalErrorEncoded{ _tag: "InternalError" message: string }
NotFoundEncoded{ _tag: "NotFound" message: string }
呼叫该群组
操作 ID 的形式为 vcs.<name>。生成的Promise SDK(@cadcamfun/api/sdk)将其中大部分暴露为 client.<namespace>.<method>(input), 在哪里 input 是路径参数和主体字段的一个平面对象;每张卡的 SDK 示例显示了确切的访问器和输入类型。不会生成分段上传、二进制或 JavaScript 响应以及原始 Webhook;这些卡片显示 fetch 改为。
import { CadCam, ClientError } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
try {
await client.projects.list()
} catch (error) {
if (error instanceof ClientError) {
// Transport | UnexpectedStatus | UnsupportedContentType | MalformedResponse | SseEventTooLarge
} else {
// a declared error body: switch on error._tag
}
} 故障排除
| 症状 | 可能的原因 | 使固定 |
|---|---|---|
| 每次调用 401 | 上次启动的令牌或丢失 Bearer 前缀 | 发送 Authorization: Bearer <token> 使用边车启动时的令牌。 |
| 在任何事情发生之前的 400 | 主体或参数与架构不匹配 | 将有效负载与卡上的请求架构进行比较。 |
| 在别处可见的记录上出现 403 或 404 | 代理账户不同 | 发送正确的 x-session-token,或使用拥有该记录的本地配置文件。 |
| 409 | 状态冲突,例如重复的名称或过时的分支头 | 重新读取资源并使用当前数据重试。 |
| 尝试显示“被 CORS 阻止” | 这些文档是从非环回源提供的 | 在本地运行文档或将请求复制为curl。 |
| 连接被拒绝 | Sidecar 在新端口上重新启动 | 从新读取端口 ready 行。 |