@izak0s/spacebring-api 10.2.0 → 10.4.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 -->197 operations across 21 resource groups<!-- /coverage -->** — the full Spacebring API surface
18
+ - **<!-- coverage -->209 operations across 22 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
@@ -1058,6 +1058,58 @@ function createBilling(client, defaults) {
1058
1058
  };
1059
1059
  }
1060
1060
 
1061
+ // src/generated/resources/checkIns.ts
1062
+ function createCheckins(client, defaults) {
1063
+ return {
1064
+ /**
1065
+ * Retrieve check-ins
1066
+ *
1067
+ * Retrieve the check-ins of a location, newest arrival first. With bearer token authentication, the user must be an administrator of the location.
1068
+ */
1069
+ async list(query, options) {
1070
+ return unwrap(await client.GET("/check_ins/v1", { params: { query }, signal: options?.signal }), "GET /check_ins/v1");
1071
+ },
1072
+ /**
1073
+ * Retrieve check-ins — iterates every item across all pages.
1074
+ *
1075
+ * Retrieve the check-ins of a location, newest arrival first. With bearer token authentication, the user must be an administrator of the location.
1076
+ */
1077
+ iterate(query, options) {
1078
+ return paginate(
1079
+ async (nextPageToken) => unwrap(await client.GET("/check_ins/v1", { params: { query: { ...query, nextPageToken } }, signal: options?.signal }), "GET /check_ins/v1"),
1080
+ "checkIns"
1081
+ );
1082
+ },
1083
+ /**
1084
+ * Get a check-in
1085
+ *
1086
+ * Get a check-in by its id. With bearer token authentication, the user must be an administrator of the check-in's location.
1087
+ *
1088
+ * @param checkInId The ID of the check-in.
1089
+ * @param options Request options (abort signal).
1090
+ */
1091
+ async get(checkInId, options) {
1092
+ return unwrapProp(await client.GET("/check_ins/v1/{checkInId}", { params: { path: { checkInId } }, signal: options?.signal }), "checkIn", "GET /check_ins/v1/{checkInId}");
1093
+ },
1094
+ /**
1095
+ * Check in
1096
+ *
1097
+ * Record an arrival for a booking, an event ticket, a visit, or a member's subscription. Identify what to check in with its check-in id, with the location and a six-digit code, or with the location and a customer ref to check a member in without a code. With bearer token authentication, the user must be an administrator of the location.
1098
+ */
1099
+ async checkIn(body, options) {
1100
+ return unwrapProp(await client.POST("/check_ins/v1/checkin", { body, signal: options?.signal }), "checkIn", "POST /check_ins/v1/checkin");
1101
+ },
1102
+ /**
1103
+ * Check out
1104
+ *
1105
+ * Record a departure on an open check-in. Identify it with its check-in id, or with the location and the six-digit code it was opened with. With bearer token authentication, the user must be an administrator of the location.
1106
+ */
1107
+ async checkOut(body, options) {
1108
+ return unwrapProp(await client.POST("/check_ins/v1/checkout", { body, signal: options?.signal }), "checkIn", "POST /check_ins/v1/checkout");
1109
+ }
1110
+ };
1111
+ }
1112
+
1061
1113
  // src/generated/resources/community.ts
