跳到内容
CADCAMFUN
文档

文档

用户

配置文件、帐户资源、API 密钥、令牌记录、密码和帐户删除。

从英文自动翻译。 查看英文原文

调试台

将这些请求发送到您自己正在运行的 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 演练.

运营

18 个端点,位于 user 组,由 sidecar 自己生成 开放API文档。受保护的操作需要 Authorization: Bearer $CADCAMFUN_TOKEN;看 验证。行为和限制在 子系统指南.

得到 /api/user/profile user.profile
放 /api/user/profile user.updateProfile
得到 /api/user/stats user.stats
得到 /api/user/components user.components
得到 /api/user/projects user.projects
得到 /api/user/toolpaths user.toolpaths
得到 /api/user/organizations user.organizations
得到 /api/user/api-keys user.apiKeys
邮政 /api/user/api-keys user.createApiKey
删除 /api/user/api-keys user.revokeApiKey
删除 /api/user/delete-account user.deleteAccount
放 /api/user/password user.password
得到 /api/user/tokens user.tokens
邮政 /api/user/tokens user.createToken
得到 /api/user/verify-change user.verifyChange
得到 /api/user/git-profile user.gitProfile
放 /api/user/git-profile user.updateGitProfile
得到 /api/user/{id} user.byId
3D 中的用户操作 拖动进行轨道旋转·滚动进行缩放·右键拖动进行平移
每个操作一个块 (18),按此页面的每个资源部分堆叠,并按方法着色:绿色 GET、橙色 POST、蓝色 PUT、紫色 PATCH、红色 DELETE。在构建时从 OpenAPI 文档生成。

/api/user/profile

得到 /api/user/profile # user.profile

需要 Authorization: Bearer <token>.

