// sdk · Go
SDK Go pour l'API AstroWay
Le module officiel AstroWay Go : chaque endpoint de l'API comme méthode, par ex. aw.Chart.Compute, avec un context sur chaque appel. Les retries sur 408/409/429/5xx respectent Retry-After, et un POST conserve un Idempotency-Key, donc un appel relancé n’est pas facturé deux fois. Les erreurs sont testées avec errors.Is, et la réponse est décodée dans ton propre type. Bibliothèque standard uniquement, Go 1.22+.
// 01 / install
Installer
go get github.com/astroway/astroway-go importation: astroway "github.com/astroway/astroway-go"
Voir dans le registre → github.com/astroway/astroway-go
// 02 / highlights
Fonctionnalités
- 725 méthodes du spec OpenAPI
- context.Context sur chaque appel
- Retries avec Retry-After et Idempotency-Key
- errors.Is : ErrQuotaExceeded, ErrRateLimit
- Bibliothèque standard uniquement
// 03 / first request
Première requête
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
} Démarrer avec Go
10 000 crédits gratuits par mois. SDK open-source, généré à partir d'OpenAPI 3.1, toujours synchronisé avec le backend.