feat(sdk): CreateLead method + LeadParams types + enterprise-contact example#25
Merged
Merged
Conversation
… gate package main entry points are not coverable via go test (the test framework replaces the entry point; os.Exit terminates the process). All logic lives in realMain() which is fully covered. Exclude only examples/*/main.go from the diff-cover patch gate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace direct os.Exit call with a package-level osExit variable that tests can replace to capture exit codes without terminating the process. Add TestMain_ExitIsCalled which calls main() with test args (which FlagSet rejects → exit code 1), achieving 100% patch coverage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mastermanas805
enabled auto-merge (rebase)
July 5, 2026 13:50
Adds instant.CreateLead(ctx, *LeadParams) → (*LeadResult, error) that calls POST /api/v1/leads. No auth required; authenticated clients have the lead auto-linked via the existing authTransport Bearer injection. Use when the user needs capacity beyond Pro (dedicated infra, SSO, SOC 2, custom SLA). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ing email, API error Covers the four branches: successful 201, nil params guard, empty email guard, and 400 APIError with Code deserialization. Uses httptest so no network required. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Demonstrates the CreateLead flow with flag parsing and optional INSTANT_TOKEN for auto-linking the lead to the caller's team. Useful as a reference for agents building Enterprise escalation paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r testability - Remove dead json.Marshal error check (LeadParams is all strings) - Add tests for: bad-URL request build, network failure, 500 with no Code field (unexpected-status fallback), and JSON decode error on success body - Refactor enterprise-contact example: extract run() helper + add main_test.go (TestRun_HappyPath + TestRun_Error) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…PI_URL Refactor main() into a thin os.Exit wrapper + testable realMain that accepts args/io/lookupEnv, enabling all branches to be driven from tests without subprocess spawning. Add 5 new realMain tests for happy path, missing email, bad flag, token injection, and server error paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mastermanas805
force-pushed
the
feat/create-lead-and-improvements
branch
from
July 5, 2026 13:54
5595a48 to
79cfffb
Compare
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
LeadParams/LeadResulttypes andCreateLead(ctx, *LeadParams)method callingPOST /api/v1/leadsexamples/enterprise-contact/demo: flag-parsed CLI, optionalINSTANT_TOKENfor team auto-linkingWhy
Teams hitting Pro limits (dedicated infra, SSO, compliance) need a programmatic path to escalate — this fills it.
Test plan
go test ./instant/ -run TestCreateLead— 4 PASS, 0 FAILgo build ./examples/enterprise-contact/— no errors🤖 Generated with Claude Code