@astroway/sdk 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/dist/namespaces.generated.d.ts +323 -277
- package/dist/namespaces.generated.d.ts.map +1 -1
- package/dist/namespaces.generated.js +73 -50
- package/dist/namespaces.generated.js.map +1 -1
- package/dist/types.generated.d.ts +12155 -6971
- package/dist/types.generated.d.ts.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -38,9 +38,16 @@ const chart = await aw.chart.compute({
|
|
|
38
38
|
houseSystem: 'P',
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
const SIGNS = ['Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo',
|
|
42
|
+
'Libra', 'Scorpio', 'Sagittarius', 'Capricorn', 'Aquarius', 'Pisces'];
|
|
43
|
+
|
|
44
|
+
const asc = chart.houses.ascendant; // 212.0929
|
|
45
|
+
console.log(`ASC: ${SIGNS[Math.floor(asc / 30)]} ${(asc % 30).toFixed(2)}°`); // ASC: Scorpio 2.09°
|
|
46
|
+
console.log(`Sun: ${chart.planets[0].longitude.toFixed(2)}°`); // Sun: 111.77°
|
|
42
47
|
```
|
|
43
48
|
|
|
49
|
+
`/chart` returns positions, not labels: `houses.ascendant` and every `planets[].longitude` are ecliptic longitudes in degrees, so a sign name is `Math.floor(longitude / 30)` into the list above and the degree within it is `longitude % 30`.
|
|
50
|
+
|
|
44
51
|
The SDK exposes **94 typed namespaces / 623 methods** auto-generated from the OpenAPI spec — `aw.synastry.aspectGrid({...})`, `aw.bazi.dayMaster({...})`, `aw.vedic.dashasVimshottariMaha({...})`, etc. Path autocomplete and body/response types come straight from your IDE; the `{ ok, data, error }` envelope is unwrapped for you.
|
|
45
52
|
|
|
46
53
|
Need a raw response or an endpoint not yet covered by namespaces? `aw.client` is the underlying [`openapi-fetch`](https://openapi-ts.dev/openapi-fetch/) instance — `aw.client.POST('/chart', { body })` returns the full envelope with the same typing.
|
|
@@ -149,6 +156,10 @@ try {
|
|
|
149
156
|
|
|
150
157
|
Full hierarchy: `ApiError` → `APIConnectionError` (→ `APITimeoutError`), `BadRequestError` (400), `AuthenticationError` (401), `PermissionDeniedError` (403), `NotFoundError` (404), `UnprocessableEntityError` (422), `RateLimitError` (429), `InternalServerError` (5xx).
|
|
151
158
|
|
|
159
|
+
### The 400 you are most likely to hit first
|
|
160
|
+
|
|
161
|
+
Chart bodies take `latitude`, `longitude` and `timezoneOffset`. The short spellings `lat`, `lon`, `lng`, `long`, `tz` and `timezone` are refused with a `BadRequestError` whose `e.code` is `INVALID_FIELD`, and `e.body.error.details` names every offending field at once as `{ path, expected, message }`. They are not accepted and not deprecated: they were never in the spec, and before the API started refusing them they were silently ignored, which charted 0°N 0°E at UTC under a `200`. Details: <https://api.astroway.info/en/errors/#invalid_field>.
|
|
162
|
+
|
|
152
163
|
---
|
|
153
164
|
|
|
154
165
|
## Configuration
|