Add this client as project dependency
go get -u go.clever-cloud.dev/client
import "go.clever-cloud.dev/client"
cc := client.New(
client.WithAutoAuthConfig(),
)
type Self struct {
ID string `json:"id"`
}
res := client.Get[Self](context.Background(), cc, "/v2/self")
if res.HasError() {
// handle res.Error()
}
fmt.Println(res.Payload().ID)
if the operation you want to do does not return anything, use:
res := client.Get[client.Nothing](context.Background(), cc, "/v2/self")
Get it from clever-tools config ~/.config/clever-cloud/clever-tools.json
curl -XPOST https://api-bridge.clever-cloud.com/api-tokens \
-H "Content-Type: application/json" \
--data '{
"email": "[email protected]",
"password": "MY_SECRET_PASSWORD",
"mfaCode": "MFA_CODE", # optional
"name": "Token for SDK",
"description": "Optional description for this token used by CI foo",
"expirationDate": "2025-06-06T00:00:00.000Z"
}'