@layr-labs/ecloud-sdk 1.0.0-dev.4 → 1.0.0-dev.5

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/browser.cjs CHANGED
@@ -744,7 +744,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
744
744
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
745
745
  var CanUpdateAppProfilePermission = "0x036fef61";
746
746
  function getDefaultClientId() {
747
- const version = true ? "1.0.0-dev.4" : "0.0.0";
747
+ const version = true ? "1.0.0-dev.5" : "0.0.0";
748
748
  return `ecloud-sdk/v${version}`;
749
749
  }
750
750
  var UserApiClient = class {
@@ -1347,6 +1347,63 @@ var BillingApiClient = class {
1347
1347
  return resp.json();
1348
1348
  }
1349
1349
  // ==========================================================================
1350
+ // Admin - Coupon Methods
1351
+ // ==========================================================================
1352
+ async createCoupon(amountCents) {
1353
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons`;
1354
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { amountCents });
1355
+ return resp.json();
1356
+ }
1357
+ async listCoupons(opts) {
1358
+ const params = new URLSearchParams();
1359
+ if (opts?.offset !== void 0) params.set("offset", opts.offset.toString());
1360
+ if (opts?.limit !== void 0) params.set("limit", opts.limit.toString());
1361
+ if (opts?.active !== void 0) params.set("active", opts.active.toString());
1362
+ if (opts?.redeemed !== void 0) params.set("redeemed", opts.redeemed.toString());
1363
+ const qs = params.toString();
1364
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons${qs ? `?${qs}` : ""}`;
1365
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
1366
+ return resp.json();
1367
+ }
1368
+ async getCoupon(id) {
1369
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}`;
1370
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
1371
+ return resp.json();
1372
+ }
1373
+ async deactivateCoupon(id) {
1374
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/deactivate`;
1375
+ await this.makeAuthenticatedRequest(endpoint, "POST", "compute");
1376
+ }
1377
+ async redeemCouponForUser(id, address) {
1378
+ const endpoint = `${this.config.billingApiServerURL}/admin/coupons/${id}/redeem`;
1379
+ await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
1380
+ }
1381
+ // ==========================================================================
1382
+ // Admin - Admin Management Methods
1383
+ // ==========================================================================
1384
+ async addAdmin(address) {
1385
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
1386
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { address });
1387
+ return resp.json();
1388
+ }
1389
+ async removeAdmin(address) {
1390
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins/${address}`;
1391
+ await this.makeAuthenticatedRequest(endpoint, "DELETE", "compute");
1392
+ }
1393
+ async listAdmins() {
1394
+ const endpoint = `${this.config.billingApiServerURL}/admin/admins`;
1395
+ const resp = await this.makeAuthenticatedRequest(endpoint, "GET", "compute");
1396
+ return resp.json();
1397
+ }
1398
+ // ==========================================================================
1399
+ // User - Coupon Redemption
1400
+ // ==========================================================================
1401
+ async redeemCoupon(code) {
1402
+ const endpoint = `${this.config.billingApiServerURL}/v1/coupons/redeem`;
1403
+ const resp = await this.makeAuthenticatedRequest(endpoint, "POST", "compute", { code });
1404
+ return resp.json();
1405
+ }
1406
+ // ==========================================================================
1350
1407
  // Internal Methods
1351
1408
  // ==========================================================================
1352
1409
  /**