@flexbe/sdk 0.2.37 → 0.2.38

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.
@@ -316,6 +316,22 @@ export class Pages {
316
316
  * @throws {ServerException} When the server encounters an error
317
317
  * @throws {TimeoutException} When the request times out
318
318
  */
319
+ getVersions(pageId) {
320
+ return __awaiter(this, void 0, void 0, function* () {
321
+ const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
322
+ return response.data;
323
+ });
324
+ }
325
+ /**
326
+ * @deprecated Use getVersions instead, remove it after frontend will be updated
327
+ * @param pageId - ID of the page to get versions for
328
+ * @returns List of page versions
329
+ * @throws {UnauthorizedException} When the API key is invalid or expired
330
+ * @throws {NotFoundException} When the page is not found
331
+ * @throws {ForbiddenException} When the page does not belong to the site
332
+ * @throws {ServerException} When the server encounters an error
333
+ * @throws {TimeoutException} When the request times out
334
+ */
319
335
  getPageVersions(pageId) {
320
336
  return __awaiter(this, void 0, void 0, function* () {
321
337
  const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
@@ -325,7 +341,7 @@ export class Pages {
325
341
  /**
326
342
  * Get a specific page version
327
343
  * @param pageId - ID of the page
328
- * @param versionId - ID of the version to get
344
+ * @param versionId - ID of the version to get or 'published' to get the published version
329
345
  * @returns The requested page version with data
330
346
  * @throws {UnauthorizedException} When the API key is invalid or expired
331
347
  * @throws {NotFoundException} When the page or version is not found
@@ -333,12 +349,27 @@ export class Pages {
333
349
  * @throws {ServerException} When the server encounters an error
334
350
  * @throws {TimeoutException} When the request times out
335
351
  */
336
- getPageVersion(pageId, versionId) {
352
+ getVersion(pageId, versionId) {
337
353
  return __awaiter(this, void 0, void 0, function* () {
338
354
  const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
339
355
  return response.data;
340
356
  });
341
357
  }
358
+ /**
359
+ * Get the published version of a page
360
+ * @param pageId - ID of the page
361
+ * @returns The published page version with data
362
+ * @throws {UnauthorizedException} When the API key is invalid or expired
363
+ * @throws {NotFoundException} When the page is not found or has no published version
364
+ * @throws {ForbiddenException} When the page does not belong to the site
365
+ * @throws {ServerException} When the server encounters an error
366
+ * @throws {TimeoutException} When the request times out
367
+ */
368
+ getPublishedVersion(pageId) {
369
+ return __awaiter(this, void 0, void 0, function* () {
370
+ return this.getVersion(pageId, 'published');
371
+ });
372
+ }
342
373
  /**
343
374
  * Create a new page version
344
375
  * @param pageId - ID of the page to create version for
@@ -283,6 +283,20 @@ class Pages {
283
283
  * @throws {ServerException} When the server encounters an error
284
284
  * @throws {TimeoutException} When the request times out
285
285
  */
286
+ async getVersions(pageId) {
287
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
288
+ return response.data;
289
+ }
290
+ /**
291
+ * @deprecated Use getVersions instead, remove it after frontend will be updated
292
+ * @param pageId - ID of the page to get versions for
293
+ * @returns List of page versions
294
+ * @throws {UnauthorizedException} When the API key is invalid or expired
295
+ * @throws {NotFoundException} When the page is not found
296
+ * @throws {ForbiddenException} When the page does not belong to the site
297
+ * @throws {ServerException} When the server encounters an error
298
+ * @throws {TimeoutException} When the request times out
299
+ */
286
300
  async getPageVersions(pageId) {
287
301
  const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
288
302
  return response.data;
@@ -290,7 +304,7 @@ class Pages {
290
304
  /**
291
305
  * Get a specific page version
292
306
  * @param pageId - ID of the page
293
- * @param versionId - ID of the version to get
307
+ * @param versionId - ID of the version to get or 'published' to get the published version
294
308
  * @returns The requested page version with data
295
309
  * @throws {UnauthorizedException} When the API key is invalid or expired
296
310
  * @throws {NotFoundException} When the page or version is not found
@@ -298,10 +312,23 @@ class Pages {
298
312
  * @throws {ServerException} When the server encounters an error
299
313
  * @throws {TimeoutException} When the request times out
300
314
  */
301
- async getPageVersion(pageId, versionId) {
315
+ async getVersion(pageId, versionId) {
302
316
  const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
303
317
  return response.data;
304
318
  }
319
+ /**
320
+ * Get the published version of a page
321
+ * @param pageId - ID of the page
322
+ * @returns The published page version with data
323
+ * @throws {UnauthorizedException} When the API key is invalid or expired
324
+ * @throws {NotFoundException} When the page is not found or has no published version
325
+ * @throws {ForbiddenException} When the page does not belong to the site
326
+ * @throws {ServerException} When the server encounters an error
327
+ * @throws {TimeoutException} When the request times out
328
+ */
329
+ async getPublishedVersion(pageId) {
330
+ return this.getVersion(pageId, 'published');
331
+ }
305
332
  /**
306
333
  * Create a new page version
307
334
  * @param pageId - ID of the page to create version for
@@ -280,6 +280,20 @@ export class Pages {
280
280
  * @throws {ServerException} When the server encounters an error
281
281
  * @throws {TimeoutException} When the request times out
282
282
  */
283
+ async getVersions(pageId) {
284
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
285
+ return response.data;
286
+ }
287
+ /**
288
+ * @deprecated Use getVersions instead, remove it after frontend will be updated
289
+ * @param pageId - ID of the page to get versions for
290
+ * @returns List of page versions
291
+ * @throws {UnauthorizedException} When the API key is invalid or expired
292
+ * @throws {NotFoundException} When the page is not found
293
+ * @throws {ForbiddenException} When the page does not belong to the site
294
+ * @throws {ServerException} When the server encounters an error
295
+ * @throws {TimeoutException} When the request times out
296
+ */
283
297
  async getPageVersions(pageId) {
284
298
  const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
285
299
  return response.data;
@@ -287,7 +301,7 @@ export class Pages {
287
301
  /**
288
302
  * Get a specific page version
289
303
  * @param pageId - ID of the page
290
- * @param versionId - ID of the version to get
304
+ * @param versionId - ID of the version to get or 'published' to get the published version
291
305
  * @returns The requested page version with data
292
306
  * @throws {UnauthorizedException} When the API key is invalid or expired
293
307
  * @throws {NotFoundException} When the page or version is not found
@@ -295,10 +309,23 @@ export class Pages {
295
309
  * @throws {ServerException} When the server encounters an error
296
310
  * @throws {TimeoutException} When the request times out
297
311
  */
298
- async getPageVersion(pageId, versionId) {
312
+ async getVersion(pageId, versionId) {
299
313
  const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
300
314
  return response.data;
301
315
  }
316
+ /**
317
+ * Get the published version of a page
318
+ * @param pageId - ID of the page
319
+ * @returns The published page version with data
320
+ * @throws {UnauthorizedException} When the API key is invalid or expired
321
+ * @throws {NotFoundException} When the page is not found or has no published version
322
+ * @throws {ForbiddenException} When the page does not belong to the site
323
+ * @throws {ServerException} When the server encounters an error
324
+ * @throws {TimeoutException} When the request times out
325
+ */
326
+ async getPublishedVersion(pageId) {
327
+ return this.getVersion(pageId, 'published');
328
+ }
302
329
  /**
303
330
  * Create a new page version
304
331
  * @param pageId - ID of the page to create version for
@@ -226,11 +226,22 @@ export declare class Pages {
226
226
  * @throws {ServerException} When the server encounters an error
227
227
  * @throws {TimeoutException} When the request times out
228
228
  */
229
+ getVersions(pageId: number): Promise<PageVersionListResponse>;
230
+ /**
231
+ * @deprecated Use getVersions instead, remove it after frontend will be updated
232
+ * @param pageId - ID of the page to get versions for
233
+ * @returns List of page versions
234
+ * @throws {UnauthorizedException} When the API key is invalid or expired
235
+ * @throws {NotFoundException} When the page is not found
236
+ * @throws {ForbiddenException} When the page does not belong to the site
237
+ * @throws {ServerException} When the server encounters an error
238
+ * @throws {TimeoutException} When the request times out
239
+ */
229
240
  getPageVersions(pageId: number): Promise<PageVersionListResponse>;
230
241
  /**
231
242
  * Get a specific page version
232
243
  * @param pageId - ID of the page
233
- * @param versionId - ID of the version to get
244
+ * @param versionId - ID of the version to get or 'published' to get the published version
234
245
  * @returns The requested page version with data
235
246
  * @throws {UnauthorizedException} When the API key is invalid or expired
236
247
  * @throws {NotFoundException} When the page or version is not found
@@ -238,7 +249,18 @@ export declare class Pages {
238
249
  * @throws {ServerException} When the server encounters an error
239
250
  * @throws {TimeoutException} When the request times out
240
251
  */
241
- getPageVersion(pageId: number, versionId: number): Promise<PageVersionDataResponse>;
252
+ getVersion(pageId: number, versionId: number | 'published'): Promise<PageVersionDataResponse>;
253
+ /**
254
+ * Get the published version of a page
255
+ * @param pageId - ID of the page
256
+ * @returns The published page version with data
257
+ * @throws {UnauthorizedException} When the API key is invalid or expired
258
+ * @throws {NotFoundException} When the page is not found or has no published version
259
+ * @throws {ForbiddenException} When the page does not belong to the site
260
+ * @throws {ServerException} When the server encounters an error
261
+ * @throws {TimeoutException} When the request times out
262
+ */
263
+ getPublishedVersion(pageId: number): Promise<PageVersionDataResponse>;
242
264
  /**
243
265
  * Create a new page version
244
266
  * @param pageId - ID of the page to create version for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexbe/sdk",
3
- "version": "0.2.37",
3
+ "version": "0.2.38",
4
4
  "description": "TypeScript SDK for Flexbe API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",