Skip to content

Expand SDK to cover every API endpoint and validate response types live - #36

Open
arunim2405 wants to merge 2 commits into
mainfrom
f/update-go-sdk
Open

Expand SDK to cover every API endpoint and validate response types live#36
arunim2405 wants to merge 2 commits into
mainfrom
f/update-go-sdk

Conversation

@arunim2405

@arunim2405 arunim2405 commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

Brings the Go SDK to parity with the API repo: every client-callable route in platform_api/api/urls.py now has an SDK method (226 in total, up from 126), and the response types were validated against a live organization.

New clients: Billing, Chats (infra2code and kyro chats plus messages), Resources (move, search, tags), StateBackends.

New operations on existing clients: organization create/list/update/delete, org-wide workflow listing, counting and bulk actions; role bindings and legacy API tokens; runner group list, runner registration and storage-backend credentials; connector authenticate, account and repository listing; connector-group discovery scans and child authentication; bulk secret read; template artifacts, subscription create/update, input schemas, VCS triggers and the public marketplace listings; workflow-group resource listing; stack compare; workflow and stack-workflow compare, file upload URLs, artifact content read/create/delete, versions, rollback and locks; stack workflow create; stack workflow run list/update/delete; workflow run delete and the KSUID-based read/update; run facts create/update. New request/response types live in a model.go per package.

Deliberately not modelled (documented in CLAUDE.md): inbound VCS webhook receivers, orgs/<org>/email_service/ (internal-only), and run_queued_wfruns/ (its core method no longer exists).

Fixes found by live validation

Run against a real organization with a reversible create → update → delete cycle on temporary resources:

  • All List* methods accept the API's 204 empty response (stacks, connector groups, state backends and others previously errored).
  • API-access read and list decode the real envelope (data, with msg a string); connector list items are connector objects, not envelopes.
  • About 80 live fields added to generated response types (timestamps, KSUIDs, workflow run RuntimeParameters, template revision metadata, org entitlements, and more).
  • State backend create no longer drops the required Statefiles list and auth block; auth is typed as {integrationId}.
  • ListAllRoles, ListAllPolicies and GetStackWorkflowRunFacts return their responses instead of discarding them.
  • CreateTemplateRevision sends the request body instead of {}.
  • Step-template creates force TemplateType like the sibling packages; OwnerOrg on step-template updates gained omitempty so partial updates no longer send null.

Breaking changes

  • AccessManagement.ListAllRoles, Policies.ListAllPolicies, StackWorkflowRunFacts.GetStackWorkflowRunFacts now return (map[string]interface{}, error).
  • ApiAccessListResponse and ApiAccessGetResponse: Msg is *string, the payload is in Data.
  • GeneratedConnectorListAllResponseMsg.Msg is []*GeneratedConnectorReadResponseMsg.
  • statebackends.StateBackend.Statefiles is always sent (pass an empty list).

Test plan

  • go build ./..., go vet, gofmt clean
  • go test ./core/ ./internal/
  • SG_API_TOKEN=... SG_ORG=autotesting-org go test ./tests/live/ — 47 read endpoints decode with no undeclared fields (new test, skipped without credentials)
  • Live create/update/delete cycle on autotesting-org for workflow groups, workflows, secrets, roles, policies, API accesses, state backends and chats; all temporary resources removed
  • Endpoints that need a Cognito user token (org create/list, public templates, input schema), runner registration, billing writes and workflow run triggers were not exercised live

🤖 Generated with Claude Code

https://claude.ai/code/session_01QFnDMC1JV9J4Hpk2oxwnAM

arunim2405 and others added 2 commits September 3, 2026 09:24
Introduces a new Cobra-based `sg` CLI (`cmd/sg` + `cli/`) with one leaf command per SDK method, body/query flag helpers, raw-response output handling, and extensive command tests (including tree parity checks). Expands the Go SDK with new resource clients (`billing`, `chats`, `resources`, `statebackends`) and many missing operations across existing clients (organizations, templates, workflows, workflow runs/facts, connectors, runner groups, secrets, access management, stacks, etc.), plus new per-package `model.go` request/response types.

Also improves API compatibility by marking optional-response endpoints, fixing request/response shapes (including list/get payloads and required update fields), adding newly observed fields to typed models, and adding live decode coverage tests to catch undeclared response fields. Build/test/docs updates include CLI build target, unit-test target including `./cli/`, README CLI usage, and ignore rules for `bin/`.
Drops cmd/sg, cli/ and the cobra dependency along with the CLI build target,
README section and ignore rule. The SDK changes stay: new billing, chats,
resources and statebackends clients, the missing operations on existing
clients, the live-validated response type fixes and the tests/live decode
coverage test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFnDMC1JV9J4Hpk2oxwnAM
@arunim2405 arunim2405 changed the title Add sg CLI and expand SDK endpoint coverage Expand SDK to cover every API endpoint and validate response types live Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant