सामग्री पर जाएँ
CADCAMFUN
दस्तावेज़

दस्तावेज़

अनुप्रयोग सेवाएँ

डेस्कटॉप एकीकरण मार्ग, ट्रैक किए गए प्रोजेक्ट संचालन, सूचनाएं और पुश-सदस्यता रिकॉर्ड।

स्वचालित अनुवाद अभी उपलब्ध नहीं है; पाठ अंग्रेज़ी में है और इंटरफ़ेस आपकी भाषा में है। अंग्रेज़ी मूल देखें

प्लेग्राउंड

इन अनुरोधों को अपने स्वयं के चल रहे साइडकार को भेजें। मान इस ब्राउज़र में रहते हैं.

जुड़े नहीं हैं
यह कैसे काम करता है

साइडकार स्टार्टअप पर चुने गए लूपबैक पोर्ट पर सुनता है और इसे प्रिंट करता है ready रेखा; उस यूआरएल का उपयोग करें और CADCAMFUN_TOKEN इसकी शुरुआत की गई थी. अनुरोध सीधे इस पृष्ठ से उस पते पर जाते हैं।

साइडकार CORS हेडर को केवल टौरी मूल और तक भेजता है http://localhost या http://127.0.0.1 किसी भी बंदरगाह पर. होस्ट किए गए दस्तावेज़ों से ब्राउज़र प्रतिक्रिया को अवरुद्ध कर देता है, इसलिए दस्तावेज़ों को स्थानीय रूप से चलाएँ (bun run dev में packages/web) खेल के मैदान का उपयोग करने के लिए, या अनुरोध को कर्ल के रूप में कॉपी करें। वास्तविक डेटा को छुए बिना प्रयोग करने के लिए, साइडकार से शुरुआत करें CADCAMFUN_DATA_DIR एक बेकार निर्देशिका की ओर इशारा किया - देखें एपीआई वॉकथ्रू.

संचालन

10 एंडपॉइंट misc समूह, साइडकार के स्वयं से उत्पन्न ओपनएपीआई दस्तावेज़. संरक्षित संचालन लेते हैं Authorization: Bearer $CADCAMFUN_TOKEN; देखना प्रमाणीकरण. व्यवहार और मर्यादा में हैं सबसिस्टम गाइड.

डाक /api/push-subscription misc.pushSubscribe
मिटाना /api/push-subscription misc.pushUnsubscribe
डाक /api/app-control/notify misc.notify
डाक /api/desktop/auth/signin misc.desktopSignin
पाना /api/desktop/projects misc.desktopProjects
डाक /api/desktop/projects misc.desktopCreateProject
पाना /api/desktop/user/by-email misc.desktopUserByEmail
पाना /api/projects/tracked/{id} misc.trackedGet
रखना /api/projects/tracked/{id} misc.trackedUpdate
मिटाना /api/projects/tracked/{id} misc.trackedRemove
3डी में एप्लिकेशन सेवाओं का संचालन कक्षा में खींचें · ज़ूम करने के लिए स्क्रॉल करें · पैन करने के लिए दाईं ओर खींचें
प्रति ऑपरेशन एक ब्लॉक (10), इस पृष्ठ के प्रति संसाधन अनुभाग को स्टैक्ड किया गया है और विधि के अनुसार रंगा गया है: हरा GET, नारंगी POST, नीला PUT, बैंगनी PATCH, लाल DELETE। निर्माण के समय OpenAPI दस्तावेज़ से उत्पन्न।

/api/push-subscription

डाक /api/push-subscription # misc.pushSubscribe

आवश्यक है Authorization: Bearer <token>.