1062
1114
  function createCommunity(client, defaults) {
1063
1115
  return {
@@ -1107,6 +1159,14 @@ function createCommunity(client, defaults) {
1107
1159
  */
1108
1160
  async update(id, company, options) {
1109
1161
  return unwrapProp(await client.PUT("/community/companies/v1/{id}", { params: { path: { id } }, body: { company }, signal: options?.signal }), "company", "PUT /community/companies/v1/{id}");
1162
+ },
1163
+ /**
1164
+ * Create a logo upload
1165
+ *
1166
+ * Create an upload for a company logo. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, pass the returned key as `logo.key` when creating or updating a company within an hour; a logo that is not attached by then is discarded.
1167
+ */
1168
+ async createMedia(media, options) {
1169
+ return unwrapProp(await client.POST("/community/companies/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /community/companies/v1/media");
1110
1170
  }
1111
1171
  },
1112
1172
  memberships: {
@@ -1337,7 +1397,7 @@ function createContracts(client, defaults) {
1337
1397
  /**
1338
1398
  * Create a template
1339
1399
  *
1340
- * Create a contract template from an uploaded file.
1400
+ * Create a contract template from a .docx file uploaded through the template upload endpoint.
1341
1401
  */
1342
1402
  async create(template, options) {
1343
1403
  return unwrapProp(await client.POST("/contracts/templates/v1", { body: { template }, signal: options?.signal }), "template", "POST /contracts/templates/v1");
@@ -1345,7 +1405,7 @@ function createContracts(client, defaults) {
1345
1405
  /**
1346
1406
  * Update a template
1347
1407
  *
1348
- * Update a contract template.
1408
+ * Update a contract template. A new file is uploaded through the template upload endpoint.
1349
1409
  *
1350
1410
  * @param templateId The id of the template.
1351
1411
  * @param template The `template` payload.
@@ -1365,6 +1425,14 @@ function createContracts(client, defaults) {
1365
1425
  async delete(templateId, options) {
1366
1426
  return unwrap(await client.DELETE("/contracts/templates/v1/{templateId}", { params: { path: { templateId } }, signal: options?.signal }), "DELETE /contracts/templates/v1/{templateId}");
1367
1427
  },
1428
+ /**
1429
+ * Create a template upload
1430
+ *
1431
+ * Create a media upload for a contract template file, a .docx document of up to 50 MB. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, pass the returned key as `template.file.key` when creating or updating a template within an hour; a file that is not attached by then is discarded.
1432
+ */
1433
+ async createMedia(media, options) {
1434
+ return unwrapProp(await client.POST("/contracts/templates/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /contracts/templates/v1/media");
1435
+ },
1368
1436
  /**
1369
1437
  * Duplicate a template
1370
1438
  *
@@ -1615,6 +1683,14 @@ function createEvents(client, defaults) {
1615
1683
  // src/generated/resources/feed.ts
1616
1684
  function createFeed(client, defaults) {
1617
1685
  return {
1686
+ /**
1687
+ * Create a media upload
1688
+ *
1689
+ * Create a media upload for an image or a video in a post. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, pass the returned key in `media[].key` when creating or updating a post within an hour; a file that is not attached by then is discarded. A video must declare its `width` and `height`; an image's dimensions are read from the file.
1690
+ */
1691
+ async createMedia(media, options) {
1692
+ return unwrapProp(await client.POST("/feed/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /feed/v1/media");
1693
+ },
1618
1694
  comments: {
1619
1695
  /**
1620
1696
  * Create a post comment
@@ -1834,6 +1910,22 @@ function createGuides(client, defaults) {
1834
1910
  */
1835
1911
  async delete(guideId, options) {
1836
1912
  return unwrap(await client.DELETE("/guides/v1/{guideId}", { params: { path: { guideId } }, signal: options?.signal }), "DELETE /guides/v1/{guideId}");
1913
+ },
1914
+ /**
1915
+ * Create an attachment upload
1916
+ *
1917
+ * Create an upload for a file to attach to a guide, of any type up to 50 MB. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, pass the returned key in `attachments[].key` when creating or updating a guide within an hour; a file that is not attached by then is discarded. The file is served as a download under the declared name.
1918
+ */
1919
+ async createAttachment(attachment, options) {
1920
+ return unwrapProp(await client.POST("/guides/v1/attachments", { body: { attachment }, signal: options?.signal }), "attachment", "POST /guides/v1/attachments");
1921
+ },
1922
+ /**
1923
+ * Create a media upload
1924
+ *
1925
+ * Create a media upload for an image or a video in a guide. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, add the returned url to the guide `description` as a Markdown image, `![alt text](url)`, when creating or updating a guide within an hour; a file that is not attached by then is discarded. A video must declare its `width` and `height`; an image's dimensions are read from the file.
1926
+ */
1927
+ async createMedia(media, options) {
1928
+ return unwrapProp(await client.POST("/guides/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /guides/v1/media");
1837
1929
  }
1838
1930
  };
1839
1931
  }
@@ -2060,6 +2152,14 @@ function createResources(client, defaults) {
2060
2152
  async update(resourceId, resource, options) {
2061
2153
  return unwrap(await client.PATCH("/resources/v1/{resourceId}", { params: { path: { resourceId } }, body: { resource }, signal: options?.signal }), "PATCH /resources/v1/{resourceId}");
2062
2154
  },
2155
+ /**
2156
+ * Create a media upload
2157
+ *
2158
+ * Create a media upload for a resource photo. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, add the returned key to `media` when creating or updating a resource within an hour; an image that is not attached by then is discarded. A resource holds up to 10 photos, the first being its cover.
2159
+ */
2160
+ async createMedia(media, options) {
2161
+ return unwrapProp(await client.POST("/resources/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /resources/v1/media");
2162
+ },
2063
2163
  /**
2064
2164
  * Check resource availability
2065
2165
  *
@@ -2319,6 +2419,14 @@ function createShop(client, defaults) {
2319
2419
  */
2320
2420
  async delete(productId, options) {
2321
2421
  return unwrap(await client.DELETE("/shop/products/v1/{productId}", { params: { path: { productId } }, signal: options?.signal }), "DELETE /shop/products/v1/{productId}");
2422
+ },
2423
+ /**
2424
+ * Create a media upload
2425
+ *
2426
+ * Create a media upload for a product cover image. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, pass the returned key as `media[0].key` when creating or updating a product within an hour; an image that is not attached by then is discarded.
2427
+ */
2428
+ async createMedia(media, options) {
2429
+ return unwrapProp(await client.POST("/shop/products/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /shop/products/v1/media");
2322
2430
  }
2323
2431
  }
2324
2432
  };
@@ -2456,6 +2564,14 @@ function createSupport(client, defaults) {
2456
2564
  async create(ticket, options) {
2457
2565
  return unwrap(await client.POST("/support/tickets/v1", { body: { ticket }, signal: options?.signal }), "POST /support/tickets/v1");
2458
2566
  },
2567
+ /**
2568
+ * Create a ticket media upload
2569
+ *
2570
+ * Create a media upload for a ticket comment attachment, a file of any type up to 50 MB. The response carries a presigned URL: send the raw file bytes with a PUT request within a minute, using exactly the headers returned. Once the file is stored, pass the returned key as `activity.attachments[0].key` when creating a ticket comment within 25 minutes; a file that is not attached by then is discarded.
2571
+ */
2572
+ async createMedia(media, options) {
2573
+ return unwrapProp(await client.POST("/support/tickets/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /support/tickets/v1/media");
2574
+ },
2459
2575
  /**
2460
2576
  * Update a ticket's assignee
2461
2577
  *
@@ -2496,7 +2612,7 @@ function createSupport(client, defaults) {
2496
2612
  /**
2497
2613
  * Create a ticket comment
2498
2614
  *
2499
- * Create a support ticket comment.
2615
+ * Create a support ticket comment. To attach a file, create a media upload first, send the file, then pass its key as `activity.attachments[0].key`; a 409 response means the file has not been received yet, so retry shortly.
2500
2616
  */
2501
2617
  async create(activity, options) {
2502
2618
  return unwrapProp(await client.POST("/support/tickets/v1/comment", { body: { activity }, signal: options?.signal }), "activity", "POST /support/tickets/v1/comment");
@@ -2874,6 +2990,7 @@ function createResources2(client, defaults) {
2874
2990
  altCurrencies: createAltcurrencies(client, defaults),
2875
2991
  benefits: createBenefits(client, defaults),
2876
2992
  billing: createBilling(client, defaults),
2993
+ checkIns: createCheckins(client, defaults),
2877
2994
  community: createCommunity(client, defaults),
2878
2995
  contracts: createContracts(client, defaults),
2879
2996
  discounts: createDiscounts(client, defaults),