feat(generator): services as interfaces for dependency injection#187
Open
aenadgrleey wants to merge 8 commits intomainfrom
Open
feat(generator): services as interfaces for dependency injection#187aenadgrleey wants to merge 8 commits intomainfrom
aenadgrleey wants to merge 8 commits intomainfrom
Conversation
Enable creation of PachcaClient instances without HTTP clients for testing purposes. Each language uses its idiomatic pattern: - Kotlin: companion object with stub() function - C#: static Stub() method with private constructor - Go: NewStubPachcaClient() with functional options - Python: @classmethod stub() bypassing __init__ - Swift: static func stub() with private init Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document PachcaClient.stub() usage for unit testing with mock services. Each README now includes language-specific examples and describes what happens when calling non-overridden methods (throws/returns error). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Also adds jitter to retry delays and uses explicit 5xx status codes (500, 502, 503, 504) instead of >= 500 range. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add jitter (0.5-1.0 random factor) to retry delays across all SDKs - Add 5xx retry (500, 502, 503, 504) to TypeScript, Go, Python, Swift - Convert Kotlin services from open class to interface pattern - Revert TypeScript constructor to non-breaking positional args format - Remove TypeScript override keyword for ES5/ES6 compatibility Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ntedError - Move jitter, retry constants, and doWithRetry to utils.go (matches other SDKs) - Add NotImplementedError struct type for better error handling in stubs - Fix TypeScript docs: revert incorrect object syntax back to positional args Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
Stub()factory methods to create clients with injectable mocksNotImplementedErrortyped error in Go for better error handlingChanges by language
ChatsService(class)ChatsServiceImplPachcaClient.stub()ChatsService(interface)ChatsServiceImplNewStubPachcaClient()ChatsService(interface)ChatsServiceImplPachcaClient.stub()ChatsService(class)ChatsServiceImplPachcaClient.stub()ChatsService(protocol)ChatsServiceImplPachcaClient.stub()ChatsService(class)ChatsServiceImplPachcaClient.Stub()Test plan
cd sdk/go && go build ./...cd sdk/typescript && bun run build🤖 Generated with Claude Code