benji-sdk 0.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/LICENSE +21 -0
- package/README.md +185 -0
- package/dist/client/client/client.gen.d.ts +3 -0
- package/dist/client/client/client.gen.d.ts.map +1 -0
- package/dist/client/client/client.gen.js +229 -0
- package/dist/client/client/index.d.ts +9 -0
- package/dist/client/client/index.d.ts.map +1 -0
- package/dist/client/client/index.js +6 -0
- package/dist/client/client/types.gen.d.ts +118 -0
- package/dist/client/client/types.gen.d.ts.map +1 -0
- package/dist/client/client/types.gen.js +2 -0
- package/dist/client/client/utils.gen.d.ts +34 -0
- package/dist/client/client/utils.gen.d.ts.map +1 -0
- package/dist/client/client/utils.gen.js +233 -0
- package/dist/client/client.gen.d.ts +13 -0
- package/dist/client/client.gen.d.ts.map +1 -0
- package/dist/client/client.gen.js +3 -0
- package/dist/client/core/auth.gen.d.ts +19 -0
- package/dist/client/core/auth.gen.d.ts.map +1 -0
- package/dist/client/core/auth.gen.js +14 -0
- package/dist/client/core/bodySerializer.gen.d.ts +26 -0
- package/dist/client/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/client/core/bodySerializer.gen.js +57 -0
- package/dist/client/core/params.gen.d.ts +44 -0
- package/dist/client/core/params.gen.d.ts.map +1 -0
- package/dist/client/core/params.gen.js +100 -0
- package/dist/client/core/pathSerializer.gen.d.ts +34 -0
- package/dist/client/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/client/core/pathSerializer.gen.js +114 -0
- package/dist/client/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/client/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/client/core/queryKeySerializer.gen.js +99 -0
- package/dist/client/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/client/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/client/core/serverSentEvents.gen.js +137 -0
- package/dist/client/core/types.gen.d.ts +79 -0
- package/dist/client/core/types.gen.d.ts.map +1 -0
- package/dist/client/core/types.gen.js +2 -0
- package/dist/client/core/utils.gen.d.ts +20 -0
- package/dist/client/core/utils.gen.d.ts.map +1 -0
- package/dist/client/core/utils.gen.js +87 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +2 -0
- package/dist/client/sdk.gen.d.ts +908 -0
- package/dist/client/sdk.gen.d.ts.map +1 -0
- package/dist/client/sdk.gen.js +2232 -0
- package/dist/client/types.gen.d.ts +11857 -0
- package/dist/client/types.gen.d.ts.map +1 -0
- package/dist/client/types.gen.js +2 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Kitze
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Benji SDK
|
|
2
|
+
|
|
3
|
+
Official TypeScript SDK for the [Benji](https://benji.so) API - Your personal life operating system.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install benji-sdk
|
|
9
|
+
# or
|
|
10
|
+
pnpm add benji-sdk
|
|
11
|
+
# or
|
|
12
|
+
yarn add benji-sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { configure, Todos, Habits } from "benji-sdk";
|
|
19
|
+
|
|
20
|
+
// Configure with your API key
|
|
21
|
+
configure({ apiKey: "your-api-key" });
|
|
22
|
+
|
|
23
|
+
// List today's todos
|
|
24
|
+
const { data } = await Todos.todosList({
|
|
25
|
+
body: { screen: "today" }
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
console.log(data.todos);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Getting Your API Key
|
|
32
|
+
|
|
33
|
+
1. Log in to [Benji](https://app.benji.so)
|
|
34
|
+
2. Go to Settings > API
|
|
35
|
+
3. Generate a new API key
|
|
36
|
+
|
|
37
|
+
## Available Modules
|
|
38
|
+
|
|
39
|
+
| Module | Description |
|
|
40
|
+
|--------|-------------|
|
|
41
|
+
| `Todos` | Create, list, update, and manage todos |
|
|
42
|
+
| `Habits` | Track daily habits |
|
|
43
|
+
| `Mood` | Log and retrieve mood entries |
|
|
44
|
+
| `Journal` | Create and manage journal entries |
|
|
45
|
+
| `Hydration` | Track water intake |
|
|
46
|
+
| `Fasting` | Manage fasting windows |
|
|
47
|
+
| `Workouts` | Log workouts and exercises |
|
|
48
|
+
| `Projects` | Organize todos into projects |
|
|
49
|
+
| `Tags` | Categorize items with tags |
|
|
50
|
+
| `Trips` | Plan and track travel |
|
|
51
|
+
| `PainEvents` | Log pain events for health tracking |
|
|
52
|
+
|
|
53
|
+
## Examples
|
|
54
|
+
|
|
55
|
+
### Todos
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { configure, Todos } from "benji-sdk";
|
|
59
|
+
|
|
60
|
+
configure({ apiKey: "your-api-key" });
|
|
61
|
+
|
|
62
|
+
// Create a todo
|
|
63
|
+
await Todos.todosCreate({
|
|
64
|
+
body: {
|
|
65
|
+
title: "Buy groceries",
|
|
66
|
+
priority: "high",
|
|
67
|
+
dueDate: "2024-12-25"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// List todos for today
|
|
72
|
+
const { data } = await Todos.todosList({
|
|
73
|
+
body: { screen: "today" }
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Mark as complete
|
|
77
|
+
await Todos.todosToggle({
|
|
78
|
+
body: { id: "todo-id" }
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Delete a todo
|
|
82
|
+
await Todos.todosDelete({
|
|
83
|
+
body: { id: "todo-id" }
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Habits
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { configure, Habits } from "benji-sdk";
|
|
91
|
+
|
|
92
|
+
configure({ apiKey: "your-api-key" });
|
|
93
|
+
|
|
94
|
+
// Create a habit
|
|
95
|
+
await Habits.habitsCreate({
|
|
96
|
+
body: {
|
|
97
|
+
name: "Drink 8 glasses of water",
|
|
98
|
+
emoji: "💧"
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// List all habits
|
|
103
|
+
const { data } = await Habits.habitsList();
|
|
104
|
+
|
|
105
|
+
// Toggle habit completion for today
|
|
106
|
+
await Habits.habitsToggle({
|
|
107
|
+
body: { id: "habit-id" }
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Mood Tracking
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { configure, Mood } from "benji-sdk";
|
|
115
|
+
|
|
116
|
+
configure({ apiKey: "your-api-key" });
|
|
117
|
+
|
|
118
|
+
// Log your mood
|
|
119
|
+
await Mood.moodCreate({
|
|
120
|
+
body: {
|
|
121
|
+
level: 4, // 1-5 scale
|
|
122
|
+
notes: "Feeling great today!"
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Get mood logs
|
|
127
|
+
const { data } = await Mood.moodList();
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Journal
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { configure, Journal } from "benji-sdk";
|
|
134
|
+
|
|
135
|
+
configure({ apiKey: "your-api-key" });
|
|
136
|
+
|
|
137
|
+
// Create a journal entry
|
|
138
|
+
await Journal.journalCreate({
|
|
139
|
+
body: {
|
|
140
|
+
content: "Today was a productive day...",
|
|
141
|
+
title: "Daily Reflection"
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Custom Base URL
|
|
147
|
+
|
|
148
|
+
For self-hosted instances or development:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
configure({
|
|
152
|
+
apiKey: "your-api-key",
|
|
153
|
+
baseUrl: "https://your-instance.com/api/rest"
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## TypeScript Support
|
|
158
|
+
|
|
159
|
+
This SDK is written in TypeScript and provides full type definitions for all API endpoints, request bodies, and responses.
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import type { TodosListResponse, HabitsCreateData } from "benji-sdk";
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Error Handling
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
import { Todos } from "benji-sdk";
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
const { data, error, response } = await Todos.todosGet({
|
|
172
|
+
body: { id: "invalid-id" }
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
if (error) {
|
|
176
|
+
console.error("API Error:", error.message);
|
|
177
|
+
}
|
|
178
|
+
} catch (err) {
|
|
179
|
+
console.error("Network error:", err);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.gen.d.ts","sourceRoot":"","sources":["../../../src/client/client/client.gen.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EAGP,MAAM,aAAa,CAAC;AAgBrB,eAAO,MAAM,YAAY,GAAI,SAAQ,MAAW,KAAG,MAsRlD,CAAC"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import { createSseClient } from '../core/serverSentEvents.gen';
|
|
3
|
+
import { getValidRequestBody } from '../core/utils.gen';
|
|
4
|
+
import { buildUrl, createConfig, createInterceptors, getParseAs, mergeConfigs, mergeHeaders, setAuthParams, } from './utils.gen';
|
|
5
|
+
export const createClient = (config = {}) => {
|
|
6
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
7
|
+
const getConfig = () => ({ ..._config });
|
|
8
|
+
const setConfig = (config) => {
|
|
9
|
+
_config = mergeConfigs(_config, config);
|
|
10
|
+
return getConfig();
|
|
11
|
+
};
|
|
12
|
+
const interceptors = createInterceptors();
|
|
13
|
+
const beforeRequest = async (options) => {
|
|
14
|
+
const opts = {
|
|
15
|
+
..._config,
|
|
16
|
+
...options,
|
|
17
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
18
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
19
|
+
serializedBody: undefined,
|
|
20
|
+
};
|
|
21
|
+
if (opts.security) {
|
|
22
|
+
await setAuthParams({
|
|
23
|
+
...opts,
|
|
24
|
+
security: opts.security,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (opts.requestValidator) {
|
|
28
|
+
await opts.requestValidator(opts);
|
|
29
|
+
}
|
|
30
|
+
if (opts.body !== undefined && opts.bodySerializer) {
|
|
31
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
32
|
+
}
|
|
33
|
+
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
34
|
+
if (opts.body === undefined || opts.serializedBody === '') {
|
|
35
|
+
opts.headers.delete('Content-Type');
|
|
36
|
+
}
|
|
37
|
+
const url = buildUrl(opts);
|
|
38
|
+
return { opts, url };
|
|
39
|
+
};
|
|
40
|
+
const request = async (options) => {
|
|
41
|
+
// @ts-expect-error
|
|
42
|
+
const { opts, url } = await beforeRequest(options);
|
|
43
|
+
const requestInit = {
|
|
44
|
+
redirect: 'follow',
|
|
45
|
+
...opts,
|
|
46
|
+
body: getValidRequestBody(opts),
|
|
47
|
+
};
|
|
48
|
+
let request = new Request(url, requestInit);
|
|
49
|
+
for (const fn of interceptors.request.fns) {
|
|
50
|
+
if (fn) {
|
|
51
|
+
request = await fn(request, opts);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// fetch must be assigned here, otherwise it would throw the error:
|
|
55
|
+
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
56
|
+
const _fetch = opts.fetch;
|
|
57
|
+
let response;
|
|
58
|
+
try {
|
|
59
|
+
response = await _fetch(request);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
// Handle fetch exceptions (AbortError, network errors, etc.)
|
|
63
|
+
let finalError = error;
|
|
64
|
+
for (const fn of interceptors.error.fns) {
|
|
65
|
+
if (fn) {
|
|
66
|
+
finalError = (await fn(error, undefined, request, opts));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
finalError = finalError || {};
|
|
70
|
+
if (opts.throwOnError) {
|
|
71
|
+
throw finalError;
|
|
72
|
+
}
|
|
73
|
+
// Return error response
|
|
74
|
+
return opts.responseStyle === 'data'
|
|
75
|
+
? undefined
|
|
76
|
+
: {
|
|
77
|
+
error: finalError,
|
|
78
|
+
request,
|
|
79
|
+
response: undefined,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
for (const fn of interceptors.response.fns) {
|
|
83
|
+
if (fn) {
|
|
84
|
+
response = await fn(response, request, opts);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const result = {
|
|
88
|
+
request,
|
|
89
|
+
response,
|
|
90
|
+
};
|
|
91
|
+
if (response.ok) {
|
|
92
|
+
const parseAs = (opts.parseAs === 'auto'
|
|
93
|
+
? getParseAs(response.headers.get('Content-Type'))
|
|
94
|
+
: opts.parseAs) ?? 'json';
|
|
95
|
+
if (response.status === 204 ||
|
|
96
|
+
response.headers.get('Content-Length') === '0') {
|
|
97
|
+
let emptyData;
|
|
98
|
+
switch (parseAs) {
|
|
99
|
+
case 'arrayBuffer':
|
|
100
|
+
case 'blob':
|
|
101
|
+
case 'text':
|
|
102
|
+
emptyData = await response[parseAs]();
|
|
103
|
+
break;
|
|
104
|
+
case 'formData':
|
|
105
|
+
emptyData = new FormData();
|
|
106
|
+
break;
|
|
107
|
+
case 'stream':
|
|
108
|
+
emptyData = response.body;
|
|
109
|
+
break;
|
|
110
|
+
case 'json':
|
|
111
|
+
default:
|
|
112
|
+
emptyData = {};
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
return opts.responseStyle === 'data'
|
|
116
|
+
? emptyData
|
|
117
|
+
: {
|
|
118
|
+
data: emptyData,
|
|
119
|
+
...result,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
let data;
|
|
123
|
+
switch (parseAs) {
|
|
124
|
+
case 'arrayBuffer':
|
|
125
|
+
case 'blob':
|
|
126
|
+
case 'formData':
|
|
127
|
+
case 'json':
|
|
128
|
+
case 'text':
|
|
129
|
+
data = await response[parseAs]();
|
|
130
|
+
break;
|
|
131
|
+
case 'stream':
|
|
132
|
+
return opts.responseStyle === 'data'
|
|
133
|
+
? response.body
|
|
134
|
+
: {
|
|
135
|
+
data: response.body,
|
|
136
|
+
...result,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (parseAs === 'json') {
|
|
140
|
+
if (opts.responseValidator) {
|
|
141
|
+
await opts.responseValidator(data);
|
|
142
|
+
}
|
|
143
|
+
if (opts.responseTransformer) {
|
|
144
|
+
data = await opts.responseTransformer(data);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return opts.responseStyle === 'data'
|
|
148
|
+
? data
|
|
149
|
+
: {
|
|
150
|
+
data,
|
|
151
|
+
...result,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const textError = await response.text();
|
|
155
|
+
let jsonError;
|
|
156
|
+
try {
|
|
157
|
+
jsonError = JSON.parse(textError);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// noop
|
|
161
|
+
}
|
|
162
|
+
const error = jsonError ?? textError;
|
|
163
|
+
let finalError = error;
|
|
164
|
+
for (const fn of interceptors.error.fns) {
|
|
165
|
+
if (fn) {
|
|
166
|
+
finalError = (await fn(error, response, request, opts));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
finalError = finalError || {};
|
|
170
|
+
if (opts.throwOnError) {
|
|
171
|
+
throw finalError;
|
|
172
|
+
}
|
|
173
|
+
// TODO: we probably want to return error and improve types
|
|
174
|
+
return opts.responseStyle === 'data'
|
|
175
|
+
? undefined
|
|
176
|
+
: {
|
|
177
|
+
error: finalError,
|
|
178
|
+
...result,
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
182
|
+
const makeSseFn = (method) => async (options) => {
|
|
183
|
+
const { opts, url } = await beforeRequest(options);
|
|
184
|
+
return createSseClient({
|
|
185
|
+
...opts,
|
|
186
|
+
body: opts.body,
|
|
187
|
+
headers: opts.headers,
|
|
188
|
+
method,
|
|
189
|
+
onRequest: async (url, init) => {
|
|
190
|
+
let request = new Request(url, init);
|
|
191
|
+
for (const fn of interceptors.request.fns) {
|
|
192
|
+
if (fn) {
|
|
193
|
+
request = await fn(request, opts);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return request;
|
|
197
|
+
},
|
|
198
|
+
serializedBody: getValidRequestBody(opts),
|
|
199
|
+
url,
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
return {
|
|
203
|
+
buildUrl,
|
|
204
|
+
connect: makeMethodFn('CONNECT'),
|
|
205
|
+
delete: makeMethodFn('DELETE'),
|
|
206
|
+
get: makeMethodFn('GET'),
|
|
207
|
+
getConfig,
|
|
208
|
+
head: makeMethodFn('HEAD'),
|
|
209
|
+
interceptors,
|
|
210
|
+
options: makeMethodFn('OPTIONS'),
|
|
211
|
+
patch: makeMethodFn('PATCH'),
|
|
212
|
+
post: makeMethodFn('POST'),
|
|
213
|
+
put: makeMethodFn('PUT'),
|
|
214
|
+
request,
|
|
215
|
+
setConfig,
|
|
216
|
+
sse: {
|
|
217
|
+
connect: makeSseFn('CONNECT'),
|
|
218
|
+
delete: makeSseFn('DELETE'),
|
|
219
|
+
get: makeSseFn('GET'),
|
|
220
|
+
head: makeSseFn('HEAD'),
|
|
221
|
+
options: makeSseFn('OPTIONS'),
|
|
222
|
+
patch: makeSseFn('PATCH'),
|
|
223
|
+
post: makeSseFn('POST'),
|
|
224
|
+
put: makeSseFn('PUT'),
|
|
225
|
+
trace: makeSseFn('TRACE'),
|
|
226
|
+
},
|
|
227
|
+
trace: makeMethodFn('TRACE'),
|
|
228
|
+
};
|
|
229
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { Auth } from '../core/auth.gen';
|
|
2
|
+
export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
|
3
|
+
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
|
|
4
|
+
export { buildClientParams } from '../core/params.gen';
|
|
5
|
+
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
|
|
6
|
+
export { createClient } from './client.gen';
|
|
7
|
+
export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from './types.gen';
|
|
8
|
+
export { createConfig, mergeHeaders } from './utils.gen';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/client/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EACV,MAAM,EACN,aAAa,EACb,MAAM,EACN,kBAAkB,EAClB,OAAO,EACP,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,aAAa,EACb,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
|
|
3
|
+
export { buildClientParams } from '../core/params.gen';
|
|
4
|
+
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
|
|
5
|
+
export { createClient } from './client.gen';
|
|
6
|
+
export { createConfig, mergeHeaders } from './utils.gen';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Auth } from '../core/auth.gen';
|
|
2
|
+
import type { ServerSentEventsOptions, ServerSentEventsResult } from '../core/serverSentEvents.gen';
|
|
3
|
+
import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen';
|
|
4
|
+
import type { Middleware } from './utils.gen';
|
|
5
|
+
export type ResponseStyle = 'data' | 'fields';
|
|
6
|
+
export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, CoreConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Base URL for all requests made by this client.
|
|
9
|
+
*/
|
|
10
|
+
baseUrl?: T['baseUrl'];
|
|
11
|
+
/**
|
|
12
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
13
|
+
* fetch instance.
|
|
14
|
+
*
|
|
15
|
+
* @default globalThis.fetch
|
|
16
|
+
*/
|
|
17
|
+
fetch?: typeof fetch;
|
|
18
|
+
/**
|
|
19
|
+
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
20
|
+
* options won't have any effect.
|
|
21
|
+
*
|
|
22
|
+
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
23
|
+
*/
|
|
24
|
+
next?: never;
|
|
25
|
+
/**
|
|
26
|
+
* Return the response data parsed in a specified format. By default, `auto`
|
|
27
|
+
* will infer the appropriate method from the `Content-Type` response header.
|
|
28
|
+
* You can override this behavior with any of the {@link Body} methods.
|
|
29
|
+
* Select `stream` if you don't want to parse response data at all.
|
|
30
|
+
*
|
|
31
|
+
* @default 'auto'
|
|
32
|
+
*/
|
|
33
|
+
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
34
|
+
/**
|
|
35
|
+
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
36
|
+
*
|
|
37
|
+
* @default 'fields'
|
|
38
|
+
*/
|
|
39
|
+
responseStyle?: ResponseStyle;
|
|
40
|
+
/**
|
|
41
|
+
* Throw an error instead of returning it in the response?
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
throwOnError?: T['throwOnError'];
|
|
46
|
+
}
|
|
47
|
+
export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
48
|
+
responseStyle: TResponseStyle;
|
|
49
|
+
throwOnError: ThrowOnError;
|
|
50
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
51
|
+
/**
|
|
52
|
+
* Any body that you want to add to your request.
|
|
53
|
+
*
|
|
54
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
55
|
+
*/
|
|
56
|
+
body?: unknown;
|
|
57
|
+
path?: Record<string, unknown>;
|
|
58
|
+
query?: Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Security mechanism(s) to use for the request.
|
|
61
|
+
*/
|
|
62
|
+
security?: ReadonlyArray<Auth>;
|
|
63
|
+
url: Url;
|
|
64
|
+
}
|
|
65
|
+
export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
66
|
+
serializedBody?: string;
|
|
67
|
+
}
|
|
68
|
+
export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
|
|
69
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
70
|
+
request: Request;
|
|
71
|
+
response: Response;
|
|
72
|
+
}> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
73
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
74
|
+
error: undefined;
|
|
75
|
+
} | {
|
|
76
|
+
data: undefined;
|
|
77
|
+
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
78
|
+
}) & {
|
|
79
|
+
request: Request;
|
|
80
|
+
response: Response;
|
|
81
|
+
}>;
|
|
82
|
+
export interface ClientOptions {
|
|
83
|
+
baseUrl?: string;
|
|
84
|
+
responseStyle?: ResponseStyle;
|
|
85
|
+
throwOnError?: boolean;
|
|
86
|
+
}
|
|
87
|
+
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
88
|
+
type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
89
|
+
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
90
|
+
type BuildUrlFn = <TData extends {
|
|
91
|
+
body?: unknown;
|
|
92
|
+
path?: Record<string, unknown>;
|
|
93
|
+
query?: Record<string, unknown>;
|
|
94
|
+
url: string;
|
|
95
|
+
}>(options: TData & Options<TData>) => string;
|
|
96
|
+
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
97
|
+
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* The `createClientConfig()` function will be called on client initialization
|
|
101
|
+
* and the returned object will become the client's initial configuration.
|
|
102
|
+
*
|
|
103
|
+
* You may want to initialize your client this way instead of calling
|
|
104
|
+
* `setConfig()`. This is useful for example if you're using Next.js
|
|
105
|
+
* to ensure your client always has the correct values.
|
|
106
|
+
*/
|
|
107
|
+
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
|
|
108
|
+
export interface TDataShape {
|
|
109
|
+
body?: unknown;
|
|
110
|
+
headers?: unknown;
|
|
111
|
+
path?: unknown;
|
|
112
|
+
query?: unknown;
|
|
113
|
+
url: string;
|
|
114
|
+
}
|
|
115
|
+
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
116
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
117
|
+
export {};
|
|
118
|
+
//# sourceMappingURL=types.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.gen.d.ts","sourceRoot":"","sources":["../../../src/client/client/types.gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,MAAM,IAAI,UAAU,EACpB,MAAM,IAAI,UAAU,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,aAAa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AAG,OAAO,EACtC,SAAS,GAAG,OAAO,EACnB,cAAc,SAAS,aAAa,GAAG,QAAQ,IAC7C,QAAQ,CACV,cAAc,CAAC,SAAS,EAAE,cAAc,EAAE,YAAY,CAAC,EACvD,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAClC,GACC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
|
2
|
+
import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
|
|
3
|
+
export declare const createQuerySerializer: <T = unknown>({ parameters, ...args }?: QuerySerializerOptions) => (queryParams: T) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Infers parseAs value from provided Content-Type header.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getParseAs: (contentType: string | null) => Exclude<Config["parseAs"], "auto">;
|
|
8
|
+
export declare const setAuthParams: ({ security, ...options }: Pick<Required<RequestOptions>, "security"> & Pick<RequestOptions, "auth" | "query"> & {
|
|
9
|
+
headers: Headers;
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
export declare const buildUrl: Client['buildUrl'];
|
|
12
|
+
export declare const mergeConfigs: (a: Config, b: Config) => Config;
|
|
13
|
+
export declare const mergeHeaders: (...headers: Array<Required<Config>["headers"] | undefined>) => Headers;
|
|
14
|
+
type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
|
|
15
|
+
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
16
|
+
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
17
|
+
declare class Interceptors<Interceptor> {
|
|
18
|
+
fns: Array<Interceptor | null>;
|
|
19
|
+
clear(): void;
|
|
20
|
+
eject(id: number | Interceptor): void;
|
|
21
|
+
exists(id: number | Interceptor): boolean;
|
|
22
|
+
getInterceptorIndex(id: number | Interceptor): number;
|
|
23
|
+
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
24
|
+
use(fn: Interceptor): number;
|
|
25
|
+
}
|
|
26
|
+
export interface Middleware<Req, Res, Err, Options> {
|
|
27
|
+
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
|
28
|
+
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
29
|
+
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
30
|
+
}
|
|
31
|
+
export declare const createInterceptors: <Req, Res, Err, Options>() => Middleware<Req, Res, Err, Options>;
|
|
32
|
+
export declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=utils.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.gen.d.ts","sourceRoot":"","sources":["../../../src/client/client/utils.gen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAQzE,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEjF,eAAO,MAAM,qBAAqB,GAAI,CAAC,GAAG,OAAO,EAAE,0BAGhD,sBAA2B,mBACU,CAAC,WA6CxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GACrB,aAAa,MAAM,GAAG,IAAI,KACzB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,CAqCnC,CAAC;AAqBF,eAAO,MAAM,aAAa,GAAU,0BAGjC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAC3C,IAAI,CAAC,cAA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