Go client for querying azimuth watcher
Go to file
2025-09-16 23:42:51 -07:00
.gitignore Initial release of azimuth-client-go library 2025-07-30 14:01:03 -04:00
bigint_test.go Initial release of azimuth-client-go library 2025-07-30 14:01:03 -04:00
bigint.go Initial release of azimuth-client-go library 2025-07-30 14:01:03 -04:00
client_test.go Initial release of azimuth-client-go library 2025-07-30 14:01:03 -04:00
client.go making validation function public 2025-09-11 18:28:40 -07:00
examples_test.go updating references to martian to laconic 2025-09-16 23:42:51 -07:00
generated.go Fix the schema hopefully 2025-09-09 17:40:48 -07:00
genqlient.yaml Update module path to github.com/martian-engineering/azimuth-client-go 2025-07-30 14:51:37 -04:00
go.mod updating references to martian to laconic 2025-09-16 23:42:51 -07:00
go.sum Initial release of azimuth-client-go library 2025-07-30 14:01:03 -04:00
LICENSE Initial release of azimuth-client-go library 2025-07-30 14:01:03 -04:00
Makefile Initial release of azimuth-client-go library 2025-07-30 14:01:03 -04:00
queries.graphql Fix the schema hopefully 2025-09-09 17:40:48 -07:00
README.md updating references to martian to laconic 2025-09-16 23:42:51 -07:00
schema.graphql Fix the schema hopefully 2025-09-09 17:40:48 -07:00

Azimuth Client Go

A Go client library for interacting with the Azimuth watcher GraphQL API. This library provides type-safe access to Azimuth ship data, including cryptographic keys, ownership information, and sponsorship relationships.

Features

  • Type-safe GraphQL client using genqlient
  • Automatic caching of ship keys with configurable TTL
  • Support for authentication and encryption key retrieval
  • Ship ownership and sponsorship queries
  • Ship activity status checking
  • Urbit ship type classification (galaxy, star, planet)

Installation

go get git.vdb.to/LaconicNetwork/azimuth-client-go

Usage

Basic Client Setup

package main

import (
    "context"
    "fmt"
    "log"
    
    azimuth "git.vdb.to/LaconicNetwork/azimuth-client-go"
)

func main() {
    // Create client with default endpoint
    client := azimuth.NewClient("")
    
    // Or with custom endpoint
    client = azimuth.NewClient("https://azimuth.dev.vdb.to")
    
    // Get authentication key for a ship
    authKey, err := client.GetAuthenticationKey(context.Background(), 256)
    if err != nil {
        log.Fatal(err)
    }
    
    fmt.Printf("Auth key: %x\n", authKey)
}

Advanced Usage

// Check if ship is active
active, err := client.IsShipActive(context.Background(), 256)

// Get ship's sponsor
sponsor, err := client.GetSponsor(context.Background(), 1024)

// Get ship type
shipType := azimuth.GetShipType(256) // "star"

// Validate star sponsorship
err = azimuth.ValidateStarSponsorship(context.Background(), 256, 0, client)

Configuration

The client supports several configuration options:

  • Endpoint: GraphQL endpoint URL (defaults to "https://azimuth.dev.vdb.to/graphql")
  • Cache TTL: Duration to cache ship keys (defaults to 1 hour)
  • HTTP Timeout: HTTP client timeout (defaults to 30 seconds)

Development

Prerequisites

  • Go 1.23+
  • genqlient for GraphQL code generation

Building

go build ./...

Testing

go test ./...

Generating GraphQL Code

go generate ./...

License

This project is licensed under the MIT License.