AstroWay/api v2.254.12 · de
alle Systeme in Ordnung
// sdk · Go

Go SDK für die AstroWay API

Das offizielle AstroWay Go-Modul: jeder API-Endpoint als Methode, z. B. aw.Chart.Compute, mit einem Context bei jedem Aufruf. Wiederholungen bei 408/409/429/5xx beachten Retry-After, und ein POST behält einen Idempotency-Key, sodass ein wiederholter Aufruf nicht doppelt berechnet wird. Fehler werden mit errors.Is geprüft, und die Antwort wird in deinen eigenen Typ dekodiert. Nur Standardbibliothek, Go 1.22+.

// 01 / install

Installieren

go get github.com/astroway/astroway-go

Import: astroway "github.com/astroway/astroway-go"

// 02 / highlights

Highlights

// 03 / first request

Erste Anfrage

package main

import (
    "context"
    "fmt"
    "log"
    "os"

    astroway "github.com/astroway/astroway-go"
)

func main() {
    aw := astroway.New(os.Getenv("ASTROWAY_API_KEY"))

    res, err := aw.Chart.Compute(context.Background(), map[string]any{
        "date": "1990-07-14", "time": "14:30:00", "timezoneOffset": 3,
        "latitude": 50.4501, "longitude": 30.5234, "houseSystem": "P",
    })
    if err != nil {
        log.Fatal(err)
    }

    var chart struct {
        Houses struct {
            Ascendant float64 `json:"ascendant"`
        } `json:"houses"`
    }
    if err := res.Decode(&chart); err != nil {
        log.Fatal(err)
    }
    fmt.Println(chart.Houses.Ascendant) // 212.0952574979425
}

Start mit Go

10.000 Credits kostenlos pro Monat. Open-Source SDK, generiert aus OpenAPI 3.1, immer synchron mit dem Backend.

99,9% SLA · kostenpflichtige Tarife · 30 Tage Status →