@naturali/sdk 0.170.4 → 0.171.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/dist/index.cjs CHANGED
@@ -5428,11 +5428,13 @@ var Users = class {
5428
5428
  });
5429
5429
  }
5430
5430
  /**
5431
- * Start a credit top-up
5431
+ * Top up credit
5432
5432
  *
5433
- * A hosted card checkout that buys model credit for the caller's account. Send the caller to `checkout_url`; once the card is charged the full amount is added to `credit_balance_usd` as purchased credit, which never expires. The card fee is not deducted.
5433
+ * Buys model credit for the caller's account. Once the card is charged the full amount is added to `credit_balance_usd` as purchased credit, which never expires. The card fee is not deducted. Charged in US dollars.
5434
5434
  *
5435
- * Charged in US dollars. Creating a top-up charges nothing, and one left unpaid lapses at `expires_at`. After paying, the browser returns to the console's billing page.
5435
+ * With `saved_card: true` the saved card is charged at once and the answer is `status: paid`. When the card needs authentication or is declined, nothing is charged and the answer falls back to a checkout.
5436
+ *
5437
+ * A checkout (`status: checkout`) is a hosted page: send the caller to `checkout_url`. Creating it charges nothing, and one left unpaid lapses at `expires_at`. After paying, the browser returns to the console's billing page.
5436
5438
  *
5437
5439
  */
