@fonderie/client 0.11.0 → 0.12.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.
@@ -170,6 +170,10 @@ interface IRecordUsageInput {
170
170
 
171
171
  type IUpdatePlanInput = Partial<ICreatePlanInput>;
172
172
 
173
+ interface IWalletPreferencesInput {
174
+ spendPurchased: boolean;
175
+ }
176
+
173
177
  new BillingClient(http: HttpClient, tokens: TokenStore): BillingClient
174
178
  .setAccessToken(token: string | undefined): void
175
179
  .setWorkspaceId(workspaceId: string | undefined): void
@@ -183,6 +187,8 @@ new BillingClient(http: HttpClient, tokens: TokenStore): BillingClient
183
187
  .createPortalSession(): Promise<IApiResponse<IPortalUrlResult>>
184
188
  .recordUsage(input: IRecordUsageInput): Promise<IApiResponse<undefined>>
185
189
  .getUsage(metric: string, opts?: IReadOptions | undefined): Promise<IApiResponse<IUsageResult>>
190
+ .getWallet(opts?: IReadOptions | undefined): Promise<IApiResponse<IWalletResult>>
191
+ .setWalletPreferences(input: IWalletPreferencesInput): Promise<IApiResponse<IWalletResult>>
186
192
 
187
193
  interface IConfigAdminClientOptions {
188
194
  baseUrl: string;
@@ -948,6 +954,20 @@ interface IVerifyEmailResult {
948
954
  email: string;
949
955
  }
950
956
 
957
+ interface IWalletDTO {
958
+ balance: string;
959
+ currency: string;
960
+ precision: number;
961
+ granted?: string;
962
+ purchased?: string;
963
+ spendPurchased?: boolean;
964
+ grantedExpiresAt?: string | null;
965
+ }
966
+
967
+ interface IWalletResult {
968
+ wallet: IWalletDTO;
969
+ }
970
+
951
971
  interface IWebhookDeliveryDTO {
952
972
  id: string;
953
973
  eventId: string;
package/dist/index.cjs CHANGED
@@ -493,6 +493,25 @@ var BillingClient = class {
493
493
  bust: opts?.bust
494
494
  });
495
495
  }
496
+ // ── Wallet ─────────────────────────────────────────────────────────────────────
497
+ getWallet(opts) {
498
+ return this.http.request({
499
+ method: "GET",
500
+ path: "/billing/wallet",
501
+ token: this.tokens.get(),
502
+ workspaceId: this.workspaceId,
503
+ bust: opts?.bust
504
+ });
505
+ }
506
+ setWalletPreferences(input) {
507
+ return this.http.request({
508
+ method: "POST",
509
+ path: "/billing/wallet/preferences",
510
+ body: input,
511
+ token: this.tokens.get(),
512
+ workspaceId: this.workspaceId
513
+ });
514
+ }
496
515
  };
497
516
 
498
517
  // src/modules/customers.ts