Skip to content

orq-ai/orquesta-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orquesta

Official Orquesta SDK for GO

Installation

go github.com/orquestadev/orquesta-go

Usage

You can get your workspace API key from the settings section in your workspace.

package main

import (
    "fmt"
    "github.com/orquestadev/orquesta-go"
)

func main() {
	client, err := orquesta.Init(orquesta.ClientOptions{
		ApiKey: "ORQUESTA_API_KEY",
	})

    if err != nil {
		  // ...
	  }

    var kill_switch_enabled bool
    err = client.Query(
    	"kill_switch",
    	orquesta.RuleContext{"environments": "production"},
    	&kill_switch_enabled
    )


    if err != nil {
		  // ...
    }

    fmt.Printf("Result: %v\n", kill_switch_enabled)
}

Notes

Is important to note that the value provided as the third parameter to the Query method must be a pointer to a variable of the type you want to receive the result in. This is because the SDK uses reflection to determine the type of the variable and then unmarshal the result into it.

It is easy to find the type if you look at the definition of the rule in the Orquesta Dashboard.

For example, if you want to receive the result as a string, you must pass a pointer to a string variable, like this:

var string_var string

err = client.Query("string_rule", orquesta.RuleContext{"environments": "production"}, &string_var)

if err != nil {
    // ...
}

About

Orquesta official SDK for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages