@firmenakte/api-client 2.9.0 → 2.11.9
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 +35 -0
- package/client.d.ts +460 -122
- package/client.d.ts.map +1 -1
- package/client.js +119 -53
- package/index.d.ts +17 -4
- package/index.d.ts.map +1 -1
- package/index.js +10 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,12 +22,47 @@ import { createApiClient } from "@firmenakte/api-client";
|
|
|
22
22
|
const api = createApiClient({
|
|
23
23
|
apiKey: "your-api-key",
|
|
24
24
|
baseUrl: "https://api.firmenakte.at", // optional, defaults to production
|
|
25
|
+
timeoutMs: 10_000, // optional, defaults to 10 seconds
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
// Use the API, e.g. list businesses
|
|
28
29
|
const { data } = await api.v1BusinessesList();
|
|
29
30
|
```
|
|
30
31
|
|
|
32
|
+
The timeout starts separately for every request and also covers reading its response body. Pass an
|
|
33
|
+
`AbortSignal` in an endpoint's request parameters when the caller needs to cancel sooner:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
const controller = new AbortController();
|
|
37
|
+
const request = api.v1BusinessesList(undefined, { signal: controller.signal });
|
|
38
|
+
controller.abort();
|
|
39
|
+
await request;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Credits and rate limits
|
|
43
|
+
|
|
44
|
+
API calls use your account's weekly credits, shared across all its keys. Free includes 50,
|
|
45
|
+
Starter 500, Business 5,000, and Enterprise an agreed allowance. It resets on Monday at
|
|
46
|
+
00:00 UTC. Purchased credits never expire and pay for calls the weekly allowance cannot cover.
|
|
47
|
+
See [credit pricing](https://firmenakte.at/preise/credits).
|
|
48
|
+
|
|
49
|
+
Operations declare `x-credit-class` in the OpenAPI spec: `basic` costs 1 credit and
|
|
50
|
+
`expensive` costs 3. Charged responses include `X-Credits-Charged` and `X-Credits-Remaining`.
|
|
51
|
+
The client exposes these on the response's `headers`:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
const response = await api.v1BusinessesList();
|
|
55
|
+
const charged = response.headers.get("X-Credits-Charged");
|
|
56
|
+
const remaining = response.headers.get("X-Credits-Remaining");
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Endpoint responses cost credits even for `400` or `404`. Authentication failures, `401`,
|
|
60
|
+
requests rejected with `429`, and server errors, `5xx`, cost no credits.
|
|
61
|
+
Credit exhaustion returns `429`, an `error` message starting with `Credits aufgebraucht`,
|
|
62
|
+
and `Retry-After` in seconds until Monday 00:00 UTC. The separate burst limit returns
|
|
63
|
+
`Retry-After: 60`. A longer wait means credit exhaustion; near Monday, check the error
|
|
64
|
+
message because the reset can be 60 seconds or less away.
|
|
65
|
+
|
|
31
66
|
## Documentation
|
|
32
67
|
|
|
33
68
|
Full API reference, authentication, and guides: **[https://docs.firmenakte.at](https://docs.firmenakte.at)**
|