5438
5440
  static createCurrentUserTopUp(options) {
package/dist/index.d.cts CHANGED
@@ -8415,24 +8415,32 @@ type TopUpCreate = {
8415
8415
  * US dollars to buy, in whole cents.
8416
8416
  */
8417
8417
  amount_usd: number;
8418
+ /**
8419
+ * Charge the saved card now instead of opening a checkout.
8420
+ */
8421
+ saved_card?: boolean;
8418
8422
  };
8419
8423
  type TopUp = {
8420
8424
  /**
8421
- * The checkout's ID at the payment provider.
8425
+ * The payment's or the checkout's ID at the payment provider.
8422
8426
  */
8423
8427
  id: string;
8424
8428
  /**
8425
- * What the checkout charges, and what it credits once paid.
8429
+ * What is charged, and what is credited once paid.
8426
8430
  */
8427
8431
  amount_usd: number;
8428
8432
  /**
8429
- * The hosted page that takes the card.
8433
+ * `paid`: the saved card was charged and the credit added. `checkout`: nothing is charged until the caller pays at `checkout_url`.
8430
8434
  */
8431
- checkout_url: string;
8435
+ status: 'paid' | 'checkout';
8432
8436
  /**
8433
- * When an unpaid checkout lapses.
8437
+ * The hosted page that takes the card; `null` when paid.
8434
8438
  */
8435
- expires_at: Date;
8439
+ checkout_url: string | null;
8440
+ /**
8441
+ * When an unpaid checkout lapses; `null` when paid.
8442
+ */
8443
+ expires_at: Date | null;
8436
8444
  };
8437
8445
  type PaymentMethod = {
8438
8446
  brand: string;
@@ -24151,6 +24159,10 @@ type CreateCurrentUserTopUpErrors = {
24151
24159
  * Missing or invalid credentials.
24152
24160
  */
24153
24161
  401: ErrorResponse;
24162
+ /**
24163
+ * `saved_card` with no saved card (`payment_method_required`).
24164
+ */
24165
+ 409: ErrorResponse;
24154
24166
  /**
24155
24167
  * The payment provider could not be reached (`payment_provider_error`). Nothing was charged.
24156
24168
  */
@@ -24163,7 +24175,7 @@ type CreateCurrentUserTopUpErrors = {
24163
24175
  type CreateCurrentUserTopUpError = CreateCurrentUserTopUpErrors[keyof CreateCurrentUserTopUpErrors];
24164
24176
  type CreateCurrentUserTopUpResponses = {
24165
24177
  /**
24166
- * The checkout to send the caller to.
24178
+ * The paid top-up, or the checkout to send the caller to.
24167
24179
  */
24168
24180
  201: TopUp;
24169
24181
  };
@@ -27579,11 +27591,13 @@ export declare class Users {
27579
27591
  */
27580
27592
  static getCurrentUserStatement<ThrowOnError extends boolean = false>(options: Options<GetCurrentUserStatementData, ThrowOnError>): RequestResult<GetCurrentUserStatementResponses, GetCurrentUserStatementErrors, ThrowOnError>;
27581
27593
  /**
27582
- * Start a credit top-up
27594
+ * Top up credit
27595
+ *
27596
+ * Buys model credit for the caller's account. Once the card is charged the full amount is added to `credit_balance_usd` as purchased credit, which never expires. The card fee is not deducted. Charged in US dollars.
27583
27597
  *
27584
- * A hosted card checkout that buys model credit for the caller's account. Send the caller to `checkout_url`; once the card is charged the full amount is added to `credit_balance_usd` as purchased credit, which never expires. The card fee is not deducted.
27598
+ * With `saved_card: true` the saved card is charged at once and the answer is `status: paid`. When the card needs authentication or is declined, nothing is charged and the answer falls back to a checkout.
27585
27599
  *
27586
- * Charged in US dollars. Creating a top-up charges nothing, and one left unpaid lapses at `expires_at`. After paying, the browser returns to the console's billing page.
27600
+ * A checkout (`status: checkout`) is a hosted page: send the caller to `checkout_url`. Creating it charges nothing, and one left unpaid lapses at `expires_at`. After paying, the browser returns to the console's billing page.
27587
27601
  *
27588
27602
  */
27589
27603
  static createCurrentUserTopUp<ThrowOnError extends boolean = false>(options: Options<CreateCurrentUserTopUpData, ThrowOnError>): RequestResult<CreateCurrentUserTopUpResponses, CreateCurrentUserTopUpErrors, ThrowOnError>;
package/dist/index.d.mts CHANGED
@@ -8415,24 +8415,32 @@ type TopUpCreate = {
8415
8415
  * US dollars to buy, in whole cents.
8416
8416
  */
8417
8417
  amount_usd: number;
8418
+ /**
8419
+ * Charge the saved card now instead of opening a checkout.
8420
+ */
8421
+ saved_card?: boolean;
8418
8422
  };
8419
8423
  type TopUp = {
8420
8424
  /**
8421
- * The checkout's ID at the payment provider.
8425
+ * The payment's or the checkout's ID at the payment provider.
8422
8426
  */
8423
8427
  id: string;
8424
8428
  /**
8425
- * What the checkout charges, and what it credits once paid.
8429
+ * What is charged, and what is credited once paid.
8426
8430
  */
8427
8431
  amount_usd: number;
8428
8432
  /**
8429
- * The hosted page that takes the card.
8433
+ * `paid`: the saved card was charged and the credit added. `checkout`: nothing is charged until the caller pays at `checkout_url`.
8430
8434
  */
8431
- checkout_url: string;
8435
+ status: 'paid' | 'checkout';
8432
8436
  /**
8433
- * When an unpaid checkout lapses.
8437
+ * The hosted page that takes the card; `null` when paid.
8434
8438
  */
8435
- expires_at: Date;
8439
+ checkout_url: string | null;
8440
+ /**
8441
+ * When an unpaid checkout lapses; `null` when paid.
8442
+ */
8443
+ expires_at: Date | null;
8436
8444
  };
8437
8445
  type PaymentMethod = {
8438
8446
  brand: string;
@@ -24151,6 +24159,10 @@ type CreateCurrentUserTopUpErrors = {
24151
24159
  * Missing or invalid credentials.
24152
24160
  */
24153
24161
  401: ErrorResponse;
24162
+ /**
24163
+ * `saved_card` with no saved card (`payment_method_required`).
24164
+ */
24165
+ 409: ErrorResponse;
24154
24166
  /**
24155
24167
  * The payment provider could not be reached (`payment_provider_error`). Nothing was charged.
24156
24168
  */
@@ -24163,7 +24175,7 @@ type CreateCurrentUserTopUpErrors = {
24163
24175
  type CreateCurrentUserTopUpError = CreateCurrentUserTopUpErrors[keyof CreateCurrentUserTopUpErrors];
24164
24176
  type CreateCurrentUserTopUpResponses = {
24165
24177
  /**
24166
- * The checkout to send the caller to.
24178
+ * The paid top-up, or the checkout to send the caller to.
24167
24179
  */
24168
24180
  201: TopUp;
24169
24181
  };
@@ -27579,11 +27591,13 @@ export declare class Users {
27579
27591
  */
27580
27592
  static getCurrentUserStatement<ThrowOnError extends boolean = false>(options: Options<GetCurrentUserStatementData, ThrowOnError>): RequestResult<GetCurrentUserStatementResponses, GetCurrentUserStatementErrors, ThrowOnError>;
27581
27593
  /**
27582
- * Start a credit top-up
27594
+ * Top up credit
27595
+ *
27596
+ * Buys model credit for the caller's account. Once the card is charged the full amount is added to `credit_balance_usd` as purchased credit, which never expires. The card fee is not deducted. Charged in US dollars.
27583
27597
  *
27584
- * A hosted card checkout that buys model credit for the caller's account. Send the caller to `checkout_url`; once the card is charged the full amount is added to `credit_balance_usd` as purchased credit, which never expires. The card fee is not deducted.
27598
+ * With `saved_card: true` the saved card is charged at once and the answer is `status: paid`. When the card needs authentication or is declined, nothing is charged and the answer falls back to a checkout.
27585
27599
  *
27586
- * Charged in US dollars. Creating a top-up charges nothing, and one left unpaid lapses at `expires_at`. After paying, the browser returns to the console's billing page.
27600
+ * A checkout (`status: checkout`) is a hosted page: send the caller to `checkout_url`. Creating it charges nothing, and one left unpaid lapses at `expires_at`. After paying, the browser returns to the console's billing page.
27587
27601
  *
27588
27602
  */
27589
27603
  static createCurrentUserTopUp<ThrowOnError extends boolean = false>(options: Options<CreateCurrentUserTopUpData, ThrowOnError>): RequestResult<CreateCurrentUserTopUpResponses, CreateCurrentUserTopUpErrors, ThrowOnError>;
package/dist/index.mjs CHANGED
@@ -5427,11 +5427,13 @@ var Users = class {
5427
5427
  });
5428
5428
  }
5429
5429
  /**
5430
- * Start a credit top-up
5430
+ * Top up credit
5431
5431
  *
5432
- * A hosted card checkout that buys model credit for the caller's account. Send the caller to `checkout_url`; once the card is charged the full amount is added to `credit_balance_usd` as purchased credit, which never expires. The card fee is not deducted.
5432
+ * Buys model credit for the caller's account. Once the card is charged the full amount is added to `credit_balance_usd` as purchased credit, which never expires. The card fee is not deducted. Charged in US dollars.
5433
5433
  *
5434
- * Charged in US dollars. Creating a top-up charges nothing, and one left unpaid lapses at `expires_at`. After paying, the browser returns to the console's billing page.
5434
+ * With `saved_card: true` the saved card is charged at once and the answer is `status: paid`. When the card needs authentication or is declined, nothing is charged and the answer falls back to a checkout.
5435
+ *
5436
+ * A checkout (`status: checkout`) is a hosted page: send the caller to `checkout_url`. Creating it charges nothing, and one left unpaid lapses at `expires_at`. After paying, the browser returns to the console's billing page.
5435
5437
  *
5436
5438
  */
5437
5439
  static createCurrentUserTopUp(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.170.4",
3
+ "version": "0.171.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@hey-api/openapi-ts": "^0.99.0",
34
- "@naturali/api": "0.170.4",
34
+ "@naturali/api": "0.171.0",
35
35
  "@ttoss/openapi-codegen": "^0.5.0",
36
36
  "@types/node": "^26.5.1",
37
37
  "tsdown": "^0.23.0",