SDKs
Available

Go

Install loams.dev/go and make the first call from Go.

Module path loams.dev/go. Every call takes a context.Context first: a cancelled context aborts the attempt, a deadline covers the whole call including retries, and backoff sleeps on the context.

Examples: github.com/ostrium-labs/loams-go · Source: sdks/go

Install

go get loams.dev/go@v0.1.0

Use Go 1.25 or newer to install: the module lives in sdks/go of the main repository, and the go-import tag that says so carries a subdirectory, which only Go 1.25 reads. The SDK itself needs Go 1.24 or newer.

Quickstart

package main

import (
	"context"
	"fmt"
	"os"
	"time"

	loams "loams.dev/go"
)

func main() {
	client := loams.New(loams.Options{
		Endpoint: os.Getenv("LOAMS_ENDPOINT"), // http://127.0.0.1:8080 for loams dev
		Auth:     loams.APIKey(os.Getenv("LOAMS_API_KEY")),
	})
	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()
	info, err := client.Instance().GetInstance(ctx, &loams.GetInstanceRequest{})
	fmt.Println(info, err)
}

Errors

var notFound *loams.NotFoundError
if errors.As(err, &notFound) { /* … */ }

if loams.ReasonOf(err) == loams.ReasonFeatureNotInVariant { /* … */ }

FeatureNotInVariantError and TokenExpiredError are subclasses of UnimplementedError and UnauthenticatedError, so errors.As matches the coarse class too. A failure from below the API (a socket, a cancelled context) carries no reason.

Collections and hybrid search are not in the SDK facade in 0.1.0; call the REST API with net/http.

On this page