Use Product SDK¶
Product SDK operates workspace-scoped product resources from Go or Python applications. A verified public distribution channel is not currently available. If you obtained the SDK through an official channel, use this page to verify a read-only connection. Do not substitute installation commands or internal module paths from another SDK for an official installation path.
1. Prepare connection information¶
export PRODUCT_API_BASE_URL='<Product API Base URL ending in /newmoi>'
export PRODUCT_API_KEY='<your-personal-access-token>'
The SDK does not append /newmoi automatically. Pass the personal access token unchanged; the client sends it through X-API-Key.
2. List visible workspaces¶
import os
import moi_product_sdk as sdk
client = sdk.new_with_personal_access_token(
os.environ["PRODUCT_API_BASE_URL"],
os.environ["PRODUCT_API_KEY"],
)
result = client.workspaces().list()
for workspace in result.workspaces:
print(workspace.id, workspace.name)
package main
import (
"context"
"fmt"
"os"
sdk "github.com/matrixorigin/matrixflow/sdk/go-sdk"
)
func main() {
ctx := context.Background()
client, err := sdk.NewWithPersonalAccessToken(
os.Getenv("PRODUCT_API_BASE_URL"),
os.Getenv("PRODUCT_API_KEY"),
)
if err != nil {
panic(err)
}
result, err := client.Workspaces().List(ctx)
if err != nil {
panic(err)
}
for _, workspace := range result.GetWorkspaces() {
fmt.Printf("%s\t%s\n", workspace.GetId(), workspace.GetName())
}
}
A successful list response shows that the endpoint and personal access token can be used for workspace discovery. Choose one returned workspace ID, then enter its scope with Python client.workspace(workspace_id) or Go client.Workspace(workspaceID). Do not use ensure_workspace or EnsureWorkspace, which may create a workspace, to verify the connection.