@onesi/genesis 0.2.14 → 0.2.15
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 +1 -1
- package/dist/client.js +1 -1
- package/dist/dials.d.ts +49 -0
- package/dist/dials.js +12 -0
- package/dist/fleets.d.ts +18 -0
- package/dist/fleets.js +14 -0
- package/dist/gateway.d.ts +149 -5
- package/dist/gateway.js +19 -3
- package/dist/generated/operations.d.ts +1 -1
- package/dist/generated/operations.js +1905 -329
- package/dist/generated/schema.d.ts +3559 -408
- package/dist/genesis.d.ts +403 -3
- package/dist/genesis.js +3 -0
- package/dist/genesis.openapi.json +5322 -591
- package/dist/hives-operations.d.ts +78 -0
- package/dist/hives-operations.js +2 -0
- package/dist/hives-timers.d.ts +90 -0
- package/dist/hives-timers.js +25 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/instances.d.ts +73 -0
- package/dist/instances.js +10 -0
- package/dist/minds.d.ts +39 -0
- package/dist/minds.js +13 -0
- package/dist/one.d.ts +45 -0
- package/dist/one.js +24 -0
- package/dist/redact.js +1 -1
- package/dist/scopes.d.ts +8 -0
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/client.js
CHANGED
|
@@ -266,7 +266,7 @@ export class GenesisClient {
|
|
|
266
266
|
const url = this.url(operationId, input);
|
|
267
267
|
const headers = {
|
|
268
268
|
accept: 'application/json',
|
|
269
|
-
'user-agent': this.opts.userAgent ?? '@onesi/genesis/0.2.
|
|
269
|
+
'user-agent': this.opts.userAgent ?? '@onesi/genesis/0.2.15',
|
|
270
270
|
...this.opts.headers, ...init.headers,
|
|
271
271
|
};
|
|
272
272
|
if (op.service === 'blinds' && !['GET', 'HEAD', 'OPTIONS'].includes(op.method))
|
package/dist/dials.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ export type DialsMessagingBrand = components['schemas']['Dials.MessagingBrand'];
|
|
|
16
16
|
export type DialsMessagingCampaign = components['schemas']['Dials.MessagingCampaign'];
|
|
17
17
|
export type DialsWorkflowDocument = components['schemas']['Dials.WorkflowDocument'];
|
|
18
18
|
export type DialsWorkflowDeleteReceipt = components['schemas']['Dials.DeleteWorkflowReceipt'];
|
|
19
|
+
export type DialsNumberVoiceHandlerReceipt = components['schemas']['Dials.NumberVoiceHandlerReceipt'];
|
|
20
|
+
export type DialsOneNumber = components['schemas']['Dials.OneNumber'];
|
|
21
|
+
export type DialsOneNumberSuggestions = components['schemas']['Dials.OneNumberSuggestions'];
|
|
22
|
+
export type DialsOneNumberChoice = components['schemas']['Dials.OneNumberChoice'];
|
|
23
|
+
export type DialsMyOneNumber = components['schemas']['Dials.MyOneNumber'];
|
|
24
|
+
export type DialsOneNumberRelease = components['schemas']['Dials.OneNumberRelease'];
|
|
19
25
|
export type DialsRoutingAction = components['schemas']['Dials.RoutingAction'];
|
|
20
26
|
export type DialsRoutingRule = components['schemas']['Dials.RoutingRule'];
|
|
21
27
|
export type DialsRoutingRuleReceipt = components['schemas']['Dials.RoutingRuleReceipt'];
|
|
@@ -160,6 +166,39 @@ export declare function dialsModule(client: GenesisClient): {
|
|
|
160
166
|
next: "workflow_deleted";
|
|
161
167
|
}>;
|
|
162
168
|
};
|
|
169
|
+
/** A person's own One number (person token): suggestions, the person's choice, their number and its release. */
|
|
170
|
+
oneNumbers: {
|
|
171
|
+
/** POST with a JSON body `{areaCode?, text?, lat?, lng?}`; lat and lng travel in the body, never the URL, and a lone one is 400. */
|
|
172
|
+
suggestions: (body?: OperationInput<"dials_listOneNumberSuggestions">["body"]) => Promise<{
|
|
173
|
+
state: "suggestions" | "none_found";
|
|
174
|
+
source: "verified_phone" | "ip_city" | "device" | "search";
|
|
175
|
+
areaCode?: string | null;
|
|
176
|
+
city?: string | null;
|
|
177
|
+
numbers: components["schemas"]["Dials.OneNumberCandidate"][];
|
|
178
|
+
}>;
|
|
179
|
+
/** 202 `reserved_intent` while Dials provisioning is off; 409 taken, 429 provisioning_cap, 503 carrier_limit. Not retried automatically. */
|
|
180
|
+
choose: (body: OperationInput<"dials_chooseOneNumber">["body"]) => Promise<{
|
|
181
|
+
state: "chosen" | "reserved_intent";
|
|
182
|
+
number?: components["schemas"]["Dials.OneNumber"];
|
|
183
|
+
} & {
|
|
184
|
+
[key: string]: unknown;
|
|
185
|
+
}>;
|
|
186
|
+
mine: () => Promise<{
|
|
187
|
+
number: components["schemas"]["Dials.OneNumber"] | null;
|
|
188
|
+
plan?: string;
|
|
189
|
+
idleDays?: number | null;
|
|
190
|
+
releaseAt?: string | null;
|
|
191
|
+
} & {
|
|
192
|
+
[key: string]: unknown;
|
|
193
|
+
}>;
|
|
194
|
+
/** Releases the person's own One number at the carrier; it cannot be recovered. */
|
|
195
|
+
release: () => Promise<{
|
|
196
|
+
state: "releasing" | "released";
|
|
197
|
+
number?: components["schemas"]["Dials.OneNumber"] | null;
|
|
198
|
+
} & {
|
|
199
|
+
[key: string]: unknown;
|
|
200
|
+
}>;
|
|
201
|
+
};
|
|
163
202
|
overview: {
|
|
164
203
|
summary: (scope: DialsScope) => Promise<{
|
|
165
204
|
ok: boolean;
|
|
@@ -230,6 +269,16 @@ export declare function dialsModule(client: GenesisClient): {
|
|
|
230
269
|
auditId: string;
|
|
231
270
|
next: string;
|
|
232
271
|
}>;
|
|
272
|
+
/** Points an owned SignalWire number's inbound voice webhook at `one_phone` (the One phone line) or `default`; 409 for a non-SignalWire number. */
|
|
273
|
+
setVoiceHandler: (body: OperationInput<"dials_setNumberVoiceHandler">["body"]) => Promise<{
|
|
274
|
+
ok: true;
|
|
275
|
+
phoneNumberId: string;
|
|
276
|
+
handler: "one_phone" | "default";
|
|
277
|
+
auditId?: string;
|
|
278
|
+
next?: string;
|
|
279
|
+
} & {
|
|
280
|
+
[key: string]: unknown;
|
|
281
|
+
}>;
|
|
233
282
|
reconcile: (body: OperationInput<"dials_reconcileNumberInventory">["body"]) => Promise<{
|
|
234
283
|
ok: boolean;
|
|
235
284
|
reconciliations: components["schemas"]["Dials.InventoryReconciliation"][];
|
package/dist/dials.js
CHANGED
|
@@ -42,6 +42,16 @@ export function dialsModule(client) {
|
|
|
42
42
|
/** Deletes the workflow and its routing descriptor; 409 while a held number is assigned to it. */
|
|
43
43
|
delete: (workflowId, body) => client.request('dials_deleteWorkflow', { workflow_id: workflowId, body }),
|
|
44
44
|
},
|
|
45
|
+
/** A person's own One number (person token): suggestions, the person's choice, their number and its release. */
|
|
46
|
+
oneNumbers: {
|
|
47
|
+
/** POST with a JSON body `{areaCode?, text?, lat?, lng?}`; lat and lng travel in the body, never the URL, and a lone one is 400. */
|
|
48
|
+
suggestions: (body = {}) => client.request('dials_listOneNumberSuggestions', { body }),
|
|
49
|
+
/** 202 `reserved_intent` while Dials provisioning is off; 409 taken, 429 provisioning_cap, 503 carrier_limit. Not retried automatically. */
|
|
50
|
+
choose: (body) => client.request('dials_chooseOneNumber', { body }),
|
|
51
|
+
mine: () => client.request('dials_getMyOneNumber', {}),
|
|
52
|
+
/** Releases the person's own One number at the carrier; it cannot be recovered. */
|
|
53
|
+
release: () => client.request('dials_releaseMyOneNumber', {}),
|
|
54
|
+
},
|
|
45
55
|
overview: {
|
|
46
56
|
summary: (scope) => client.request('dials_getConsoleSummary', scope),
|
|
47
57
|
operatingSurface: (scope) => client.request('dials_getOperatingSurface', scope),
|
|
@@ -50,6 +60,8 @@ export function dialsModule(client) {
|
|
|
50
60
|
reconciliations: (scope) => client.request('dials_listNumberReconciliations', scope),
|
|
51
61
|
drift: (scope) => client.request('dials_listNumberDrift', scope),
|
|
52
62
|
updateCallerName: (body) => client.request('dials_updateNumberCallerName', { body }),
|
|
63
|
+
/** Points an owned SignalWire number's inbound voice webhook at `one_phone` (the One phone line) or `default`; 409 for a non-SignalWire number. */
|
|
64
|
+
setVoiceHandler: (body) => client.request('dials_setNumberVoiceHandler', { body }),
|
|
53
65
|
reconcile: (body) => client.request('dials_reconcileNumberInventory', { body }),
|
|
54
66
|
list: (scope) => client.request('dials_listNumbers', scope),
|
|
55
67
|
search: (scope, query = {}) => client.request('dials_searchNumbers', { ...query, ...scope }),
|
package/dist/fleets.d.ts
CHANGED
|
@@ -463,6 +463,24 @@ export declare function fleetsModule(client: GenesisClient): {
|
|
|
463
463
|
updated_at?: number;
|
|
464
464
|
}>;
|
|
465
465
|
};
|
|
466
|
+
/** The key seat research tasks use to search and read the web through Traces (scopes exactly traces:read; its own slot, never the computer key); KMS-encrypted, never returned. */
|
|
467
|
+
webConnection: {
|
|
468
|
+
get: () => Promise<{
|
|
469
|
+
connected: boolean;
|
|
470
|
+
updated_at?: number;
|
|
471
|
+
scopes?: "traces:read"[];
|
|
472
|
+
}>;
|
|
473
|
+
set: (api_key: string) => Promise<{
|
|
474
|
+
connected: boolean;
|
|
475
|
+
updated_at?: number;
|
|
476
|
+
scopes?: "traces:read"[];
|
|
477
|
+
}>;
|
|
478
|
+
delete: () => Promise<{
|
|
479
|
+
connected: boolean;
|
|
480
|
+
updated_at?: number;
|
|
481
|
+
scopes?: "traces:read"[];
|
|
482
|
+
}>;
|
|
483
|
+
};
|
|
466
484
|
usage: {
|
|
467
485
|
/** Task lifecycle and execution-time usage events, paged by task like tasks.list. */
|
|
468
486
|
events: (query?: OperationInput<"fleets_listUsageEvents">) => Promise<{
|
package/dist/fleets.js
CHANGED
|
@@ -180,6 +180,11 @@ function validateComputerKey(apiKey) {
|
|
|
180
180
|
throw invalid('fleets_putComputerConnection', 'Computer key must contain 1–4096 UTF-8 bytes without CR, LF or NUL.');
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
+
function validateWebKey(apiKey) {
|
|
184
|
+
if (typeof apiKey !== 'string' || !apiKey || byteLength(apiKey) > 4096 || /[\r\n\0]/.test(apiKey)) {
|
|
185
|
+
throw invalid('fleets_putWebConnection', 'Web key must contain 1–4096 UTF-8 bytes without CR, LF or NUL.');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
183
188
|
/** Managed Henry instances and tasks scoped to the credential's verified org. */
|
|
184
189
|
export function fleetsModule(client) {
|
|
185
190
|
return {
|
|
@@ -378,6 +383,15 @@ export function fleetsModule(client) {
|
|
|
378
383
|
},
|
|
379
384
|
delete: () => client.request('fleets_deleteComputerConnection', {}),
|
|
380
385
|
},
|
|
386
|
+
/** The key seat research tasks use to search and read the web through Traces (scopes exactly traces:read; its own slot, never the computer key); KMS-encrypted, never returned. */
|
|
387
|
+
webConnection: {
|
|
388
|
+
get: () => client.request('fleets_getWebConnection', {}),
|
|
389
|
+
set: async (api_key) => {
|
|
390
|
+
validateWebKey(api_key);
|
|
391
|
+
return client.request('fleets_putWebConnection', { body: { api_key } });
|
|
392
|
+
},
|
|
393
|
+
delete: () => client.request('fleets_deleteWebConnection', {}),
|
|
394
|
+
},
|
|
381
395
|
usage: {
|
|
382
396
|
/** Task lifecycle and execution-time usage events, paged by task like tasks.list. */
|
|
383
397
|
events: (query = {}) => client.request('fleets_listUsageEvents', query),
|
package/dist/gateway.d.ts
CHANGED
|
@@ -112,7 +112,8 @@ export declare function orgsModule(client: GenesisClient): {
|
|
|
112
112
|
* Your organization's billing: account, contacts, tax IDs, activity, quotas and quota requests, the Minds account,
|
|
113
113
|
* invoices, the raw usage report and the public service catalog. A login session, or an org API key bound to `org`
|
|
114
114
|
* holding genesis.billing.read (reads), genesis.billing.manage (writes) or genesis.usage.read (usage report).
|
|
115
|
-
* Writes need a stable idempotency key; reuse it to replay instead of acting twice.
|
|
115
|
+
* Writes need a stable idempotency key; reuse it to replay instead of acting twice. Only subscription.create can start a
|
|
116
|
+
* charge, and only in an environment where Genesis Pro is switched on (Sandbox is test money).
|
|
116
117
|
*/
|
|
117
118
|
export declare function billingModule(client: GenesisClient): {
|
|
118
119
|
account: {
|
|
@@ -131,7 +132,7 @@ export declare function billingModule(client: GenesisClient): {
|
|
|
131
132
|
memo?: string | null;
|
|
132
133
|
};
|
|
133
134
|
stripe?: {
|
|
134
|
-
account_id?: string;
|
|
135
|
+
account_id?: string | null;
|
|
135
136
|
customer_id?: string | null;
|
|
136
137
|
livemode?: boolean;
|
|
137
138
|
};
|
|
@@ -153,7 +154,7 @@ export declare function billingModule(client: GenesisClient): {
|
|
|
153
154
|
memo?: string | null;
|
|
154
155
|
};
|
|
155
156
|
stripe?: {
|
|
156
|
-
account_id?: string;
|
|
157
|
+
account_id?: string | null;
|
|
157
158
|
customer_id?: string | null;
|
|
158
159
|
livemode?: boolean;
|
|
159
160
|
};
|
|
@@ -216,6 +217,85 @@ export declare function billingModule(client: GenesisClient): {
|
|
|
216
217
|
deleted: true;
|
|
217
218
|
}>;
|
|
218
219
|
};
|
|
220
|
+
card: {
|
|
221
|
+
/** Hosted Stripe Checkout (setup mode, off-session) for the org's billing account: send the customer to `url`; they come back to `return_url`. */
|
|
222
|
+
setup: (org: string, body: In<"gateway_createBillingCardSetupSession">["body"], idempotencyKey: string) => Promise<{
|
|
223
|
+
object: "billing_setup_session";
|
|
224
|
+
url: string;
|
|
225
|
+
expires_at: string;
|
|
226
|
+
}>;
|
|
227
|
+
/** After the return: verifies the completed session, then makes that card the default. */
|
|
228
|
+
setDefault: (org: string, body: In<"gateway_setBillingDefaultPaymentMethod">["body"], idempotencyKey: string) => Promise<{
|
|
229
|
+
object: "billing_payment_method";
|
|
230
|
+
brand?: string | null;
|
|
231
|
+
last4?: string | null;
|
|
232
|
+
exp_month?: number | null;
|
|
233
|
+
exp_year?: number | null;
|
|
234
|
+
default: true;
|
|
235
|
+
}>;
|
|
236
|
+
};
|
|
237
|
+
subscription: {
|
|
238
|
+
get: (org: string) => Promise<{
|
|
239
|
+
object: "genesis_pro_subscription";
|
|
240
|
+
org_id: string;
|
|
241
|
+
environment: "sandbox" | "live";
|
|
242
|
+
plan: "genesis_pro";
|
|
243
|
+
created?: boolean;
|
|
244
|
+
enabled?: boolean;
|
|
245
|
+
stripe?: {
|
|
246
|
+
account_id?: string | null;
|
|
247
|
+
mode?: string;
|
|
248
|
+
livemode?: boolean;
|
|
249
|
+
test_mode?: boolean;
|
|
250
|
+
};
|
|
251
|
+
subscription: {
|
|
252
|
+
id: string | null;
|
|
253
|
+
status: string;
|
|
254
|
+
prices: string[];
|
|
255
|
+
current_period_start?: string | null;
|
|
256
|
+
current_period_end?: string | null;
|
|
257
|
+
latest_invoice?: {
|
|
258
|
+
id?: string | null;
|
|
259
|
+
status?: string | null;
|
|
260
|
+
hosted_invoice_url?: string | null;
|
|
261
|
+
amount_due?: number | null;
|
|
262
|
+
} | null;
|
|
263
|
+
} | null;
|
|
264
|
+
entitlement: {
|
|
265
|
+
[key: string]: unknown;
|
|
266
|
+
};
|
|
267
|
+
}>;
|
|
268
|
+
create: (org: string, body: In<"gateway_createGenesisProSubscription">["body"], idempotencyKey: string) => Promise<{
|
|
269
|
+
object: "genesis_pro_subscription";
|
|
270
|
+
org_id: string;
|
|
271
|
+
environment: "sandbox" | "live";
|
|
272
|
+
plan: "genesis_pro";
|
|
273
|
+
created?: boolean;
|
|
274
|
+
enabled?: boolean;
|
|
275
|
+
stripe?: {
|
|
276
|
+
account_id?: string | null;
|
|
277
|
+
mode?: string;
|
|
278
|
+
livemode?: boolean;
|
|
279
|
+
test_mode?: boolean;
|
|
280
|
+
};
|
|
281
|
+
subscription: {
|
|
282
|
+
id: string | null;
|
|
283
|
+
status: string;
|
|
284
|
+
prices: string[];
|
|
285
|
+
current_period_start?: string | null;
|
|
286
|
+
current_period_end?: string | null;
|
|
287
|
+
latest_invoice?: {
|
|
288
|
+
id?: string | null;
|
|
289
|
+
status?: string | null;
|
|
290
|
+
hosted_invoice_url?: string | null;
|
|
291
|
+
amount_due?: number | null;
|
|
292
|
+
} | null;
|
|
293
|
+
} | null;
|
|
294
|
+
entitlement: {
|
|
295
|
+
[key: string]: unknown;
|
|
296
|
+
};
|
|
297
|
+
}>;
|
|
298
|
+
};
|
|
219
299
|
quotas: {
|
|
220
300
|
get: (org: string) => Promise<{
|
|
221
301
|
object: "org_quotas";
|
|
@@ -362,6 +442,68 @@ export declare function billingModule(client: GenesisClient): {
|
|
|
362
442
|
}[];
|
|
363
443
|
}[];
|
|
364
444
|
}>;
|
|
445
|
+
/**
|
|
446
|
+
* The OneOS Pro pricing catalog (public, no credential): plans, included usage and every meter's rate. Show a rate only
|
|
447
|
+
* when its `live_metered` is true.
|
|
448
|
+
*/
|
|
449
|
+
pricing: () => Promise<{
|
|
450
|
+
object: "billing_pricing";
|
|
451
|
+
version: string;
|
|
452
|
+
generated_at: string;
|
|
453
|
+
source: {
|
|
454
|
+
service: string;
|
|
455
|
+
commit: string | null;
|
|
456
|
+
stripe_mode: "live" | "test" | "off";
|
|
457
|
+
};
|
|
458
|
+
currency: "usd";
|
|
459
|
+
plans: {
|
|
460
|
+
id: "hobby" | "genesis_pro" | "enterprise";
|
|
461
|
+
name: string;
|
|
462
|
+
price_usd_month: string | null;
|
|
463
|
+
included_usage_usd?: string;
|
|
464
|
+
card_required?: boolean;
|
|
465
|
+
stripe_lookup_key?: string;
|
|
466
|
+
live_priced?: boolean;
|
|
467
|
+
annual?: {
|
|
468
|
+
price_usd_year?: string;
|
|
469
|
+
stripe_lookup_key?: string;
|
|
470
|
+
live_priced?: boolean;
|
|
471
|
+
};
|
|
472
|
+
limits?: {
|
|
473
|
+
[key: string]: unknown;
|
|
474
|
+
};
|
|
475
|
+
contact?: string;
|
|
476
|
+
}[];
|
|
477
|
+
rates: {
|
|
478
|
+
service: string;
|
|
479
|
+
service_name: string;
|
|
480
|
+
category?: string | null;
|
|
481
|
+
meters: string[];
|
|
482
|
+
label: string;
|
|
483
|
+
unit?: string | null;
|
|
484
|
+
granularity?: string | null;
|
|
485
|
+
rate: {
|
|
486
|
+
kind?: "fixed" | "list_plus_bps";
|
|
487
|
+
currency?: "usd";
|
|
488
|
+
usd_per_unit?: string;
|
|
489
|
+
per?: string;
|
|
490
|
+
bps?: number;
|
|
491
|
+
base?: string;
|
|
492
|
+
} | null;
|
|
493
|
+
included?: {
|
|
494
|
+
[key: string]: unknown;
|
|
495
|
+
};
|
|
496
|
+
allowance?: {
|
|
497
|
+
[key: string]: unknown;
|
|
498
|
+
};
|
|
499
|
+
stripe_lookup_key?: string | null;
|
|
500
|
+
stripe_unit_amount_decimal?: string | null;
|
|
501
|
+
live_metered: boolean;
|
|
502
|
+
example?: {
|
|
503
|
+
[key: string]: unknown;
|
|
504
|
+
} | null;
|
|
505
|
+
}[];
|
|
506
|
+
}>;
|
|
365
507
|
};
|
|
366
508
|
/**
|
|
367
509
|
* Your One credits (the organization's credit balance, ledger, usage, settings, checkout and subscription). A login
|
|
@@ -371,7 +513,7 @@ export declare function billingModule(client: GenesisClient): {
|
|
|
371
513
|
* URL is always on checkout.stripe.com and nothing is charged until you pay on that page.
|
|
372
514
|
*/
|
|
373
515
|
export declare function creditsModule(client: GenesisClient): {
|
|
374
|
-
/** The balance: plan and period, buckets, this month's spend by source, borrow, auto-refill, subscription, pending seat fundings
|
|
516
|
+
/** The balance: plan and period, buckets, this month's spend by source, borrow, auto-refill, subscription, pending seat fundings, the Foundry cap mirror and (with One plans on) `one_plan`. */
|
|
375
517
|
get: () => Promise<{
|
|
376
518
|
org: string;
|
|
377
519
|
plan: string;
|
|
@@ -404,6 +546,7 @@ export declare function creditsModule(client: GenesisClient): {
|
|
|
404
546
|
status: string;
|
|
405
547
|
granted_micro_usd: number;
|
|
406
548
|
};
|
|
549
|
+
one_plan?: import("./index.js").components["schemas"]["Gateway.CreditOnePlan"];
|
|
407
550
|
}>;
|
|
408
551
|
/** The catalog: every price with its credits and amount, the pack rate, the payment methods per mode and the wallet-payment terms. Needs no credits account. */
|
|
409
552
|
catalog: () => Promise<{
|
|
@@ -450,11 +593,12 @@ export declare function creditsModule(client: GenesisClient): {
|
|
|
450
593
|
ref: string | null;
|
|
451
594
|
data: import("./index.js").components["schemas"]["Gateway.CreditUsageRow"][];
|
|
452
595
|
}>;
|
|
453
|
-
/** Change the borrow ceiling and/or auto-refill (pack 10, 25 or 50)
|
|
596
|
+
/** Change the borrow ceiling and/or auto-refill (pack 10, 25 or 50); with One plans on, the daily limit (`daily_limit_credits`, null clears it) and `always_on_one`. */
|
|
454
597
|
updateSettings: (body: In<"gateway_updateCreditSettings">["body"], idempotencyKey: string) => Promise<{
|
|
455
598
|
org: string;
|
|
456
599
|
borrow: import("./index.js").components["schemas"]["Gateway.CreditBorrow"];
|
|
457
600
|
auto_refill: import("./index.js").components["schemas"]["Gateway.CreditAutoRefill"];
|
|
601
|
+
one_plan?: import("./index.js").components["schemas"]["Gateway.CreditOnePlan"];
|
|
458
602
|
}>;
|
|
459
603
|
/** A Stripe Checkout URL (checkout.stripe.com, test mode) for a plan, seats or a credit pack; `return_to` (https://chat.one.ml/pay or below) is where Checkout sends the person back. */
|
|
460
604
|
checkout: (body: In<"gateway_createCreditCheckout">["body"], idempotencyKey: string) => Promise<{
|
package/dist/gateway.js
CHANGED
|
@@ -37,7 +37,8 @@ export function orgsModule(client) {
|
|
|
37
37
|
* Your organization's billing: account, contacts, tax IDs, activity, quotas and quota requests, the Minds account,
|
|
38
38
|
* invoices, the raw usage report and the public service catalog. A login session, or an org API key bound to `org`
|
|
39
39
|
* holding genesis.billing.read (reads), genesis.billing.manage (writes) or genesis.usage.read (usage report).
|
|
40
|
-
* Writes need a stable idempotency key; reuse it to replay instead of acting twice.
|
|
40
|
+
* Writes need a stable idempotency key; reuse it to replay instead of acting twice. Only subscription.create can start a
|
|
41
|
+
* charge, and only in an environment where Genesis Pro is switched on (Sandbox is test money).
|
|
41
42
|
*/
|
|
42
43
|
export function billingModule(client) {
|
|
43
44
|
const write = (id, input, idempotencyKey) => client.request(id, input, { headers: idempotencyHeaders(id, idempotencyKey) });
|
|
@@ -57,6 +58,16 @@ export function billingModule(client) {
|
|
|
57
58
|
create: (org, body, idempotencyKey) => write('gateway_createBillingTaxId', { org, body }, idempotencyKey),
|
|
58
59
|
delete: (org, taxId, idempotencyKey) => write('gateway_deleteBillingTaxId', { org, tax_id: taxId }, idempotencyKey),
|
|
59
60
|
},
|
|
61
|
+
card: {
|
|
62
|
+
/** Hosted Stripe Checkout (setup mode, off-session) for the org's billing account: send the customer to `url`; they come back to `return_url`. */
|
|
63
|
+
setup: (org, body, idempotencyKey) => write('gateway_createBillingCardSetupSession', { org, body }, idempotencyKey),
|
|
64
|
+
/** After the return: verifies the completed session, then makes that card the default. */
|
|
65
|
+
setDefault: (org, body, idempotencyKey) => write('gateway_setBillingDefaultPaymentMethod', { org, body }, idempotencyKey),
|
|
66
|
+
},
|
|
67
|
+
subscription: {
|
|
68
|
+
get: (org) => client.request('gateway_getGenesisProSubscription', { org }),
|
|
69
|
+
create: (org, body, idempotencyKey) => write('gateway_createGenesisProSubscription', { org, body }, idempotencyKey),
|
|
70
|
+
},
|
|
60
71
|
quotas: {
|
|
61
72
|
get: (org) => client.request('gateway_getOrgQuotas', { org }),
|
|
62
73
|
requests: {
|
|
@@ -78,6 +89,11 @@ export function billingModule(client) {
|
|
|
78
89
|
service: (org, service) => client.request('gateway_getOrgServiceBilling', { org, service }),
|
|
79
90
|
/** The metered service catalog (public, no credential). */
|
|
80
91
|
catalog: () => client.request('gateway_listBillingServices'),
|
|
92
|
+
/**
|
|
93
|
+
* The OneOS Pro pricing catalog (public, no credential): plans, included usage and every meter's rate. Show a rate only
|
|
94
|
+
* when its `live_metered` is true.
|
|
95
|
+
*/
|
|
96
|
+
pricing: () => client.request('gateway_getBillingPricing'),
|
|
81
97
|
};
|
|
82
98
|
}
|
|
83
99
|
/**
|
|
@@ -90,7 +106,7 @@ export function billingModule(client) {
|
|
|
90
106
|
export function creditsModule(client) {
|
|
91
107
|
const write = (id, input, idempotencyKey) => client.request(id, input, { headers: idempotencyHeaders(id, idempotencyKey) });
|
|
92
108
|
return {
|
|
93
|
-
/** The balance: plan and period, buckets, this month's spend by source, borrow, auto-refill, subscription, pending seat fundings
|
|
109
|
+
/** The balance: plan and period, buckets, this month's spend by source, borrow, auto-refill, subscription, pending seat fundings, the Foundry cap mirror and (with One plans on) `one_plan`. */
|
|
94
110
|
get: () => client.request('gateway_getCredits'),
|
|
95
111
|
/** The catalog: every price with its credits and amount, the pack rate, the payment methods per mode and the wallet-payment terms. Needs no credits account. */
|
|
96
112
|
catalog: () => client.request('gateway_getCreditCatalog'),
|
|
@@ -98,7 +114,7 @@ export function creditsModule(client) {
|
|
|
98
114
|
entries: (query = {}) => client.request('gateway_listCreditEntries', query),
|
|
99
115
|
/** The usage rows behind a debit; `ref` is the Henry run id or receipt id of a ledger entry. */
|
|
100
116
|
usage: (query = {}) => client.request('gateway_listCreditUsage', query),
|
|
101
|
-
/** Change the borrow ceiling and/or auto-refill (pack 10, 25 or 50)
|
|
117
|
+
/** Change the borrow ceiling and/or auto-refill (pack 10, 25 or 50); with One plans on, the daily limit (`daily_limit_credits`, null clears it) and `always_on_one`. */
|
|
102
118
|
updateSettings: (body, idempotencyKey) => write('gateway_updateCreditSettings', { body }, idempotencyKey),
|
|
103
119
|
/** A Stripe Checkout URL (checkout.stripe.com, test mode) for a plan, seats or a credit pack; `return_to` (https://chat.one.ml/pay or below) is where Checkout sends the person back. */
|
|
104
120
|
checkout: (body, idempotencyKey) => write('gateway_createCreditCheckout', { body }, idempotencyKey),
|