nuki-api-js 1.0.0 → 1.1.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 +68 -0
- package/dist/components-eiu9qz9x.js +2351 -0
- package/dist/components-iddduu87.cjs +2458 -0
- package/dist/components.cjs +108 -2454
- package/dist/components.d.mts +249 -1973
- package/dist/components.d.mts.map +1 -1
- package/dist/components.mjs +1 -2351
- package/dist/effect.cjs +3 -2138
- package/dist/effect.d.mts +1 -3009
- package/dist/effect.d.mts.map +1 -1
- package/dist/effect.mjs +1 -2136
- package/dist/index.cjs +875 -6000
- package/dist/index.d.ts +40093 -10446
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +5 -5210
- package/dist/schemas-e6jr28te.js +2739 -0
- package/dist/schemas-ihzqrsub.cjs +3592 -0
- package/dist/schemas.cjs +835 -3414
- package/dist/schemas.d.mts +37140 -3776
- package/dist/schemas.d.mts.map +1 -1
- package/dist/schemas.mjs +1 -2665
- package/dist/types.cjs +3 -5
- package/dist/types.d.mts +2750 -6462
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +3 -5
- package/package.json +10 -11
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# nuki-api-js
|
|
2
|
+
|
|
3
|
+
Auto-generated, fully typed client for the [Nuki Web API](https://api.nuki.io/).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Fully typed** - every operation, parameter and response is generated from the official OpenAPI spec
|
|
8
|
+
- **Tree-shakable** - only the operations you import end up in your bundle
|
|
9
|
+
- **Runtime agnostic** - uses the global `fetch`, or bring your own implementation
|
|
10
|
+
- **Effect support** - optional [Effect](https://effect.website) bindings via `nuki-api-js/effect`
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install nuki-api-js
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { NukiApi } from "nuki-api-js";
|
|
22
|
+
|
|
23
|
+
const client = new NukiApi({ token: process.env.NUKI_TOKEN ?? null });
|
|
24
|
+
|
|
25
|
+
const accounts = await client.api.account.getAccountsResource({});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Operations are grouped by tag: `client.api.<tag>.<operation>(params)`.
|
|
29
|
+
|
|
30
|
+
### Custom fetch
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
const client = new NukiApi({
|
|
34
|
+
token: process.env.NUKI_TOKEN ?? null,
|
|
35
|
+
fetch: myFetchImplementation,
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Effect
|
|
40
|
+
|
|
41
|
+
The `effect` entrypoint exposes every operation as an `Effect`. It requires `effect` as a peer dependency.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { Effect } from "effect";
|
|
45
|
+
import { ApiService, makeApiLayer } from "nuki-api-js/effect";
|
|
46
|
+
|
|
47
|
+
const program = ApiService.account.getAccountsResource({});
|
|
48
|
+
|
|
49
|
+
await Effect.runPromise(
|
|
50
|
+
program.pipe(Effect.provide(makeApiLayer({ token: process.env.NUKI_TOKEN })))
|
|
51
|
+
);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Errors are typed as `ApiError`, `NetworkError` and `ValidationError`.
|
|
55
|
+
|
|
56
|
+
## Entrypoints
|
|
57
|
+
|
|
58
|
+
| Import | Contents |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| `nuki-api-js` | client class, operations, schemas and types |
|
|
61
|
+
| `nuki-api-js/components` | operations grouped by tag and by path |
|
|
62
|
+
| `nuki-api-js/schemas` | Zod schemas for every operation |
|
|
63
|
+
| `nuki-api-js/types` | TypeScript types for every operation |
|
|
64
|
+
| `nuki-api-js/effect` | Effect bindings |
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
ISC
|