Developer tools
Migration guides
Go 1.0
Go SDK upgrade (v0.x to v1.0)
This guide will help you upgrade from the previous Knock Go SDK to the new v1.0 Go SDK.
Basic Changes
Client Initialization
New Features in v1.0
-
Strong Type System: Improved type safety with field wrappers
-
Auto-pagination: Easily iterate through paginated resources
-
Enhanced Error Handling: Better error types with detailed information
-
Request Options: More flexible configuration for requests
-
Raw JSON Access: Access raw JSON data for advanced use cases
Breaking Changes
-
Request Parameter Style:
- The new SDK wraps all request parameters with
param.Field
using helpers likeknock.F()
to distinguish between zero values and unset fields
- The new SDK wraps all request parameters with
-
Method Signatures:
- Most methods now take IDs as positional parameters, followed by a params struct
- The new SDK spreads parameters across the method signature for better readability
-
Type System:
- The new SDK uses a strong type system with special wrapper types
- Field values need to be wrapped with
knock.F()
to be included in requests - Union types are used for parameters that can have multiple types
-
Error Handling:
- Error types and handling mechanisms have changed significantly
- The new SDK provides more detailed error information and better debugging utilities
-
Pagination:
- The new SDK introduces cursor-based pagination with auto-pagination helpers
Common Operations
Triggering Workflows
Old SDK:
New SDK:
Identifying Users
Old SDK:
New SDK:
Working with Objects
Old SDK:
New SDK:
Support
If you encounter any issues during migration, please reach out to our support team or open an issue on GitHub.