コンテンツへスキップ
CADCAMFUN
ドキュメント

ドキュメント

図書館

共有ライブラリ レコードとコンポーネント、材料、工具のルックアップ コレクション。

英語から自動翻訳されています。 英語の原文を見る

プレイグラウンド

これらのリクエストを独自の実行中のサイドカーに送信します。値はこのブラウザ内に残ります。

接続されていません
仕組み

サイドカーは起動時に選択されたループバック ポートをリッスンし、それをそのポートに出力します。 ready ライン;その URL を使用し、 CADCAMFUN_TOKEN で始まりました。リクエストはこのページからそのアドレスに直接送信されます。

サイドカーは CORS ヘッダーを Tauri オリジンと http://localhost または http://127.0.0.1 どのポートでも。ホストされているドキュメントからはブラウザーが応答をブロックするため、ドキュメントをローカルで実行します (bun run dev で packages/web) プレイグラウンドを使用するか、リクエストをcurlとしてコピーします。実際のデータに触れることなく実験するには、次のようにしてサイドカーを開始します。 CADCAMFUN_DATA_DIR 使い捨てディレクトリを指す - を参照 aPI のチュートリアル.

運営

8 エンドポイント( library サイドカー自体から生成されたグループ OpenAPIドキュメント。保護された操作には時間がかかります Authorization: Bearer $CADCAMFUN_TOKEN;見る 認証。行動と制限は次のとおりです サブシステムガイド.

得る /api/library library.list
役職 /api/library library.create
得る /api/library/{id} library.get
置く /api/library/{id} library.update
消去 /api/library/{id} library.remove
得る /api/library/components library.components
得る /api/library/materials library.materials
得る /api/library/tools library.tools
3D でのライブラリ操作 ドラッグして周回します · スクロールしてズーム · 右ドラッグしてパンします
オペレーションごとに 1 つのブロック (8)、このページのリソース セクションごとにスタックされ、メソッドごとに色分けされます: 緑色の GET、オレンジ色の POST、青色の PUT、紫色の PATCH、赤色の DELETE。ビルド時に OpenAPI ドキュメントから生成されます。

/api/library

得る /api/library # library.list

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
カテゴリ クエリ 弦 | null オプション
タイプ クエリ 弦 | null オプション
検索 クエリ 弦 | null オプション
応答
200 配列<オブジェクト> application/json
Array<{
  id: string
  name: string
  description: string | null
  category: string
  type: string
  data: unknown
  properties: unknown
  tags: unknown
  thumbnail: 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/ライブラリを取得する
[]
SDKの例
library.list
import { CadCam } from "@cadcamfun/api/sdk"

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

// LibraryListInput
const result = await client.library.list({})
curl
/api/ライブラリを取得する
curl --request GET "${CADCAMFUN_URL}/api/library" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください
役職 /api/library # library.create

必要 Authorization: Bearer <token>.

リクエスト本文 · 必須 · application/json
{
  name?: string | null
  description?: string | null
  category?: string | null
  type?: string | null
  data?: unknown | null
  properties?: unknown | null
  tags?: unknown | null
  organizationId?: string | null
  isPublic?: boolean | null
}
応答
201 物体 application/json
{
  id: string
  name: string
  description: string | null
  category: string
  type: string
  data: unknown
  properties: unknown
  tags: unknown
  thumbnail: 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の例
library.create
import { CadCam } from "@cadcamfun/api/sdk"

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

// LibraryCreateInput
const result = await client.library.create({
  name: "",
  description: "",
  category: "",
  type: "",
  data: null,
  properties: null,
  tags: null,
  organizationId: "",
  isPublic: false
})
curl
POST /api/ライブラリ
curl --request POST "${CADCAMFUN_URL}/api/library" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
試してみてください
得る /api/library/{id} # library.get

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
iD パス 弦 必須
応答
200 物体 application/json
{
  id: string
  name: string
  description: string | null
  category: string
  type: string
  data: unknown
  properties: unknown
  tags: unknown
  thumbnail: string | null
  isPublic: boolean
  createdAt: string
  updatedAt: string
  ownerId: string | null
  organizationId: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDKの例
library.get
import { CadCam } from "@cadcamfun/api/sdk"

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

// LibraryGetInput
const result = await client.library.get({
  id: "<id>"
})
curl
/api/ライブラリ/{id}を取得
curl --request GET "${CADCAMFUN_URL}/api/library/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください
置く /api/library/{id} # library.update

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
iD パス 弦 必須
リクエスト本文 · 必須 · application/json
{
  name?: string | null
  description?: string | null
  category?: string | null
  type?: string | null
  data?: unknown | null
  properties?: unknown | null
  tags?: unknown | null
  organizationId?: string | null
  isPublic?: boolean | null
}
応答
200 物体 application/json
{
  id: string
  name: string
  description: string | null
  category: string
  type: string
  data: unknown
  properties: unknown
  tags: unknown
  thumbnail: 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の例
library.update
import { CadCam } from "@cadcamfun/api/sdk"

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

// LibraryUpdateInput
const result = await client.library.update({
  id: "<id>",
  name: "",
  description: "",
  category: "",
  type: "",
  data: null,
  properties: null,
  tags: null,
  organizationId: "",
  isPublic: false
})
curl
PUT /api/library/{id}
curl --request PUT "${CADCAMFUN_URL}/api/library/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
試してみてください
消去 /api/library/{id} # library.remove

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
iD パス 弦 必須
応答
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の例
library.remove
import { CadCam } from "@cadcamfun/api/sdk"

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

// LibraryRemoveInput
const result = await client.library.remove({
  id: "<id>"
})
curl
/api/library/{id} を削除します
curl --request DELETE "${CADCAMFUN_URL}/api/library/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください

/api/library/components

得る /api/library/components # library.components

必要 Authorization: Bearer <token>.

応答
200 物体 application/json
{
  data: Array<{
    id: string
    name: string
    description: string | null
    category: string
    type: string
    data: unknown
    properties: unknown
    tags: unknown
    thumbnail: string | null
    isPublic: boolean
    createdAt: string
    updatedAt: string
    ownerId: string | null
    organizationId: string | null
    owner: {
      id: string
      name: string | null
      email: string | null
      image: string | null
    } | null
  }>
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 KeyedInternalEncoded application/json
KeyedInternalEncoded
応答例 捕獲 · 200
/api/ライブラリ/コンポーネントを取得する
{
  "data": []
}
SDKの例
library.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.library.components()
curl
/api/ライブラリ/コンポーネントを取得する
curl --request GET "${CADCAMFUN_URL}/api/library/components" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください

/api/library/materials

得る /api/library/materials # library.materials

必要 Authorization: Bearer <token>.

応答
200 物体 application/json
{
  data: Array<{
    id: string
    name: string
    description: string | null
    properties: unknown
    isPublic: boolean
    createdAt: string
    updatedAt: string
    ownerId: string | null
    organizationId: string | null
    owner: {
      id: string
      name: string | null
      email: string | null
      image: string | null
    } | null
  }>
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 KeyedInternalEncoded application/json
KeyedInternalEncoded
応答例 捕獲 · 200
/api/ライブラリ/マテリアルを取得する
{
  "data": []
}
SDKの例
library.materials
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.library.materials()
curl
/api/ライブラリ/マテリアルを取得する
curl --request GET "${CADCAMFUN_URL}/api/library/materials" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください

/api/library/tools

得る /api/library/tools # library.tools

必要 Authorization: Bearer <token>.

応答
200 物体 application/json
{
  data: 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
    owner: {
      id: string
      name: string | null
      email: string | null
      image: string | null
    } | null
  }>
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 KeyedInternalEncoded application/json
KeyedInternalEncoded
応答例 捕獲 · 200
/api/ライブラリ/ツールを取得する
{
  "data": []
}
SDKの例
library.tools
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.library.tools()
curl
/api/ライブラリ/ツールを取得する
curl --request GET "${CADCAMFUN_URL}/api/library/tools" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください

スキーマ

このグループのパラメータ、本体、および応答から到達可能な名前付きスキーマ。あ ? オプションのフィールドをマークします。 | null null 値が存在する可能性があるフィールドにマークを付けます。

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

このグループに電話をかける

オペレーション ID の形式は次のとおりです。 library.<name>。生成された Promise SDK (@cadcamfun/api/sdk) それらのほとんどを次のように公開します client.<namespace>.<method>(input)、 どこ input パスパラメータとボディフィールドの 1 つのフラットオブジェクトです。各カードの SDK の例は、正確なアクセサーと入力タイプを示しています。マルチパート アップロード、バイナリまたは JavaScript 応答、生の Webhook は生成されません。それらのカードが示しているのは 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 によってブロックされました」と表示されてみてくださいドキュメントは非ループバックオリジンから提供されますドキュメントをローカルで実行するか、リクエストをcurlとしてコピーします。
接続拒否サイドカーが新しいポートで再起動されました新しいポートからポートを読み取ります ready 行。