Thykof / clevercloud-client-go

Clever Cloud API Go client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go CleverCloud API client

Go Reference

How to

Installation

Add this client as project dependency

go get -u go.clever-cloud.dev/client

Usage

Client instantiation

import "go.clever-cloud.dev/client"

cc := client.New(
    client.WithAutoOauthConfig(),
) 

Use the client

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

About

Clever Cloud API Go client

License:Apache License 2.0


Languages

Language:Go 98.8%Language:Makefile 1.2%