5 Commits
Author SHA1 Message Date
zeekay b4e1366340 rebrand: export Insights types instead of PostHog
Rename Go package from posthog to insights across all 80+ files.
Consumers now import as `insights "github.com/hanzoai/insights-go"`
and use insights.Client, insights.Config, insights.Capture, etc.

- Rename posthog.go -> insights.go, posthog_test.go -> insights_test.go
- Update package declaration from posthog to insights in all .go files
- Update SDKName from posthog-go to insights-go
- Update DefaultEndpoint from app.posthog.com to insights.hanzo.ai
- Update all FieldError/ConfigError type strings
- Update User-Agent headers, log prefixes, comments, and docs
- Update JSON test fixtures to match new SDK name
- Update CLI, examples, extras, and sdk_compliance_adapter
- Fix pre-existing go vet warnings (non-constant format strings)
2026-03-13 19:54:58 -07:00
AndersandGitHub 227dc9bb39 feat: Add device_id parameter to /flags requests (#157)
Add support for passing device_id to the PostHog /flags endpoint.
This allows clients to identify devices separately from users when
evaluating feature flags.

- Add DeviceId field to FlagsRequestData (omitted when nil)
- Add DeviceId to FeatureFlagPayload and FeatureFlagPayloadNoKey
- Thread device_id through all flag evaluation paths
- Add tests verifying device_id is passed in request payload
2026-02-04 14:30:37 +01:00
Matheus BatistaandGitHub 80414db3e8 fix(flags): avoid setting flags to false on transient errors (#162)
* fix cache overwrite on transient errors

* add flagfailed field for better distinction
2026-01-30 16:26:41 -03:00
Dustin ByrneandGitHub dfac8b7fdb feat: Add GetFeatureFlagResult method to client (#159)
* refactor: Rename `FeatureFlagResult` -> `featureFlagEvaluationResult`

It's an internal type used to track request metadata to be reported via
$feature_flag_called. This shouldn't be conflated with the
`getFeatureFlagResult()` API.

* feat: Add `GetFeatureFlagResult` method to client

This method returns an object indicating if the flag is enabled, what
the variant is, and a method for parsing the payload as a given type. It
emits a 'feature flag called' event by default, and will become
the canonical method of fetching a feature flag

* fix: Always return nil if a flag doesn't exist

* doc: Update CHANGELOG
2026-01-28 17:30:01 +00:00
Dustin ByrneandGitHub 5ce035676b feat: Set $feature_flag_error on $feature_flag_called (#142)
* feat: Set `$feature_flag_error` on `$feature_flag_called`

* test: Add integration tests for captured events
2026-01-09 12:42:02 -05:00