@izak0s/spacebring-api 10.2.0 → 10.3.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 -->207 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,14 @@ 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 a media upload
1916
+ *
1917
+ * 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.
1918
+ */
1919
+ async createMedia(media, options) {
1920
+ return unwrapProp(await client.POST("/guides/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /guides/v1/media");
1837
1921
  }
1838
1922
  };
1839
1923
  }
@@ -2060,6 +2144,14 @@ function createResources(client, defaults) {
2060
2144
  async update(resourceId, resource, options) {
2061
2145
  return unwrap(await client.PATCH("/resources/v1/{resourceId}", { params: { path: { resourceId } }, body: { resource }, signal: options?.signal }), "PATCH /resources/v1/{resourceId}");
2062
2146
  },
2147
+ /**
2148
+ * Create a media upload
2149
+ *
2150
+ * 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.
2151
+ */
2152
+ async createMedia(media, options) {
2153
+ return unwrapProp(await client.POST("/resources/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /resources/v1/media");
2154
+ },
2063
2155
  /**
2064
2156
  * Check resource availability
2065
2157
  *
@@ -2319,6 +2411,14 @@ function createShop(client, defaults) {
2319
2411
  */
2320
2412
  async delete(productId, options) {
2321
2413
  return unwrap(await client.DELETE("/shop/products/v1/{productId}", { params: { path: { productId } }, signal: options?.signal }), "DELETE /shop/products/v1/{productId}");
2414
+ },
2415
+ /**
2416
+ * Create a media upload
2417
+ *
2418
+ * 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.
2419
+ */
2420
+ async createMedia(media, options) {
2421
+ return unwrapProp(await client.POST("/shop/products/v1/media", { body: { media }, signal: options?.signal }), "media", "POST /shop/products/v1/media");
2322
2422
  }
2323
2423
  }
2324
2424
  };
@@ -2874,6 +2974,7 @@ function createResources2(client, defaults) {
2874
2974
  altCurrencies: createAltcurrencies(client, defaults),
2875
2975
  benefits: createBenefits(client, defaults),
2876
2976
  billing: createBilling(client, defaults),
2977
+ checkIns: createCheckins(client, defaults),
2877
2978
  community: createCommunity(client, defaults),
2878
2979
  contracts: createContracts(client, defaults),
2879
2980
  discounts: createDiscounts(client, defaults),