ドキュメント
アプリケーションサービス
デスクトップ統合ルート、追跡されたプロジェクト操作、通知、およびプッシュ サブスクリプション レコード。
英語から自動翻訳されています。 英語の原文を見る
これらのリクエストを独自の実行中のサイドカーに送信します。値はこのブラウザ内に残ります。
仕組み
サイドカーは起動時に選択されたループバック ポートをリッスンし、それをそのポートに出力します。 ready ライン;その URL を使用し、 CADCAMFUN_TOKEN で始まりました。リクエストはこのページからそのアドレスに直接送信されます。
サイドカーは CORS ヘッダーを Tauri オリジンと http://localhost または http://127.0.0.1 どのポートでも。ホストされているドキュメントからはブラウザーが応答をブロックするため、ドキュメントをローカルで実行します (bun run dev で packages/web) プレイグラウンドを使用するか、リクエストをcurlとしてコピーします。実際のデータに触れることなく実験するには、次のようにしてサイドカーを開始します。 CADCAMFUN_DATA_DIR 使い捨てディレクトリを指す - を参照 aPI のチュートリアル.
運営
10 エンドポイント( misc サイドカー自体から生成されたグループ OpenAPIドキュメント。保護された操作には時間がかかります 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 |
/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
SDKの例
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 試してみてください
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
SDKの例
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
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
SDKの例
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
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 デスクトップUnauthorizedEncoded |不正にエンコードされた application/json
DesktopUnauthorizedEncoded | UnauthorizedEncoded
500 DesktopInternalEncoded application/json
DesktopInternalEncoded
SDKの例
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
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"
} SDKの例
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}" 試してみてください
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
SDKの例
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
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"
} SDKの例
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
misc.trackedGet 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
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
SDKの例
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
curl --request GET "${CADCAMFUN_URL}/api/projects/tracked/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
misc.trackedUpdate 必要 Authorization: Bearer <token>.
| 名前 | で | タイプ | 必須 |
|---|---|---|---|
| iD | パス | 弦 | 必須 |
{ 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
SDKの例
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
curl --request PUT "${CADCAMFUN_URL}/api/projects/tracked/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json 試してみてください
misc.trackedRemove 必要 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の例
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
curl --request DELETE "${CADCAMFUN_URL}/api/projects/tracked/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" 試してみてください
スキーマ
このグループのパラメータ、本体、および応答から到達可能な名前付きスキーマ。あ ? オプションのフィールドをマークします。 | null 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 }
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 }
このグループに電話をかける
オペレーション ID の形式は次のとおりです。 misc.<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 行。 |