@flexbe/sdk 0.2.37 → 0.2.39

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.
@@ -274,69 +274,51 @@ export class Pages {
274
274
  });
275
275
  }
276
276
  /**
277
- * Get list of page history items
278
- * @param pageId - ID of the page to get history for
279
- * @returns List of page history items
277
+ * Get list of page versions
278
+ * @param pageId - ID of the page to get versions for
279
+ * @returns List of page versions
280
280
  * @throws {UnauthorizedException} When the API key is invalid or expired
281
281
  * @throws {NotFoundException} When the page is not found
282
282
  * @throws {ForbiddenException} When the page does not belong to the site
283
283
  * @throws {ServerException} When the server encounters an error
284
284
  * @throws {TimeoutException} When the request times out
285
285
  */
286
- getPageHistory(pageId) {
286
+ getVersions(pageId) {
287
287
  return __awaiter(this, void 0, void 0, function* () {
288
- const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/history`);
288
+ const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
289
289
  return response.data;
290
290
  });
291
291
  }
292
292
  /**
293
- * Get a specific page history item
293
+ * Get a specific page version
294
294
  * @param pageId - ID of the page
295
- * @param versionId - ID of the history item to get
296
- * @returns The requested page history item with data
297
- * @throws {UnauthorizedException} When the API key is invalid or expired
298
- * @throws {NotFoundException} When the page or history item is not found
299
- * @throws {ForbiddenException} When the page does not belong to the site
300
- * @throws {ServerException} When the server encounters an error
301
- * @throws {TimeoutException} When the request times out
302
- */
303
- getPageHistoryItem(pageId, versionId) {
304
- return __awaiter(this, void 0, void 0, function* () {
305
- const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/history/${versionId}`);
306
- return response.data;
307
- });
308
- }
309
- /**
310
- * Get list of page versions
311
- * @param pageId - ID of the page to get versions for
312
- * @returns List of page versions
295
+ * @param versionId - ID of the version to get or 'published' to get the published version
296
+ * @returns The requested page version with data
313
297
  * @throws {UnauthorizedException} When the API key is invalid or expired
314
- * @throws {NotFoundException} When the page is not found
298
+ * @throws {NotFoundException} When the page or version is not found
315
299
  * @throws {ForbiddenException} When the page does not belong to the site
316
300
  * @throws {ServerException} When the server encounters an error
317
301
  * @throws {TimeoutException} When the request times out
318
302
  */