回应
200 目的 application/json
{
  id: string
  name: string | null
  email: string | null
  image: string | null
  bio: string | null
  location: string | null
  website: string | null
  company: string | null
  title: string | null
  publicProfile: boolean
  showEmail: boolean
  createdAt: string
  _count: {
    projects: number | "Infinity" | "-Infinity" | "NaN"
  }
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
响应示例 捕获·200
获取 /api/用户/个人资料
{
  "id": "c942817d-0162-4291-84ff-77321d387acc",
  "name": "Local user",
  "email": "local@cadcamfun.local",
  "image": null,
  "bio": null,
  "location": null,
  "website": null,
  "company": null,
  "title": null,
  "publicProfile": true,
  "showEmail": false,
  "createdAt": "2026-10-15T04:52:06.538Z",
  "_count": {
    "projects": 0
  }
}
SDK示例
user.profile
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.profile()
curl
获取 /api/用户/个人资料
curl --request GET "${CADCAMFUN_URL}/api/user/profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
放 /api/user/profile # user.updateProfile

需要 Authorization: Bearer <token>.

请求正文 · 必需 · multipart/form-data
{
  name?: string | null
  bio?: string | null
  location?: string | null
  website?: string | null
  company?: string | null
  title?: string | null
  publicProfile?: string | null
  showEmail?: string | null
  profileImage?: string[] | null
}
回应
200 目的 application/json
{
  message: string
  user: {
    id: string
    name: string | null
    email: string | null
    image: string | null
    bio: string | null
    location: string | null
    website: string | null
    company: string | null
    title: string | null
    publicProfile: boolean
    showEmail: boolean
    updatedAt: string
  }
  name: string | null
  email: string | null
  image: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
获取示例
user.updateProfile
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/user/profile`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
PUT /api/用户/个人资料
curl --request PUT "${CADCAMFUN_URL}/api/user/profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: multipart/form-data" \
  --data-binary @request-body
尝试一下

此操作采用 multipart/form-data;使用curl 或fetch 示例。

/api/user/stats

得到 /api/user/stats # user.stats

需要 Authorization: Bearer <token>.

回应
200 目的 application/json
{
  projectsCount: number | "Infinity" | "-Infinity" | "NaN"
  drawingsCount: number | "Infinity" | "-Infinity" | "NaN"
  toolpathsCount: number | "Infinity" | "-Infinity" | "NaN"
  componentsCount: number | "Infinity" | "-Infinity" | "NaN"
  totalDesigns: number | "Infinity" | "-Infinity" | "NaN"
  memberSince: string
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 KeyedInternalEncoded application/json
KeyedInternalEncoded
响应示例 捕获·200
获取/api/用户/统计信息
{
  "projectsCount": 0,
  "drawingsCount": 0,
  "toolpathsCount": 0,
  "componentsCount": 0,
  "totalDesigns": 0,
  "memberSince": "2026-10-15T04:52:06.538Z"
}
SDK示例
user.stats
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.stats()
curl
获取/api/用户/统计信息
curl --request GET "${CADCAMFUN_URL}/api/user/stats" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下

/api/user/components

得到 /api/user/components # user.components

需要 Authorization: Bearer <token>.

回应
200 数组<对象> application/json
Array<{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  thumbnail: string | null
  projectId: string | null
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
响应示例 捕获·200
获取/api/用户/组件
[]
SDK示例
user.components
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.components()
curl
获取/api/用户/组件
curl --request GET "${CADCAMFUN_URL}/api/user/components" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下

/api/user/projects

得到 /api/user/projects # user.projects

需要 Authorization: Bearer <token>.

回应
200 数组<对象> application/json
Array<{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
响应示例 捕获·200
获取/api/用户/项目
[]
SDK示例
user.projects
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.projects()
curl
获取/api/用户/项目
curl --request GET "${CADCAMFUN_URL}/api/user/projects" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下

/api/user/toolpaths

得到 /api/user/toolpaths # user.toolpaths

需要 Authorization: Bearer <token>.

回应
200 数组<对象> application/json
Array<{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  thumbnail: string | null
  projectId: string | null
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
响应示例 捕获·200
GET /api/用户/工具路径
[]
SDK示例
user.toolpaths
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.toolpaths()
curl
GET /api/用户/工具路径
curl --request GET "${CADCAMFUN_URL}/api/user/toolpaths" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下

/api/user/organizations

得到 /api/user/organizations # user.organizations

需要 Authorization: Bearer <token>.

回应
200 数组<对象> application/json
Array<{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  role: string
  userCount: number | "Infinity" | "-Infinity" | "NaN"
  projectCount: number | "Infinity" | "-Infinity" | "NaN"
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
响应示例 捕获·200
获取/api/用户/组织
[]
SDK示例
user.organizations
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.organizations()
curl
获取/api/用户/组织
curl --request GET "${CADCAMFUN_URL}/api/user/organizations" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下

/api/user/api-keys

得到 /api/user/api-keys # user.apiKeys

需要 Authorization: Bearer <token>.

回应
200 数组<对象> application/json
Array<{
  id: string
  name: string
  createdAt: string
  lastUsed: string | null
  expiresAt: string | null
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
响应示例 捕获·200
GET /api/用户/api-keys
[]
SDK示例
user.apiKeys
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.apiKeys()
curl
GET /api/用户/api-keys
curl --request GET "${CADCAMFUN_URL}/api/user/api-keys" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
邮政 /api/user/api-keys # user.createApiKey

需要 Authorization: Bearer <token>.

请求正文 · 必填 · application/json
{
  name?: unknown | null
}
回应
201 目的 application/json
{
  message: string
  apiKey: string
  name: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
user.createApiKey
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserCreateApiKeyInput
const result = await client.user.createApiKey({
  name: null
})
curl
POST /api/用户/api-keys
curl --request POST "${CADCAMFUN_URL}/api/user/api-keys" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下
删除 /api/user/api-keys # user.revokeApiKey

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
keyId 询问 细绳 | null 选修的
回应
200 目的 application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
user.revokeApiKey
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserRevokeApiKeyInput
const result = await client.user.revokeApiKey({})
curl
删除/api/用户/api-keys
curl --request DELETE "${CADCAMFUN_URL}/api/user/api-keys" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下

/api/user/delete-account

删除 /api/user/delete-account # user.deleteAccount

需要 Authorization: Bearer <token>.

回应
200 目的 application/json
{
  message: string
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
user.deleteAccount
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.deleteAccount()
curl
删除 /api/用户/删除帐户
curl --request DELETE "${CADCAMFUN_URL}/api/user/delete-account" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下

/api/user/password

放 /api/user/password # user.password

需要 Authorization: Bearer <token>.

请求正文 · 必填 · application/json
{
  currentPassword?: string | null
  newPassword?: string | null
}
回应
200 目的 application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
user.password
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserPasswordInput
const result = await client.user.password({
  currentPassword: "",
  newPassword: ""
})
curl
PUT /api/用户/密码
curl --request PUT "${CADCAMFUN_URL}/api/user/password" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下

/api/user/tokens

得到 /api/user/tokens # user.tokens

需要 Authorization: Bearer <token>.

回应
200 目的 application/json
{
  tokens: Array<{
    id: string
    name: string
    prefix: string
    permissions: string[]
    createdAt: string
    lastUsed?: string | null
    expiresAt?: string | null
    isActive: boolean
  }>
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 KeyedInternalEncoded application/json
KeyedInternalEncoded
响应示例 捕获·200
获取/api/用户/令牌
{
  "tokens": [
    {
      "id": "token-1",
      "name": "Development Token",
      "prefix": "cad_dev_abc123",
      "permissions": [
        "read:projects",
        "write:drawings",
        "read:toolpaths"
      ],
      "createdAt": "2026-10-08T04:52:23.364Z",
      "lastUsed": "2026-10-15T03:52:23.364Z",
      "isActive": true
    },
    {
      "id": "token-2",
      "name": "Mobile App Token",
      "prefix": "cad_mobile_xyz789",
      "permissions": [
        "read:projects",
        "write:toolpaths"
      ],
      "createdAt": "2026-10-01T04:52:23.364Z",
      "lastUsed": "2026-10-15T01:52:23.364Z",
      "expiresAt": "2026-11-14T04:52:23.364Z",
      "isActive": true
    },
    {
      "id": "token-3",
      "name": "Analytics Integration",
      "prefix": "cad_analytics_def456",
      "permissions": [
        "read:analytics",
        "read:usage"
      ],
      "createdAt": "2026-09-24T04:52:23.364Z",
      "expiresAt": "2026-10-14T04:52:23.364Z",
      "isActive": false
    }
  ]
}
SDK示例
user.tokens
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.user.tokens()
curl
获取/api/用户/令牌
curl --request GET "${CADCAMFUN_URL}/api/user/tokens" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
邮政 /api/user/tokens # user.createToken

需要 Authorization: Bearer <token>.

请求正文 · 必填 · application/json
{
  name?: string | null
  permissions?: unknown | null
  expiresIn?: number | "Infinity" | "-Infinity" | "NaN" | null
}
回应
201 目的 application/json
{
  token: {
    id: string
    name: string
    prefix: string
    permissions: string[]
    createdAt: string
    lastUsed?: string | null
    expiresAt?: string | null
    isActive: boolean
  }
  fullToken: string
}
400 TokenBadRequestEncoded application/json
TokenBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 KeyedInternalEncoded application/json
KeyedInternalEncoded
SDK示例
user.createToken
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserCreateTokenInput
const result = await client.user.createToken({
  name: "",
  permissions: null,
  expiresIn: 0
})
curl
POST /api/用户/令牌
curl --request POST "${CADCAMFUN_URL}/api/user/tokens" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下

/api/user/verify-change

得到 /api/user/verify-change # user.verifyChange

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
代币 询问 细绳 | null 选修的
类型 询问 细绳 | null 选修的
密码 询问 细绳 | null 选修的
回应
200 目的 application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
响应示例 捕获·400
GET /api/用户/验证更改
{
  "_tag": "BadRequest",
  "message": "Token and verification type are required"
}
SDK示例
user.verifyChange
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserVerifyChangeInput
const result = await client.user.verifyChange({})
curl
GET /api/用户/验证更改
curl --request GET "${CADCAMFUN_URL}/api/user/verify-change" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下

/api/user/git-profile

得到 /api/user/git-profile # user.gitProfile

需要 Authorization: Bearer <token>.

回应
200 目的 application/json
{
  name: string
  email: string
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
获取示例
user.gitProfile
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/user/git-profile`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
GET /api/用户/git-profile
curl --request GET "${CADCAMFUN_URL}/api/user/git-profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下
放 /api/user/git-profile # user.updateGitProfile

需要 Authorization: Bearer <token>.

请求正文 · 必填 · application/json
{
  name: string
  email: string
}
回应
200 目的 application/json
{
  name: string
  email: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
获取示例
user.updateGitProfile
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/user/git-profile`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
PUT /api/用户/git-profile
curl --request PUT "${CADCAMFUN_URL}/api/user/git-profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
尝试一下

/api/user

得到 /api/user/{id} # user.byId

需要 Authorization: Bearer <token>.

参数
姓名在类型必需的
iD 小路 细绳 必需的
回应
200 目的 application/json
{
  id: string
  name: string | null
  email: string | null
  image: string | null
  createdAt: string
  organizations: Array<{
    id: string
    name: string
    role: string
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK示例
user.byId
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// UserByIdInput
const result = await client.user.byId({
  id: "<id>"
})
curl
获取/api/用户/{id}
curl --request GET "${CADCAMFUN_URL}/api/user/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
尝试一下

模式

可从该组的参数、主体和响应访问命名模式。一个 ? 标记可选字段; | null 标记可能存在空值的字段。

BadRequestEncoded
{
  _tag: "BadRequest"
  message: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
KeyedInternalEncoded
{
  _tag: "KeyedInternal"
  error: string
}
NotFoundEncoded
{
  _tag: "NotFound"
  message: string
}
TokenBadRequestEncoded
{
  _tag: "TokenBadRequest"
  error: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

呼叫该群组

操作 ID 的形式为 user.<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 行。