Skip to content

mittwald/api-client-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mittwald API Golang client

Go Reference

This package contains a (mostly auto-generated) Golang client for the mittwald mStudio API.

License

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.

Installation

You can install this package using go get:

$ go get github.com/mittwald/api-client-go

API versions

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"

Usage

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:

  1. Omit authentication option for unauthenticated access
  2. mittwaldv2.WithAccessToken (recommended) to authenticate with an API token
  3. mittwaldv2.WithAccessTokenFromEnv (recommended) to authenticate with an API token that is automatically retrieved from the process environment variables (MITTWALD_API_TOKEN).
  4. mittwaldv2.WithUsernamePassword to authenticate with username and password; this does not work for users that have 2FA enabled
  5. mittwaldv2.WithAccessTokenRetrievalKey to authenticate with an access token retrieval key (only relevant for mStudio extensions)
  6. mittwaldv2.WithExtensionSecret to authenticate as an extension (only relevant for mStudio extensions)

Other options include:

  1. mittwaldv2.WithBaseURL can be used to override the API base URL (useful for testing purposes).
  2. 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.

Example

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)
}

API documentation

The API documentation can be found in our Developer Portal. You can find the operation ID on the right side of each operation.

About

Go client for the mittwald mStudio API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages