SDKs
Go SDK: v1 to v2 Migration
Request and response types moved into their own package. Here is what changed and how to update.
What changed
v1 generated every request/response type into the same package as the API client (github.com/themudhaxk/mudbase-sdk-go). As the API surface grew, that meant hundreds of model files sitting next to the client and configuration code in one flat package. v2 splits them:
- Request/response structs (for example
CreateApiKeyRequest) now live in amodelssubpackage:github.com/themudhaxk/mudbase-sdk-go/v2/models. - The client, configuration, and per-resource API services (
APIClient,Configuration,*APIService) stay in the root package, unchanged in shape. - The module path took the standard Go major-version-2 suffix that comes with this kind of breaking change:
github.com/themudhaxk/mudbase-sdk-go/v2instead ofgithub.com/themudhaxk/mudbase-sdk-go.
v1 is not deprecated or removed - go get github.com/themudhaxk/mudbase-sdk-go keeps working exactly as it does today for any code already importing it. There is no forced migration deadline. New integrations should start on v2.
Before / after
v1:
import (
"context"
mudbase "github.com/themudhaxk/mudbase-sdk-go"
)
req := mudbase.NewCreateApiKeyRequest("My key", "PROJECT_ID")
apiClient := mudbase.NewAPIClient(mudbase.NewConfiguration())
key, _, err := apiClient.APIKeysAPI.CreateApiKey(context.Background()).CreateApiKeyRequest(*req).Execute()import (
"context"
mudbase "github.com/themudhaxk/mudbase-sdk-go"
)
req := mudbase.NewCreateApiKeyRequest("My key", "PROJECT_ID")
apiClient := mudbase.NewAPIClient(mudbase.NewConfiguration())
key, _, err := apiClient.APIKeysAPI.CreateApiKey(context.Background()).CreateApiKeyRequest(*req).Execute()v2 - only the model reference and the import change:
import (
"context"
mudbase "github.com/themudhaxk/mudbase-sdk-go/v2"
models "github.com/themudhaxk/mudbase-sdk-go/v2/models"
)
req := models.NewCreateApiKeyRequest("My key", "PROJECT_ID")
apiClient := mudbase.NewAPIClient(mudbase.NewConfiguration())
key, _, err := apiClient.APIKeysAPI.CreateApiKey(context.Background()).CreateApiKeyRequest(*req).Execute()import (
"context"
mudbase "github.com/themudhaxk/mudbase-sdk-go/v2"
models "github.com/themudhaxk/mudbase-sdk-go/v2/models"
)
req := models.NewCreateApiKeyRequest("My key", "PROJECT_ID")
apiClient := mudbase.NewAPIClient(mudbase.NewConfiguration())
key, _, err := apiClient.APIKeysAPI.CreateApiKey(context.Background()).CreateApiKeyRequest(*req).Execute()The client call itself - apiClient.APIKeysAPI.CreateApiKey(...).CreateApiKeyRequest(...).Execute() - is unchanged. Only the type you construct the request with (and its import) moves to models.
Upgrade steps
- Update your import to the v2 module:
go get github.com/themudhaxk/mudbase-sdk-go/v2. - Add a second import for the models package:
models "github.com/themudhaxk/mudbase-sdk-go/v2/models". - Anywhere you construct or reference a request/response type directly (for example
mudbase.NewCreateApiKeyRequest(...)or a baremudbase.SomeResponsevariable declaration), prefix it withmodels.instead. - Client, configuration, and API-service call sites need no changes.
More
See the Go SDK page for installation and a full quick start, or the SDKs Overview for other languages.