@roxyapi/sdk 1.0.1 → 1.1.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/AGENTS.md ADDED
@@ -0,0 +1,151 @@
1
+ # @roxyapi/sdk — Agent Guide
2
+
3
+ TypeScript SDK for RoxyAPI. Multi-domain spiritual and metaphysical intelligence API. One API key, fully typed, zero runtime dependencies.
4
+
5
+ > Before writing any code with this SDK, read `docs/llms-full.txt` in this package for the complete method reference with examples.
6
+
7
+ ## Install and initialize
8
+
9
+ ```bash
10
+ npm install @roxyapi/sdk
11
+ ```
12
+
13
+ ```typescript
14
+ import { createRoxy } from '@roxyapi/sdk';
15
+
16
+ const roxy = createRoxy(process.env.ROXY_API_KEY!);
17
+ ```
18
+
19
+ `createRoxy` sets the base URL (`https://roxyapi.com/api/v2`) and auth header automatically. Every method returns `{ data, error, response }`.
20
+
21
+ ## Domains
22
+
23
+ Type `roxy.` to see all available namespaces. Type `roxy.{domain}.` to see every method in that domain.
24
+
25
+ | Namespace | What it covers |
26
+ |-----------|----------------|
27
+ | `roxy.astrology` | Western astrology: natal charts, horoscopes, synastry, moon phases, transits, compatibility |
28
+ | `roxy.vedicAstrology` | Vedic/Jyotish: birth charts, dashas, nakshatras, panchang, KP system, doshas, yogas |
29
+ | `roxy.tarot` | Rider-Waite-Smith deck: spreads, daily pulls, yes/no, Celtic Cross, custom layouts |
30
+ | `roxy.numerology` | Life path, expression, soul urge, personal year, karmic analysis, compatibility |
31
+ | `roxy.crystals` | Crystal healing properties, zodiac/chakra pairings, birthstones, search |
32
+ | `roxy.iching` | I Ching: hexagrams, trigrams, coin casting, daily readings |
33
+ | `roxy.angelNumbers` | Angel number meanings, pattern analysis, daily guidance |
34
+ | `roxy.dreams` | Dream symbol dictionary and interpretations |
35
+ | `roxy.location` | City geocoding for birth chart coordinates |
36
+ | `roxy.usage` | API usage stats and subscription info |
37
+
38
+ ## Critical patterns
39
+
40
+ ### GET endpoints — use `path` for URL parameters
41
+
42
+ ```typescript
43
+ const { data } = await roxy.astrology.getDailyHoroscope({
44
+ path: { sign: 'aries' },
45
+ });
46
+
47
+ const { data } = await roxy.crystals.getCrystal({
48
+ path: { slug: 'amethyst' },
49
+ });
50
+ ```
51
+
52
+ ### POST endpoints — use `body` for request data
53
+
54
+ Most valuable endpoints (charts, spreads, calculations) are POST:
55
+
56
+ ```typescript
57
+ // Birth chart — requires date, time, coordinates
58
+ const { data } = await roxy.astrology.generateNatalChart({
59
+ body: {
60
+ date: '1990-01-15',
61
+ time: '14:30:00',
62
+ latitude: 28.6139,
63
+ longitude: 77.209,
64
+ },
65
+ });
66
+
67
+ // Tarot spread
68
+ const { data } = await roxy.tarot.castCelticCross({
69
+ body: { question: 'What should I focus on?' },
70
+ });
71
+
72
+ // Numerology
73
+ const { data } = await roxy.numerology.calculateLifePath({
74
+ body: { year: 1990, month: 1, day: 15 },
75
+ });
76
+ ```
77
+
78
+ ### Query parameters
79
+
80
+ ```typescript
81
+ const { data } = await roxy.crystals.searchCrystals({
82
+ query: { q: 'amethyst' },
83
+ });
84
+ ```
85
+
86
+ ### Error handling
87
+
88
+ ```typescript
89
+ const { data, error, response } = await roxy.astrology.getDailyHoroscope({
90
+ path: { sign: 'aries' },
91
+ });
92
+
93
+ if (error) {
94
+ // error is { error: string } on 4xx/5xx
95
+ console.error('Status:', response?.status, 'Error:', error);
96
+ return;
97
+ }
98
+ // data is fully typed after error check
99
+ console.log(data.sign, data.overview);
100
+ ```
101
+
102
+ Common error codes: `401` invalid/missing API key, `403` subscription expired or limit reached, `429` rate limited, `404` resource not found.
103
+
104
+ ## Common tasks
105
+
106
+ | Task | Code |
107
+ |------|------|
108
+ | Daily horoscope | `roxy.astrology.getDailyHoroscope({ path: { sign } })` |
109
+ | Birth chart (Western) | `roxy.astrology.generateNatalChart({ body: { date, time, latitude, longitude } })` |
110
+ | Birth chart (Vedic) | `roxy.vedicAstrology.generateBirthChart({ body: { date, time, latitude, longitude } })` |
111
+ | Compatibility score | `roxy.astrology.calculateCompatibility({ body: { person1, person2 } })` |
112
+ | Tarot daily card | `roxy.tarot.getDailyCard({ body: { date } })` |
113
+ | Celtic Cross reading | `roxy.tarot.castCelticCross({ body: { question } })` |
114
+ | Life Path number | `roxy.numerology.calculateLifePath({ body: { year, month, day } })` |
115
+ | Full numerology chart | `roxy.numerology.generateNumerologyChart({ body: { date, name } })` |
116
+ | Crystal by zodiac | `roxy.crystals.getCrystalsByZodiac({ path: { sign } })` |
117
+ | I Ching reading | `roxy.iching.castReading()` |
118
+ | Angel number meaning | `roxy.angelNumbers.getAngelNumber({ path: { number: '1111' } })` |
119
+ | Dream symbol lookup | `roxy.dreams.getDreamSymbol({ path: { id: 'flying' } })` |
120
+ | Find city coordinates | `roxy.location.searchCities({ query: { q: 'Mumbai' } })` |
121
+ | Check API usage | `roxy.usage.getUsageStats()` |
122
+
123
+ ## Location helper
124
+
125
+ Most chart endpoints need `latitude` and `longitude`. Use the location API to geocode:
126
+
127
+ ```typescript
128
+ const { data: cities } = await roxy.location.searchCities({
129
+ query: { q: 'Mumbai, India' },
130
+ });
131
+ const city = cities[0];
132
+ // Use city.latitude and city.longitude in chart requests
133
+ ```
134
+
135
+ ## Gotchas
136
+
137
+ - **Parameters are objects, not positional.** Always `{ path: {...} }`, `{ body: {...} }`, or `{ query: {...} }` — never positional arguments.
138
+ - **Do not guess method names.** Type `roxy.domain.` and let autocomplete show available methods. Method names come from `operationId` in the OpenAPI spec, not URL paths.
139
+ - **Do not use raw `fetch`.** The SDK handles auth headers, base URL, and typed responses.
140
+ - **Do not expose API keys client-side.** Call Roxy from server code, API routes, or server components only.
141
+ - **Chart endpoints need coordinates.** Use `roxy.location.searchCities()` to get latitude/longitude before calling any birth chart or panchang method.
142
+ - **Date format is `YYYY-MM-DD`, time is `HH:MM:SS`.** Both are strings. Timezone is optional (IANA format like `America/New_York`).
143
+ - **All list endpoints may return paginated objects** (e.g. `{ items: [...], total: N }`) rather than raw arrays. Check the type.
144
+ - **`data` and `error` are mutually exclusive.** If `error` is set, `data` is `undefined` and vice versa.
145
+
146
+ ## Links
147
+
148
+ - Full method reference: `docs/llms-full.txt` (bundled in this package)
149
+ - Interactive API docs: https://roxyapi.com/api-reference
150
+ - Pricing and API keys: https://roxyapi.com/pricing
151
+ - MCP for AI agents: https://roxyapi.com/docs/mcp
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![API Reference](https://img.shields.io/badge/api%20reference-roxyapi.com-blue)](https://roxyapi.com/api-reference)
6
6
  [![Pricing](https://img.shields.io/badge/pricing-roxyapi.com-blue)](https://roxyapi.com/pricing)
7
7
 
8
- TypeScript SDK for [RoxyAPI](https://roxyapi.com). 8 domains, 120+ endpoints, one API key.
8
+ TypeScript SDK for [RoxyAPI](https://roxyapi.com). Multiple domains, fully typed endpoints, one API key.
9
9
 
10
10
  Build astrology apps, tarot platforms, birth chart generators, and compatibility tools without writing a single calculation.
11
11
 
@@ -107,7 +107,18 @@ if (error) {
107
107
 
108
108
  ## TypeScript
109
109
 
110
- Every request and response is fully typed. IDE autocomplete shows available methods per domain and exact parameter shapes:no docs tab needed.
110
+ Every request and response is fully typed. IDE autocomplete shows available methods per domain and exact parameter shapesno docs tab needed.
111
+
112
+ ## AI agents (Cursor, Claude Code, Copilot, Codex)
113
+
114
+ This package ships with bundled documentation that AI coding agents can read directly from `node_modules/`:
115
+
116
+ - **`AGENTS.md`** — Quick start, patterns, gotchas, and a common tasks reference table
117
+ - **`docs/llms-full.txt`** — Complete method reference with code examples for every domain
118
+
119
+ AI agents that support `AGENTS.md` (Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Gemini CLI) will read it automatically. For other tools, point your agent to `node_modules/@roxyapi/sdk/AGENTS.md`.
120
+
121
+ Also available: [MCP server](https://roxyapi.com/docs/mcp) for AI agents that support the Model Context Protocol.
111
122
 
112
123
  ## Links
113
124
 
package/dist/factory.cjs CHANGED
@@ -2673,8 +2673,8 @@ var Roxy = class _Roxy extends HeyApiClient {
2673
2673
  }
2674
2674
  };
2675
2675
 
2676
- // package.json
2677
- var version = "1.0.0";
2676
+ // src/version.ts
2677
+ var VERSION = "1.1.0";
2678
2678
 
2679
2679
  // src/factory.ts
2680
2680
  function createRoxy(auth) {
@@ -2683,7 +2683,7 @@ function createRoxy(auth) {
2683
2683
  baseUrl: "https://roxyapi.com/api/v2",
2684
2684
  auth,
2685
2685
  headers: {
2686
- "X-SDK-Client": `roxyapi-sdk-typescript/${version}`
2686
+ "X-SDK-Client": `roxy-sdk-typescript/${VERSION}`
2687
2687
  }
2688
2688
  })
2689
2689
  );
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,SAAS,CAAC;AAIxB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,KAAK,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAWhD"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,KAAK,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAWhD"}
package/dist/factory.js CHANGED
@@ -1839,8 +1839,8 @@ var Roxy = class _Roxy extends HeyApiClient {
1839
1839
  }
1840
1840
  };
1841
1841
 
1842
- // package.json
1843
- var version = "1.0.0";
1842
+ // src/version.ts
1843
+ var VERSION = "1.1.0";
1844
1844
 
1845
1845
  // src/factory.ts
1846
1846
  function createRoxy(auth) {
@@ -1849,7 +1849,7 @@ function createRoxy(auth) {
1849
1849
  baseUrl: "https://roxyapi.com/api/v2",
1850
1850
  auth,
1851
1851
  headers: {
1852
- "X-SDK-Client": `roxyapi-sdk-typescript/${version}`
1852
+ "X-SDK-Client": `roxy-sdk-typescript/${VERSION}`
1853
1853
  }
1854
1854
  })
1855
1855
  );
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "1.1.0";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}