@izak0s/spacebring-api 1.13.0 → 2.1.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
@@ -15,7 +15,7 @@ A fully-typed TypeScript client for the [Spacebring](https://www.spacebring.com)
15
15
 
16
16
  ## Features
17
17
 
18
- - **<!-- coverage -->163 operations across 20 resource groups<!-- /coverage -->** — the full Spacebring API surface
18
+ - **<!-- coverage -->182 operations across 21 resource groups<!-- /coverage -->** — the full Spacebring API surface
19
19
  - **Auto-generated** from the official OpenAPI spec — types and facade regenerate anytime the spec changes
20
20
  - **Nested, discoverable API** — `sb.billing.invoices.pay(id)`, `sb.visitors.visits.checkIn(body)`
21
21
  - **Auto-pagination** — every paginated list endpoint has an `iterate()` async generator that walks `nextPageToken` for you
package/dist/index.cjs CHANGED
@@ -1221,6 +1221,16 @@ function createContracts(client, defaults) {
1221
1221
  async create(contract, options) {
1222
1222
  return unwrapProp(await client.POST("/contracts/v1", { body: { contract }, signal: options?.signal }), "contract", "POST /contracts/v1");
1223
1223
  },
1224
+ /**
1225
+ * Update a contract
1226
+ *
1227
+ * @param contractId The id of the contract.
1228
+ * @param contract The `contract` payload.
1229
+ * @param options Request options (abort signal).
1230
+ */
1231
+ async update(contractId, contract, options) {
1232
+ return unwrap(await client.PATCH("/contracts/v1/{contractId}", { params: { path: { contractId } }, body: { contract }, signal: options?.signal }), "PATCH /contracts/v1/{contractId}");
1233
+ },
1224
1234
  /**
1225
1235
  * Delete a contract
1226
1236
  *
@@ -1230,6 +1240,18 @@ function createContracts(client, defaults) {
1230
1240
  async delete(contractId, options) {
1231
1241
  return unwrap(await client.DELETE("/contracts/v1/{contractId}", { params: { path: { contractId } }, signal: options?.signal }), "DELETE /contracts/v1/{contractId}");
1232
1242
  },
1243
+ /**
1244
+ * Decline a contract
1245
+ *
1246
+ * Mark a contract signer as declined. Declining also declines the contract.
1247
+ *
1248
+ * @param contractId The id of the contract.
1249
+ * @param signerId The id of the contract signer.
1250
+ * @param options Request options (abort signal).
1251
+ */
1252
+ async declineContract(contractId, signerId, options) {
1253
+ return unwrap(await client.PUT("/contracts/v1/{contractId}/signers/{signerId}/decline", { params: { path: { contractId, signerId } }, signal: options?.signal }), "PUT /contracts/v1/{contractId}/signers/{signerId}/decline");
1254
+ },
1233
1255
  /**
1234
1256
  * Issue a contract
1235
1257
  *
@@ -1240,6 +1262,29 @@ function createContracts(client, defaults) {
1240
1262
  async issue(contractId, signatureMethod, options) {
1241
1263
  return unwrapProp(await client.POST("/contracts/v1/{contractId}/issue", { params: { path: { contractId } }, body: { signatureMethod }, signal: options?.signal }), "contract", "POST /contracts/v1/{contractId}/issue");
1242
1264
  },
1265
+ /**
1266
+ * Resend a contract
1267
+ *
1268
+ * Resend the signature request email to the next pending signer of an issued eSignature contract.
1269
+ *
1270
+ * @param contractId The id of the contract.
1271
+ * @param options Request options (abort signal).
1272
+ */
1273
+ async resend(contractId, options) {
1274
+ return unwrap(await client.POST("/contracts/v1/{contractId}/resend", { params: { path: { contractId } }, signal: options?.signal }), "POST /contracts/v1/{contractId}/resend");
1275
+ },
1276
+ /**
1277
+ * Sign a contract
1278
+ *
1279
+ * Mark a contract signer as signed. When all signers have signed, the contract becomes signed.
1280
+ *
1281
+ * @param contractId The id of the contract.
1282
+ * @param signerId The id of the contract signer.
1283
+ * @param options Request options (abort signal).
1284
+ */
1285
+ async signContract(contractId, signerId, options) {
1286
+ return unwrap(await client.PUT("/contracts/v1/{contractId}/signers/{signerId}/sign", { params: { path: { contractId, signerId } }, signal: options?.signal }), "PUT /contracts/v1/{contractId}/signers/{signerId}/sign");
1287
+ },
1243
1288
  /**
1244
1289
  * Terminate a contract
1245
1290
  *
@@ -1249,6 +1294,80 @@ function createContracts(client, defaults) {
1249
1294
  */
1250
1295
  async terminate(contractId, reason, options) {
1251
1296
  return unwrap(await client.PATCH("/contracts/v1/{contractId}/terminate", { params: { path: { contractId } }, body: { reason }, signal: options?.signal }), "PATCH /contracts/v1/{contractId}/terminate");
1297
+ },
1298
+ templates: {
1299
+ /**
1300
+ * Retrieve templates
1301
+ *
1302
+ * Retrieve all contract templates in the location.
1303
+ */
1304
+ async list(query, options) {
1305
+ return unwrap(await client.GET("/contracts/templates/v1", { params: { query }, signal: options?.signal }), "GET /contracts/templates/v1");
1306
+ },
1307
+ /**
1308
+ * Retrieve templates — iterates every item across all pages.
1309
+ *
1310
+ * Retrieve all contract templates in the location.
1311
+ */
1312
+ iterate(query, options) {
1313
+ return paginate(
1314
+ async (nextPageToken) => unwrap(await client.GET("/contracts/templates/v1", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /contracts/templates/v1"),
1315
+ "templates"
1316
+ );
1317
+ },
1318
+ /**
1319
+ * Retrieve a template
1320
+ *
1321
+ * Retrieve a contract template.
1322
+ *
1323
+ * @param templateId The id of the template.
1324
+ * @param options Request options (abort signal).
1325
+ */
1326
+ async get(templateId, options) {
1327
+ return unwrapProp(await client.GET("/contracts/templates/v1/{templateId}", { params: { path: { templateId } }, signal: options?.signal }), "template", "GET /contracts/templates/v1/{templateId}");
1328
+ },
1329
+ /**
1330
+ * Create a template
1331
+ *
1332
+ * Create a contract template from an uploaded file.
1333
+ */
1334
+ async create(template, options) {
1335
+ return unwrapProp(await client.POST("/contracts/templates/v1", { body: { template }, signal: options?.signal }), "template", "POST /contracts/templates/v1");
1336
+ },
1337
+ /**
1338
+ * Update a template
1339
+ *
1340
+ * Update a contract template.
1341
+ *
1342
+ * @param templateId The id of the template.
1343
+ * @param template The `template` payload.
1344
+ * @param options Request options (abort signal).
1345
+ */
1346
+ async update(templateId, template, options) {
1347
+ return unwrap(await client.PATCH("/contracts/templates/v1/{templateId}", { params: { path: { templateId } }, body: { template }, signal: options?.signal }), "PATCH /contracts/templates/v1/{templateId}");
1348
+ },
1349
+ /**
1350
+ * Delete a template
1351
+ *
1352
+ * Delete a contract template.
1353
+ *
1354
+ * @param templateId The id of the template.
1355
+ * @param options Request options (abort signal).
1356
+ */
1357
+ async delete(templateId, options) {
1358
+ return unwrap(await client.DELETE("/contracts/templates/v1/{templateId}", { params: { path: { templateId } }, signal: options?.signal }), "DELETE /contracts/templates/v1/{templateId}");
1359
+ },
1360
+ /**
1361
+ * Duplicate a template
1362
+ *
1363
+ * Duplicate a contract template, creating a copy with the same title and file.
1364
+ *
1365
+ * @param templateId The id of the template.
1366
+ * @param options Request options (abort signal).
1367
+ */
1368
+ async duplicate(templateId, options) {
1369
+ return unwrapProp(await client.POST("/contracts/templates/v1/{templateId}/duplicate", { params: { path: { templateId } }, signal: options?.signal }), "template", "POST /contracts/templates/v1/{templateId}/duplicate");
1370
+ }
1252
1371
  }
1253
1372
  };
1254
1373
  }
@@ -1256,6 +1375,25 @@ function createContracts(client, defaults) {
1256
1375
  // src/generated/resources/discounts.ts
1257
1376
  function createDiscounts(client, defaults) {
1258
1377
  return {
1378
+ /**
1379
+ * Retrieve redemptions — iterates every item across all pages.
1380
+ *
1381
+ * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1382
+ */
1383
+ iterateRedemptions(query, options) {
1384
+ return paginate(
1385
+ async (nextPageToken) => unwrap(await client.GET("/discounts/v1/redemptions", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /discounts/v1/redemptions"),
1386
+ "redemptions"
1387
+ );
1388
+ },
1389
+ /**
1390
+ * Retrieve redemptions
1391
+ *
1392
+ * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1393
+ */
1394
+ async listRedemptions(query, options) {
1395
+ return unwrap(await client.GET("/discounts/v1/redemptions", { params: { query }, signal: options?.signal }), "GET /discounts/v1/redemptions");
1396
+ },
1259
1397
  coupons: {
1260
1398
  /**
1261
1399
  * Retrieve coupons
@@ -1263,7 +1401,7 @@ function createDiscounts(client, defaults) {
1263
1401
  * Retrieve all coupons in the location.
1264
1402
  */
1265
1403
  async list(query, options) {
1266
- return unwrap(await client.GET("/discounts/coupons/v1", { params: { query }, signal: options?.signal }), "GET /discounts/coupons/v1");
1404
+ return unwrap(await client.GET("/discounts/v1/coupons", { params: { query }, signal: options?.signal }), "GET /discounts/v1/coupons");
1267
1405
  },
1268
1406
  /**
1269
1407
  * Retrieve coupons — iterates every item across all pages.
@@ -1272,7 +1410,7 @@ function createDiscounts(client, defaults) {
1272
1410
  */
1273
1411
  iterate(query, options) {
1274
1412
  return paginate(
1275
- async (nextPageToken) => unwrap(await client.GET("/discounts/coupons/v1", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /discounts/coupons/v1"),
1413
+ async (nextPageToken) => unwrap(await client.GET("/discounts/v1/coupons", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /discounts/v1/coupons"),
1276
1414
  "coupons"
1277
1415
  );
1278
1416
  },
@@ -1283,11 +1421,11 @@ function createDiscounts(client, defaults) {
1283
1421
  * @param options Request options (abort signal).
1284
1422
  */
1285
1423
  async get(id, options) {
1286
- return unwrapProp(await client.GET("/discounts/coupons/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "coupon", "GET /discounts/coupons/v1/{id}");
1424
+ return unwrapProp(await client.GET("/discounts/v1/coupons/{id}", { params: { path: { id } }, signal: options?.signal }), "coupon", "GET /discounts/v1/coupons/{id}");
1287
1425
  },
1288
1426
  /** Create a coupon */
1289
1427
  async create(coupon, options) {
1290
- return unwrapProp(await client.POST("/discounts/coupons/v1", { body: { coupon }, signal: options?.signal }), "coupon", "POST /discounts/coupons/v1");
1428
+ return unwrapProp(await client.POST("/discounts/v1/coupons", { body: { coupon }, signal: options?.signal }), "coupon", "POST /discounts/v1/coupons");
1291
1429
  },
1292
1430
  /**
1293
1431
  * Update a coupon
@@ -1297,7 +1435,7 @@ function createDiscounts(client, defaults) {
1297
1435
  * @param options Request options (abort signal).
1298
1436
  */
1299
1437
  async update(id, coupon, options) {
1300
- return unwrap(await client.PATCH("/discounts/coupons/v1/{id}", { params: { path: { id } }, body: { coupon }, signal: options?.signal }), "PATCH /discounts/coupons/v1/{id}");
1438
+ return unwrap(await client.PATCH("/discounts/v1/coupons/{id}", { params: { path: { id } }, body: { coupon }, signal: options?.signal }), "PATCH /discounts/v1/coupons/{id}");
1301
1439
  },
1302
1440
  /**
1303
1441
  * Delete a coupon
@@ -1306,7 +1444,7 @@ function createDiscounts(client, defaults) {
1306
1444
  * @param options Request options (abort signal).
1307
1445
  */
1308
1446
  async delete(id, options) {
1309
- return unwrap(await client.DELETE("/discounts/coupons/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "DELETE /discounts/coupons/v1/{id}");
1447
+ return unwrap(await client.DELETE("/discounts/v1/coupons/{id}", { params: { path: { id } }, signal: options?.signal }), "DELETE /discounts/v1/coupons/{id}");
1310
1448
  }
1311
1449
  },
1312
1450
  promocodes: {
@@ -1316,7 +1454,7 @@ function createDiscounts(client, defaults) {
1316
1454
  * Retrieve all promocodes.
1317
1455
  */
1318
1456
  async list(query, options) {
1319
- return unwrapProp(await client.GET("/discounts/promocodes/v1", { params: { query }, signal: options?.signal }), "promocodes", "GET /discounts/promocodes/v1");
1457
+ return unwrapProp(await client.GET("/discounts/v1/promocodes", { params: { query }, signal: options?.signal }), "promocodes", "GET /discounts/v1/promocodes");
1320
1458
  },
1321
1459
  /**
1322
1460
  * Get a promocode
@@ -1325,11 +1463,11 @@ function createDiscounts(client, defaults) {
1325
1463
  * @param options Request options (abort signal).
1326
1464
  */
1327
1465
  async get(id, options) {
1328
- return unwrapProp(await client.GET("/discounts/promocodes/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "promocode", "GET /discounts/promocodes/v1/{id}");
1466
+ return unwrapProp(await client.GET("/discounts/v1/promocodes/{id}", { params: { path: { id } }, signal: options?.signal }), "promocode", "GET /discounts/v1/promocodes/{id}");
1329
1467
  },
1330
1468
  /** Create a promocode */
1331
1469
  async create(promocode, options) {
1332
- return unwrapProp(await client.POST("/discounts/promocodes/v1", { body: { promocode }, signal: options?.signal }), "promocode", "POST /discounts/promocodes/v1");
1470
+ return unwrapProp(await client.POST("/discounts/v1/promocodes", { body: { promocode }, signal: options?.signal }), "promocode", "POST /discounts/v1/promocodes");
1333
1471
  },
1334
1472
  /**
1335
1473
  * Archive a promocode
@@ -1338,28 +1476,7 @@ function createDiscounts(client, defaults) {
1338
1476
  * @param options Request options (abort signal).
1339
1477
  */
1340
1478
  async archive(id, options) {
1341
- return unwrapProp(await client.PUT("/discounts/promocodes/v1/{id}/archive", { params: { path: { id } }, signal: options?.signal }), "promocode", "PUT /discounts/promocodes/v1/{id}/archive");
1342
- }
1343
- },
1344
- redemptions: {
1345
- /**
1346
- * Retrieve redemptions
1347
- *
1348
- * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1349
- */
1350
- async list(query, options) {
1351
- return unwrap(await client.GET("/discounts/redemptions/v1", { params: { query }, signal: options?.signal }), "GET /discounts/redemptions/v1");
1352
- },
1353
- /**
1354
- * Retrieve redemptions — iterates every item across all pages.
1355
- *
1356
- * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1357
- */
1358
- iterate(query, options) {
1359
- return paginate(
1360
- async (nextPageToken) => unwrap(await client.GET("/discounts/redemptions/v1", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /discounts/redemptions/v1"),
1361
- "redemptions"
1362
- );
1479
+ return unwrapProp(await client.PUT("/discounts/v1/promocodes/{id}/archive", { params: { path: { id } }, signal: options?.signal }), "promocode", "PUT /discounts/v1/promocodes/{id}/archive");
1363
1480
  }
1364
1481
  }
1365
1482
  };
@@ -1380,10 +1497,26 @@ function createEvents(client, defaults) {
1380
1497
  async create(event, options) {
1381
1498
  return unwrapProp(await client.POST("/events/v1", { body: { event }, signal: options?.signal }), "event", "POST /events/v1");
1382
1499
  },
1500
+ /** Update an event */
1501
+ async update(id, event, options) {
1502
+ return unwrapProp(await client.PUT("/events/v1/{id}", { params: { path: { id } }, body: { event }, signal: options?.signal }), "event", "PUT /events/v1/{id}");
1503
+ },
1383
1504
  /** Delete an event */
1384
1505
  async delete(id, options) {
1385
1506
  return unwrap(await client.DELETE("/events/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "DELETE /events/v1/{id}");
1386
1507
  },
1508
+ /**
1509
+ * Add event hosts
1510
+ *
1511
+ * Add hosts to an event. Creates a free host ticket for each membership without one; existing attendee tickets are switched to the host role. Returns all tickets of the event.
1512
+ *
1513
+ * @param id The id of the event.
1514
+ * @param tickets The `tickets` payload.
1515
+ * @param options Request options (abort signal).
1516
+ */
1517
+ async addEventHosts(id, tickets, options) {
1518
+ return unwrapProp(await client.PUT("/events/v1/{id}/hosts", { params: { path: { id } }, body: { tickets }, signal: options?.signal }), "tickets", "PUT /events/v1/{id}/hosts");
1519
+ },
1387
1520
  /** Cancel an event */
1388
1521
  async cancel(id, options) {
1389
1522
  return unwrapProp(await client.PUT("/events/v1/{id}/cancel", { params: { path: { id } }, signal: options?.signal }), "event", "PUT /events/v1/{id}/cancel");
@@ -1422,6 +1555,40 @@ function createEvents(client, defaults) {
1422
1555
  */
1423
1556
  async get(id, options) {
1424
1557
  return unwrapProp(await client.GET("/events/tickets/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "ticket", "GET /events/tickets/v1/{id}");
1558
+ },
1559
+ /**
1560
+ * Update a ticket
1561
+ *
1562
+ * Update an event ticket. Only the ticket role can be changed.
1563
+ *
1564
+ * @param id The id of the event ticket.
1565
+ * @param ticket The `ticket` payload.
1566
+ * @param options Request options (abort signal).
1567
+ */
1568
+ async update(id, ticket, options) {
1569
+ return unwrapProp(await client.PUT("/events/tickets/v1/{id}", { params: { path: { id } }, body: { ticket }, signal: options?.signal }), "ticket", "PUT /events/tickets/v1/{id}");
1570
+ },
1571
+ /**
1572
+ * Delete a ticket
1573
+ *
1574
+ * Delete an event ticket. Returns the deleted ticket.
1575
+ *
1576
+ * @param id The id of the event ticket.
1577
+ * @param options Request options (abort signal).
1578
+ */
1579
+ async delete(id, options) {
1580
+ return unwrapProp(await client.DELETE("/events/tickets/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "ticket", "DELETE /events/tickets/v1/{id}");
1581
+ },
1582
+ /**
1583
+ * Check in a ticket
1584
+ *
1585
+ * Check in an event ticket. Fails if the ticket is already checked in.
1586
+ *
1587
+ * @param id The id of the event ticket.
1588
+ * @param options Request options (abort signal).
1589
+ */
1590
+ async checkIn(id, options) {
1591
+ return unwrapProp(await client.POST("/events/tickets/v1/{id}/checkin", { params: { path: { id } }, signal: options?.signal }), "ticket", "POST /events/tickets/v1/{id}/checkin");
1425
1592
  }
1426
1593
  }
1427
1594
  };
@@ -1686,6 +1853,54 @@ function createNetworks(client, defaults) {
1686
1853
  };
1687
1854
  }
1688
1855
 
1856
+ // src/generated/resources/packages.ts
1857
+ function createPackages(client, defaults) {
1858
+ return {
1859
+ /**
1860
+ * Retrieve packages
1861
+ *
1862
+ * Retrieve all packages in the location.
1863
+ */
1864
+ async list(query, options) {
1865
+ return unwrap(await client.GET("/packages/v1", { params: { query }, signal: options?.signal }), "GET /packages/v1");
1866
+ },
1867
+ /**
1868
+ * Retrieve packages — iterates every item across all pages.
1869
+ *
1870
+ * Retrieve all packages in the location.
1871
+ */
1872
+ iterate(query, options) {
1873
+ return paginate(
1874
+ async (nextPageToken) => unwrap(await client.GET("/packages/v1", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /packages/v1"),
1875
+ "packages"
1876
+ );
1877
+ },
1878
+ /** Create a package */
1879
+ async create(packageBody, options) {
1880
+ return unwrapProp(await client.POST("/packages/v1", { body: { package: packageBody }, signal: options?.signal }), "package", "POST /packages/v1");
1881
+ },
1882
+ /**
1883
+ * Update a package
1884
+ *
1885
+ * @param packageId The id of the package.
1886
+ * @param packageBody The `package` payload.
1887
+ * @param options Request options (abort signal).
1888
+ */
1889
+ async update(packageId, packageBody, options) {
1890
+ return unwrap(await client.PATCH("/packages/v1/{packageId}", { params: { path: { packageId } }, body: { package: packageBody }, signal: options?.signal }), "PATCH /packages/v1/{packageId}");
1891
+ },
1892
+ /**
1893
+ * Delete a package
1894
+ *
1895
+ * @param packageId The id of the package.
1896
+ * @param options Request options (abort signal).
1897
+ */
1898
+ async delete(packageId, options) {
1899
+ return unwrap(await client.DELETE("/packages/v1/{packageId}", { params: { path: { packageId } }, signal: options?.signal }), "DELETE /packages/v1/{packageId}");
1900
+ }
1901
+ };
1902
+ }
1903
+
1689
1904
  // src/generated/resources/plans.ts
1690
1905
  function createPlans(client, defaults) {
1691
1906
  return {
@@ -2477,6 +2692,7 @@ function createResources2(client, defaults) {
2477
2692
  guides: createGuides(client, defaults),
2478
2693
  locations: createLocations(client, defaults),
2479
2694
  networks: createNetworks(client, defaults),
2695
+ packages: createPackages(client, defaults),
2480
2696
  plans: createPlans(client, defaults),
2481
2697
  registrations: createRegistrations(client, defaults),
2482
2698
  resources: createResources(client, defaults),