This package contains a (mostly auto-generated) Golang client for the mittwald mStudio API.
Copyright (c) 2025 Mittwald CM Service GmbH & Co. KG and contributors
This project is licensed under the MIT License; see the LICENSE file for details.
You can install this package using go get
:
$ go get github.com/mittwald/api-client-go
The API client is designed with the support for multiple API versions in mind (although currently, the only available API version is v2).
To use a specific API version, use github.com/mittwald/api-client-go/mittwaldvX
as import path, with vX
being the API version you want to use (for example, v2
):
import "github.com/mittwald/api-client-go/mittwaldv2"
Use the mittwaldv2.New
function to instantiate a new client:
ctx := context.Background()
token := os.Getenv("MITTWALD_API_TOKEN")
client, err := mittwaldv2.New(ctx, mittwaldv2.WithAccessToken(token))
if err != nil {
panic(err)
}
You can use different options to configure different kinds of authentication:
- Omit authentication option for unauthenticated access
mittwaldv2.WithAccessToken
(recommended) to authenticate with an API tokenmittwaldv2.WithAccessTokenFromEnv
(recommended) to authenticate with an API token that is automatically retrieved from the process environment variables (MITTWALD_API_TOKEN
).mittwaldv2.WithUsernamePassword
to authenticate with username and password; this does not work for users that have 2FA enabledmittwaldv2.WithAccessTokenRetrievalKey
to authenticate with an access token retrieval key (only relevant for mStudio extensions)mittwaldv2.WithExtensionSecret
to authenticate as an extension (only relevant for mStudio extensions)
Other options include:
mittwaldv2.WithBaseURL
can be used to override the API base URL (useful for testing purposes).mittwaldv2.WithEventualConsistency
enables client-side support for the eventual consistency behaviour.
Have a look at our API introduction for more information on how to obtain an API token and how to get started with the API.
req := projectclientv2.ListProjectsRequest{
CustomerID: pointer.To("2ef23459-beb1-4ac2-9a38-d3a9df62bf93"),
Limit: pointer.To(100),
}
projects, res, err := client.Projects().ListProjects(ctx, req)
for _, project := range projects {
fmt.Println(project.ShortId)
}
The API documentation can be found in our Developer Portal. You can find the operation ID on the right side of each operation.