@stackbe/sdk 0.8.0 → 0.8.1

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.mts CHANGED
@@ -1256,7 +1256,8 @@ declare class OrganizationsClient {
1256
1256
  role: 'admin' | 'member';
1257
1257
  }): Promise<OrganizationMember>;
1258
1258
  /**
1259
- * Send an invite to join an organization.
1259
+ * Send an invite email to join an organization.
1260
+ * The recipient will receive a magic link.
1260
1261
  *
1261
1262
  * @example
1262
1263
  * ```typescript
@@ -1267,6 +1268,21 @@ declare class OrganizationsClient {
1267
1268
  * ```
1268
1269
  */
1269
1270
  invite(orgId: string, options: InviteMemberOptions): Promise<OrganizationInvite>;
1271
+ /**
1272
+ * List all members and pending invites for an organization.
1273
+ *
1274
+ * @example
1275
+ * ```typescript
1276
+ * const { members, invites } = await stackbe.organizations.listMembers('org_123');
1277
+ *
1278
+ * members.forEach(m => console.log(`${m.customer.email} - ${m.role}`));
1279
+ * invites.forEach(i => console.log(`Pending: ${i.email}`));
1280
+ * ```
1281
+ */
1282
+ listMembers(orgId: string): Promise<{
1283
+ members: OrganizationMember[];
1284
+ invites: OrganizationInvite[];
1285
+ }>;
1270
1286
  /**
1271
1287
  * List pending invites for an organization.
1272
1288
  *
package/dist/index.d.ts CHANGED
@@ -1256,7 +1256,8 @@ declare class OrganizationsClient {
1256
1256
  role: 'admin' | 'member';
1257
1257
  }): Promise<OrganizationMember>;
1258
1258
  /**
1259
- * Send an invite to join an organization.
1259
+ * Send an invite email to join an organization.
1260
+ * The recipient will receive a magic link.
1260
1261
  *
1261
1262
  * @example
1262
1263
  * ```typescript
@@ -1267,6 +1268,21 @@ declare class OrganizationsClient {
1267
1268
  * ```
1268
1269
  */
1269
1270
  invite(orgId: string, options: InviteMemberOptions): Promise<OrganizationInvite>;
1271
+ /**
1272
+ * List all members and pending invites for an organization.
1273
+ *
1274
+ * @example
1275
+ * ```typescript
1276
+ * const { members, invites } = await stackbe.organizations.listMembers('org_123');
1277
+ *
1278
+ * members.forEach(m => console.log(`${m.customer.email} - ${m.role}`));
1279
+ * invites.forEach(i => console.log(`Pending: ${i.email}`));
1280
+ * ```
1281
+ */
1282
+ listMembers(orgId: string): Promise<{
1283
+ members: OrganizationMember[];
1284
+ invites: OrganizationInvite[];
1285
+ }>;
1270
1286
  /**
1271
1287
  * List pending invites for an organization.
1272
1288
  *
package/dist/index.js CHANGED
@@ -1333,7 +1333,8 @@ var OrganizationsClient = class {
1333
1333
  );
1334
1334
  }
1335
1335
  /**
1336
- * Send an invite to join an organization.
1336
+ * Send an invite email to join an organization.
1337
+ * The recipient will receive a magic link.
1337
1338
  *
1338
1339
  * @example
1339
1340
  * ```typescript
@@ -1345,10 +1346,26 @@ var OrganizationsClient = class {
1345
1346
  */
1346
1347
  async invite(orgId, options) {
1347
1348
  return this.http.post(
1348
- `/v1/apps/${this.appId}/admin/organizations/${orgId}/invites`,
1349
+ `/v1/apps/${this.appId}/admin/organizations/${orgId}/members/invite`,
1349
1350
  options
1350
1351
  );
1351
1352
  }
