SDK 快速入门 — Go + Python¶
trustmint 以两种语言提供客户端 SDK,因此任一堆栈上的集成商都可以编写更少的集成代码。 SDK 处理 FGAI-HMAC AK/SK 签名(不是 AWS SigV4 的部分 — 请参阅注册)和生成的类型化错误表面。此页面是前门; SDK源码+README是权威参考。
These are the backend-integration SDKs (your factory-service ↔ ThingMake). The device-side SDKs that implement the on-device DDI-1 wire contract are distributed separately — see Device SDKs. Don't look for device SDKs here.
真相来源¶
产物 |
它是什么 |
|---|---|
|
顶级 SDK 指南 — 前 5 分钟、AK/SK 接线方案、示例矩阵、Makefile 目标 |
|
Go SDK(生成客户端+ |
|
Python SDK(生成的客户端+ |
|
Four runnable example scenarios per language, plus a Python factory-integration gate |
The SDKs are generated from the ThingMake OpenAPI snapshot (rendered on the
API reference page) and the error catalog thingmake-error-catalog.json
— do not hand-fork them.
前 5 分钟¶
The reusable half of the SDK is the signer: it turns an ordinary HTTP client into one that signs every request with FGAI-HMAC. Wrap your client, point it at the public API host, and call a capability path.
// Go — wrap any http.Client
client := &http.Client{
Transport: signing.NewSigningTransport(accessKeyID, secretKey, nil),
}
resp, err := client.Get("https://api.flexgalaxy.ai/provisioning/v1/factory-integrations")
# Python — httpx or requests
import httpx
from thingmake_sdk.auth import AKSKAuth
client = httpx.Client(base_url="https://api.flexgalaxy.ai",
auth=AKSKAuth(access_key_id, secret_key))
resp = client.get("/provisioning/v1/factory-integrations")
Use https://api.staging.flexgalaxy.ai for the same API one release ahead while you
are still integrating. Both hosts speak the identical contract. The per-SDK READMEs
(sdks/go/README.md, sdks/python/README.md) document the generated client types on
top of the signer.
示例矩阵¶
The example programs are reading material first: each one is a complete, commented implementation of one scenario, and each is wired to a local fixture rather than to the public host, so copy the shape rather than running them against production.
# |
场景 |
身份验证 |
Go |
Python |
|---|---|---|---|---|
01 |
注册工厂服务(获取一次性AK/SK) |
bearer token |
|
|
02 |
接收状态更改通知(订阅 + webhook 监听器) |
AK/SK |
|
|
03 |
Poll state changes via cursor (cursor loop, 410 recovery) |
AK/SK |
|
|
04 |
验证 Webhook 签名(托管接收器 + 调用验证助手) |
网络钩子秘密 |
|
|
05 |
Factory-integration gate (end-to-end identify/provision round trip) |
AK/SK |
— |
|
Example 01 mints an interactive bearer token, registers the factory integration, and writes
the one-time {access_key_id, secret_access_key} to a git-ignored .aksk.env.
Examples 02 / 03 / 04 read ACCESS_KEY_ID and SECRET_ACCESS_KEY from it. Never commit
.aksk.env — it holds your secret-key.
生成的客户端界面¶
The generated Go/Python clients are regenerated from the OpenAPI snapshot and cover
the device-model registry under the registry capability:
/registry/v1/vendor/registry/v1/models/registry/v1/models/{id}/registry/v1/software/registry/v1/software/{id}
The CLI reference lists the full capability groups a credential can reach; the API reference is the endpoint-level contract. Treat a method's presence in a generated client as availability, and those two pages as the supported surface.
接下来做什么¶
每个示例的演练都映射到 → Registration、Webhooks
将示例串联成一个旅程 → 入门
自我认证自己的后端 → 一致性