319
- getPageVersions(pageId) {
303
+ getVersion(pageId, versionId) {
320
304
  return __awaiter(this, void 0, void 0, function* () {
321
- const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
305
+ const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
322
306
  return response.data;
323
307
  });
324
308
  }
325
309
  /**
326
- * Get a specific page version
310
+ * Get the published version of a page
327
311
  * @param pageId - ID of the page
328
- * @param versionId - ID of the version to get
329
- * @returns The requested page version with data
312
+ * @returns The published page version with data
330
313
  * @throws {UnauthorizedException} When the API key is invalid or expired
331
- * @throws {NotFoundException} When the page or version is not found
314
+ * @throws {NotFoundException} When the page is not found or has no published version
332
315
  * @throws {ForbiddenException} When the page does not belong to the site
333
316
  * @throws {ServerException} When the server encounters an error
334
317
  * @throws {TimeoutException} When the request times out
335
318
  */
336
- getPageVersion(pageId, versionId) {
319
+ getPublishedVersion(pageId) {
337
320
  return __awaiter(this, void 0, void 0, function* () {
338
- const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
339
- return response.data;
321
+ return this.getVersion(pageId, 'published');
340
322
  });
341
323
  }
342
324
  /**
@@ -244,35 +244,6 @@ class Pages {
244
244
  const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
245
245
  return response.data;
246
246
  }
247
- /**
248
- * Get list of page history items
249
- * @param pageId - ID of the page to get history for
250
- * @returns List of page history items
251
- * @throws {UnauthorizedException} When the API key is invalid or expired
252
- * @throws {NotFoundException} When the page is not found
253
- * @throws {ForbiddenException} When the page does not belong to the site
254
- * @throws {ServerException} When the server encounters an error
255
- * @throws {TimeoutException} When the request times out
256
- */
257
- async getPageHistory(pageId) {
258
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/history`);
259
- return response.data;
260
- }
261
- /**
262
- * Get a specific page history item
263
- * @param pageId - ID of the page
264
- * @param versionId - ID of the history item to get
265
- * @returns The requested page history item with data
266
- * @throws {UnauthorizedException} When the API key is invalid or expired
267
- * @throws {NotFoundException} When the page or history item is not found
268
- * @throws {ForbiddenException} When the page does not belong to the site
269
- * @throws {ServerException} When the server encounters an error
270
- * @throws {TimeoutException} When the request times out
271
- */
272
- async getPageHistoryItem(pageId, versionId) {
273
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/history/${versionId}`);
274
- return response.data;
275
- }
276
247
  /**
277
248
  * Get list of page versions
278
249
  * @param pageId - ID of the page to get versions for
@@ -283,14 +254,14 @@ class Pages {
283
254
  * @throws {ServerException} When the server encounters an error
284
255
  * @throws {TimeoutException} When the request times out
285
256
  */
286
- async getPageVersions(pageId) {
257
+ async getVersions(pageId) {
287
258
  const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
288
259
  return response.data;
289
260
  }
290
261
  /**
291
262
  * Get a specific page version
292
263
  * @param pageId - ID of the page
293
- * @param versionId - ID of the version to get
264
+ * @param versionId - ID of the version to get or 'published' to get the published version
294
265
  * @returns The requested page version with data
295
266
  * @throws {UnauthorizedException} When the API key is invalid or expired
296
267
  * @throws {NotFoundException} When the page or version is not found
@@ -298,10 +269,23 @@ class Pages {
298
269
  * @throws {ServerException} When the server encounters an error
299
270
  * @throws {TimeoutException} When the request times out
300
271
  */
301
- async getPageVersion(pageId, versionId) {
272
+ async getVersion(pageId, versionId) {
302
273
  const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
303
274
  return response.data;
304
275
  }
276
+ /**
277
+ * Get the published version of a page
278
+ * @param pageId - ID of the page
279
+ * @returns The published page version with data
280
+ * @throws {UnauthorizedException} When the API key is invalid or expired
281
+ * @throws {NotFoundException} When the page is not found or has no published version
282
+ * @throws {ForbiddenException} When the page does not belong to the site
283
+ * @throws {ServerException} When the server encounters an error
284
+ * @throws {TimeoutException} When the request times out
285
+ */
286
+ async getPublishedVersion(pageId) {
287
+ return this.getVersion(pageId, 'published');
288
+ }
305
289
  /**
306
290
  * Create a new page version
307
291
  * @param pageId - ID of the page to create version for
@@ -241,35 +241,6 @@ export class Pages {
241
241
  const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
242
242
  return response.data;
243
243
  }
244
- /**
245
- * Get list of page history items
246
- * @param pageId - ID of the page to get history for
247
- * @returns List of page history items
248
- * @throws {UnauthorizedException} When the API key is invalid or expired
249
- * @throws {NotFoundException} When the page is not found
250
- * @throws {ForbiddenException} When the page does not belong to the site
251
- * @throws {ServerException} When the server encounters an error
252
- * @throws {TimeoutException} When the request times out
253
- */
254
- async getPageHistory(pageId) {
255
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/history`);
256
- return response.data;
257
- }
258
- /**
259
- * Get a specific page history item
260
- * @param pageId - ID of the page
261
- * @param versionId - ID of the history item to get
262
- * @returns The requested page history item with data
263
- * @throws {UnauthorizedException} When the API key is invalid or expired
264
- * @throws {NotFoundException} When the page or history item is not found
265
- * @throws {ForbiddenException} When the page does not belong to the site
266
- * @throws {ServerException} When the server encounters an error
267
- * @throws {TimeoutException} When the request times out
268
- */
269
- async getPageHistoryItem(pageId, versionId) {
270
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/history/${versionId}`);
271
- return response.data;
272
- }
273
244
  /**
274
245
  * Get list of page versions
275
246
  * @param pageId - ID of the page to get versions for
@@ -280,14 +251,14 @@ export class Pages {
280
251
  * @throws {ServerException} When the server encounters an error
281
252
  * @throws {TimeoutException} When the request times out
282
253
  */
283
- async getPageVersions(pageId) {
254
+ async getVersions(pageId) {
284
255
  const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions`);
285
256
  return response.data;
286
257
  }
287
258
  /**
288
259
  * Get a specific page version
289
260
  * @param pageId - ID of the page
290
- * @param versionId - ID of the version to get
261
+ * @param versionId - ID of the version to get or 'published' to get the published version
291
262
  * @returns The requested page version with data
292
263
  * @throws {UnauthorizedException} When the API key is invalid or expired
293
264
  * @throws {NotFoundException} When the page or version is not found
@@ -295,10 +266,23 @@ export class Pages {
295
266
  * @throws {ServerException} When the server encounters an error
296
267
  * @throws {TimeoutException} When the request times out
297
268
  */
298
- async getPageVersion(pageId, versionId) {
269
+ async getVersion(pageId, versionId) {
299
270
  const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
300
271
  return response.data;
301
272
  }
273
+ /**
274
+ * Get the published version of a page
275
+ * @param pageId - ID of the page
276
+ * @returns The published page version with data
277
+ * @throws {UnauthorizedException} When the API key is invalid or expired
278
+ * @throws {NotFoundException} When the page is not found or has no published version
279
+ * @throws {ForbiddenException} When the page does not belong to the site
280
+ * @throws {ServerException} When the server encounters an error
281
+ * @throws {TimeoutException} When the request times out
282
+ */
283
+ async getPublishedVersion(pageId) {
284
+ return this.getVersion(pageId, 'published');
285
+ }
302
286
  /**
303
287
  * Create a new page version
304
288
  * @param pageId - ID of the page to create version for
@@ -1,5 +1,5 @@
1
1
  import { ApiClient } from './api-client';
2
- import { BulkDeleteResponse, BulkUpdateFolderItem, BulkUpdateFolderResponse, BulkUpdatePageItem, BulkUpdateResponse, CreateFolderParams, CreatePageVersionParams, GetPagesParams, Page, PageContent, PageFolder, PageFolderListResponse, PageHistoryItemData, PageHistoryListResponse, PageListResponse, PageVersionDataResponse, PageVersionListResponse, UpdateFolderParams, UpdatePageContentParams, UpdatePageParams } from '../types/pages';
2
+ import { BulkDeleteResponse, BulkUpdateFolderItem, BulkUpdateFolderResponse, BulkUpdatePageItem, BulkUpdateResponse, CreateFolderParams, CreatePageVersionParams, GetPagesParams, Page, PageContent, PageFolder, PageFolderListResponse, PageListResponse, PageVersionDataResponse, PageVersionListResponse, UpdateFolderParams, UpdatePageContentParams, UpdatePageParams } from '../types/pages';
3
3
  export declare class Pages {
4
4
  private readonly api;
5
5
  private readonly siteId;
@@ -194,51 +194,39 @@ export declare class Pages {
194
194
  */
195
195
  updatePageContent(pageId: number, content: Partial<UpdatePageContentParams>): Promise<PageContent>;
196
196
  /**
197
- * Get list of page history items
198
- * @param pageId - ID of the page to get history for
199
- * @returns List of page history items
197
+ * Get list of page versions
198
+ * @param pageId - ID of the page to get versions for
199
+ * @returns List of page versions
200
200
  * @throws {UnauthorizedException} When the API key is invalid or expired
201
201
  * @throws {NotFoundException} When the page is not found
202
202
  * @throws {ForbiddenException} When the page does not belong to the site
203
203
  * @throws {ServerException} When the server encounters an error
204
204
  * @throws {TimeoutException} When the request times out
205
205
  */
206
- getPageHistory(pageId: number): Promise<PageHistoryListResponse>;
206
+ getVersions(pageId: number): Promise<PageVersionListResponse>;
207
207
  /**
208
- * Get a specific page history item
208
+ * Get a specific page version
209
209
  * @param pageId - ID of the page
210
- * @param versionId - ID of the history item to get
211
- * @returns The requested page history item with data
212
- * @throws {UnauthorizedException} When the API key is invalid or expired
213
- * @throws {NotFoundException} When the page or history item is not found
214
- * @throws {ForbiddenException} When the page does not belong to the site
215
- * @throws {ServerException} When the server encounters an error
216
- * @throws {TimeoutException} When the request times out
217
- */
218
- getPageHistoryItem(pageId: number, versionId: number): Promise<PageHistoryItemData>;
219
- /**
220
- * Get list of page versions
221
- * @param pageId - ID of the page to get versions for
222
- * @returns List of page versions
210
+ * @param versionId - ID of the version to get or 'published' to get the published version
211
+ * @returns The requested page version with data
223
212
  * @throws {UnauthorizedException} When the API key is invalid or expired
224
- * @throws {NotFoundException} When the page is not found
213
+ * @throws {NotFoundException} When the page or version is not found
225
214
  * @throws {ForbiddenException} When the page does not belong to the site
226
215
  * @throws {ServerException} When the server encounters an error
227
216
  * @throws {TimeoutException} When the request times out
228
217
  */
229
- getPageVersions(pageId: number): Promise<PageVersionListResponse>;
218
+ getVersion(pageId: number, versionId: number | 'published'): Promise<PageVersionDataResponse>;
230
219
  /**
231
- * Get a specific page version
220
+ * Get the published version of a page
232
221
  * @param pageId - ID of the page
233
- * @param versionId - ID of the version to get
234
- * @returns The requested page version with data
222
+ * @returns The published page version with data
235
223
  * @throws {UnauthorizedException} When the API key is invalid or expired
236
- * @throws {NotFoundException} When the page or version is not found
224
+ * @throws {NotFoundException} When the page is not found or has no published version
237
225
  * @throws {ForbiddenException} When the page does not belong to the site
238
226
  * @throws {ServerException} When the server encounters an error
239
227
  * @throws {TimeoutException} When the request times out
240
228
  */
241
- getPageVersion(pageId: number, versionId: number): Promise<PageVersionDataResponse>;
229
+ getPublishedVersion(pageId: number): Promise<PageVersionDataResponse>;
242
230
  /**
243
231
  * Create a new page version
244
232
  * @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.39",
4
4
  "description": "TypeScript SDK for Flexbe API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",