Go client for querying azimuth watcher
| .gitignore | ||
| bigint_test.go | ||
| bigint.go | ||
| client_test.go | ||
| client.go | ||
| examples_test.go | ||
| generated.go | ||
| genqlient.yaml | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| queries.graphql | ||
| README.md | ||
| schema.graphql | ||
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.