@roxyapi/sdk 1.2.85 → 1.2.87
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/AGENTS.md +51 -30
- package/README.md +252 -186
- package/dist/client/client.gen.d.ts +1 -1
- package/dist/client/client.gen.d.ts.map +1 -1
- package/dist/client/index.d.ts +10 -10
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/types.gen.d.ts +4 -4
- package/dist/client/types.gen.d.ts.map +1 -1
- package/dist/client/utils.gen.d.ts +2 -2
- package/dist/client/utils.gen.d.ts.map +1 -1
- package/dist/client.gen.d.ts +2 -2
- package/dist/client.gen.d.ts.map +1 -1
- package/dist/core/bodySerializer.gen.d.ts +1 -1
- package/dist/core/bodySerializer.gen.d.ts.map +1 -1
- package/dist/core/serverSentEvents.gen.d.ts +1 -1
- package/dist/core/serverSentEvents.gen.d.ts.map +1 -1
- package/dist/core/types.gen.d.ts +2 -2
- package/dist/core/types.gen.d.ts.map +1 -1
- package/dist/core/utils.gen.d.ts +1 -1
- package/dist/core/utils.gen.d.ts.map +1 -1
- package/dist/factory.cjs +34 -2
- package/dist/factory.d.ts +2 -2
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +34 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/sdk.gen.d.ts +15 -3
- package/dist/sdk.gen.d.ts.map +1 -1
- package/dist/types.gen.d.ts +5975 -178
- package/dist/types.gen.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/docs/llms-full.txt +72 -24
- package/package.json +23 -11
- package/src/client/client.gen.ts +5 -5
- package/src/client/index.ts +10 -10
- package/src/client/types.gen.ts +4 -4
- package/src/client/utils.gen.ts +6 -6
- package/src/client.gen.ts +2 -2
- package/src/core/bodySerializer.gen.ts +1 -1
- package/src/core/serverSentEvents.gen.ts +1 -1
- package/src/core/types.gen.ts +2 -2
- package/src/core/utils.gen.ts +2 -2
- package/src/factory.ts +4 -4
- package/src/index.ts +2 -2
- package/src/sdk.gen.ts +39 -5
- package/src/types.gen.ts +6273 -462
- package/src/version.ts +1 -1
package/AGENTS.md
CHANGED
|
@@ -27,7 +27,7 @@ const { data } = await roxy.location.searchCities({ query: { q: 'New York' } });
|
|
|
27
27
|
const { latitude, longitude, timezone } = data.cities[0];
|
|
28
28
|
// `timezone` is the IANA string ("America/New_York"). Pass it directly to any chart
|
|
29
29
|
// endpoint and the server resolves it to the DST-correct decimal offset using
|
|
30
|
-
// the chart
|
|
30
|
+
// the `date` of the chart itself, so a January 1990 New York chart picks EST (-5) even
|
|
31
31
|
// when you looked the city up in July. If you prefer numbers, `utcOffset`
|
|
32
32
|
// (5.5, -5, 9, ...) also works and produces identical charts.
|
|
33
33
|
```
|
|
@@ -42,7 +42,7 @@ Type `roxy.` to see all available namespaces. Type `roxy.{domain}.` to see every
|
|
|
42
42
|
| Namespace | What it covers |
|
|
43
43
|
|-----------|----------------|
|
|
44
44
|
| `roxy.astrology` | Western astrology API for natal birth charts, daily, weekly, monthly, and yearly horoscopes with unique content per s... |
|
|
45
|
-
| `roxy.vedicAstrology` | Vedic astrology (Jyotish) and KP API for kundli generation with
|
|
45
|
+
| `roxy.vedicAstrology` | Vedic astrology (Jyotish) and KP API for kundli generation with the sixteen Shodasavarga divisional charts (D1 to D60... |
|
|
46
46
|
| `roxy.forecast` | Astrology forecast API that merges upcoming transit aspects, sign ingresses, retrograde stations, new and full moons,... |
|
|
47
47
|
| `roxy.humanDesign` | Human Design API that generates the full bodygraph from a birth moment: type, strategy, inner authority, profile, def... |
|
|
48
48
|
| `roxy.chineseAstrology` | Chinese zodiac and BaZi astrology API: Four Pillars charts, Chinese zodiac signs and the Chinese lunisolar calendar f... |
|
|
@@ -70,24 +70,26 @@ Type `roxy.` to see all available namespaces. Type `roxy.{domain}.` to see every
|
|
|
70
70
|
Five rules to follow when writing any call with this SDK. Get these right and the generated types do the rest.
|
|
71
71
|
|
|
72
72
|
- **One options object, hey-api wrapped.** Every method takes a single object with `path`, `query`, and `body` keys. Path params go in `path`, query params in `query`, request body in `body`. Never flat named args. Right: `roxy.astrology.getDailyHoroscope({ path: { sign: 'aries' } })`. Wrong: `roxy.astrology.getDailyHoroscope({ sign: 'aries' })`.
|
|
73
|
-
- **Always `await`. Always destructure `{ data, error, response }`.** All methods are async. `data` is the typed success response (undefined on error). `error` is the typed API error (`{ error: string, code: string }`, undefined on success). `response` is the raw `fetch` Response. Switch on `error.code`, not on `error.error`.
|
|
73
|
+
- **Always `await`. Always destructure `{ data, error, response }`.** All methods are async. `data` is the typed success response (undefined on error). `error` is the typed API error (`{ error: string, code: string }`, undefined on success). `response` is the raw `fetch` Response. Switch on `error.code`, not on `error.error`. The pair is a discriminated union, so `data` is typed as possibly undefined until `error` is checked: write `if (error) throw error;` before reading `data` in a `strict` project, or pass `throwOnError: true` in the call options to have failures throw and `data` typed as always present.
|
|
74
74
|
- **Method names match the OpenAPI `operationId` verbatim.** When in doubt, autocomplete `roxy.{domain}.` in your editor or `grep 'public ' node_modules/@roxyapi/sdk/dist/factory.d.ts`. Never invent a method from the URL path or a guess.
|
|
75
|
-
- **Response field names come from the
|
|
76
|
-
- **Do not hand-roll requests.** No raw `fetch`, no axios. The SDK injects auth, base URL
|
|
75
|
+
- **Response field names come from the response schema of the spec.** Field access is typed dot syntax (`data.cities[0].timezone`). TypeScript will catch any invented field at compile time via the generated types - if `tsc` complains, the field does not exist.
|
|
76
|
+
- **Do not hand-roll requests.** No raw `fetch`, no axios. The SDK injects auth, the base URL and typed responses; it does not retry, so wrap calls you want retried. Use `createRoxy(key)` for the common case, or `new Roxy({ client })` with `createClient` from `@roxyapi/sdk/client` when you need a custom fetch or interceptors.
|
|
77
77
|
|
|
78
78
|
## Critical patterns
|
|
79
79
|
|
|
80
80
|
### Two-step pattern for coordinate-dependent endpoints
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
|
-
const { data } = await roxy.location.searchCities({ query: { q: 'London' } });
|
|
83
|
+
const { data, error } = await roxy.location.searchCities({ query: { q: 'London' } });
|
|
84
|
+
if (error) throw error;
|
|
84
85
|
const { latitude, longitude, timezone } = data.cities[0];
|
|
86
|
+
const birth = { date: '1990-01-15', time: '14:30:00', latitude, longitude, timezone };
|
|
85
87
|
|
|
86
|
-
const { data: chart } = await roxy.astrology.generateNatalChart({
|
|
87
|
-
body: { date: '1990-01-15', time: '14:30:00', latitude, longitude, timezone },
|
|
88
|
-
});
|
|
88
|
+
const { data: chart } = await roxy.astrology.generateNatalChart({ body: birth });
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
One lookup feeds every domain. The same `birth` object is the body for `astrology.generateNatalChart`, `vedicAstrology.generateBirthChart`, `vedicAstrology.getCurrentDasha`, `ayurveda.calculateAyurvedicConstitution` and the `birthData` of `forecast.forecastTransits`; the instant alone (`date`, `time`, `timezone`) is the body for `humanDesign.generateBodygraph`, `chineseAstrology.generateBaziChart` and `kabbalah.generateBirthProfile`. Never look the city up twice for one person.
|
|
92
|
+
|
|
91
93
|
### GET endpoints - use `path` for URL params, `query` for query params
|
|
92
94
|
|
|
93
95
|
```typescript
|
|
@@ -126,7 +128,7 @@ await roxy.numerology.calculateLifePath({
|
|
|
126
128
|
});
|
|
127
129
|
```
|
|
128
130
|
|
|
129
|
-
Supported: `astrology`, `vedicAstrology`, `forecast`, `humanDesign`, `chineseAstrology`, `fengShui`, `mesoamericanAstrology`, `vastu`, `numerology`, `kabbalah`, `tarot`, `biorhythm`, `ayurveda`, `iching`, `crystals`, `angelNumbers`. English-only: `dreams`, `location`, `usage
|
|
131
|
+
Supported: `astrology`, `vedicAstrology`, `forecast`, `humanDesign`, `chineseAstrology`, `fengShui`, `mesoamericanAstrology`, `vastu`, `numerology`, `kabbalah`, `tarot`, `biorhythm`, `ayurveda`, `iching`, `crystals`, `angelNumbers`, `languages`. English-only: `dreams`, `location`, `usage`. The two Chinese scripts (`zh-Hans`, `zh-Hant`) currently ship on Chinese astrology and feng shui; every other domain answers those codes in English per field. To list supported codes at runtime, call `roxy.languages.listLanguages()`.
|
|
130
132
|
|
|
131
133
|
### Error handling
|
|
132
134
|
|
|
@@ -151,54 +153,73 @@ console.log(data.sign, data.overview);
|
|
|
151
153
|
| 401 | `invalid_api_key` | Key format invalid or tampered |
|
|
152
154
|
| 401 | `subscription_not_found` | Key references non-existent subscription |
|
|
153
155
|
| 401 | `subscription_inactive` | Subscription cancelled, expired, or suspended |
|
|
156
|
+
| 401 | `api_key_revoked` | Key was deleted from the account |
|
|
154
157
|
| 404 | `not_found` | Resource not found |
|
|
158
|
+
| 4xx | `bad_request` and other status-derived codes | A client error the endpoint itself detected, such as a date window whose `endDate` precedes `startDate` |
|
|
155
159
|
| 429 | `rate_limit_exceeded` | Monthly quota reached |
|
|
156
160
|
| 500 | `internal_error` | Server error |
|
|
157
161
|
|
|
158
162
|
## Common tasks
|
|
159
163
|
|
|
160
|
-
|
|
164
|
+
In the catalog order (Western astrology, Vedic astrology, forecast, Human Design, Chinese astrology, feng shui, Mesoamerican astrology, Vastu, numerology, Kabbalah, tarot, biorhythm, Ayurveda, I Ching, crystals, dreams, angel numbers, location, usage, languages). `birth` is `{ date, time, latitude, longitude, timezone }` from the two-step pattern above.
|
|
161
165
|
|
|
162
166
|
| Task | Code |
|
|
163
167
|
|------|------|
|
|
168
|
+
| Find city coordinates (do this first) | `roxy.location.searchCities({ query: { q: 'Berlin' } })` |
|
|
164
169
|
| Daily horoscope | `roxy.astrology.getDailyHoroscope({ path: { sign } })` |
|
|
165
|
-
| Natal chart (Western) | `roxy.astrology.generateNatalChart({ body:
|
|
170
|
+
| Natal chart (Western) | `roxy.astrology.generateNatalChart({ body: birth })` |
|
|
166
171
|
| Synastry | `roxy.astrology.calculateSynastry({ body: { person1, person2 } })` |
|
|
167
172
|
| Compatibility score | `roxy.astrology.calculateCompatibility({ body: { person1, person2 } })` |
|
|
168
|
-
| Current moon phase | `roxy.astrology.getCurrentMoonPhase()` |
|
|
173
|
+
| Current moon phase | `roxy.astrology.getCurrentMoonPhase({})` |
|
|
169
174
|
| Transits | `roxy.astrology.calculateTransits({ body: { natalChart } })` |
|
|
170
|
-
| Kundli (Vedic birth chart) | `roxy.vedicAstrology.generateBirthChart({ body:
|
|
171
|
-
| Panchang (detailed) | `roxy.vedicAstrology.getDetailedPanchang({ body: { date, latitude, longitude } })` |
|
|
172
|
-
| Choghadiya | `roxy.vedicAstrology.getChoghadiya({ body: { date, latitude, longitude } })` |
|
|
173
|
-
| Current dasha | `roxy.vedicAstrology.getCurrentDasha({ body:
|
|
174
|
-
| Mangal Dosha | `roxy.vedicAstrology.checkManglikDosha({ body:
|
|
175
|
+
| Kundli (Vedic birth chart) | `roxy.vedicAstrology.generateBirthChart({ body: birth })` |
|
|
176
|
+
| Panchang (detailed) | `roxy.vedicAstrology.getDetailedPanchang({ body: { date, latitude, longitude, timezone } })` |
|
|
177
|
+
| Choghadiya | `roxy.vedicAstrology.getChoghadiya({ body: { date, latitude, longitude, timezone } })` |
|
|
178
|
+
| Current dasha | `roxy.vedicAstrology.getCurrentDasha({ body: birth })` |
|
|
179
|
+
| Mangal Dosha | `roxy.vedicAstrology.checkManglikDosha({ body: birth })` |
|
|
175
180
|
| Guna Milan (matching) | `roxy.vedicAstrology.calculateGunMilan({ body: { person1, person2 } })` |
|
|
176
|
-
| Navamsa (D9) | `roxy.vedicAstrology.generateNavamsa({ body:
|
|
177
|
-
| KP chart | `roxy.vedicAstrology.generateKpChart({ body:
|
|
181
|
+
| Navamsa (D9) | `roxy.vedicAstrology.generateNavamsa({ body: birth })` |
|
|
182
|
+
| KP chart | `roxy.vedicAstrology.generateKpChart({ body: birth })` |
|
|
183
|
+
| KP ruling planets | `roxy.vedicAstrology.getKpRulingPlanets({ body: { latitude, longitude, timezone } })` |
|
|
178
184
|
| Nakshatra detail | `roxy.vedicAstrology.getNakshatra({ path: { id: 'ashwini' } })` |
|
|
185
|
+
| Transit forecast | `roxy.forecast.forecastTransits({ body: { birthData: birth, startDate, endDate } })` |
|
|
186
|
+
| Cross-domain timeline | `roxy.forecast.generateTimeline({ body: { birthData: birth, startDate, endDate } })` |
|
|
187
|
+
| Human Design bodygraph | `roxy.humanDesign.generateBodygraph({ body: { date, time, timezone } })` |
|
|
188
|
+
| Human Design connection | `roxy.humanDesign.calculateConnection({ body: { personA, personB } })` |
|
|
189
|
+
| BaZi Four Pillars | `roxy.chineseAstrology.generateBaziChart({ body: { date, time, timezone } })` |
|
|
190
|
+
| Chinese zodiac animal | `roxy.chineseAstrology.calculateZodiacAnimal({ body: { date } })` |
|
|
191
|
+
| Almanac day (Tong Shu) | `roxy.chineseAstrology.getAlmanacDay({ path: { date } })` |
|
|
192
|
+
| Kua number | `roxy.fengShui.calculateKuaNumber({ body: { date, gender } })` |
|
|
193
|
+
| Flying star natal chart | `roxy.fengShui.generateFlyingStarChart({ body: { period, facing } })` |
|
|
194
|
+
| Tzolkin day sign | `roxy.mesoamericanAstrology.calculateTzolkin({ body: { date } })` |
|
|
195
|
+
| Full Maya chart | `roxy.mesoamericanAstrology.generateMayanChart({ body: { date } })` |
|
|
196
|
+
| Vastu entrance | `roxy.vastu.calculateEntrancePada({ body: { plot, facing, doorPosition } })` |
|
|
197
|
+
| Vastu room compliance | `roxy.vastu.calculateRoomCompliance({ body: { plot, facing, rooms } })` |
|
|
179
198
|
| Life path number | `roxy.numerology.calculateLifePath({ body: { year, month, day } })` |
|
|
180
199
|
| Full numerology chart | `roxy.numerology.generateNumerologyChart({ body: { fullName, year, month, day } })` |
|
|
181
200
|
| Personal year | `roxy.numerology.calculatePersonalYear({ body: { month, day } })` |
|
|
201
|
+
| Gematria | `roxy.kabbalah.calculateGematria({ body: { text } })` |
|
|
202
|
+
| Kabbalah birth profile | `roxy.kabbalah.generateBirthProfile({ body: { date, time, timezone } })` |
|
|
182
203
|
| Daily tarot card | `roxy.tarot.getDailyCard({ body: { seed } })` |
|
|
183
204
|
| Three-card spread | `roxy.tarot.castThreeCard({ body: { question } })` |
|
|
184
205
|
| Celtic Cross | `roxy.tarot.castCelticCross({ body: { question } })` |
|
|
185
206
|
| Yes / no tarot | `roxy.tarot.castYesNo({ body: { question } })` |
|
|
186
|
-
|
|
|
187
|
-
|
|
|
188
|
-
| Daily biorhythm | `roxy.biorhythm.getDailyBiorhythm({ body: { seed } })` |
|
|
207
|
+
| Biorhythm reading | `roxy.biorhythm.getReading({ body: { birthDate } })` |
|
|
208
|
+
| Daily biorhythm (seeded) | `roxy.biorhythm.getDailyBiorhythm({ body: { seed } })` |
|
|
189
209
|
| Biorhythm forecast | `roxy.biorhythm.getForecast({ body: { birthDate } })` |
|
|
190
210
|
| Biorhythm compatibility | `roxy.biorhythm.calculateBioCompatibility({ body: { person1, person2 } })` |
|
|
211
|
+
| Ayurvedic constitution | `roxy.ayurveda.calculateAyurvedicConstitution({ body: birth })` |
|
|
212
|
+
| Dinacharya | `roxy.ayurveda.getDinacharyaSchedule({ body: { date, latitude, longitude, timezone } })` |
|
|
191
213
|
| Daily hexagram | `roxy.iching.getDailyHexagram({ body: { seed } })` |
|
|
192
|
-
| Cast I Ching reading | `roxy.iching.castReading()` |
|
|
214
|
+
| Cast I Ching reading | `roxy.iching.castReading({})` |
|
|
193
215
|
| Hexagram detail | `roxy.iching.getHexagram({ path: { number: 1 } })` |
|
|
194
216
|
| Crystal by zodiac | `roxy.crystals.getCrystalsByZodiac({ path: { sign } })` |
|
|
195
217
|
| Crystal by chakra | `roxy.crystals.getCrystalsByChakra({ path: { chakra } })` |
|
|
196
218
|
| Dream symbol lookup | `roxy.dreams.getDreamSymbol({ path: { id: 'flying' } })` |
|
|
197
219
|
| Angel number meaning | `roxy.angelNumbers.getAngelNumber({ path: { number: '1111' } })` |
|
|
198
220
|
| Universal number lookup | `roxy.angelNumbers.analyzeNumberSequence({ query: { number: '1234' } })` |
|
|
199
|
-
|
|
|
200
|
-
|
|
|
201
|
-
| List supported languages | `roxy.languages.listLanguages()` |
|
|
221
|
+
| Check API usage | `roxy.usage.getUsageStats({})` |
|
|
222
|
+
| List supported languages | `roxy.languages.listLanguages({})` |
|
|
202
223
|
|
|
203
224
|
## Field formats that trip agents
|
|
204
225
|
|
|
@@ -232,7 +253,7 @@ These are the fields AI agents most often get wrong. Copy the format column exac
|
|
|
232
253
|
|--------|---------|--------|---------|
|
|
233
254
|
| UTC / London (winter) | `0` | Dubai | `4` |
|
|
234
255
|
| London (summer, BST) | `1` | Karachi | `5` |
|
|
235
|
-
| Berlin / Paris | `1` (winter) / `2` (summer) | Delhi
|
|
256
|
+
| Berlin / Paris | `1` (winter) / `2` (summer) | Delhi (IST) | `5.5` |
|
|
236
257
|
| Istanbul | `3` | Kathmandu (NPT) | `5.75` |
|
|
237
258
|
| Moscow | `3` | Dhaka | `6` |
|
|
238
259
|
| Tehran | `3.5` (winter) / `4.5` (summer) | Bangkok | `7` |
|
|
@@ -242,7 +263,7 @@ These are the fields AI agents most often get wrong. Copy the format column exac
|
|
|
242
263
|
| Denver (MST / MDT) | `-7` / `-6` | Auckland | `12` (winter) / `13` (summer) |
|
|
243
264
|
| Los Angeles (PST / PDT) | `-8` / `-7` | Honolulu | `-10` |
|
|
244
265
|
|
|
245
|
-
DST matters. If the birth date falls inside a daylight-saving window, use the summer / DST offset
|
|
266
|
+
DST matters. If the birth date falls inside a daylight-saving window, use the summer / DST offset, or pass the IANA string from the location lookup and let the server resolve it. India observes no DST, so a fixed `5.5` is always right there; anywhere else, a natal chart must carry the offset in force at the time of birth.
|
|
246
267
|
|
|
247
268
|
## Astrology domain gotchas for LLMs
|
|
248
269
|
|
|
@@ -280,7 +301,7 @@ Use the SDK for typed TypeScript apps. Use MCP for AI agents (Claude Desktop, Cu
|
|
|
280
301
|
- **Western `timezone` is required** and accepts either a decimal (`-5` for EST, `5.5` for IST, `0` for UTC) or an IANA string (`"America/New_York"`, `"Asia/Kolkata"`, `"UTC"`). IANA is resolved to the DST-correct offset for the request `date`. Vedic endpoints accept an optional `timezone` that defaults to `5.5` (IST).
|
|
281
302
|
- **`data` and `error` are mutually exclusive.** If `error` is set, `data` is `undefined` and vice versa.
|
|
282
303
|
- **Switch on `error.code`, not `error.error`.** The message may change; the code is stable.
|
|
283
|
-
- **List endpoints
|
|
304
|
+
- **List endpoints return a paginated envelope**, `{ total, limit, offset }` plus a named array (`cities`, `crystals`, `hexagrams`, `symbols`), never a bare array. Pass `query: { limit }` to widen a page; `listHexagrams` defaults to 20 of 64.
|
|
284
305
|
|
|
285
306
|
## Links
|
|
286
307
|
|