Skip to content

CleverCloud/clevercloud-go

Repository files navigation

clevercloud-go

Go Reference

A Go client for Clever Cloud

This client is generated by OpenAPI Generator tool.

Installation

go get github.com/clevercloud/clevercloud-go/clevercloud

Documentation

See generated ReadMe.md

Usage

To use the underlying API, you will need OAuth credentials, for further details please checkout our API documentation.

With those credentials you need to instantiate the OAuth client and build the API client with it:

import "github.com/clevercloud/clevercloud-go/clevercloud"

oauth := clevercloud.NewOAuthClient("myConsumerKey", "myConsumerSecret")
oauth.SetTokens("myCleverToken", "myCleverSecret")

config := clevercloud.NewConfiguration()
api := clevercloud.NewOAuthAPIClient(oauth, config)

Once you have an api object you can request any services provided by the client:

For example:

resp, r, err := api.SelfApi.GetUser(context.Background())
if err != nil {
    fmt.Printf("Error when calling `SelfApi.GetUser``: %v\n", err)

    return
}

// response from `GetUser`: UserView
fmt.Printf("Response from `SelfApi.GetUser`: %v\n", resp)