Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/CleverCloud/clevercloud-go

[Alpha] A Go client for Clever Cloud API
https://github.com/CleverCloud/clevercloud-go

clevercloud go golang

Last synced: 3 months ago
JSON representation

[Alpha] A Go client for Clever Cloud API

Awesome Lists containing this project

README

        

# clevercloud-go

[![Go Reference](https://pkg.go.dev/badge/github.com/clevercloud/clevercloud-go/clevercloud.svg)](https://pkg.go.dev/github.com/clevercloud/clevercloud-go/clevercloud)

> A Go client for Clever Cloud

This client is generated by [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) tool.

## Installation

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

## Documentation

See generated [ReadMe.md](./clevercloud/ReadMe.md)

## Usage

To use the underlying API, you will need OAuth credentials, for further details please checkout our [API documentation](https://www.clever-cloud.com/doc/extend/cc-api/).

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

```go
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:

- [AuthApi](./clevercloud/docs/AuthApi.md)
- [DefaultApi](./clevercloud/docs/DefaultApi.md)
- [OrganisationApi](./clevercloud/docs/OrganisationApi.md)
- [PaymentApi](./clevercloud/docs/PaymentApi.md)
- [ProductsApi](./clevercloud/docs/ProductsApi.md)
- [SelfApi](./clevercloud/docs/SelfApi.md)
- [UserApi](./clevercloud/docs/UserApi.md)

For example:

```go
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)
```