@simpleapps-com/augur-api 2026.9.6 → 2026.10.1

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 CHANGED
@@ -8,6 +8,8 @@ TypeScript client library for Augur microservices.
8
8
  npm install @simpleapps-com/augur-api
9
9
  ```
10
10
 
11
+ **Pin the version.** Versions are CalVer (`YYYY.MM.PATCH`), and a month roll can carry breaking changes when the Augur API changes upstream, but npm treats `^2026.9.7` as accepting `2026.10.0`. Use an exact version or `~` (patch updates only), and read the [release notes](https://github.com/simpleapps-com/augur-api/releases) before moving to a new month.
12
+
11
13
  ## Quick Start
12
14
 
13
15
  ```typescript
@@ -139,6 +141,35 @@ try {
139
141
  }
140
142
  ```
141
143
 
144
+ The status decides the class: 400 → `ValidationError`, 401 → `AuthenticationError`, 404 → `NotFoundError`, 429 → `RateLimitError`, anything else → `AugurError`. `error.endpoint` is the path template (`/inv-mast/{invMastUid}`), and messages never contain parameter values.
145
+
146
+ ## Endpoint Registry and `call()`
147
+
148
+ `AugurAPI.endpoints()` lists every endpoint (id, method, path template, params). `call()` invokes one by id or alias id, with no typed method:
149
+
150
+ ```typescript
151
+ const result = await api.call('items.invMast.doc.get', {
152
+ pathParams: { invMastUid: 12345 },
153
+ query: { edgeCache: 1 },
154
+ });
155
+
156
+ result.httpStatus; // 200
157
+ result.envelope?.data; // set when the body is the standard 8-key envelope
158
+ result.body; // parsed JSON, or the raw text when the body isn't JSON
159
+ ```
160
+
161
+ - Arguments are checked before any request: path params must match exactly, query keys must be declared, and a body is allowed only on POST/PUT. Violations throw `InvalidArgumentError`.
162
+ - A 2xx always resolves; there is no schema validation. Use the typed methods when you want validated, typed responses.
163
+ - Non-2xx responses throw the same errors as the typed methods.
164
+
165
+ ## Path Values
166
+
167
+ Path values are sent unencoded, because the API does not decode path segments (`/bins/D%2FS` looks up the literal `D%2FS`). A string path value MUST use only letters, digits and `- . _ ~ ! $ & ' ( ) * + , ; = : @`. Anything else, such as `/`, `?`, `#`, `%`, spaces or non-ASCII, throws `InvalidArgumentError` before any request. Pass the raw value, never a pre-encoded one. Use the query parameter instead where there is one:
168
+
169
+ ```typescript
170
+ await api.call('items.locations.bins.list', { pathParams: { locationId: 100 }, query: { bin: 'D/S' } });
171
+ ```
172
+
142
173
  ## For AI Agents
143
174
 
144
175
  See [SKILL.md](./SKILL.md) for guidance on using this package with AI assistance.
package/SKILL.md CHANGED
@@ -110,9 +110,11 @@ Apply same pattern to any service:
110
110
 
111
111
  | Resource | URL Pattern | Use When |
112
112
  |----------|-------------|----------|
113
- | **llms.txt** | `https://{service}.augur-api.com/llms.txt` | Discover endpoints |
114
- | **endpoints.jsonl** | `https://{service}.augur-api.com/endpoints.jsonl` | Get parameters |
115
- | **openapi.json** | `https://{service}.augur-api.com/openapi.json` | Full schemas |
113
+ | **endpoints.jsonl** | `https://{service}.augur-api.com/endpoints.jsonl` | **Start here.** One JSON line per endpoint: method, path, path params and query params, each with type and required flag. Grep it for a path; for a GET that line is all you need. It has no request or response bodies |
114
+ | **openapi.json** | `https://{service}.augur-api.com/openapi.json` | Request and response bodies field by field, descriptions, formats, documented errors |
115
+ | **llms.txt** | `https://{service}.augur-api.com/llms.txt` | Plain-text endpoint list and the other Augur services |
116
+
117
+ The generated code carries the same information: every method's doc lists its summary, documented errors, path and query params, body and response fields with their meaning, and a link to its operation in `openapi.json`.
116
118
 
117
119
  **Central Reference:** https://augur-api.info
118
120
 
@@ -147,8 +149,8 @@ Every client also inherits `healthCheck`, `ping`, and `whoami` (each with a `…
147
149
 
148
150
  1. **Start** - `new AugurAPI({ siteId, bearerToken })`
149
151
  2. **Discover** - Fetch any `llms.txt`, find "Other Services"
150
- 3. **Find endpoints** - Fetch target service's `llms.txt`
151
- 4. **Get parameters** - Fetch `endpoints.jsonl` for method signatures
152
+ 3. **Find the endpoint and its params** - Grep the service's `endpoints.jsonl`; for a GET, that line is everything you need
153
+ 4. **Bodies** - For POST/PUT bodies and response fields, read the method's doc in `src/services/{service}/generated/types.ts` (or the `openapi.json` operation it links)
152
154
  5. **Convert to code** - Apply the path→property pattern
153
155
  6. **Verify** - Check `src/services/{service}/client.ts` if unsure
154
156
 
@@ -214,6 +216,21 @@ for (const faq of faqs) {
214
216
  }
215
217
  ```
216
218
 
219
+ ## Calling by Endpoint Id (`call()`)
220
+
221
+ For generic callers (tools, agents, scripts) that should not hard-code a typed method:
222
+
223
+ ```typescript
224
+ AugurAPI.endpoints(); // every endpoint: id, method, path template, pathParams, queryParams, hasBody
225
+ const result = await api.call('items.invMast.doc.get', { pathParams: { invMastUid: 12345 } });
226
+ result.envelope?.data; // null envelope means the body isn't the 8-key envelope; see result.body
227
+ ```
228
+
229
+ - Ids are `camelCase(service).chain.action`, the same as the typed call path.
230
+ - Arguments are checked before any request (`InvalidArgumentError`). A 2xx never fails validation.
231
+ - Errors: 400 → `ValidationError`, 401 → `AuthenticationError`, 404 → `NotFoundError`, 429 → `RateLimitError`, anything else → `AugurError`. `error.endpoint` is the path template.
232
+ - Path values are sent unencoded: a string path value with `/ ? # %`, spaces or non-ASCII is rejected. Use the query param instead (e.g. `bins.list` with `query: { bin: 'D/S' }`).
233
+
217
234
  ## Key Differences from Python Client
218
235
 
219
236
  | Aspect | TypeScript | Python |