// sdk · TypeScript
SDK TypeScript untuk AstroWay API
Resmi @astroway/sdk - wrapper tipis di atas openapi-fetch (~6 KB runtime). Otomatis penyelesaian jalur + tipe permintaan/tanggapan di IDE Anda untuk semua endpoint. Hierarki kesalahan gaya Stainless, retry bawaan untuk 408/409/429/5xx, OIDC + SLSA L3 provenance.
// 01 / install
Pasang
npm install @astroway/sdk pnpm
pnpm add @astroway/sdk yarn
yarn add @astroway/sdk bun
bun add @astroway/sdk impor: import { Astroway } from '@astroway/sdk';
Lihat di registry → @astroway/sdk
// 02 / highlights
Fitur Unggulan
- Tipe TypeScript lengkap
- Dihasilkan OpenAPI 3.1
- Retry + backoff bawaan
- Kesalahan gaya Stainless
- OIDC + SLSA L3
// 03 / first request
Permintaan pertama
import { Astroway } from '@astroway/sdk';
const aw = new Astroway({ apiKey: process.env.ASTROWAY_API_KEY! });
const { data: chart } = await aw.client.POST('/chart', {
body: {
date: '1990-07-14',
time: '14:30:00',
timezoneOffset: 3,
latitude: 50.4501,
longitude: 30.5234,
houseSystem: 'P',
},
});
// aw.client.POST is the raw typed fetch, so `chart` is the { ok, data } envelope
console.log(chart.data.houses.ascendant); // 212.0952574979425 Mulai dengan TypeScript
10.000 kredit gratis per bulan. SDK open-source, dibuat dari OpenAPI 3.1, selalu sinkron dengan backend.