Skip to content

Xelon-AG/xelon-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xelon SDK for Go

Tests Go Report Card GoDoc

xelon-sdk-go is the official Xelon SDK for the Go programming language.

Installation

# X.Y.Z is the version you need
go get github.com/Xelon-AG/xelon-sdk-go@vX.Y.Z


# for non Go modules usage or latest version
go get github.com/Xelon-AG/xelon-sdk-go

Usage

import "github.com/Xelon-AG/xelon-sdk-go"

Create a new Xelon client, then use the exposed services to access different parts of the Xelon API.

Authentication

Currently, Bearer token is the only method of authenticating with the API. You can learn how to obtain it here. Then use your token to create a new client:

client := xelon.NewClient("my-secret-token")

If you want to specify more parameters by client initialization, use With... methods and pass via option pattern:

var opts []xelon.ClientOption
opts = append(opts, xelon.WithBaseURL(baseURL))
opts = append(opts, xelon.WithClientID(clientID))
opts = append(opts, xelon.WithUserAgent(userAgent))

client := xelon.NewClient("my-secret-token", opts...)

Examples

List all ssh keys for the user.

func main() {
  client := xelon.NewClient("my-secret-token")

  // list all ssh keys for the authenticated user
  ctx := context.Background()
  sshKeys, _, err := client.SSHKeys.List(ctx)
}

Contributing

We love pull requests! Please see the contribution guidelines.

License

This SDK is distributed under the Apache-2.0 license, see LICENSE for more information.