@runlot/api 0.1.0-rc.210 → 0.1.0-rc.211
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/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +371 -6
- package/dist/schema.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/schema.d.ts
CHANGED
|
@@ -3762,12 +3762,19 @@ export interface paths {
|
|
|
3762
3762
|
* charge Y to the saved card, at most N times a day" and takes a checkbox, because card network
|
|
3763
3763
|
* rules require prior consent for off-session charges.
|
|
3764
3764
|
*
|
|
3765
|
-
* The server checks
|
|
3766
|
-
*
|
|
3767
|
-
*
|
|
3765
|
+
* The server checks: whether a payment method is saved (409 if not), whether the amount is one
|
|
3766
|
+
* of the offered top-up amounts, whether the threshold is **greater than 0 and smaller than the
|
|
3767
|
+
* top-up amount**, and `perDay` — the most top-ups a day, a whole number of at least 1 or `null`
|
|
3768
|
+
* for unlimited (5 when left out). Unlimited has no daily count: charges go on for as long as
|
|
3769
|
+
* the balance keeps falling below the threshold, one at a time. A threshold of 0 makes every automatic charge fail with 402,
|
|
3768
3770
|
* and a threshold at or above the top-up amount leaves the balance still below the threshold
|
|
3769
3771
|
* after a top-up, so it would keep topping up until it hit the daily cap.
|
|
3770
3772
|
*
|
|
3773
|
+
* **A refused charge turns it off.** When the payment provider refuses an automatic charge — a
|
|
3774
|
+
* declined card, no valid saved card, or a provider setting that refuses off-session charges —
|
|
3775
|
+
* auto top-up is turned off at once, `autoTopupStopped` on `getAICredit` says when and why, and
|
|
3776
|
+
* the org's admins get `ai_autotopup_disabled`. Saving this setting again, on or off, clears it.
|
|
3777
|
+
*
|
|
3771
3778
|
* Requires admin. Audited as `ai.autotopup.on` / `ai.autotopup.off`.
|
|
3772
3779
|
*/
|
|
3773
3780
|
put: operations["setAIAutoTopup"];
|
|
@@ -4641,6 +4648,119 @@ export interface paths {
|
|
|
4641
4648
|
patch?: never;
|
|
4642
4649
|
trace?: never;
|
|
4643
4650
|
};
|
|
4651
|
+
"/v1/orgs/{orgSlug}/billing/payment-methods": {
|
|
4652
|
+
parameters: {
|
|
4653
|
+
query?: never;
|
|
4654
|
+
header?: never;
|
|
4655
|
+
path: {
|
|
4656
|
+
orgSlug: components["parameters"]["OrgSlug"];
|
|
4657
|
+
};
|
|
4658
|
+
cookie?: never;
|
|
4659
|
+
};
|
|
4660
|
+
/**
|
|
4661
|
+
* The organization's saved cards, read from Polar
|
|
4662
|
+
* @description The cards saved on the organization's Polar customer, with brand, last four digits, expiry and
|
|
4663
|
+
* which one is the **default** — the card automatic charges (AI credit top-up, Pro overage,
|
|
4664
|
+
* domain renewal) are made to. Read live from Polar on every request: runlot stores no card data.
|
|
4665
|
+
*
|
|
4666
|
+
* `customer: false` means the organization has no billing account with Polar yet;
|
|
4667
|
+
* `addBillingPaymentMethod` makes one. A one-time AI credit top-up does not save its card — add
|
|
4668
|
+
* cards with `addBillingPaymentMethod`. Requires admin.
|
|
4669
|
+
*/
|
|
4670
|
+
get: operations["getBillingPaymentMethods"];
|
|
4671
|
+
put?: never;
|
|
4672
|
+
post?: never;
|
|
4673
|
+
delete?: never;
|
|
4674
|
+
options?: never;
|
|
4675
|
+
head?: never;
|
|
4676
|
+
patch?: never;
|
|
4677
|
+
trace?: never;
|
|
4678
|
+
};
|
|
4679
|
+
"/v1/orgs/{orgSlug}/billing/payment-methods/default": {
|
|
4680
|
+
parameters: {
|
|
4681
|
+
query?: never;
|
|
4682
|
+
header?: never;
|
|
4683
|
+
path: {
|
|
4684
|
+
orgSlug: components["parameters"]["OrgSlug"];
|
|
4685
|
+
};
|
|
4686
|
+
cookie?: never;
|
|
4687
|
+
};
|
|
4688
|
+
get?: never;
|
|
4689
|
+
/**
|
|
4690
|
+
* Makes a saved card the default
|
|
4691
|
+
* @description Sets Polar's default payment method for the organization's customer. Automatic charges and the
|
|
4692
|
+
* Pro subscription use the default. `id` is one of the organization's own saved cards
|
|
4693
|
+
* (`getBillingPaymentMethods`); an expired card is refused with 409 `card_expired`. Requires
|
|
4694
|
+
* admin. Audited as `billing.card.default`.
|
|
4695
|
+
*/
|
|
4696
|
+
put: operations["setBillingDefaultPaymentMethod"];
|
|
4697
|
+
post?: never;
|
|
4698
|
+
delete?: never;
|
|
4699
|
+
options?: never;
|
|
4700
|
+
head?: never;
|
|
4701
|
+
patch?: never;
|
|
4702
|
+
trace?: never;
|
|
4703
|
+
};
|
|
4704
|
+
"/v1/orgs/{orgSlug}/billing/payment-methods/add": {
|
|
4705
|
+
parameters: {
|
|
4706
|
+
query?: never;
|
|
4707
|
+
header?: never;
|
|
4708
|
+
path: {
|
|
4709
|
+
orgSlug: components["parameters"]["OrgSlug"];
|
|
4710
|
+
};
|
|
4711
|
+
cookie?: never;
|
|
4712
|
+
};
|
|
4713
|
+
get?: never;
|
|
4714
|
+
put?: never;
|
|
4715
|
+
/**
|
|
4716
|
+
* Opens Polar's page to add a card
|
|
4717
|
+
* @description Returns a one-time `url` for Polar's hosted customer portal, where the card is entered — the card
|
|
4718
|
+
* never passes through runlot. The browser comes back to `returnTo` (under this deployment's public
|
|
4719
|
+
* URL), and the screen reads `getBillingPaymentMethods` again.
|
|
4720
|
+
*
|
|
4721
|
+
* An organization with no billing account yet (a free organization that never paid, or a Pro plan
|
|
4722
|
+
* provided by Runlot) gets one made with the signed-in admin's email; when that email already has
|
|
4723
|
+
* one, the organization shares it. Requires admin.
|
|
4724
|
+
*/
|
|
4725
|
+
post: operations["addBillingPaymentMethod"];
|
|
4726
|
+
delete?: never;
|
|
4727
|
+
options?: never;
|
|
4728
|
+
head?: never;
|
|
4729
|
+
patch?: never;
|
|
4730
|
+
trace?: never;
|
|
4731
|
+
};
|
|
4732
|
+
"/v1/orgs/{orgSlug}/billing/payment-methods/remove": {
|
|
4733
|
+
parameters: {
|
|
4734
|
+
query?: never;
|
|
4735
|
+
header?: never;
|
|
4736
|
+
path: {
|
|
4737
|
+
orgSlug: components["parameters"]["OrgSlug"];
|
|
4738
|
+
};
|
|
4739
|
+
cookie?: never;
|
|
4740
|
+
};
|
|
4741
|
+
get?: never;
|
|
4742
|
+
put?: never;
|
|
4743
|
+
/**
|
|
4744
|
+
* Removes a saved card
|
|
4745
|
+
* @description Removes a saved card from the organization's Polar customer. The card's `id` is in the body,
|
|
4746
|
+
* not the URL, so it never appears in a request log.
|
|
4747
|
+
*
|
|
4748
|
+
* - A paid **Pro** organization always keeps a valid (unexpired) card: removing its last one is
|
|
4749
|
+
* refused with 409 `replacement_required`. Add the replacement first.
|
|
4750
|
+
* - While **auto top-up** is on, the last valid card cannot be removed either: 409
|
|
4751
|
+
* `autotopup_needs_card`. Turn auto top-up off first, or add another card.
|
|
4752
|
+
* - Removing the **default** makes another valid card the default first; `promotedDefault` is then
|
|
4753
|
+
* true and `methods` shows which one.
|
|
4754
|
+
*
|
|
4755
|
+
* Requires admin. Audited as `billing.card.remove`.
|
|
4756
|
+
*/
|
|
4757
|
+
post: operations["removeBillingPaymentMethod"];
|
|
4758
|
+
delete?: never;
|
|
4759
|
+
options?: never;
|
|
4760
|
+
head?: never;
|
|
4761
|
+
patch?: never;
|
|
4762
|
+
trace?: never;
|
|
4763
|
+
};
|
|
4644
4764
|
"/v1/orgs/{orgSlug}/billing/cancel": {
|
|
4645
4765
|
parameters: {
|
|
4646
4766
|
query?: never;
|
|
@@ -13254,6 +13374,52 @@ export interface components {
|
|
|
13254
13374
|
belowMicroCents: number;
|
|
13255
13375
|
/** Format: int64 */
|
|
13256
13376
|
microCents: number;
|
|
13377
|
+
/** @description The most automatic top-ups a day the organization agreed to; null is unlimited */
|
|
13378
|
+
perDay: number | null;
|
|
13379
|
+
};
|
|
13380
|
+
/**
|
|
13381
|
+
* @description Present when auto top-up is off because the payment provider refused a charge (not when an admin
|
|
13382
|
+
* turned it off). It stays until auto top-up is saved again. `provider_setting` is the payment
|
|
13383
|
+
* provider refusing automatic charges because of a setting on runlot's side — not the card;
|
|
13384
|
+
* manual top-up still works. `action_required` is a charge the bank wanted the cardholder to
|
|
13385
|
+
* confirm (3-D Secure), which cannot happen with nobody present. `billing_address` is an
|
|
13386
|
+
* incomplete billing address, which the provider needs to calculate tax.
|
|
13387
|
+
*/
|
|
13388
|
+
AIAutoTopupStopped: {
|
|
13389
|
+
/** Format: date-time */
|
|
13390
|
+
at: string;
|
|
13391
|
+
/** @enum {string} */
|
|
13392
|
+
reason: "provider_setting" | "card_declined" | "action_required" | "no_card" | "billing_address" | "charge_refused";
|
|
13393
|
+
};
|
|
13394
|
+
/** @description One saved card, as Polar reports it. Nothing here is stored by runlot. */
|
|
13395
|
+
PaymentMethod: {
|
|
13396
|
+
/** @description Polar's id, to name this card in a default change or a removal */
|
|
13397
|
+
id: string;
|
|
13398
|
+
/** @description `card`, `kr_card`, or another payment method type */
|
|
13399
|
+
type: string;
|
|
13400
|
+
/** @example visa */
|
|
13401
|
+
brand?: string;
|
|
13402
|
+
/** @example 4242 */
|
|
13403
|
+
last4?: string;
|
|
13404
|
+
expMonth?: number;
|
|
13405
|
+
expYear?: number;
|
|
13406
|
+
/** @description e.g. apple_pay, when the card came from a wallet */
|
|
13407
|
+
wallet?: string;
|
|
13408
|
+
/** @description The card automatic charges are made to */
|
|
13409
|
+
isDefault: boolean;
|
|
13410
|
+
/** @description Past its expiry month — it cannot be charged */
|
|
13411
|
+
expired: boolean;
|
|
13412
|
+
};
|
|
13413
|
+
PaymentMethodList: {
|
|
13414
|
+
/** @description Whether the billing address is enough for the payment provider to calculate tax — automatic charges need it as well as a card. Completed on the provider's page (`addBillingPaymentMethod`) */
|
|
13415
|
+
billingAddressComplete: boolean;
|
|
13416
|
+
/** @description false means the organization has no billing account with Polar yet — the first checkout creates it */
|
|
13417
|
+
customer: boolean;
|
|
13418
|
+
methods: components["schemas"]["PaymentMethod"][];
|
|
13419
|
+
};
|
|
13420
|
+
PaymentMethodChange: components["schemas"]["PaymentMethodList"] & {
|
|
13421
|
+
/** @description The removed card was the default, and another card became it */
|
|
13422
|
+
promotedDefault: boolean;
|
|
13257
13423
|
};
|
|
13258
13424
|
AICredit: {
|
|
13259
13425
|
/** @description false means AI credit is not available here — the top-up endpoints answer 501 */
|
|
@@ -13278,9 +13444,10 @@ export interface components {
|
|
|
13278
13444
|
/** @description When false, auto top-up cannot be turned on — your first top-up is what saves the card */
|
|
13279
13445
|
hasPaymentMethod: boolean;
|
|
13280
13446
|
autoTopup?: components["schemas"]["AIAutoTopup"];
|
|
13447
|
+
autoTopupStopped?: components["schemas"]["AIAutoTopupStopped"];
|
|
13281
13448
|
autoTopupsToday: number;
|
|
13282
|
-
/** @description
|
|
13283
|
-
autoTopupPerDay: number;
|
|
13449
|
+
/** @description The most automatic top-ups in one day — the organization's choice, 5 until it chooses. Null is unlimited */
|
|
13450
|
+
autoTopupPerDay: number | null;
|
|
13284
13451
|
};
|
|
13285
13452
|
StorageObject: {
|
|
13286
13453
|
/**
|
|
@@ -21645,6 +21812,8 @@ export interface operations {
|
|
|
21645
21812
|
belowMicroCents?: number;
|
|
21646
21813
|
/** Format: int64 */
|
|
21647
21814
|
microCents?: number;
|
|
21815
|
+
/** @description The most automatic top-ups a day, at least 1; null for unlimited. Left out, it is 5 */
|
|
21816
|
+
perDay?: number | null;
|
|
21648
21817
|
};
|
|
21649
21818
|
};
|
|
21650
21819
|
};
|
|
@@ -21677,7 +21846,7 @@ export interface operations {
|
|
|
21677
21846
|
};
|
|
21678
21847
|
};
|
|
21679
21848
|
403: components["responses"]["Forbidden"];
|
|
21680
|
-
/** @description `no_payment_method` —
|
|
21849
|
+
/** @description `no_payment_method` — the org has no valid saved card (read from Polar); `billing_address_required` — its billing address is incomplete. Fix either on the billing page first */
|
|
21681
21850
|
409: {
|
|
21682
21851
|
headers: {
|
|
21683
21852
|
[name: string]: unknown;
|
|
@@ -23326,6 +23495,202 @@ export interface operations {
|
|
|
23326
23495
|
};
|
|
23327
23496
|
};
|
|
23328
23497
|
};
|
|
23498
|
+
getBillingPaymentMethods: {
|
|
23499
|
+
parameters: {
|
|
23500
|
+
query?: never;
|
|
23501
|
+
header?: never;
|
|
23502
|
+
path: {
|
|
23503
|
+
orgSlug: components["parameters"]["OrgSlug"];
|
|
23504
|
+
};
|
|
23505
|
+
cookie?: never;
|
|
23506
|
+
};
|
|
23507
|
+
requestBody?: never;
|
|
23508
|
+
responses: {
|
|
23509
|
+
/** @description Saved cards */
|
|
23510
|
+
200: {
|
|
23511
|
+
headers: {
|
|
23512
|
+
[name: string]: unknown;
|
|
23513
|
+
};
|
|
23514
|
+
content: {
|
|
23515
|
+
"application/json": components["schemas"]["PaymentMethodList"];
|
|
23516
|
+
};
|
|
23517
|
+
};
|
|
23518
|
+
403: components["responses"]["Forbidden"];
|
|
23519
|
+
404: components["responses"]["NotFound"];
|
|
23520
|
+
/** @description `billing_off` */
|
|
23521
|
+
501: {
|
|
23522
|
+
headers: {
|
|
23523
|
+
[name: string]: unknown;
|
|
23524
|
+
};
|
|
23525
|
+
content?: never;
|
|
23526
|
+
};
|
|
23527
|
+
/** @description `billing_unavailable` */
|
|
23528
|
+
502: {
|
|
23529
|
+
headers: {
|
|
23530
|
+
[name: string]: unknown;
|
|
23531
|
+
};
|
|
23532
|
+
content?: never;
|
|
23533
|
+
};
|
|
23534
|
+
};
|
|
23535
|
+
};
|
|
23536
|
+
setBillingDefaultPaymentMethod: {
|
|
23537
|
+
parameters: {
|
|
23538
|
+
query?: never;
|
|
23539
|
+
header?: never;
|
|
23540
|
+
path: {
|
|
23541
|
+
orgSlug: components["parameters"]["OrgSlug"];
|
|
23542
|
+
};
|
|
23543
|
+
cookie?: never;
|
|
23544
|
+
};
|
|
23545
|
+
requestBody: {
|
|
23546
|
+
content: {
|
|
23547
|
+
"application/json": {
|
|
23548
|
+
id: string;
|
|
23549
|
+
};
|
|
23550
|
+
};
|
|
23551
|
+
};
|
|
23552
|
+
responses: {
|
|
23553
|
+
/** @description The cards after the change */
|
|
23554
|
+
200: {
|
|
23555
|
+
headers: {
|
|
23556
|
+
[name: string]: unknown;
|
|
23557
|
+
};
|
|
23558
|
+
content: {
|
|
23559
|
+
"application/json": components["schemas"]["PaymentMethodChange"];
|
|
23560
|
+
};
|
|
23561
|
+
};
|
|
23562
|
+
400: components["responses"]["BadRequest"];
|
|
23563
|
+
403: components["responses"]["Forbidden"];
|
|
23564
|
+
404: components["responses"]["NotFound"];
|
|
23565
|
+
/** @description `card_expired` */
|
|
23566
|
+
409: {
|
|
23567
|
+
headers: {
|
|
23568
|
+
[name: string]: unknown;
|
|
23569
|
+
};
|
|
23570
|
+
content?: never;
|
|
23571
|
+
};
|
|
23572
|
+
/** @description `billing_off` */
|
|
23573
|
+
501: {
|
|
23574
|
+
headers: {
|
|
23575
|
+
[name: string]: unknown;
|
|
23576
|
+
};
|
|
23577
|
+
content?: never;
|
|
23578
|
+
};
|
|
23579
|
+
/** @description `billing_unavailable` */
|
|
23580
|
+
502: {
|
|
23581
|
+
headers: {
|
|
23582
|
+
[name: string]: unknown;
|
|
23583
|
+
};
|
|
23584
|
+
content?: never;
|
|
23585
|
+
};
|
|
23586
|
+
};
|
|
23587
|
+
};
|
|
23588
|
+
addBillingPaymentMethod: {
|
|
23589
|
+
parameters: {
|
|
23590
|
+
query?: never;
|
|
23591
|
+
header?: never;
|
|
23592
|
+
path: {
|
|
23593
|
+
orgSlug: components["parameters"]["OrgSlug"];
|
|
23594
|
+
};
|
|
23595
|
+
cookie?: never;
|
|
23596
|
+
};
|
|
23597
|
+
requestBody: {
|
|
23598
|
+
content: {
|
|
23599
|
+
"application/json": {
|
|
23600
|
+
/** Format: uri */
|
|
23601
|
+
returnTo: string;
|
|
23602
|
+
};
|
|
23603
|
+
};
|
|
23604
|
+
};
|
|
23605
|
+
responses: {
|
|
23606
|
+
/** @description Portal session */
|
|
23607
|
+
200: {
|
|
23608
|
+
headers: {
|
|
23609
|
+
[name: string]: unknown;
|
|
23610
|
+
};
|
|
23611
|
+
content: {
|
|
23612
|
+
"application/json": {
|
|
23613
|
+
/** Format: uri */
|
|
23614
|
+
url: string;
|
|
23615
|
+
};
|
|
23616
|
+
};
|
|
23617
|
+
};
|
|
23618
|
+
400: components["responses"]["BadRequest"];
|
|
23619
|
+
403: components["responses"]["Forbidden"];
|
|
23620
|
+
/** @description `email_required` — the signed-in account has no email address */
|
|
23621
|
+
409: {
|
|
23622
|
+
headers: {
|
|
23623
|
+
[name: string]: unknown;
|
|
23624
|
+
};
|
|
23625
|
+
content?: never;
|
|
23626
|
+
};
|
|
23627
|
+
/** @description `billing_off` */
|
|
23628
|
+
501: {
|
|
23629
|
+
headers: {
|
|
23630
|
+
[name: string]: unknown;
|
|
23631
|
+
};
|
|
23632
|
+
content?: never;
|
|
23633
|
+
};
|
|
23634
|
+
/** @description `billing_unavailable` */
|
|
23635
|
+
502: {
|
|
23636
|
+
headers: {
|
|
23637
|
+
[name: string]: unknown;
|
|
23638
|
+
};
|
|
23639
|
+
content?: never;
|
|
23640
|
+
};
|
|
23641
|
+
};
|
|
23642
|
+
};
|
|
23643
|
+
removeBillingPaymentMethod: {
|
|
23644
|
+
parameters: {
|
|
23645
|
+
query?: never;
|
|
23646
|
+
header?: never;
|
|
23647
|
+
path: {
|
|
23648
|
+
orgSlug: components["parameters"]["OrgSlug"];
|
|
23649
|
+
};
|
|
23650
|
+
cookie?: never;
|
|
23651
|
+
};
|
|
23652
|
+
requestBody: {
|
|
23653
|
+
content: {
|
|
23654
|
+
"application/json": {
|
|
23655
|
+
id: string;
|
|
23656
|
+
};
|
|
23657
|
+
};
|
|
23658
|
+
};
|
|
23659
|
+
responses: {
|
|
23660
|
+
/** @description The cards after the removal */
|
|
23661
|
+
200: {
|
|
23662
|
+
headers: {
|
|
23663
|
+
[name: string]: unknown;
|
|
23664
|
+
};
|
|
23665
|
+
content: {
|
|
23666
|
+
"application/json": components["schemas"]["PaymentMethodChange"];
|
|
23667
|
+
};
|
|
23668
|
+
};
|
|
23669
|
+
403: components["responses"]["Forbidden"];
|
|
23670
|
+
404: components["responses"]["NotFound"];
|
|
23671
|
+
/** @description `replacement_required` or `autotopup_needs_card` */
|
|
23672
|
+
409: {
|
|
23673
|
+
headers: {
|
|
23674
|
+
[name: string]: unknown;
|
|
23675
|
+
};
|
|
23676
|
+
content?: never;
|
|
23677
|
+
};
|
|
23678
|
+
/** @description `billing_off` */
|
|
23679
|
+
501: {
|
|
23680
|
+
headers: {
|
|
23681
|
+
[name: string]: unknown;
|
|
23682
|
+
};
|
|
23683
|
+
content?: never;
|
|
23684
|
+
};
|
|
23685
|
+
/** @description `billing_unavailable` */
|
|
23686
|
+
502: {
|
|
23687
|
+
headers: {
|
|
23688
|
+
[name: string]: unknown;
|
|
23689
|
+
};
|
|
23690
|
+
content?: never;
|
|
23691
|
+
};
|
|
23692
|
+
};
|
|
23693
|
+
};
|
|
23329
23694
|
cancelBilling: {
|
|
23330
23695
|
parameters: {
|
|
23331
23696
|
query?: never;
|