@izak0s/spacebring-api 1.12.0 → 2.0.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/dist/index.js CHANGED
@@ -1194,6 +1194,16 @@ function createContracts(client, defaults) {
1194
1194
  async create(contract, options) {
1195
1195
  return unwrapProp(await client.POST("/contracts/v1", { body: { contract }, signal: options?.signal }), "contract", "POST /contracts/v1");
1196
1196
  },
1197
+ /**
1198
+ * Update a contract
1199
+ *
1200
+ * @param contractId The id of the contract.
1201
+ * @param contract The `contract` payload.
1202
+ * @param options Request options (abort signal).
1203
+ */
1204
+ async update(contractId, contract, options) {
1205
+ return unwrap(await client.PATCH("/contracts/v1/{contractId}", { params: { path: { contractId } }, body: { contract }, signal: options?.signal }), "PATCH /contracts/v1/{contractId}");
1206
+ },
1197
1207
  /**
1198
1208
  * Delete a contract
1199
1209
  *
@@ -1203,6 +1213,18 @@ function createContracts(client, defaults) {
1203
1213
  async delete(contractId, options) {
1204
1214
  return unwrap(await client.DELETE("/contracts/v1/{contractId}", { params: { path: { contractId } }, signal: options?.signal }), "DELETE /contracts/v1/{contractId}");
1205
1215
  },
1216
+ /**
1217
+ * Decline a contract
1218
+ *
1219
+ * Mark a contract signer as declined. Declining also declines the contract.
1220
+ *
1221
+ * @param contractId The id of the contract.
1222
+ * @param signerId The id of the contract signer.
1223
+ * @param options Request options (abort signal).
1224
+ */
1225
+ async declineContract(contractId, signerId, options) {
1226
+ 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");
1227
+ },
1206
1228
  /**
1207
1229
  * Issue a contract
1208
1230
  *
@@ -1213,6 +1235,29 @@ function createContracts(client, defaults) {
1213
1235
  async issue(contractId, signatureMethod, options) {
1214
1236
  return unwrapProp(await client.POST("/contracts/v1/{contractId}/issue", { params: { path: { contractId } }, body: { signatureMethod }, signal: options?.signal }), "contract", "POST /contracts/v1/{contractId}/issue");
1215
1237
  },
1238
+ /**
1239
+ * Resend a contract
1240
+ *
1241
+ * Resend the signature request email to the next pending signer of an issued eSignature contract.
1242
+ *
1243
+ * @param contractId The id of the contract.
1244
+ * @param options Request options (abort signal).
1245
+ */
1246
+ async resend(contractId, options) {
1247
+ return unwrap(await client.POST("/contracts/v1/{contractId}/resend", { params: { path: { contractId } }, signal: options?.signal }), "POST /contracts/v1/{contractId}/resend");
1248
+ },
1249
+ /**
1250
+ * Sign a contract
1251
+ *
1252
+ * Mark a contract signer as signed. When all signers have signed, the contract becomes signed.
1253
+ *
1254
+ * @param contractId The id of the contract.
1255
+ * @param signerId The id of the contract signer.
1256
+ * @param options Request options (abort signal).
1257
+ */
1258
+ async signContract(contractId, signerId, options) {
1259
+ 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");
1260
+ },
1216
1261
  /**
1217
1262
  * Terminate a contract
1218
1263
  *
@@ -1222,6 +1267,80 @@ function createContracts(client, defaults) {
1222
1267
  */
1223
1268
  async terminate(contractId, reason, options) {
1224
1269
  return unwrap(await client.PATCH("/contracts/v1/{contractId}/terminate", { params: { path: { contractId } }, body: { reason }, signal: options?.signal }), "PATCH /contracts/v1/{contractId}/terminate");
1270
+ },
1271
+ templates: {
1272
+ /**
1273
+ * Retrieve templates
1274
+ *
1275
+ * Retrieve all contract templates in the location.
1276
+ */
1277
+ async list(query, options) {
1278
+ return unwrap(await client.GET("/contracts/templates/v1", { params: { query }, signal: options?.signal }), "GET /contracts/templates/v1");
1279
+ },
1280
+ /**
1281
+ * Retrieve templates — iterates every item across all pages.
1282
+ *
1283
+ * Retrieve all contract templates in the location.
1284
+ */
1285
+ iterate(query, options) {
1286
+ return paginate(
1287
+ async (nextPageToken) => unwrap(await client.GET("/contracts/templates/v1", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /contracts/templates/v1"),
1288
+ "templates"
1289
+ );
1290
+ },
1291
+ /**
1292
+ * Retrieve a template
1293
+ *
1294
+ * Retrieve a contract template.
1295
+ *
1296
+ * @param templateId The id of the template.
1297
+ * @param options Request options (abort signal).
1298
+ */
1299
+ async get(templateId, options) {
1300
+ return unwrapProp(await client.GET("/contracts/templates/v1/{templateId}", { params: { path: { templateId } }, signal: options?.signal }), "template", "GET /contracts/templates/v1/{templateId}");
1301
+ },
1302
+ /**
1303
+ * Create a template
1304
+ *
1305
+ * Create a contract template from an uploaded file.
1306
+ */
1307
+ async create(template, options) {
1308
+ return unwrapProp(await client.POST("/contracts/templates/v1", { body: { template }, signal: options?.signal }), "template", "POST /contracts/templates/v1");
1309
+ },
1310
+ /**
1311
+ * Update a template
1312
+ *
1313
+ * Update a contract template.
1314
+ *
1315
+ * @param templateId The id of the template.
1316
+ * @param template The `template` payload.
1317
+ * @param options Request options (abort signal).
1318
+ */
1319
+ async update(templateId, template, options) {
1320
+ return unwrap(await client.PATCH("/contracts/templates/v1/{templateId}", { params: { path: { templateId } }, body: { template }, signal: options?.signal }), "PATCH /contracts/templates/v1/{templateId}");
1321
+ },
1322
+ /**
1323
+ * Delete a template
1324
+ *
1325
+ * Delete a contract template.
1326
+ *
1327
+ * @param templateId The id of the template.
1328
+ * @param options Request options (abort signal).
1329
+ */
1330
+ async delete(templateId, options) {
1331
+ return unwrap(await client.DELETE("/contracts/templates/v1/{templateId}", { params: { path: { templateId } }, signal: options?.signal }), "DELETE /contracts/templates/v1/{templateId}");
1332
+ },
1333
+ /**
1334
+ * Duplicate a template
1335
+ *
1336
+ * Duplicate a contract template, creating a copy with the same title and file.
1337
+ *
1338
+ * @param templateId The id of the template.
1339
+ * @param options Request options (abort signal).
1340
+ */
1341
+ async duplicate(templateId, options) {
1342
+ return unwrapProp(await client.POST("/contracts/templates/v1/{templateId}/duplicate", { params: { path: { templateId } }, signal: options?.signal }), "template", "POST /contracts/templates/v1/{templateId}/duplicate");
1343
+ }
1225
1344
  }
1226
1345
  };
1227
1346
  }
@@ -1229,6 +1348,25 @@ function createContracts(client, defaults) {
1229
1348
  // src/generated/resources/discounts.ts
1230
1349
  function createDiscounts(client, defaults) {
1231
1350
  return {
1351
+ /**
1352
+ * Retrieve redemptions — iterates every item across all pages.
1353
+ *
1354
+ * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1355
+ */
1356
+ iterateRedemptions(query, options) {
1357
+ return paginate(
1358
+ async (nextPageToken) => unwrap(await client.GET("/discounts/v1/redemptions", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /discounts/v1/redemptions"),
1359
+ "redemptions"
1360
+ );
1361
+ },
1362
+ /**
1363
+ * Retrieve redemptions
1364
+ *
1365
+ * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1366
+ */
1367
+ async listRedemptions(query, options) {
1368
+ return unwrap(await client.GET("/discounts/v1/redemptions", { params: { query }, signal: options?.signal }), "GET /discounts/v1/redemptions");
1369
+ },
1232
1370
  coupons: {
1233
1371
  /**
1234
1372
  * Retrieve coupons
@@ -1236,7 +1374,7 @@ function createDiscounts(client, defaults) {
1236
1374
  * Retrieve all coupons in the location.
1237
1375
  */
1238
1376
  async list(query, options) {
1239
- return unwrap(await client.GET("/discounts/coupons/v1", { params: { query }, signal: options?.signal }), "GET /discounts/coupons/v1");
1377
+ return unwrap(await client.GET("/discounts/v1/coupons", { params: { query }, signal: options?.signal }), "GET /discounts/v1/coupons");
1240
1378
  },
1241
1379
  /**
1242
1380
  * Retrieve coupons — iterates every item across all pages.
@@ -1245,7 +1383,7 @@ function createDiscounts(client, defaults) {
1245
1383
  */
1246
1384
  iterate(query, options) {
1247
1385
  return paginate(
1248
- async (nextPageToken) => unwrap(await client.GET("/discounts/coupons/v1", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /discounts/coupons/v1"),
1386
+ async (nextPageToken) => unwrap(await client.GET("/discounts/v1/coupons", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /discounts/v1/coupons"),
1249
1387
  "coupons"
1250
1388
  );
1251
1389
  },
@@ -1256,11 +1394,11 @@ function createDiscounts(client, defaults) {
1256
1394
  * @param options Request options (abort signal).
1257
1395
  */
1258
1396
  async get(id, options) {
1259
- return unwrapProp(await client.GET("/discounts/coupons/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "coupon", "GET /discounts/coupons/v1/{id}");
1397
+ return unwrapProp(await client.GET("/discounts/v1/coupons/{id}", { params: { path: { id } }, signal: options?.signal }), "coupon", "GET /discounts/v1/coupons/{id}");
1260
1398
  },
1261
1399
  /** Create a coupon */
1262
1400
  async create(coupon, options) {
1263
- return unwrapProp(await client.POST("/discounts/coupons/v1", { body: { coupon }, signal: options?.signal }), "coupon", "POST /discounts/coupons/v1");
1401
+ return unwrapProp(await client.POST("/discounts/v1/coupons", { body: { coupon }, signal: options?.signal }), "coupon", "POST /discounts/v1/coupons");
1264
1402
  },
1265
1403
  /**
1266
1404
  * Update a coupon
@@ -1270,7 +1408,7 @@ function createDiscounts(client, defaults) {
1270
1408
  * @param options Request options (abort signal).
1271
1409
  */
1272
1410
  async update(id, coupon, options) {
1273
- return unwrap(await client.PATCH("/discounts/coupons/v1/{id}", { params: { path: { id } }, body: { coupon }, signal: options?.signal }), "PATCH /discounts/coupons/v1/{id}");
1411
+ return unwrap(await client.PATCH("/discounts/v1/coupons/{id}", { params: { path: { id } }, body: { coupon }, signal: options?.signal }), "PATCH /discounts/v1/coupons/{id}");
1274
1412
  },
1275
1413
  /**
1276
1414
  * Delete a coupon
@@ -1279,7 +1417,7 @@ function createDiscounts(client, defaults) {
1279
1417
  * @param options Request options (abort signal).
1280
1418
  */
1281
1419
  async delete(id, options) {
1282
- return unwrap(await client.DELETE("/discounts/coupons/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "DELETE /discounts/coupons/v1/{id}");
1420
+ return unwrap(await client.DELETE("/discounts/v1/coupons/{id}", { params: { path: { id } }, signal: options?.signal }), "DELETE /discounts/v1/coupons/{id}");
1283
1421
  }
1284
1422
  },
1285
1423
  promocodes: {
@@ -1289,7 +1427,7 @@ function createDiscounts(client, defaults) {
1289
1427
  * Retrieve all promocodes.
1290
1428
  */
1291
1429
  async list(query, options) {
1292
- return unwrapProp(await client.GET("/discounts/promocodes/v1", { params: { query }, signal: options?.signal }), "promocodes", "GET /discounts/promocodes/v1");
1430
+ return unwrapProp(await client.GET("/discounts/v1/promocodes", { params: { query }, signal: options?.signal }), "promocodes", "GET /discounts/v1/promocodes");
1293
1431
  },
1294
1432
  /**
1295
1433
  * Get a promocode
@@ -1298,11 +1436,11 @@ function createDiscounts(client, defaults) {
1298
1436
  * @param options Request options (abort signal).
1299
1437
  */
1300
1438
  async get(id, options) {
1301
- return unwrapProp(await client.GET("/discounts/promocodes/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "promocode", "GET /discounts/promocodes/v1/{id}");
1439
+ return unwrapProp(await client.GET("/discounts/v1/promocodes/{id}", { params: { path: { id } }, signal: options?.signal }), "promocode", "GET /discounts/v1/promocodes/{id}");
1302
1440
  },
1303
1441
  /** Create a promocode */
1304
1442
  async create(promocode, options) {
1305
- return unwrapProp(await client.POST("/discounts/promocodes/v1", { body: { promocode }, signal: options?.signal }), "promocode", "POST /discounts/promocodes/v1");
1443
+ return unwrapProp(await client.POST("/discounts/v1/promocodes", { body: { promocode }, signal: options?.signal }), "promocode", "POST /discounts/v1/promocodes");
1306
1444
  },
1307
1445
  /**
1308
1446
  * Archive a promocode
@@ -1311,28 +1449,7 @@ function createDiscounts(client, defaults) {
1311
1449
  * @param options Request options (abort signal).
1312
1450
  */
1313
1451
  async archive(id, options) {
1314
- return unwrapProp(await client.PUT("/discounts/promocodes/v1/{id}/archive", { params: { path: { id } }, signal: options?.signal }), "promocode", "PUT /discounts/promocodes/v1/{id}/archive");
1315
- }
1316
- },
1317
- redemptions: {
1318
- /**
1319
- * Retrieve redemptions
1320
- *
1321
- * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1322
- */
1323
- async list(query, options) {
1324
- return unwrap(await client.GET("/discounts/redemptions/v1", { params: { query }, signal: options?.signal }), "GET /discounts/redemptions/v1");
1325
- },
1326
- /**
1327
- * Retrieve redemptions — iterates every item across all pages.
1328
- *
1329
- * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1330
- */
1331
- iterate(query, options) {
1332
- return paginate(
1333
- async (nextPageToken) => unwrap(await client.GET("/discounts/redemptions/v1", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /discounts/redemptions/v1"),
1334
- "redemptions"
1335
- );
1452
+ return unwrapProp(await client.PUT("/discounts/v1/promocodes/{id}/archive", { params: { path: { id } }, signal: options?.signal }), "promocode", "PUT /discounts/v1/promocodes/{id}/archive");
1336
1453
  }
1337
1454
  }
1338
1455
  };
@@ -1353,10 +1470,26 @@ function createEvents(client, defaults) {
1353
1470
  async create(event, options) {
1354
1471
  return unwrapProp(await client.POST("/events/v1", { body: { event }, signal: options?.signal }), "event", "POST /events/v1");
1355
1472
  },
1473
+ /** Update an event */
1474
+ async update(id, event, options) {
1475
+ return unwrapProp(await client.PUT("/events/v1/{id}", { params: { path: { id } }, body: { event }, signal: options?.signal }), "event", "PUT /events/v1/{id}");
1476
+ },
1356
1477
  /** Delete an event */
1357
1478
  async delete(id, options) {
1358
1479
  return unwrap(await client.DELETE("/events/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "DELETE /events/v1/{id}");
1359
1480
  },
1481
+ /**
1482
+ * Add event hosts
1483
+ *
1484
+ * 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.
1485
+ *
1486
+ * @param id The id of the event.
1487
+ * @param tickets The `tickets` payload.
1488
+ * @param options Request options (abort signal).
1489
+ */
1490
+ async addEventHosts(id, tickets, options) {
1491
+ return unwrapProp(await client.PUT("/events/v1/{id}/hosts", { params: { path: { id } }, body: { tickets }, signal: options?.signal }), "tickets", "PUT /events/v1/{id}/hosts");
1492
+ },
1360
1493
  /** Cancel an event */
1361
1494
  async cancel(id, options) {
1362
1495
  return unwrapProp(await client.PUT("/events/v1/{id}/cancel", { params: { path: { id } }, signal: options?.signal }), "event", "PUT /events/v1/{id}/cancel");
@@ -1395,6 +1528,40 @@ function createEvents(client, defaults) {
1395
1528
  */
1396
1529
  async get(id, options) {
1397
1530
  return unwrapProp(await client.GET("/events/tickets/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "ticket", "GET /events/tickets/v1/{id}");
1531
+ },
1532
+ /**
1533
+ * Update a ticket
1534
+ *
1535
+ * Update an event ticket. Only the ticket role can be changed.
1536
+ *
1537
+ * @param id The id of the event ticket.
1538
+ * @param ticket The `ticket` payload.
1539
+ * @param options Request options (abort signal).
1540
+ */
1541
+ async update(id, ticket, options) {
1542
+ return unwrapProp(await client.PUT("/events/tickets/v1/{id}", { params: { path: { id } }, body: { ticket }, signal: options?.signal }), "ticket", "PUT /events/tickets/v1/{id}");
1543
+ },
1544
+ /**
1545
+ * Delete a ticket
1546
+ *
1547
+ * Delete an event ticket. Returns the deleted ticket.
1548
+ *
1549
+ * @param id The id of the event ticket.
1550
+ * @param options Request options (abort signal).
1551
+ */
1552
+ async delete(id, options) {
1553
+ return unwrapProp(await client.DELETE("/events/tickets/v1/{id}", { params: { path: { id } }, signal: options?.signal }), "ticket", "DELETE /events/tickets/v1/{id}");
1554
+ },
1555
+ /**
1556
+ * Check in a ticket
1557
+ *
1558
+ * Check in an event ticket. Fails if the ticket is already checked in.
1559
+ *
1560
+ * @param id The id of the event ticket.
1561
+ * @param options Request options (abort signal).
1562
+ */
1563
+ async checkIn(id, options) {
1564
+ return unwrapProp(await client.POST("/events/tickets/v1/{id}/checkin", { params: { path: { id } }, signal: options?.signal }), "ticket", "POST /events/tickets/v1/{id}/checkin");
1398
1565
  }
1399
1566
  }
1400
1567
  };
@@ -1659,6 +1826,54 @@ function createNetworks(client, defaults) {
1659
1826
  };
1660
1827
  }
1661
1828
 
1829
+ // src/generated/resources/packages.ts
1830
+ function createPackages(client, defaults) {
1831
+ return {
1832
+ /**
1833
+ * Retrieve packages
1834
+ *
1835
+ * Retrieve all packages in the location.
1836
+ */
1837
+ async list(query, options) {
1838
+ return unwrap(await client.GET("/packages/v1", { params: { query }, signal: options?.signal }), "GET /packages/v1");
1839
+ },
1840
+ /**
1841
+ * Retrieve packages — iterates every item across all pages.
1842
+ *
1843
+ * Retrieve all packages in the location.
1844
+ */
1845
+ iterate(query, options) {
1846
+ return paginate(
1847
+ async (nextPageToken) => unwrap(await client.GET("/packages/v1", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /packages/v1"),
1848
+ "packages"
1849
+ );
1850
+ },
1851
+ /** Create a package */
1852
+ async create(packageBody, options) {
1853
+ return unwrapProp(await client.POST("/packages/v1", { body: { package: packageBody }, signal: options?.signal }), "package", "POST /packages/v1");
1854
+ },
1855
+ /**
1856
+ * Update a package
1857
+ *
1858
+ * @param packageId The id of the package.
1859
+ * @param packageBody The `package` payload.
1860
+ * @param options Request options (abort signal).
1861
+ */
1862
+ async update(packageId, packageBody, options) {
1863
+ return unwrap(await client.PATCH("/packages/v1/{packageId}", { params: { path: { packageId } }, body: { package: packageBody }, signal: options?.signal }), "PATCH /packages/v1/{packageId}");
1864
+ },
1865
+ /**
1866
+ * Delete a package
1867
+ *
1868
+ * @param packageId The id of the package.
1869
+ * @param options Request options (abort signal).
1870
+ */
1871
+ async delete(packageId, options) {
1872
+ return unwrap(await client.DELETE("/packages/v1/{packageId}", { params: { path: { packageId } }, signal: options?.signal }), "DELETE /packages/v1/{packageId}");
1873
+ }
1874
+ };
1875
+ }
1876
+
1662
1877
  // src/generated/resources/plans.ts
1663
1878
  function createPlans(client, defaults) {
1664
1879
  return {
@@ -2450,6 +2665,7 @@ function createResources2(client, defaults) {
2450
2665
  guides: createGuides(client, defaults),
2451
2666
  locations: createLocations(client, defaults),
2452
2667
  networks: createNetworks(client, defaults),
2668
+ packages: createPackages(client, defaults),
2453
2669
  plans: createPlans(client, defaults),
2454
2670
  registrations: createRegistrations(client, defaults),
2455
2671
  resources: createResources(client, defaults),