Categorygithub.com/nuonco/nuon-go
modulepackage
0.35.1
Repository: https://github.com/nuonco/nuon-go.git
Documentation: pkg.go.dev

# README

nuon-go

An interface for working with our API from go.

Overview

The Nuon API allows you to configure your Nuon apps, release to them and create new installs.

Full documentation is available at https://docs.nuon.co.

All endpoints in the API follow REST conventions and standard HTTP methods. You can find the OpenAPI Spec here

Installation

In your project, you can install the package directly using go get:

go get github.com/nuonco/nuon-go

In your code, add the following import:

import nuon "github.com/nuonco/nuon-go"

Create a client

Create a new api client, using an API key set in the environment.


apiURL := "https://api.nuon.co"
apiToken := os.Getenv("NUON_API_TOKEN")
orgID := os.Getenv("NUON_ORG_ID")

apiClient, err := client.New(s.v,
  client.WithAuthToken(apiToken),
  client.WithURL(apiURL),
  client.WithOrgID(orgID),
)
if err != nil {
  return fmt.Errorf("unable to get api client: %w", err)
}

Example usage

List all apps in an org

apps, err := apiClient.ListApps(ctx)

Get an app

app, err := apiClient.GetApp(ctx, appID)

Contributing

Please submit a PR, and if you would like help, contact us on our community slack.

Since this library relies on generating client code from our graphql api, please run to ensure your generated client code is up to date.

$ go generate ./...

You can also change the open api spec to generate against, by setting the API_URL field to a different value:

$ NUON_API_URL=http://localhost:8081 go generate ./...

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewMockClient creates a new mock instance.
ToUserError returns the error as a user error if possible.
WithAuthToken specifies the auth token to use.
WithOrgID specifies the org id to use.
WithURL specifies the url to use.
WithValidator specifies a validator to use.

# Structs

MockClient is a mock of Client interface.
MockClientMockRecorder is the mock recorder for MockClient.

# Interfaces

go:generate -command swagger go run github.com/go-swagger/go-swagger/cmd/swaggergo:generate swagger generate client --skip-tag-packages -f $NUON_API_URL/docs/doc.jsongo:generate -command mockgen go run github.com/golang/mock/mockgengo:generate mockgen -destination=mock.go -source=client.go -package=nuon.