api-go-sdk

module
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: MPL-2.0

README

Buddy SDK for Go

api-go-sdk is the Buddy SDK for the Go programming language.

The SDK requires a minimum version of Go 1.21.

Checkout out our blog for information about the latest changes

Getting started

To get started working with the SDK setup your project for Go modules, and retrieve the SDK dependencies with go get. This example shows how you can use the SDK to make an API request using the SDK's client.

Initialize Project
$ mkdir ~/buddytest
$ cd ~/buddytest
$ go mod init buddytest
Add SDK Dependencies
$ go get github.com/buddy/api-go-sdk
Write Code

In your preferred editor add the following content to main.go

package main

import (
  "fmt"
  "github.com/buddy/api-go-sdk/buddy"
  "os"
)

func main() {
  client, err := buddy.NewDefaultClient(os.Getenv("BUDDY_TOKEN"))
  if err != nil {
    fmt.Printf("Error: %s", err.Error())
    os.Exit(1)
  }
  profile, _, err := client.ProfileService.Get()
  if err != nil {
    fmt.Printf("Error: %s", err.Error())
    os.Exit(1)
  } else {
    fmt.Printf("My name is %s", profile.Name)
  }
}

Examples

For more examples go to examples directory

API docs

Full API docs can be found here

Directories

Path Synopsis
examples
group/get Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL