AstroWay/api v2.254.12 · tr
tüm sistemler normal
// sdk · Go

AstroWay API için Go SDK'sı

Resmi AstroWay Go modülü: her API uç noktasını bir metod olarak sunar, örneğin aw.Chart.Compute, her çağrıda bir context ile. 408/409/429/5xx hatalarında Retry-After uygulanır ve POST bir Idempotency-Key tutar, böylece yeniden denenen çağrı iki kez ücretlendirilmez. Hatalar errors.Is ile test edilir ve yanıt kendi tipine dekode edilir. Sadece standart kütüphane, Go 1.22+.

// 01 / install

Kur

go get github.com/astroway/astroway-go

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

// 02 / highlights

Öne çıkanlar

// 03 / first request

İlk istek

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
}

Go ile başla

Ayda 10.000 kredi ücretsiz. Open-source SDK, OpenAPI 3.1’den oluşturulur, her zaman arka uçla senkron.

%99,9 SLA · ücretli planlar · 30g durum →