AstroWay/api v2.254.12 · nl
alle systemen normaal
// sdk · Go

Go SDK voor de AstroWay API

De officiële AstroWay Go-module: elke API-endpoint als een methode, zoals aw.Chart.Compute, met een context bij elke oproep. Herpogingen op 408/409/429/5xx respecteren Retry-After, en een POST houdt één Idempotency-Key, zodat een herhaalde oproep niet dubbel wordt gefactureerd. Fouten test je met errors.Is, en het antwoord decodeer je naar je eigen type. Alleen standaardbibliotheek, Go 1.22+.

// 01 / install

Installeren

go get github.com/astroway/astroway-go

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

// 02 / highlights

Kenmerken

// 03 / first request

Eerste verzoek

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 met Go

10.000 credits gratis per maand. Open-source SDK, gegenereerd vanuit OpenAPI 3.1, altijd synchroon met de backend.

99.9% SLA · betaalde plannen · 30d status →