تخطَّ إلى المحتوى
CADCAMFUN
الوثائق

الوثائق

المستخدمين

الملفات الشخصية وموارد الحساب ومفاتيح واجهة برمجة التطبيقات وسجلات الرموز المميزة وكلمات المرور وإزالة الحساب.

مترجم تلقائيًا من الإنجليزية. عرض الأصل بالإنجليزية

ساحة التجربة

أرسل هذه الطلبات إلى السايدكار الخاصة بك. تبقى القيم في هذا المتصفح.

غير متصل
كيف يعمل هذا

يستمع السايدكار إلى منفذ الاسترجاع الذي تم اختياره عند بدء التشغيل ويطبعه في منفذ الاسترجاع الخاص به ready خط؛ استخدم عنوان URL هذا و CADCAMFUN_TOKEN لقد بدأ مع. تذهب الطلبات مباشرة من هذه الصفحة إلى هذا العنوان.

يرسل السايدكار رؤوس CORS فقط إلى أصول Tauri وإلى http://localhost أو http://127.0.0.1 على أي منفذ. من المستندات المستضافة، يحظر المتصفح الاستجابة، لذا قم بتشغيل المستندات محليًا (bun run dev في packages/web) لاستخدام الملعب، أو نسخ الطلب كحليقة. للتجربة دون لمس البيانات الحقيقية، ابدأ تشغيل السايدكار باستخدام CADCAMFUN_DATA_DIR أشار إلى دليل مهمل - انظر إرشادات واجهة برمجة التطبيقات.

العمليات

18 نقاط نهاية في user المجموعة التي تم إنشاؤها من السايدكار مستند OpenAPI. تأخذ العمليات المحمية 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
عمليات المستخدمين في 3د اسحب إلى المدار · قم بالتمرير للتكبير · اسحب بزر الماوس الأيمن للتحريك
كتلة واحدة لكل عملية (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/user/profile
{
  "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/user/profile
curl --request GET "${CADCAMFUN_URL}/api/user/profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يضع /api/user/profile # user.updateProfile

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · بيانات متعددة الأجزاء/النموذج
{
  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
ضع /api/user/profile
curl --request PUT "${CADCAMFUN_URL}/api/user/profile" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: multipart/form-data" \
  --data-binary @request-body
جربه

تأخذ هذه العملية بيانات متعددة الأجزاء/النموذج؛ استخدم مثال الضفيرة أو الجلب.

/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/user/stats
{
  "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/user/stats
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/user/components
[]
مثال 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/user/components
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/user/projects
[]
مثال 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/user/projects
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
الحصول على /api/user/toolpaths
[]
مثال 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
الحصول على /api/user/toolpaths
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/user/organizations
[]
مثال 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/user/organizations
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
احصل على /api/user/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
احصل على /api/user/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/user/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/user/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/user/delete-account
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
ضع /api/user/password
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/user/tokens
{
  "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/user/tokens
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/user/tokens
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
الحصول على /api/user/verify-change
{
  "_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
الحصول على /api/user/verify-change
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
احصل على /api/user/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
ضع /api/user/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>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
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/user/{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
}

استدعاء هذه المجموعة

معرفات العملية لها النموذج user.<name>. وعد SDK الذي تم إنشاؤه (@cadcamfun/api/sdk) يعرض معظمهم client.<namespace>.<method>(input)، أين input هو كائن مسطح واحد من معلمات المسار وحقول النص؛ يُظهر مثال SDK لكل بطاقة الملحق الدقيق ونوع الإدخال. لا يتم إنشاء التحميلات متعددة الأجزاء والاستجابات الثنائية أو استجابات JavaScript وخطافات الويب الأولية؛ تظهر تلك البطاقات 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"يتم تقديم المستندات من أصل غير استرجاعيقم بتشغيل المستندات محليًا أو انسخ الطلب كـ curly.
رفض اتصالتم إعادة تشغيل السايدكار في منفذ جديدقراءة المنفذ من الجديد ready سطر.