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

الوثائق

أدوات

سجلات القطع والأبعاد المستخدمة في سير عمل تصنيع التطبيقات.

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

ساحة التجربة

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

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

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

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

العمليات

5 نقاط نهاية في tools المجموعة التي تم إنشاؤها من السايدكار مستند OpenAPI. تأخذ العمليات المحمية Authorization: Bearer $CADCAMFUN_TOKEN; يرى المصادقة. السلوك والحدود موجودة دليل النظام الفرعي.

يحصل /api/tools tools.list
بريد /api/tools tools.create
يحصل /api/tools/{id} tools.get
يضع /api/tools/{id} tools.update
يمسح /api/tools/{id} tools.remove
عمليات الأدوات في 3د اسحب إلى المدار · قم بالتمرير للتكبير · اسحب بزر الماوس الأيمن للتحريك
كتلة واحدة لكل عملية (5)، مكدسة لكل قسم موارد في هذه الصفحة وملونة حسب الطريقة: GET الأخضر، POST البرتقالي، PUT الأزرق، PATCH البنفسجي، DELETE الأحمر. تم إنشاؤها من مستند OpenAPI في وقت الإنشاء.

/api/tools

يحصل /api/tools # tools.list

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

حدود
اسمفييكتبمطلوب
يكتب استفسار خيط | null خياري
مادة استفسار خيط | null خياري
القطر استفسار خيط | null خياري
يبحث استفسار خيط | null خياري
عام استفسار خيط | null خياري
الردود
200 صفيف <كائن> application/json
Array<{
  id: string
  name: string
  type: string
  diameter: number | "Infinity" | "-Infinity" | "NaN"
  material: string
  numberOfFlutes: number | "Infinity" | "-Infinity" | "NaN" | null
  maxRPM: number | "Infinity" | "-Infinity" | "NaN" | null
  coolantType: string | null
  cuttingLength: number | "Infinity" | "-Infinity" | "NaN" | null
  totalLength: number | "Infinity" | "-Infinity" | "NaN" | null
  shankDiameter: number | "Infinity" | "-Infinity" | "NaN" | null
  cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null
  tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null
  threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  stickout?: number | "Infinity" | "-Infinity" | "NaN" | null
  notes: string | null
  isPublic: boolean
  createdAt: string
  updatedAt: string
  ownerId: string | null
  organizationId: string | null
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
رد المثال تم الالتقاط · 200
الحصول على /api/tools
[]
مثال SDK
tools.list
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsListInput
const result = await client.tools.list({})
curl
الحصول على /api/tools
curl --request GET "${CADCAMFUN_URL}/api/tools" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
بريد /api/tools # tools.create

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

نص الطلب · مطلوب · application/json
{
  name?: string | null
  type?: string | null
  diameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  material?: string | null
  numberOfFlutes?: number | "Infinity" | "-Infinity" | "NaN" | null
  maxRPM?: number | "Infinity" | "-Infinity" | "NaN" | null
  coolantType?: string | null
  cuttingLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  totalLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  shankDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null
  tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null
  threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  stickout?: number | "Infinity" | "-Infinity" | "NaN" | null
  notes?: string | null
  organizationId?: string | null
  isPublic?: boolean | null
}
الردود
201 هدف application/json
{
  id: string
  name: string
  type: string
  diameter: number | "Infinity" | "-Infinity" | "NaN"
  material: string
  numberOfFlutes: number | "Infinity" | "-Infinity" | "NaN" | null
  maxRPM: number | "Infinity" | "-Infinity" | "NaN" | null
  coolantType: string | null
  cuttingLength: number | "Infinity" | "-Infinity" | "NaN" | null
  totalLength: number | "Infinity" | "-Infinity" | "NaN" | null
  shankDiameter: number | "Infinity" | "-Infinity" | "NaN" | null
  cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null
  tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null
  threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  stickout?: number | "Infinity" | "-Infinity" | "NaN" | null
  notes: string | null
  isPublic: boolean
  createdAt: string
  updatedAt: string
  ownerId: string | null
  organizationId: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
tools.create
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsCreateInput
const result = await client.tools.create({
  name: "",
  type: "",
  diameter: 0,
  material: "",
  numberOfFlutes: 0,
  maxRPM: 0,
  coolantType: "",
  cuttingLength: 0,
  totalLength: 0,
  shankDiameter: 0,
  cornerRadius: 0,
  tipAngle: 0,
  threadPitch: 0,
  holderDiameter: 0,
  holderLength: 0,
  stickout: 0,
  notes: "",
  organizationId: "",
  isPublic: false
})
curl
نشر /api/tools
curl --request POST "${CADCAMFUN_URL}/api/tools" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يحصل /api/tools/{id} # tools.get

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

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
200 هدف application/json
{
  id: string
  name: string
  type: string
  diameter: number | "Infinity" | "-Infinity" | "NaN"
  material: string
  numberOfFlutes: number | "Infinity" | "-Infinity" | "NaN" | null
  maxRPM: number | "Infinity" | "-Infinity" | "NaN" | null
  coolantType: string | null
  cuttingLength: number | "Infinity" | "-Infinity" | "NaN" | null
  totalLength: number | "Infinity" | "-Infinity" | "NaN" | null
  shankDiameter: number | "Infinity" | "-Infinity" | "NaN" | null
  cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null
  tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null
  threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  stickout?: number | "Infinity" | "-Infinity" | "NaN" | null
  notes: string | null
  isPublic: boolean
  createdAt: string
  updatedAt: string
  ownerId: string | null
  organizationId: string | null
  owner: {
    id: string
    name: string | null
    email: string | null
  } | null
  organization: {
    id: string
    name: string
  } | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
tools.get
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsGetInput
const result = await client.tools.get({
  id: "<id>"
})
curl
الحصول على /api/tools/{id}
curl --request GET "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يضع /api/tools/{id} # tools.update

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

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
نص الطلب · مطلوب · application/json
{
  name?: string | null
  type?: string | null
  diameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  material?: string | null
  numberOfFlutes?: number | "Infinity" | "-Infinity" | "NaN" | null
  maxRPM?: number | "Infinity" | "-Infinity" | "NaN" | null
  coolantType?: string | null
  cuttingLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  totalLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  shankDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null
  tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null
  threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  stickout?: number | "Infinity" | "-Infinity" | "NaN" | null
  notes?: string | null
  organizationId?: string | null
  isPublic?: boolean | null
}
الردود
200 هدف application/json
{
  id: string
  name: string
  type: string
  diameter: number | "Infinity" | "-Infinity" | "NaN"
  material: string
  numberOfFlutes: number | "Infinity" | "-Infinity" | "NaN" | null
  maxRPM: number | "Infinity" | "-Infinity" | "NaN" | null
  coolantType: string | null
  cuttingLength: number | "Infinity" | "-Infinity" | "NaN" | null
  totalLength: number | "Infinity" | "-Infinity" | "NaN" | null
  shankDiameter: number | "Infinity" | "-Infinity" | "NaN" | null
  cornerRadius?: number | "Infinity" | "-Infinity" | "NaN" | null
  tipAngle?: number | "Infinity" | "-Infinity" | "NaN" | null
  threadPitch?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderDiameter?: number | "Infinity" | "-Infinity" | "NaN" | null
  holderLength?: number | "Infinity" | "-Infinity" | "NaN" | null
  stickout?: number | "Infinity" | "-Infinity" | "NaN" | null
  notes: string | null
  isPublic: boolean
  createdAt: string
  updatedAt: string
  ownerId: string | null
  organizationId: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
tools.update
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsUpdateInput
const result = await client.tools.update({
  id: "<id>",
  name: "",
  type: "",
  diameter: 0,
  material: "",
  numberOfFlutes: 0,
  maxRPM: 0,
  coolantType: "",
  cuttingLength: 0,
  totalLength: 0,
  shankDiameter: 0,
  cornerRadius: 0,
  tipAngle: 0,
  threadPitch: 0,
  holderDiameter: 0,
  holderLength: 0,
  stickout: 0,
  notes: "",
  organizationId: "",
  isPublic: false
})
curl
ضع /api/tools/{id}
curl --request PUT "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يمسح /api/tools/{id} # tools.remove

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

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
200 هدف application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
tools.remove
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsRemoveInput
const result = await client.tools.remove({
  id: "<id>"
})
curl
حذف /api/tools/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/tools/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

المخططات

يمكن الوصول إلى المخططات المسماة من معلمات هذه المجموعة وأجسامها واستجاباتها. أ ? يمثل حقلاً اختياريًا؛ | null يضع علامة على الحقل الذي قد يكون موجودًا بقيمة فارغة.

BadRequestEncoded
{
  _tag: "BadRequest"
  message: string
}
ForbiddenEncoded
{
  _tag: "Forbidden"
  message: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
NotFoundEncoded
{
  _tag: "NotFound"
  message: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

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

معرفات العملية لها النموذج tools.<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 سطر.