@stackbe/sdk 0.11.1 → 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.
package/README.md CHANGED
@@ -298,6 +298,9 @@ const org = await stackbe.organizations.create({
298
298
  // List all organizations
299
299
  const orgs = await stackbe.organizations.list();
300
300
 
301
+ // List organizations for a specific customer (for org switchers)
302
+ const customerOrgs = await stackbe.organizations.listByCustomer('cust_123');
303
+
301
304
  // Get organization by ID
302
305
  const org = await stackbe.organizations.get('org_123');
303
306
 
package/dist/index.d.mts CHANGED
@@ -1502,6 +1502,17 @@ declare class OrganizationsClient {
1502
1502
  offset?: number;
1503
1503
  search?: string;
1504
1504
  }): Promise<Organization[]>;
1505
+ /**
1506
+ * List organizations where a specific customer is a member.
1507
+ * Useful for building org switchers or checking what orgs a user belongs to.
1508
+ *
1509
+ * @example
1510
+ * ```typescript
1511
+ * const orgs = await stackbe.organizations.listByCustomer('cust_123');
1512
+ * orgs.forEach(org => console.log(`${org.name} - ${org.members.find(m => m.customerId === 'cust_123')?.role}`));
1513
+ * ```
1514
+ */
1515
+ listByCustomer(customerId: string): Promise<Organization[]>;
1505
1516
  /**
1506
1517
  * Get an organization by ID.
1507
1518
  *
package/dist/index.d.ts CHANGED
@@ -1502,6 +1502,17 @@ declare class OrganizationsClient {
1502
1502
  offset?: number;
1503
1503
  search?: string;
1504
1504
  }): Promise<Organization[]>;
1505
+ /**
1506
+ * List organizations where a specific customer is a member.
1507
+ * Useful for building org switchers or checking what orgs a user belongs to.
1508
+ *
1509
+ * @example
1510
+ * ```typescript
1511
+ * const orgs = await stackbe.organizations.listByCustomer('cust_123');
1512
+ * orgs.forEach(org => console.log(`${org.name} - ${org.members.find(m => m.customerId === 'cust_123')?.role}`));
1513
+ * ```
1514
+ */
1515
+ listByCustomer(customerId: string): Promise<Organization[]>;
1505
1516
  /**
1506
1517
  * Get an organization by ID.
1507
1518
  *
package/dist/index.js CHANGED
@@ -1504,6 +1504,21 @@ var OrganizationsClient = class {
1504
1504
  const path = `/v1/apps/${this.appId}/admin/organizations${query ? `?${query}` : ""}`;
1505
1505
  return this.http.get(path);
1506
1506
  }
1507
+ /**
1508
+ * List organizations where a specific customer is a member.
1509
+ * Useful for building org switchers or checking what orgs a user belongs to.
1510
+ *
1511
+ * @example
1512
+ * ```typescript
1513
+ * const orgs = await stackbe.organizations.listByCustomer('cust_123');
1514
+ * orgs.forEach(org => console.log(`${org.name} - ${org.members.find(m => m.customerId === 'cust_123')?.role}`));
1515
+ * ```
1516
+ */
1517
+ async listByCustomer(customerId) {
1518
+ return this.http.get(
1519
+ `/v1/apps/${this.appId}/admin/organizations/by-customer/${customerId}`
1520
+ );
1521
+ }
1507
1522
  /**
1508
1523
  * Get an organization by ID.
1509
1524
  *
package/dist/index.mjs CHANGED
@@ -1463,6 +1463,21 @@ var OrganizationsClient = class {
1463
1463
  const path = `/v1/apps/${this.appId}/admin/organizations${query ? `?${query}` : ""}`;
1464
1464
  return this.http.get(path);
1465
1465
  }
1466
+ /**
1467
+ * List organizations where a specific customer is a member.
1468
+ * Useful for building org switchers or checking what orgs a user belongs to.
1469
+ *
1470
+ * @example
1471
+ * ```typescript
1472
+ * const orgs = await stackbe.organizations.listByCustomer('cust_123');
1473
+ * orgs.forEach(org => console.log(`${org.name} - ${org.members.find(m => m.customerId === 'cust_123')?.role}`));
1474
+ * ```
1475
+ */
1476
+ async listByCustomer(customerId) {
1477
+ return this.http.get(
1478
+ `/v1/apps/${this.appId}/admin/organizations/by-customer/${customerId}`
1479
+ );
1480
+ }
1466
1481
  /**
1467
1482
  * Get an organization by ID.
1468
1483
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackbe/sdk",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "Official JavaScript/TypeScript SDK for StackBE - the billing backend for your side project",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",