1353
+ /**
1354
+ * List all members and pending invites for an organization.
1355
+ *
1356
+ * @example
1357
+ * ```typescript
1358
+ * const { members, invites } = await stackbe.organizations.listMembers('org_123');
1359
+ *
1360
+ * members.forEach(m => console.log(`${m.customer.email} - ${m.role}`));
1361
+ * invites.forEach(i => console.log(`Pending: ${i.email}`));
1362
+ * ```
1363
+ */
1364
+ async listMembers(orgId) {
1365
+ return this.http.get(
1366
+ `/v1/apps/${this.appId}/admin/organizations/${orgId}/members`
1367
+ );
1368
+ }
1352
1369
  /**
1353
1370
  * List pending invites for an organization.
1354
1371
  *
@@ -1358,9 +1375,8 @@ var OrganizationsClient = class {
1358
1375
  * ```
1359
1376
  */
1360
1377
  async listInvites(orgId) {
1361
- return this.http.get(
1362
- `/v1/apps/${this.appId}/admin/organizations/${orgId}/invites`
1363
- );
1378
+ const { invites } = await this.listMembers(orgId);
1379
+ return invites;
1364
1380
  }
1365
1381
  /**
1366
1382
  * Cancel a pending invite.
@@ -1372,7 +1388,7 @@ var OrganizationsClient = class {
1372
1388
  */
1373
1389
  async cancelInvite(orgId, inviteId) {
1374
1390
  return this.http.delete(
1375
- `/v1/apps/${this.appId}/admin/organizations/${orgId}/invites/${inviteId}`
1391
+ `/v1/apps/${this.appId}/admin/organizations/${orgId}/members/${inviteId}`
1376
1392
  );
1377
1393
  }
1378
1394
  };
package/dist/index.mjs CHANGED
@@ -1294,7 +1294,8 @@ var OrganizationsClient = class {
1294
1294
  );
1295
1295
  }
1296
1296
  /**
1297
- * Send an invite to join an organization.
1297
+ * Send an invite email to join an organization.
1298
+ * The recipient will receive a magic link.
1298
1299
  *
1299
1300
  * @example
1300
1301
  * ```typescript
@@ -1306,10 +1307,26 @@ var OrganizationsClient = class {
1306
1307
  */
1307
1308
  async invite(orgId, options) {
1308
1309
  return this.http.post(
1309
- `/v1/apps/${this.appId}/admin/organizations/${orgId}/invites`,
1310
+ `/v1/apps/${this.appId}/admin/organizations/${orgId}/members/invite`,
1310
1311
  options
1311
1312
  );
1312
1313
  }
1314
+ /**
1315
+ * List all members and pending invites for an organization.
1316
+ *
1317
+ * @example
1318
+ * ```typescript
1319
+ * const { members, invites } = await stackbe.organizations.listMembers('org_123');
1320
+ *
1321
+ * members.forEach(m => console.log(`${m.customer.email} - ${m.role}`));
1322
+ * invites.forEach(i => console.log(`Pending: ${i.email}`));
1323
+ * ```
1324
+ */
1325
+ async listMembers(orgId) {
1326
+ return this.http.get(
1327
+ `/v1/apps/${this.appId}/admin/organizations/${orgId}/members`
1328
+ );
1329
+ }
1313
1330
  /**
1314
1331
  * List pending invites for an organization.
1315
1332
  *
@@ -1319,9 +1336,8 @@ var OrganizationsClient = class {
1319
1336
  * ```
1320
1337
  */
1321
1338
  async listInvites(orgId) {
1322
- return this.http.get(
1323
- `/v1/apps/${this.appId}/admin/organizations/${orgId}/invites`
1324
- );
1339
+ const { invites } = await this.listMembers(orgId);
1340
+ return invites;
1325
1341
  }
1326
1342
  /**
1327
1343
  * Cancel a pending invite.
@@ -1333,7 +1349,7 @@ var OrganizationsClient = class {
1333
1349
  */
1334
1350
  async cancelInvite(orgId, inviteId) {
1335
1351
  return this.http.delete(
1336
- `/v1/apps/${this.appId}/admin/organizations/${orgId}/invites/${inviteId}`
1352
+ `/v1/apps/${this.appId}/admin/organizations/${orgId}/members/${inviteId}`
1337
1353
  );
1338
1354
  }
1339
1355
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackbe/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
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",