跳到内容
CADCAMFUN
文档

文档

历史和工作流程

项目与 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/{id}/vcs/status vcs.status
得到 /api/projects/{id}/vcs/log vcs.log
邮政 /api/projects/{id}/vcs/commit vcs.commit
得到 /api/projects/{id}/vcs/branches vcs.branches
邮政 /api/projects/{id}/vcs/branches vcs.createBranch
邮政 /api/projects/{id}/vcs/checkout vcs.checkout
邮政 /api/projects/{id}/vcs/restore vcs.restore
得到 /api/projects/{id}/vcs/diff vcs.diff
得到 /api/projects/{id}/pulls vcs.listPullRequests
邮政 /api/projects/{id}/pulls vcs.openPullRequest
得到 /api/projects/{id}/pulls/{number} vcs.pullRequest
邮政 /api/projects/{id}/pulls/{number}/reviews vcs.review
邮政 /api/projects/{id}/pulls/{number}/merge vcs.mergePullRequest
邮政 /api/projects/{id}/pulls/{number}/close vcs.closePullRequest
得到 /api/projects/{id}/vcs/remote vcs.remote
放 /api/projects/{id}/vcs/remote vcs.setRemote
邮政 /api/projects/{id}/vcs/push vcs.push
邮政 /api/projects/{id}/vcs/pull vcs.pull
得到 /api/projects/{id}/actions/runs vcs.runs
邮政 /api/projects/{id}/actions/dispatch vcs.dispatch
得到 /api/projects/{id}/actions/workflows vcs.listWorkflows
得到 /api/projects/{id}/actions/workflows/{name} vcs.workflow
3D 中的历史记录和工作流程操作 拖动进行轨道旋转·滚动进行缩放·右键拖动进行平移
每个操作一个块 (22),按此页面的每个资源部分堆叠,并按方法着色:绿色 GET、橙色 POST、蓝色 PUT、紫色 PATCH、红色 DELETE。在构建时从 OpenAPI 文档生成。

/api/projects

得到 /api/projects/{id}/vcs/status # 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示例
vcs.status
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
获取 /api/projects/{id}/vcs/status
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/status" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
得到 /api/projects/{id}/vcs/log # 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示例
vcs.log
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
获取 /api/projects/{id}/vcs/log
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/log" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
邮政 /api/projects/{id}/vcs/commit # vcs.commit

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.commit
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
POST /api/projects/{id}/vcs/commit
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/commit" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
得到 /api/projects/{id}/vcs/branches # 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示例
vcs.branches
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
获取 /api/projects/{id}/vcs/branches
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/branches" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
邮政 /api/projects/{id}/vcs/branches # vcs.createBranch

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.createBranch
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
POST /api/projects/{id}/vcs/branches
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/branches" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
邮政 /api/projects/{id}/vcs/checkout # vcs.checkout

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.checkout
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
POST /api/projects/{id}/vcs/checkout
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/checkout" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
邮政 /api/projects/{id}/vcs/restore # vcs.restore

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.restore
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
POST /api/projects/{id}/vcs/restore
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/restore" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
得到 /api/projects/{id}/vcs/diff # 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示例
vcs.diff
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
获取 /api/projects/{id}/vcs/diff
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/diff?to=<to>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
得到 /api/projects/{id}/pulls # 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示例
vcs.listPullRequests
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
获取 /api/projects/{id}/pulls
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/pulls" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
邮政 /api/projects/{id}/pulls # vcs.openPullRequest

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.openPullRequest
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
POST /api/projects/{id}/pulls
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/pulls" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
得到 /api/projects/{id}/pulls/{number} # 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示例
vcs.pullRequest
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
GET /api/projects/{id}/pulls/{number}
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/pulls/<number>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
邮政 /api/projects/{id}/pulls/{number}/reviews # vcs.review

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
数字 小路 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.review
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
POST /api/projects/{id}/pulls/{number}/reviews
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
尝试一下
邮政 /api/projects/{id}/pulls/{number}/merge # 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示例
vcs.mergePullRequest
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
POST /api/projects/{id}/pulls/{number}/merge
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/pulls/<number>/merge" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
邮政 /api/projects/{id}/pulls/{number}/close # 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示例
vcs.closePullRequest
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
POST /api/projects/{id}/pulls/{number}/close
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/pulls/<number>/close" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
得到 /api/projects/{id}/vcs/remote # 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示例
vcs.remote
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
获取 /api/projects/{id}/vcs/remote
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/vcs/remote" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
放 /api/projects/{id}/vcs/remote # vcs.setRemote

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.setRemote
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
PUT /api/projects/{id}/vcs/remote
curl --request PUT "${CADCAMFUN_URL}/api/projects/<id>/vcs/remote" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
邮政 /api/projects/{id}/vcs/push # vcs.push

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
x-github-令牌 标头 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.push
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
POST /api/projects/{id}/vcs/push
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/push" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
邮政 /api/projects/{id}/vcs/pull # vcs.pull

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
x-github-令牌 标头 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.pull
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
POST /api/projects/{id}/vcs/pull
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/vcs/pull" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
得到 /api/projects/{id}/actions/runs # 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示例
vcs.runs
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
获取 /api/projects/{id}/actions/runs
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/actions/runs" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
邮政 /api/projects/{id}/actions/dispatch # vcs.dispatch

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
请求正文 · 必填 · application/json
{
  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示例
vcs.dispatch
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
POST /api/projects/{id}/actions/dispatch
curl --request POST "${CADCAMFUN_URL}/api/projects/<id>/actions/dispatch" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
得到 /api/projects/{id}/actions/workflows # 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示例
vcs.listWorkflows
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
获取 /api/projects/{id}/actions/workflows
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/actions/workflows" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
得到 /api/projects/{id}/actions/workflows/{name} # 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示例
vcs.workflow
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
GET /api/projects/{id}/actions/workflows/{name}
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
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

呼叫该群组

操作 ID 的形式为 vcs.<name>。生成的Promise SDK(@cadcamfun/api/sdk)将其中大部分暴露为 client.<namespace>.<method>(input), 在哪里 input 是路径参数和主体字段的一个平面对象;每张卡的 SDK 示例显示了确切的访问器和输入类型。不会生成分段上传、二进制或 JavaScript 响应以及原始 Webhook;这些卡片显示 fetch 改为。

Promise SDK 的错误
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 行。