Expand SDK to cover every API endpoint and validate response types live - #36
Open
arunim2405 wants to merge 2 commits into
Open
Expand SDK to cover every API endpoint and validate response types live#36arunim2405 wants to merge 2 commits into
arunim2405 wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the Go SDK to parity with the API repo: every client-callable route in
platform_api/api/urls.pynow 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.goper package.Deliberately not modelled (documented in CLAUDE.md): inbound VCS webhook receivers,
orgs/<org>/email_service/(internal-only), andrun_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:
List*methods accept the API's 204 empty response (stacks, connector groups, state backends and others previously errored).data, withmsga string); connector list items are connector objects, not envelopes.RuntimeParameters, template revision metadata, org entitlements, and more).Statefileslist andauthblock;authis typed as{integrationId}.ListAllRoles,ListAllPoliciesandGetStackWorkflowRunFactsreturn their responses instead of discarding them.CreateTemplateRevisionsends the request body instead of{}.TemplateTypelike the sibling packages;OwnerOrgon step-template updates gainedomitemptyso partial updates no longer sendnull.Breaking changes
AccessManagement.ListAllRoles,Policies.ListAllPolicies,StackWorkflowRunFacts.GetStackWorkflowRunFactsnow return(map[string]interface{}, error).ApiAccessListResponseandApiAccessGetResponse:Msgis*string, the payload is inData.GeneratedConnectorListAllResponseMsg.Msgis[]*GeneratedConnectorReadResponseMsg.statebackends.StateBackend.Statefilesis always sent (pass an empty list).Test plan
go build ./...,go vet,gofmtcleango 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)autotesting-orgfor workflow groups, workflows, secrets, roles, policies, API accesses, state backends and chats; all temporary resources removed🤖 Generated with Claude Code
https://claude.ai/code/session_01QFnDMC1JV9J4Hpk2oxwnAM