@genvoris/node 1.0.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 +132 -0
- package/dist/index.d.mts +328 -0
- package/dist/index.d.ts +328 -0
- package/dist/index.js +384 -0
- package/dist/index.mjs +353 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Genvoris
|
|
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,132 @@
|
|
|
1
|
+
# @genvoris/node
|
|
2
|
+
|
|
3
|
+
Official Node.js SDK for the [Genvoris Virtual Try-On API](https://docs.genvoris.org).
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
Node.js **18** or higher (uses native `fetch`).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @genvoris/node
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import Genvoris from '@genvoris/node';
|
|
19
|
+
|
|
20
|
+
const gv = new Genvoris({ apiKey: process.env.GENVORIS_API_KEY! });
|
|
21
|
+
|
|
22
|
+
// Create a customer
|
|
23
|
+
const customer = await gv.customers.create({
|
|
24
|
+
externalId: 'user_42',
|
|
25
|
+
email: 'shopper@example.com',
|
|
26
|
+
planId: 'pln_xxxxxxxx',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Mint a session token for the widget
|
|
30
|
+
const session = await gv.sessions.mint({ customerId: customer.id });
|
|
31
|
+
// → pass session.token to your frontend
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Resources
|
|
35
|
+
|
|
36
|
+
### Customers
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
await gv.customers.create({ externalId, email?, planId?, metadata? })
|
|
40
|
+
await gv.customers.retrieve(id)
|
|
41
|
+
await gv.customers.update(id, { email?, planId?, status?, resetPeriod? })
|
|
42
|
+
await gv.customers.list({ status?, limit?, cursor? })
|
|
43
|
+
await gv.customers.cancel(id)
|
|
44
|
+
await gv.customers.usage(id)
|
|
45
|
+
await gv.customers.sessions(id)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Plans
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
await gv.plans.list({ include_inactive? })
|
|
52
|
+
await gv.plans.create({ name, monthlyTryOns, externalPriceId?, active? })
|
|
53
|
+
await gv.plans.retrieve(id)
|
|
54
|
+
await gv.plans.update(id, { name?, monthlyTryOns?, active? })
|
|
55
|
+
await gv.plans.archive(id)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Sessions
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
await gv.sessions.mint({ customerId, ttlSeconds? })
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Webhooks
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
await gv.webhooks.list()
|
|
68
|
+
await gv.webhooks.create({ url, secret, events })
|
|
69
|
+
await gv.webhooks.test(id)
|
|
70
|
+
await gv.webhooks.delete(id)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Webhook verification
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { WebhooksResource } from '@genvoris/node';
|
|
77
|
+
|
|
78
|
+
// In your Express / Next.js handler — pass the raw body, not parsed JSON
|
|
79
|
+
const event = WebhooksResource.verify({
|
|
80
|
+
payload: req.body,
|
|
81
|
+
header: req.header('x-genvoris-signature') ?? '',
|
|
82
|
+
secret: process.env.GENVORIS_WEBHOOK_SECRET!,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
console.log(event.type, event.data);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The signature format is `t=<unix>,v1=<hex>`. The signed string is `${timestamp}.${rawBody}` using HMAC-SHA256. Verification uses `crypto.timingSafeEqual`.
|
|
89
|
+
|
|
90
|
+
## Error handling
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import {
|
|
94
|
+
GenvorisAPIError,
|
|
95
|
+
GenvorisAuthError,
|
|
96
|
+
GenvorisRateLimitError,
|
|
97
|
+
GenvorisValidationError,
|
|
98
|
+
} from '@genvoris/node';
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
await gv.customers.retrieve('cus_missing');
|
|
102
|
+
} catch (err) {
|
|
103
|
+
if (err instanceof GenvorisAuthError) {
|
|
104
|
+
// 401 / 403 — bad or revoked key
|
|
105
|
+
} else if (err instanceof GenvorisRateLimitError) {
|
|
106
|
+
console.log(`retry after ${err.retryAfterSeconds}s`);
|
|
107
|
+
} else if (err instanceof GenvorisValidationError) {
|
|
108
|
+
console.error(err.fieldErrors);
|
|
109
|
+
} else if (err instanceof GenvorisAPIError) {
|
|
110
|
+
console.error(err.status, err.code, err.requestId);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The client automatically retries `429`, `502`, `503`, and `504` responses using exponential backoff with jitter (`min(2^n × 250 ms, 8 000 ms)`), up to `maxRetries` (default: 3).
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
const gv = new Genvoris({
|
|
121
|
+
apiKey: 'gvk_live_...',
|
|
122
|
+
baseUrl: 'https://genvoris.org/api/v1', // default
|
|
123
|
+
timeoutMs: 30_000, // default 30 s
|
|
124
|
+
maxRetries: 3, // default 3
|
|
125
|
+
defaultHeaders: { 'X-My-Header': 'val' },
|
|
126
|
+
fetch: customFetch, // bring-your-own fetch
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT — see [LICENSE](./LICENSE).
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
interface GenvorisConfig {
|
|
2
|
+
/** Your store API key — starts with `gvk_live_` */
|
|
3
|
+
apiKey: string;
|
|
4
|
+
/** Override the base URL. Default: `https://genvoris.org/api/v1` */
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
/** Request timeout in milliseconds. Default: 30 000 */
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
/** Maximum number of retries on 429/502/503/504. Default: 3 */
|
|
9
|
+
maxRetries?: number;
|
|
10
|
+
/** Additional headers to send on every request */
|
|
11
|
+
defaultHeaders?: Record<string, string>;
|
|
12
|
+
/** Custom fetch implementation. Default: `globalThis.fetch` */
|
|
13
|
+
fetch?: typeof globalThis.fetch;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface CustomerCreateParams {
|
|
17
|
+
/** Your stable external identifier. Re-POSTing with the same value upserts. */
|
|
18
|
+
externalId: string;
|
|
19
|
+
email?: string;
|
|
20
|
+
/** Plan to assign. No plan = every try-on returns 402. */
|
|
21
|
+
planId?: string;
|
|
22
|
+
/** Free-form metadata stored with the customer. */
|
|
23
|
+
metadata?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
interface CustomerUpdateParams {
|
|
26
|
+
email?: string | null;
|
|
27
|
+
/** Pass `null` to detach the plan. */
|
|
28
|
+
planId?: string | null;
|
|
29
|
+
status?: 'ACTIVE' | 'PAUSED' | 'CANCELLED';
|
|
30
|
+
metadata?: Record<string, unknown> | null;
|
|
31
|
+
/** When `true`, resets the period start to now and end to now + 30 days. */
|
|
32
|
+
resetPeriod?: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface CustomerListParams {
|
|
35
|
+
status?: 'ACTIVE' | 'PAUSED' | 'CANCELLED';
|
|
36
|
+
/** 1–200. Default: 50. */
|
|
37
|
+
limit?: number;
|
|
38
|
+
/** Pagination cursor from the previous page's `next_cursor`. */
|
|
39
|
+
cursor?: string;
|
|
40
|
+
}
|
|
41
|
+
interface Customer {
|
|
42
|
+
id: string;
|
|
43
|
+
externalId: string;
|
|
44
|
+
email?: string | null;
|
|
45
|
+
planId?: string | null;
|
|
46
|
+
status: 'ACTIVE' | 'PAUSED' | 'CANCELLED';
|
|
47
|
+
createdAt: string;
|
|
48
|
+
updatedAt: string;
|
|
49
|
+
metadata?: Record<string, unknown> | null;
|
|
50
|
+
}
|
|
51
|
+
interface CustomerList {
|
|
52
|
+
data: Customer[];
|
|
53
|
+
next_cursor?: string | null;
|
|
54
|
+
}
|
|
55
|
+
interface CustomerUsage {
|
|
56
|
+
data: {
|
|
57
|
+
customer_id: string;
|
|
58
|
+
external_id: string;
|
|
59
|
+
plan: {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
monthlyTryOns: number;
|
|
63
|
+
} | null;
|
|
64
|
+
status: string;
|
|
65
|
+
period_start: string;
|
|
66
|
+
period_end: string;
|
|
67
|
+
current: {
|
|
68
|
+
used: number;
|
|
69
|
+
limit: number;
|
|
70
|
+
remaining: number;
|
|
71
|
+
ok: boolean;
|
|
72
|
+
};
|
|
73
|
+
history: Array<{
|
|
74
|
+
period_start: string;
|
|
75
|
+
period_end: string;
|
|
76
|
+
used: number;
|
|
77
|
+
limit: number;
|
|
78
|
+
}>;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
interface CustomerSession {
|
|
82
|
+
token: string;
|
|
83
|
+
expires_at: string;
|
|
84
|
+
}
|
|
85
|
+
interface CustomerSessionList {
|
|
86
|
+
data: CustomerSession[];
|
|
87
|
+
}
|
|
88
|
+
declare class CustomersResource {
|
|
89
|
+
private readonly config;
|
|
90
|
+
constructor(config: GenvorisConfig);
|
|
91
|
+
/** Create or upsert an end-customer. */
|
|
92
|
+
create(params: CustomerCreateParams): Promise<Customer>;
|
|
93
|
+
/** Retrieve a single customer by their Genvoris `id`. */
|
|
94
|
+
retrieve(id: string): Promise<Customer>;
|
|
95
|
+
/** Update a customer's email, plan, status, or metadata. */
|
|
96
|
+
update(id: string, params: CustomerUpdateParams): Promise<Customer>;
|
|
97
|
+
/** List customers with optional status filter and cursor pagination. */
|
|
98
|
+
list(params?: CustomerListParams): Promise<CustomerList>;
|
|
99
|
+
/** Soft-cancel a customer. Future try-ons return 402 `cancelled`. */
|
|
100
|
+
cancel(id: string): Promise<void>;
|
|
101
|
+
/** Return the customer's current-period quota state and usage history. */
|
|
102
|
+
usage(id: string): Promise<CustomerUsage>;
|
|
103
|
+
/** List active widget sessions for this customer. */
|
|
104
|
+
sessions(id: string): Promise<CustomerSessionList>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface PlanCreateParams {
|
|
108
|
+
/** Display name. 1–80 characters. */
|
|
109
|
+
name: string;
|
|
110
|
+
/** Monthly try-on quota. 1–1 000 000. */
|
|
111
|
+
monthlyTryOns: number;
|
|
112
|
+
/** Map back to your billing price ID (e.g. Stripe price_xxx). */
|
|
113
|
+
externalPriceId?: string;
|
|
114
|
+
/** Defaults to `true`. */
|
|
115
|
+
active?: boolean;
|
|
116
|
+
}
|
|
117
|
+
interface PlanUpdateParams {
|
|
118
|
+
name?: string;
|
|
119
|
+
monthlyTryOns?: number;
|
|
120
|
+
externalPriceId?: string;
|
|
121
|
+
active?: boolean;
|
|
122
|
+
}
|
|
123
|
+
interface PlanListParams {
|
|
124
|
+
/** Include soft-disabled plans. Default: `false`. */
|
|
125
|
+
include_inactive?: boolean;
|
|
126
|
+
}
|
|
127
|
+
interface Plan {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
monthlyTryOns: number;
|
|
131
|
+
externalPriceId?: string | null;
|
|
132
|
+
active: boolean;
|
|
133
|
+
createdAt: string;
|
|
134
|
+
updatedAt: string;
|
|
135
|
+
}
|
|
136
|
+
interface PlanList {
|
|
137
|
+
data: Plan[];
|
|
138
|
+
}
|
|
139
|
+
declare class PlansResource {
|
|
140
|
+
private readonly config;
|
|
141
|
+
constructor(config: GenvorisConfig);
|
|
142
|
+
/** List all plans. Pass `{ include_inactive: true }` to include disabled ones. */
|
|
143
|
+
list(params?: PlanListParams): Promise<PlanList>;
|
|
144
|
+
/** Create a new plan. Returns `201 Created`. */
|
|
145
|
+
create(params: PlanCreateParams): Promise<Plan>;
|
|
146
|
+
/** Retrieve a single plan. */
|
|
147
|
+
retrieve(id: string): Promise<Plan>;
|
|
148
|
+
/** Update any plan fields. */
|
|
149
|
+
update(id: string, params: PlanUpdateParams): Promise<Plan>;
|
|
150
|
+
/**
|
|
151
|
+
* Soft-disable a plan. Existing customers keep quota until cancelled or
|
|
152
|
+
* reassigned. The plan stops appearing in `list()` unless `include_inactive`
|
|
153
|
+
* is `true`.
|
|
154
|
+
*/
|
|
155
|
+
archive(id: string): Promise<void>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface SessionMintParams {
|
|
159
|
+
/** Genvoris customer ID or your `externalId`. */
|
|
160
|
+
customerId: string;
|
|
161
|
+
/** JWT lifetime in seconds. Default: 900 (15 min). */
|
|
162
|
+
ttlSeconds?: number;
|
|
163
|
+
}
|
|
164
|
+
interface MintedSession {
|
|
165
|
+
token: string;
|
|
166
|
+
token_type: 'Bearer';
|
|
167
|
+
/** Remaining lifetime in seconds at issuance. */
|
|
168
|
+
expires_in: number;
|
|
169
|
+
/** ISO-8601 expiry timestamp. */
|
|
170
|
+
expires_at: string;
|
|
171
|
+
customer: {
|
|
172
|
+
id: string;
|
|
173
|
+
external_id: string;
|
|
174
|
+
plan_name: string | null;
|
|
175
|
+
monthly_try_ons: number | null;
|
|
176
|
+
period_end: string | null;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
declare class SessionsResource {
|
|
180
|
+
private readonly config;
|
|
181
|
+
constructor(config: GenvorisConfig);
|
|
182
|
+
/**
|
|
183
|
+
* Mint a short-lived widget session token for a customer.
|
|
184
|
+
*
|
|
185
|
+
* The token should be sent to your frontend and passed to the
|
|
186
|
+
* Genvoris widget — never exposed in client-side code directly.
|
|
187
|
+
*/
|
|
188
|
+
mint({ customerId, ttlSeconds }: SessionMintParams): Promise<MintedSession>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface WebhookCreateParams {
|
|
192
|
+
/** HTTPS endpoint URL Genvoris will POST events to. */
|
|
193
|
+
url: string;
|
|
194
|
+
/** Signing secret — store this securely; shown only once in the dashboard. */
|
|
195
|
+
secret: string;
|
|
196
|
+
/** Event types to subscribe to, e.g. `['end_customer.created']`. */
|
|
197
|
+
events: string[];
|
|
198
|
+
description?: string;
|
|
199
|
+
}
|
|
200
|
+
interface WebhookVerifyOptions {
|
|
201
|
+
/**
|
|
202
|
+
* The raw request body **as received over the wire** — do NOT parse and
|
|
203
|
+
* re-serialise, or the HMAC will mismatch.
|
|
204
|
+
*
|
|
205
|
+
* Pass a `string` or any `ArrayBufferView` (e.g. `Uint8Array`).
|
|
206
|
+
*/
|
|
207
|
+
payload: Uint8Array | string;
|
|
208
|
+
/** Value of the `X-Genvoris-Signature` header. */
|
|
209
|
+
header: string;
|
|
210
|
+
/** The endpoint signing secret from your dashboard. */
|
|
211
|
+
secret: string;
|
|
212
|
+
/**
|
|
213
|
+
* Maximum age of the timestamp in seconds before the signature is rejected.
|
|
214
|
+
* Default: 300 (5 minutes).
|
|
215
|
+
*/
|
|
216
|
+
toleranceSeconds?: number;
|
|
217
|
+
}
|
|
218
|
+
interface WebhookEndpoint {
|
|
219
|
+
id: string;
|
|
220
|
+
url: string;
|
|
221
|
+
events: string[];
|
|
222
|
+
description?: string | null;
|
|
223
|
+
active: boolean;
|
|
224
|
+
createdAt: string;
|
|
225
|
+
}
|
|
226
|
+
interface WebhookEndpointList {
|
|
227
|
+
data: WebhookEndpoint[];
|
|
228
|
+
}
|
|
229
|
+
/** Parsed, verified webhook event envelope. */
|
|
230
|
+
interface GenvorisEvent<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
231
|
+
id: string;
|
|
232
|
+
type: string;
|
|
233
|
+
created: number;
|
|
234
|
+
data: T;
|
|
235
|
+
}
|
|
236
|
+
declare class WebhooksResource {
|
|
237
|
+
private readonly config;
|
|
238
|
+
constructor(config: GenvorisConfig);
|
|
239
|
+
/** List all webhook endpoints for your store. */
|
|
240
|
+
list(): Promise<WebhookEndpointList>;
|
|
241
|
+
/** Register a new webhook endpoint. */
|
|
242
|
+
create(params: WebhookCreateParams): Promise<WebhookEndpoint>;
|
|
243
|
+
/** Send a synthetic `webhook.test` ping to the endpoint. */
|
|
244
|
+
test(id: string): Promise<void>;
|
|
245
|
+
/** Delete a webhook endpoint. */
|
|
246
|
+
delete(id: string): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Verify the `X-Genvoris-Signature` header and return the parsed event.
|
|
249
|
+
*
|
|
250
|
+
* Throws if the signature is invalid, the timestamp is too old, or the
|
|
251
|
+
* header is malformed. Uses `crypto.timingSafeEqual` to prevent
|
|
252
|
+
* timing attacks.
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```ts
|
|
256
|
+
* import { WebhooksResource } from '@genvoris/node';
|
|
257
|
+
*
|
|
258
|
+
* const event = WebhooksResource.verify({
|
|
259
|
+
* payload: req.body, // raw Buffer — do NOT parse JSON first
|
|
260
|
+
* header: req.header('x-genvoris-signature') ?? '',
|
|
261
|
+
* secret: process.env.GENVORIS_WEBHOOK_SECRET!,
|
|
262
|
+
* });
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
static verify<T extends Record<string, unknown> = Record<string, unknown>>({ payload, header, secret, toleranceSeconds, }: WebhookVerifyOptions): GenvorisEvent<T>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
declare class GenvorisAPIError extends Error {
|
|
269
|
+
readonly status: number;
|
|
270
|
+
readonly code: string;
|
|
271
|
+
readonly requestId: string | undefined;
|
|
272
|
+
constructor(args: {
|
|
273
|
+
status: number;
|
|
274
|
+
code: string;
|
|
275
|
+
message?: string;
|
|
276
|
+
requestId?: string;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
declare class GenvorisAuthError extends GenvorisAPIError {
|
|
280
|
+
constructor(args: {
|
|
281
|
+
status: number;
|
|
282
|
+
code: string;
|
|
283
|
+
message?: string;
|
|
284
|
+
requestId?: string;
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
declare class GenvorisRateLimitError extends GenvorisAPIError {
|
|
288
|
+
readonly retryAfterSeconds: number;
|
|
289
|
+
constructor(args: {
|
|
290
|
+
status: number;
|
|
291
|
+
code: string;
|
|
292
|
+
message?: string;
|
|
293
|
+
requestId?: string;
|
|
294
|
+
retryAfterSeconds?: number;
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
declare class GenvorisValidationError extends GenvorisAPIError {
|
|
298
|
+
readonly fieldErrors: Record<string, string[]>;
|
|
299
|
+
constructor(args: {
|
|
300
|
+
status: number;
|
|
301
|
+
code: string;
|
|
302
|
+
message?: string;
|
|
303
|
+
requestId?: string;
|
|
304
|
+
fieldErrors?: Record<string, string[]>;
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Official Genvoris Node.js SDK client.
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```ts
|
|
313
|
+
* import Genvoris from '@genvoris/node';
|
|
314
|
+
*
|
|
315
|
+
* const gv = new Genvoris({ apiKey: process.env.GENVORIS_API_KEY! });
|
|
316
|
+
*
|
|
317
|
+
* const session = await gv.sessions.mint({ customerId: 'ec_abc' });
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
declare class Genvoris {
|
|
321
|
+
readonly customers: CustomersResource;
|
|
322
|
+
readonly plans: PlansResource;
|
|
323
|
+
readonly sessions: SessionsResource;
|
|
324
|
+
readonly webhooks: WebhooksResource;
|
|
325
|
+
constructor(config: GenvorisConfig);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export { type Customer, type CustomerCreateParams, type CustomerList, type CustomerListParams, type CustomerSession, type CustomerSessionList, type CustomerUpdateParams, type CustomerUsage, GenvorisAPIError, GenvorisAuthError, type GenvorisConfig, type GenvorisEvent, GenvorisRateLimitError, GenvorisValidationError, type MintedSession, type Plan, type PlanCreateParams, type PlanList, type PlanListParams, type PlanUpdateParams, type SessionMintParams, type WebhookCreateParams, type WebhookEndpoint, type WebhookEndpointList, type WebhookVerifyOptions, WebhooksResource, Genvoris as default };
|