अनुरोध का मुख्य भाग · आवश्यक · एप्लिकेशन/जेसन
{
  endpoint?: string | null
  keys?: {
    p256dh?: string | null
    auth?: string | null
  } | null
}
जवाब
200 वस्तु application/json
{
  success: true
  id: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
एसडीके उदाहरण
misc.pushSubscribe
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscPushSubscribeInput
const result = await client.misc.pushSubscribe({
  endpoint: "",
  keys: {}
})
curl
पोस्ट/एपीआई/पुश-सदस्यता
curl --request POST "${CADCAMFUN_URL}/api/push-subscription" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
इसे अजमाएं
मिटाना /api/push-subscription # misc.pushUnsubscribe

आवश्यक है Authorization: Bearer <token>.

अनुरोध का मुख्य भाग · आवश्यक · एप्लिकेशन/जेसन
{
  endpoint?: string | null
}
जवाब
200 वस्तु application/json
{
  success: true
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
एसडीके उदाहरण
misc.pushUnsubscribe
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscPushUnsubscribeInput
const result = await client.misc.pushUnsubscribe({
  endpoint: ""
})
curl
/एपीआई/पुश-सब्सक्रिप्शन हटाएं
curl --request DELETE "${CADCAMFUN_URL}/api/push-subscription" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
इसे अजमाएं

/api/app-control/notify

डाक /api/app-control/notify # misc.notify

आवश्यक है Authorization: Bearer <token>.

अनुरोध का मुख्य भाग · आवश्यक · एप्लिकेशन/जेसन
{
  userId?: string | null
  message?: unknown | null
}
जवाब
200 वस्तु application/json
{
  success: true
  message: string
}
400 NotifyBadRequestEncoded application/json
NotifyBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 NotifyInternalEncoded application/json
NotifyInternalEncoded
एसडीके उदाहरण
misc.notify
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscNotifyInput
const result = await client.misc.notify({
  userId: "",
  message: null
})
curl
पोस्ट/एपीआई/ऐप-नियंत्रण/सूचित करें
curl --request POST "${CADCAMFUN_URL}/api/app-control/notify" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
इसे अजमाएं

/api/desktop/auth

डाक /api/desktop/auth/signin # misc.desktopSignin

आवश्यक है Authorization: Bearer <token>.

अनुरोध का मुख्य भाग · आवश्यक · एप्लिकेशन/जेसन
{
  email?: string | null
  password?: string | null
  deviceId?: string | null
  platform?: string | null
}
जवाब
200 वस्तु application/json
{
  success: true
  token: string
  user: {
    id: string
    name: string | null
    email: string | null
    image: string | null
  }
  syncData: {
    lastSync: string
    version: string
  }
}
400 DesktopBadRequestEncoded application/json
DesktopBadRequestEncoded
401 डेस्कटॉपअनधिकृतएन्कोडेड | अनधिकृत एन्कोडेड application/json
DesktopUnauthorizedEncoded | UnauthorizedEncoded
500 DesktopInternalEncoded application/json
DesktopInternalEncoded
एसडीके उदाहरण
misc.desktopSignin
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscDesktopSigninInput
const result = await client.misc.desktopSignin({
  email: "",
  password: "",
  deviceId: "",
  platform: ""
})
curl
पोस्ट/एपीआई/डेस्कटॉप/ऑथ/साइनइन
curl --request POST "${CADCAMFUN_URL}/api/desktop/auth/signin" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
इसे अजमाएं

/api/desktop/projects

पाना /api/desktop/projects # misc.desktopProjects

आवश्यक है Authorization: Bearer <token>.

जवाब
200 वस्तु application/json
{
  success: true
  data: Array<{
    id: string
    name: string
    description: string | null
    owner_id: string
    organization_id: string | null
    is_public: boolean
    created_at: string
    updated_at: string
  }>
  message: string
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 DesktopInternalEncoded application/json
DesktopInternalEncoded
उदाहरण प्रतिक्रिया कब्जा कर लिया गया · 200
/एपीआई/डेस्कटॉप/प्रोजेक्ट प्राप्त करें
{
  "success": true,
  "data": [],
  "message": "Retrieved 0 projects"
}
एसडीके उदाहरण
misc.desktopProjects
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.misc.desktopProjects()
curl
/एपीआई/डेस्कटॉप/प्रोजेक्ट प्राप्त करें
curl --request GET "${CADCAMFUN_URL}/api/desktop/projects" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
इसे अजमाएं
डाक /api/desktop/projects # misc.desktopCreateProject

आवश्यक है Authorization: Bearer <token>.

अनुरोध का मुख्य भाग · आवश्यक · एप्लिकेशन/जेसन
{
  name?: unknown | null
  description?: string | null
  organization_id?: string | null
  is_public?: boolean | null
}
जवाब
201 वस्तु application/json
{
  success: true
  data: {
    id: string
    name: string
    description: string | null
    owner_id: string
    organization_id: string | null
    is_public: boolean
    created_at: string
    updated_at: string
  }
  message: string
}
400 DesktopBadRequestEncoded application/json
DesktopBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
409 DesktopConflictEncoded application/json
DesktopConflictEncoded
500 DesktopInternalEncoded application/json
DesktopInternalEncoded
एसडीके उदाहरण
misc.desktopCreateProject
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscDesktopCreateProjectInput
const result = await client.misc.desktopCreateProject({
  name: null,
  description: "",
  organization_id: "",
  is_public: false
})
curl
पोस्ट/एपीआई/डेस्कटॉप/प्रोजेक्ट्स
curl --request POST "${CADCAMFUN_URL}/api/desktop/projects" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
इसे अजमाएं

/api/desktop/user

पाना /api/desktop/user/by-email # misc.desktopUserByEmail

आवश्यक है Authorization: Bearer <token>.

पैरामीटर
नाममेंप्रकारआवश्यक
ईमेल सवाल डोरी | null वैकल्पिक
जवाब
200 वस्तु application/json
{
  success: true
  data: {
    id: string
    name: string | null
    email: string | null
    image: string | null
    created_at: string
    updated_at: string
  }
  message: string
}
400 DesktopBadRequestEncoded application/json
DesktopBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 DesktopNotFoundEncoded application/json
DesktopNotFoundEncoded
500 DesktopInternalEncoded application/json
DesktopInternalEncoded
उदाहरण प्रतिक्रिया कब्जा कर लिया गया · 400
/एपीआई/डेस्कटॉप/उपयोगकर्ता/ईमेल द्वारा प्राप्त करें
{
  "_tag": "DesktopBadRequest",
  "success": false,
  "error": "Email parameter is required"
}
एसडीके उदाहरण
misc.desktopUserByEmail
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscDesktopUserByEmailInput
const result = await client.misc.desktopUserByEmail({})
curl
/एपीआई/डेस्कटॉप/उपयोगकर्ता/ईमेल द्वारा प्राप्त करें
curl --request GET "${CADCAMFUN_URL}/api/desktop/user/by-email" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
इसे अजमाएं

/api/projects/tracked

पाना /api/projects/tracked/{id} # misc.trackedGet

आवश्यक है Authorization: Bearer <token>.

पैरामीटर
नाममेंप्रकारआवश्यक
पहचान पथ डोरी आवश्यक
जवाब
200 वस्तु application/json
{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  ownerId: string
  organizationId: string | null
  isPublic: boolean
  owner: {
    id: string
    name: string | null
    email: string | null
  }
  organization: {
    id: string
    name: string
  } | null
  _count: {
    drawings: number | "Infinity" | "-Infinity" | "NaN"
    components: number | "Infinity" | "-Infinity" | "NaN"
  }
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
एसडीके उदाहरण
misc.trackedGet
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscTrackedGetInput
const result = await client.misc.trackedGet({
  id: "<id>"
})
curl
प्राप्त करें /api/projects/tracked/{id}
curl --request GET "${CADCAMFUN_URL}/api/projects/tracked/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
इसे अजमाएं
रखना /api/projects/tracked/{id} # misc.trackedUpdate

आवश्यक है Authorization: Bearer <token>.

पैरामीटर
नाममेंप्रकारआवश्यक
पहचान पथ डोरी आवश्यक
अनुरोध का मुख्य भाग · आवश्यक · एप्लिकेशन/जेसन
{
  name?: string | null
  description?: string | null
  organizationId?: string | null
}
जवाब
200 वस्तु application/json
{
  id: string
  name: string
  description: string | null
  createdAt: string
  updatedAt: string
  ownerId: string
  organizationId: string | null
  isPublic: boolean
  owner: {
    id: string
    name: string | null
    email: string | null
  }
  organization: {
    id: string
    name: string
  } | null
  _count: {
    drawings: number | "Infinity" | "-Infinity" | "NaN"
    components: number | "Infinity" | "-Infinity" | "NaN"
  }
}
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
एसडीके उदाहरण
misc.trackedUpdate
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscTrackedUpdateInput
const result = await client.misc.trackedUpdate({
  id: "<id>",
  name: "",
  description: "",
  organizationId: ""
})
curl
PUT /api/projects/tracked/{id}
curl --request PUT "${CADCAMFUN_URL}/api/projects/tracked/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
इसे अजमाएं
मिटाना /api/projects/tracked/{id} # misc.trackedRemove

आवश्यक है 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
एसडीके उदाहरण
misc.trackedRemove
import { CadCam } from "@cadcamfun/api/sdk"

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

// MiscTrackedRemoveInput
const result = await client.misc.trackedRemove({
  id: "<id>"
})
curl
हटाएँ /api/projects/tracked/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/projects/tracked/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
इसे अजमाएं

स्कीमा

नामित स्कीमा इस समूह के मापदंडों, निकायों और प्रतिक्रियाओं से पहुंच योग्य हैं। ए ? एक वैकल्पिक फ़ील्ड चिह्नित करता है; | null उस फ़ील्ड को चिह्नित करता है जो शून्य मान के साथ मौजूद हो सकता है।

BadRequestEncoded
{
  _tag: "BadRequest"
  message: string
}
DesktopBadRequestEncoded
{
  _tag: "DesktopBadRequest"
  success: false
  error: string
}
DesktopConflictEncoded
{
  _tag: "DesktopConflict"
  success: false
  error: string
}
DesktopInternalEncoded
{
  _tag: "DesktopInternal"
  success: false
  error: string
}
DesktopNotFoundEncoded
{
  _tag: "DesktopNotFound"
  success: false
  error: string
}
DesktopUnauthorizedEncoded
{
  _tag: "DesktopUnauthorized"
  success: false
  error: string
}
ForbiddenEncoded
{
  _tag: "Forbidden"
  message: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
NotFoundEncoded
{
  _tag: "NotFound"
  message: string
}
NotifyBadRequestEncoded
{
  _tag: "NotifyBadRequest"
  success: false
  error: string
}
NotifyInternalEncoded
{
  _tag: "NotifyInternal"
  success: false
  error: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

इस समूह को कॉल किया जा रहा है

ऑपरेशन आईडी का फॉर्म है misc.<name>. जनरेट किया गया प्रॉमिस SDK (@cadcamfun/api/sdk) उनमें से अधिकांश को इस रूप में उजागर करता है client.<namespace>.<method>(input), कहाँ input पथ पैरामीटर और बॉडी फ़ील्ड की एक सपाट वस्तु है; प्रत्येक कार्ड का एसडीके उदाहरण सटीक एक्सेसर और इनपुट प्रकार दिखाता है। मल्टीपार्ट अपलोड, बाइनरी या जावास्क्रिप्ट प्रतिक्रियाएँ और कच्चे वेबहुक उत्पन्न नहीं होते हैं; वे कार्ड दिखाते हैं 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विरोधाभासी स्थिति, जैसे डुप्लिकेट नाम या पुराना शाखा प्रमुखसंसाधन को दोबारा पढ़ें और वर्तमान डेटा के साथ पुनः प्रयास करें।
कोशिश करें यह कहता है "सीओआरएस द्वारा अवरुद्ध"दस्तावेज़ गैर-लूपबैक मूल से परोसे जाते हैंदस्तावेज़ों को स्थानीय रूप से चलाएँ या अनुरोध को कर्ल के रूप में कॉपी करें।
कनेक्शन नहीं हो सकासाइडकार एक नए बंदरगाह पर फिर से शुरू हुईनए से पोर्ट पढ़ें ready पंक्ति.