@simpleapps-com/augur-api 2026.9.5 → 2026.9.7

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
@@ -139,6 +139,35 @@ try {
139
139
  }
140
140
  ```
141
141
 
142
+ 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.
143
+
144
+ ## Endpoint Registry and `call()`
145
+
146
+ `AugurAPI.endpoints()` lists every endpoint (id, method, path template, params). `call()` invokes one by id or alias id, with no typed method:
147
+
148
+ ```typescript
149
+ const result = await api.call('items.invMast.doc.get', {
150
+ pathParams: { invMastUid: 12345 },
151
+ query: { edgeCache: 1 },
152
+ });
153
+
154
+ result.httpStatus; // 200
155
+ result.envelope?.data; // set when the body is the standard 8-key envelope
156
+ result.body; // parsed JSON, or the raw text when the body isn't JSON
157
+ ```
158
+
159
+ - 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`.
160
+ - A 2xx always resolves; there is no schema validation. Use the typed methods when you want validated, typed responses.
161
+ - Non-2xx responses throw the same errors as the typed methods.
162
+
163
+ ## Path Values
164
+
165
+ 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:
166
+
167
+ ```typescript
168
+ await api.call('items.locations.bins.list', { pathParams: { locationId: 100 }, query: { bin: 'D/S' } });
169
+ ```
170
+
142
171
  ## For AI Agents
143
172
 
144
173
  See [SKILL.md](./SKILL.md) for guidance on using this package with AI assistance.
package/SKILL.md CHANGED
@@ -194,23 +194,41 @@ response.message // Status message
194
194
  response.status // HTTP status code
195
195
  ```
196
196
 
197
- ## Zod Schemas
197
+ ## Types and Validation
198
198
 
199
- All request params and response data use Zod schemas:
199
+ Request params and responses are validated with Valibot schemas. Types are exported per service as
200
+ a namespace (`{Service}Types`): params are `{Chain}{Action}Params`, request bodies
201
+ `{Chain}{Action}Body`, response data `{Chain}{Action}Data`.
200
202
 
201
203
  ```typescript
202
- import { InvMastListParams, InvMast } from '@simpleapps-com/augur-api';
204
+ import type { ItemsTypes } from '@simpleapps-com/augur-api';
203
205
 
204
206
  // Type-safe params
205
- const params: InvMastListParams = { limit: 10, offset: 0 };
206
- const response = await api.items.invMast.list(params);
207
+ const params: ItemsTypes.InvMastFaqListParams = { limit: 10, offset: 0 };
208
+ const response = await api.items.invMast.faq.list(invMastUid, params);
207
209
 
208
- // Type-safe response
209
- for (const item of response.data) {
210
- console.log(item.itemId); // IDE autocomplete works
210
+ // Type-safe response data
211
+ const faqs: ItemsTypes.InvMastFaqListData = response.data;
212
+ for (const faq of faqs) {
213
+ console.log(faq.question); // IDE autocomplete works
211
214
  }
212
215
  ```
213
216
 
217
+ ## Calling by Endpoint Id (`call()`)
218
+
219
+ For generic callers (tools, agents, scripts) that should not hard-code a typed method:
220
+
221
+ ```typescript
222
+ AugurAPI.endpoints(); // every endpoint: id, method, path template, pathParams, queryParams, hasBody
223
+ const result = await api.call('items.invMast.doc.get', { pathParams: { invMastUid: 12345 } });
224
+ result.envelope?.data; // null envelope means the body isn't the 8-key envelope; see result.body
225
+ ```
226
+
227
+ - Ids are `camelCase(service).chain.action`, the same as the typed call path.
228
+ - Arguments are checked before any request (`InvalidArgumentError`). A 2xx never fails validation.
229
+ - Errors: 400 → `ValidationError`, 401 → `AuthenticationError`, 404 → `NotFoundError`, 429 → `RateLimitError`, anything else → `AugurError`. `error.endpoint` is the path template.
230
+ - 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' }`).
231
+
214
232
  ## Key Differences from Python Client
215
233
 
216
234
  | Aspect | TypeScript | Python |
@@ -219,4 +237,4 @@ for (const item of response.data) {
219
237
  | Service: brand-folder | api.brandFolder | api.brand_folder |
220
238
  | Resource: inv-mast | .invMast | .inv_mast |
221
239
  | Method: invMastUid | invMastUid | inv_mast_uid |
222
- | Validation | Zod | Pydantic v2 |
240
+ | Validation | Valibot | Pydantic v2 |