feat: add GetWithAssistedSupport for Company endpoint 202 handling#392
Open
travisjoseph wants to merge 1 commit intomainfrom
Open
feat: add GetWithAssistedSupport for Company endpoint 202 handling#392travisjoseph wants to merge 1 commit intomainfrom
travisjoseph wants to merge 1 commit intomainfrom
Conversation
For assisted connections, the /employer/company endpoint returns 202
status when data sync is in progress. This creates a non-generated
wrapper that handles both response types via union discrimination:
- Company (200 OK with company data)
- CompanyDataSyncInProgress (202 with sync status)
Implementation follows existing PayStatement pattern with:
- Union response type with AsUnion() method
- Type-safe pattern matching via type switch
- Constants for 202 status codes and messages
- Full test coverage for both response types
Usage:
```go
resp, err := client.HRIS.Company.GetWithAssistedSupport(ctx)
switch u := resp.AsUnion().(type) {
case finchgo.Company:
// Handle company data
case finchgo.CompanyDataSyncInProgress:
// Retry later
}
```
Co-Authored-By: Claude Sonnet 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
GetWithAssistedSupport()method to handle 202 responses from assisted connectionsProblem
For assisted connections,
/employer/companyendpoint returns 202 status when data sync is in progress. Current SDK only expectsCompanystruct, causing deserialization failures.Solution
Created
company_assisted.gowith union response types:Companyvariant for 200 OK with dataCompanyDataSyncInProgressvariant for 202 sync statusAsUnion()methodUsage
Test Plan
🤖 Generated with Claude Code