chore(go): audit root package

Share one request, decode, and error path across the client, public
endpoints, and export download; align types with the Backend contract
and split types_api.go.

Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
This commit is contained in:
雷电芽衣 committed 2026-09-03 01:06:42 -04:00
1 parent f5341ed557
commit 27b720ca69
11 files changed
+528 -663

No files matched your search

+11 -4
View File
@@ -81,8 +81,8 @@ func TestSDKCompatibilityAgainstLatestAPI(t *testing.T) {
if err != nil {
t.Fatalf("api token auth failed: %v", err)
}
if meWithAPI.User.OrgID != login.User.OrgID {
t.Fatalf("api token org mismatch: got %s want %s", meWithAPI.User.OrgID, login.User.OrgID)
if orgID(meWithAPI.User.OrgID) != login.User.OrgID {
t.Fatalf("api token org mismatch: got %s want %s", orgID(meWithAPI.User.OrgID), login.User.OrgID)
}
rotateResp, err := client.RotateApiToken()
@@ -98,8 +98,8 @@ func TestSDKCompatibilityAgainstLatestAPI(t *testing.T) {
if err != nil {
t.Fatalf("rotated token auth failed: %v", err)
}
if meWithRotated.User.OrgID != login.User.OrgID {
t.Fatalf("rotated token org mismatch: got %s want %s", meWithRotated.User.OrgID, login.User.OrgID)
if orgID(meWithRotated.User.OrgID) != login.User.OrgID {
t.Fatalf("rotated token org mismatch: got %s want %s", orgID(meWithRotated.User.OrgID), login.User.OrgID)
}
_, err = client.RegisterAgent(&elydora.RegisterAgentRequest{
@@ -154,3 +154,10 @@ func TestSDKCompatibilityAgainstLatestAPI(t *testing.T) {
t.Fatalf("verify operation invalid: %+v", verify)
}
}
func orgID(value *string) string {
if value == nil {
return ""
}
return *value
}