Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.spairehq.com/llms.txt

Use this file to discover all available pages before exploring further.

Installation

Terminal
go get app.spairehq.com/go

Quickstart

main.go
package main

import (
	"context"
	"log"
	"os"

	spairego "app.spairehq.com/go"
)

func main() {
	ctx := context.Background()

	s := spairego.New(
		spairego.WithSecurity(os.Getenv("SPAIRE_ACCESS_TOKEN")),
	)

	res, err := s.Organizations.List(ctx, nil, spairego.Pointer[int64](1), spairego.Pointer[int64](10), nil)
	if err != nil {
		log.Fatal(err)
	}
	if res.ListResourceOrganization != nil {
		for {
			// handle items

			res, err = res.Next()
			if err != nil {
				log.Fatal(err)
			}
			if res == nil {
				break
			}
		}
	}
}

Sandbox Environment

You can configure the SDK to hit the sandbox environment instead of production by passing the server name when instantiating the client:
s := spairego.New(
	spairego.WithServer(spairego.ServerSandbox),
	spairego.WithSecurity(os.Getenv("SPAIRE_ACCESS_TOKEN")),
)