AstroWay/api v2.254.12 · it
tutti i sistemi sono operativi
// sdk · Go

SDK Go per l'API AstroWay

Il modulo Go ufficiale di AstroWay: ogni endpoint API come metodo, ad esempio aw.Chart.Compute, con un context in ogni chiamata. I retry su 408/409/429/5xx rispettano Retry-After, e un POST mantiene un Idempotency-Key, così una chiamata ritentata non viene addebitata due volte. Gli errori si verificano con errors.Is, e la risposta viene decodificata nel tuo tipo. Solo libreria standard, Go 1.22+.

// 01 / install

Installa

go get github.com/astroway/astroway-go

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

// 02 / highlights

Funzionalità

// 03 / first request

Prima richiesta

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
}

Inizia con Go

10.000 crediti gratis al mese. SDK open-source, generato da OpenAPI 3.1, sempre sincronizzato con il backend.

99.9% SLA · piani a pagamento · 30d stato →