Documentazione
Utensili
Registrazioni e dimensioni della taglierina utilizzate dai flussi di lavoro di lavorazione dell'applicazione.
Tradotto automaticamente dall'inglese. Vedi l'originale in inglese
Invia queste richieste al tuo sidecar in corsa. I valori rimangono in questo browser.
Come funziona
Il sidecar resta in ascolto su una porta di loopback scelta all'avvio e la stampa nel suo file ready linea; usa quell'URL e il file CADCAMFUN_TOKEN è stato iniziato con. Le richieste vanno direttamente da questa pagina a quell'indirizzo.
Il sidecar invia intestazioni CORS solo alle origini Tauri e a http://localhost o http://127.0.0.1 su qualsiasi porto. Dai documenti ospitati il browser blocca la risposta, quindi esegui i documenti localmente (bun run dev in packages/web) per utilizzare il parco giochi, oppure copiare la richiesta come ricciolo. Per sperimentare senza toccare i dati reali, avvia il sidecar con CADCAMFUN_DATA_DIR indicato in una directory usa e getta - vedi la procedura dettagliata dell'API.
Operazioni
5 endpoint nel tools gruppo, generato da quello del sidecar Documento OpenAPI. Le operazioni protette richiedono Authorization: Bearer $CADCAMFUN_TOKEN; vedere autenticazione. Comportamenti e limiti sono entrati la guida del sottosistema.
| ottenere | /api/tools | tools.list |
| inviare | /api/tools | tools.create |
| ottenere | /api/tools/{id} | tools.get |
| mettere | /api/tools/{id} | tools.update |
| eliminare | /api/tools/{id} | tools.remove |
/api/tools
tools.list Richiede Authorization: Bearer <token>.
| Nome | In | Tipo | Necessario |
|---|---|---|---|
| tipo | domanda | corda | null | opzionale |
| materiale | domanda | corda | null | opzionale |
| diametro | domanda | corda | null | opzionale |
| ricerca | domanda | corda | null | opzionale |
| pubblico | domanda | corda | null | opzionale |
200 Matrice<oggetto> 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
Risposta di esempio catturato · 200
[] Esempio dell'SDK
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
curl --request GET "${CADCAMFUN_URL}/api/tools" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Provalo
tools.create Richiede Authorization: Bearer <token>.
{ 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 oggetto 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
Esempio dell'SDK
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
curl --request POST "${CADCAMFUN_URL}/api/tools" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Provalo
tools.get Richiede Authorization: Bearer <token>.
| Nome | In | Tipo | Necessario |
|---|---|---|---|
| id | sentiero | corda | necessario |
200 oggetto 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
Esempio dell'SDK
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
curl --request GET "${CADCAMFUN_URL}/api/tools/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Provalo
tools.update Richiede Authorization: Bearer <token>.
| Nome | In | Tipo | Necessario |
|---|---|---|---|
| id | sentiero | corda | necessario |
{ 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 oggetto 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
Esempio dell'SDK
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
curl --request PUT "${CADCAMFUN_URL}/api/tools/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Provalo
tools.remove Richiede Authorization: Bearer <token>.
| Nome | In | Tipo | Necessario |
|---|---|---|---|
| id | sentiero | corda | necessario |
200 oggetto 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
Esempio dell'SDK
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
curl --request DELETE "${CADCAMFUN_URL}/api/tools/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Provalo
Schemi
Schemi denominati raggiungibili dai parametri, dai corpi e dalle risposte di questo gruppo. UN ? contrassegna un campo facoltativo; | null contrassegna un campo che può essere presente con un valore nullo.
BadRequestEncoded{ _tag: "BadRequest" message: string }
ForbiddenEncoded{ _tag: "Forbidden" message: string }
InternalErrorEncoded{ _tag: "InternalError" message: string }
NotFoundEncoded{ _tag: "NotFound" message: string }
Chiamando questo gruppo
Gli ID operazione hanno il formato tools.<name>. L'SDK Promise generato (@cadcamfun/api/sdk) ne espone la maggior parte come client.<namespace>.<method>(input), dove input è un oggetto piatto di parametri di percorso e campi del corpo; l'esempio dell'SDK di ciascuna scheda mostra l'esatto accessor e il tipo di input. Non vengono generati caricamenti in più parti, risposte binarie o JavaScript e webhook grezzi; quelle carte mostrano fetch invece.
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
}
} Risoluzione dei problemi
| Sintomo | Probabile causa | Aggiustare |
|---|---|---|
| 401 a ogni chiamata | Token di un lancio precedente o mancante Bearer prefisso | Inviare Authorization: Bearer <token> con il gettone con cui è stato avviato il sidecar. |
| 400 prima che accada qualcosa | Il corpo o il parametro non corrisponde allo schema | Confronta il payload con lo schema di richiesta sulla carta. |
| 403 o 404 su un record visibile altrove | Il resoconto della recitazione è diverso | Invia il diritto x-session-tokenoppure utilizzare il profilo locale proprietario del record. |
| 409 | Stato in conflitto, ad esempio un nome duplicato o una testa di ramo obsoleta | Rileggere la risorsa e riprovare con i dati correnti. |
| Prova, dice "bloccato da CORS" | I documenti vengono serviti da un'origine non di loopback | Esegui i documenti localmente o copia la richiesta come curl. |
| Connessione rifiutata | Il sidecar è ripartito su una nuova porta | Leggi il porto dal nuovo ready riga. |