ドキュメント
ワークスペース
読み取り専用のプロジェクト図面、コンポーネント、ツールパス、ライブラリ リソース、およびコンパニオン クライアントの限定プレビュー。
英語から自動翻訳されています。 英語の原文を見る
これらのリクエストを独自の実行中のサイドカーに送信します。値はこのブラウザ内に残ります。
仕組み
サイドカーは起動時に選択されたループバック ポートをリッスンし、それをそのポートに出力します。 ready ライン;その URL を使用し、 CADCAMFUN_TOKEN で始まりました。リクエストはこのページからそのアドレスに直接送信されます。
サイドカーは CORS ヘッダーを Tauri オリジンと http://localhost または http://127.0.0.1 どのポートでも。ホストされているドキュメントからはブラウザーが応答をブロックするため、ドキュメントをローカルで実行します (bun run dev で packages/web) プレイグラウンドを使用するか、リクエストをcurlとしてコピーします。実際のデータに触れることなく実験するには、次のようにしてサイドカーを開始します。 CADCAMFUN_DATA_DIR 使い捨てディレクトリを指す - を参照 aPI のチュートリアル.
運営
8 エンドポイント( workspace サイドカー自体から生成されたグループ OpenAPIドキュメント。保護された操作には時間がかかります Authorization: Bearer $CADCAMFUN_TOKEN;見る 認証。行動と制限は次のとおりです サブシステムガイド.
| 得る | /api/projects/{id}/workspace/drawings | workspace.drawings |
| 得る | /api/projects/{id}/workspace/drawings/{drawingId}/preview | workspace.drawingPreview |
| 得る | /api/projects/{id}/workspace/components | workspace.components |
| 得る | /api/projects/{id}/workspace/components/{componentId}/preview | workspace.componentPreview |
| 得る | /api/projects/{id}/workspace/toolpaths | workspace.toolpaths |
| 得る | /api/projects/{id}/workspace/toolpaths/{toolpathId} | workspace.toolpath |
| 得る | /api/projects/{id}/workspace/toolpaths/{toolpathId}/preview | workspace.toolpathPreview |
| 得る | /api/projects/{id}/workspace/library | workspace.library |
/api/projects
workspace.drawings 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
200 配列<オブジェクト> application/json
Array<{ id: string name: string subtitle: string | null updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
例を取得する
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/drawings`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/drawings" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
workspace.drawingPreview 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
| drawingId | パス | 弦 | 必須 |
200 物体 application/json
{ positions: Array<number | "Infinity" | "-Infinity" | "NaN"> indices: Array<number | "Infinity" | "-Infinity" | "NaN"> normals: Array<number | "Infinity" | "-Infinity" | "NaN"> bounds: { min: unknown[] max: unknown[] } parts: Array<{ id: string name: string triangleStart: number | "Infinity" | "-Infinity" | "NaN" triangleCount: number | "Infinity" | "-Infinity" | "NaN" }> truncated: boolean revision: string features?: Array<{ elementId: string name: string features: Array<{ id: string type: string parameters: Array<{ key: string value: string }> }> }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
例を取得する
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/drawings/${drawingId}/preview`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/drawings/<drawingId>/preview" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
workspace.components 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
200 配列<オブジェクト> application/json
Array<{ id: string name: string subtitle: string | null updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
例を取得する
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/components`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
workspace.componentPreview 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
| componentId | パス | 弦 | 必須 |
200 物体 application/json
{ positions: Array<number | "Infinity" | "-Infinity" | "NaN"> indices: Array<number | "Infinity" | "-Infinity" | "NaN"> normals: Array<number | "Infinity" | "-Infinity" | "NaN"> bounds: { min: unknown[] max: unknown[] } parts: Array<{ id: string name: string triangleStart: number | "Infinity" | "-Infinity" | "NaN" triangleCount: number | "Infinity" | "-Infinity" | "NaN" }> truncated: boolean revision: string features?: Array<{ elementId: string name: string features: Array<{ id: string type: string parameters: Array<{ key: string value: string }> }> }> parameters: Array<{ key: string value: string }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
例を取得する
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/components/${componentId}/preview`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/components/<componentId>/preview" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
workspace.toolpaths 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
200 配列<オブジェクト> application/json
Array<{ id: string name: string subtitle: string | null updatedAt: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
例を取得する
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
workspace.toolpath 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
| toolpathId | パス | 弦 | 必須 |
200 物体 application/json
{ id: string name: string operationType: string | null gcode: string stats: { rapidMoves: number | "Infinity" | "-Infinity" | "NaN" linearMoves: number | "Infinity" | "-Infinity" | "NaN" circularMoves: number | "Infinity" | "-Infinity" | "NaN" machineFunctions: number | "Infinity" | "-Infinity" | "NaN" } revision: string updatedAt: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
例を取得する
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths/${toolpathId}`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths/<toolpathId>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
workspace.toolpathPreview 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
| toolpathId | パス | 弦 | 必須 |
200 物体 application/json
{ segments: Array<{ kind: "rapid" | "linear" | "circular" line: number | "Infinity" | "-Infinity" | "NaN" from: unknown[] to: unknown[] }> bounds: { min: unknown[] max: unknown[] } stock: { min: unknown[] max: unknown[] } truncated: boolean stats: { rapidMoves: number | "Infinity" | "-Infinity" | "NaN" linearMoves: number | "Infinity" | "-Infinity" | "NaN" circularMoves: number | "Infinity" | "-Infinity" | "NaN" machineFunctions: number | "Infinity" | "-Infinity" | "NaN" } machine?: { kind: "mill" | "lathe" | "3dprinter" source: "override" | "kernel" | "generator" | "inferred" | "settings" mismatch?: { inferred: "mill" | "lathe" | "3dprinter" reasons: string[] } axes: number | "Infinity" | "-Infinity" | "NaN" turns: string workholding: string assumed: Array<"workholding" | "table" | "stock"> xMode?: "diameter" | "radius" turret?: "rear" | "front" bodies: Array<{ id: string role: "stock" | "jaw" | "parallel" | "vise-base" | "clamp" | "table" | "chuck" | "collet" | "tailstock" | "bed" | "build-volume" shape: { type: "box" min: { x: number | "Infinity" | "-Infinity" | "NaN" y: number | "NaN" z: number | "NaN" } max: { x: number | "NaN" } } | { type: "cylinder-x" x0: number | "NaN" x1: number | "NaN" radius: number | "NaN" inner: number | "NaN" } | { type: "cone-x" x0: number | "NaN" r0: number | "NaN" r1: number rotateX?: number | "Infinity" | "-Infinity" | "NaN" spins: boolean assumed: boolean obstacle: boolean wire?: boolean }> spin: Array<{ segment: number | "Infinity" | "-Infinity" | "NaN" rate: number | "Infinity" | "-Infinity" | "NaN" }> collisions: Array<number | "Infinity" | "-Infinity" | "NaN"> operations?: Array<{ index: number | "Infinity" | "-Infinity" | "NaN" name: string toolId: string startSegment: number | "Infinity" | "-Infinity" | "NaN" endSegment: number | "Infinity" | "-Infinity" | "NaN" cutter?: { diameter: number | "Infinity" | "-Infinity" | "NaN" fluteLength: number | "Infinity" | "-Infinity" | "NaN" shankDiameter: number | "Infinity" | "-Infinity" | "NaN" stickout: number | "Infinity" | "-Infinity" | "NaN" noseRadius: number | "Infinity" | "-Infinity" | "NaN" holder: { diameter: number | "Infinity" | "-Infinity" | "NaN" length: number | "Infinity" | "-Infinity" | "NaN" kind: string assumed: boolean } } }> events?: Array<{ code: string severity: "error" | "warning" seconds: number | "Infinity" | "-Infinity" | "NaN" segment: number | "Infinity" | "-Infinity" | "NaN" line?: number | "Infinity" | "-Infinity" | "NaN" message: string }> tool: { family: "mill" | "lathe" | "nozzle" diameter: number | "Infinity" | "-Infinity" | "NaN" width: number | "Infinity" | "-Infinity" | "NaN" noseRadius: number | "Infinity" | "-Infinity" | "NaN" insert: string internal: boolean turret?: "rear" | "front" } } part?: { positions: Array<number | "Infinity" | "-Infinity" | "NaN"> indices: Array<number | "Infinity" | "-Infinity" | "NaN"> normals: Array<number | "Infinity" | "-Infinity" | "NaN"> bounds: { min: unknown[] max: unknown[] } parts: Array<{ id: string name: string triangleStart: number | "Infinity" | "-Infinity" | "NaN" triangleCount: number | "Infinity" | "-Infinity" | "NaN" }> truncated: boolean } revision: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
例を取得する
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/toolpaths/${toolpathId}/preview`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/toolpaths/<toolpathId>/preview" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
workspace.library 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
200 物体 application/json
{ materials: Array<{ id: string name: string subtitle: string | null updatedAt: string }> tools: Array<{ id: string name: string subtitle: string | null updatedAt: string }> machines: Array<{ id: string name: string subtitle: string | null updatedAt: string }> components: Array<{ id: string name: string subtitle: string | null updatedAt: string }> }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
例を取得する
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/projects/${id}/workspace/library`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request GET "${CADCAMFUN_URL}/api/projects/<id>/workspace/library" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
スキーマ
このグループのパラメータ、本体、および応答から到達可能な名前付きスキーマ。あ ? オプションのフィールドをマークします。 | null null 値が存在する可能性があるフィールドにマークを付けます。
BadRequestEncoded{ _tag: "BadRequest" message: string }
InternalErrorEncoded{ _tag: "InternalError" message: string }
NotFoundEncoded{ _tag: "NotFound" message: string }
このグループに電話をかける
オペレーション ID の形式は次のとおりです。 workspace.<name>。生成された Promise SDK (@cadcamfun/api/sdk) それらのほとんどを次のように公開します client.<namespace>.<method>(input)、 どこ input パスパラメータとボディフィールドの 1 つのフラットオブジェクトです。各カードの SDK の例は、正確なアクセサーと入力タイプを示しています。マルチパート アップロード、バイナリまたは JavaScript 応答、生の Webhook は生成されません。それらのカードが示しているのは 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 | 重複した名前や古いブランチヘッドなどの矛盾した状態 | リソースを再読み込みし、現在のデータで再試行します。 |
| 「CORS によってブロックされました」と表示されてみてください | ドキュメントは非ループバックオリジンから提供されます | ドキュメントをローカルで実行するか、リクエストをcurlとしてコピーします。 |
| 接続拒否 | サイドカーが新しいポートで再起動されました | 新しいポートからポートを読み取ります ready 行。 |