@flexbe/sdk 0.1.4 → 0.2.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.
@@ -80,6 +80,9 @@ export class ApiClient {
80
80
  put(url, data, config) {
81
81
  return this.request(Object.assign(Object.assign({}, config), { url, method: 'PUT', body: JSON.stringify(data) }));
82
82
  }
83
+ patch(url, data, config) {
84
+ return this.request(Object.assign(Object.assign({}, config), { url, method: 'PATCH', body: JSON.stringify(data) }));
85
+ }
83
86
  delete(url, config) {
84
87
  return this.request(Object.assign(Object.assign({}, config), { url, method: 'DELETE' }));
85
88
  }
@@ -47,4 +47,32 @@ export class Pages {
47
47
  return response.data;
48
48
  });
49
49
  }
50
+ /**
51
+ * Update a folder's properties
52
+ */
53
+ updateFolder(folderId, data) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const response = yield this.api.patch(`/sites/:siteId:/pages-folders/${folderId}`, data);
56
+ return response.data;
57
+ });
58
+ }
59
+ /**
60
+ * Create a new folder
61
+ */
62
+ createFolder(data) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const response = yield this.api.post('/sites/:siteId:/pages-folders', data);
65
+ return response.data;
66
+ });
67
+ }
68
+ /**
69
+ * Delete a folder and its items
70
+ * @throws {NotFoundException} When the folder is not found
71
+ * @throws {ForbiddenException} When the folder does not belong to the site
72
+ */
73
+ deleteFolder(folderId) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ yield this.api.delete(`/sites/:siteId:/pages-folders/${folderId}`);
76
+ });
77
+ }
50
78
  }
@@ -79,6 +79,9 @@ class ApiClient {
79
79
  put(url, data, config) {
80
80
  return this.request({ ...config, url, method: 'PUT', body: JSON.stringify(data) });
81
81
  }
82
+ patch(url, data, config) {
83
+ return this.request({ ...config, url, method: 'PATCH', body: JSON.stringify(data) });
84
+ }
82
85
  delete(url, config) {
83
86
  return this.request({ ...config, url, method: 'DELETE' });
84
87
  }
@@ -33,5 +33,27 @@ class Pages {
33
33
  const response = await this.api.get(`/sites/:siteId:/pages-folders/${folderId}`);
34
34
  return response.data;
35
35
  }
36
+ /**
37
+ * Update a folder's properties
38
+ */
39
+ async updateFolder(folderId, data) {
40
+ const response = await this.api.patch(`/sites/:siteId:/pages-folders/${folderId}`, data);
41
+ return response.data;
42
+ }
43
+ /**
44
+ * Create a new folder
45
+ */
46
+ async createFolder(data) {
47
+ const response = await this.api.post('/sites/:siteId:/pages-folders', data);
48
+ return response.data;
49
+ }
50
+ /**
51
+ * Delete a folder and its items
52
+ * @throws {NotFoundException} When the folder is not found
53
+ * @throws {ForbiddenException} When the folder does not belong to the site
54
+ */
55
+ async deleteFolder(folderId) {
56
+ await this.api.delete(`/sites/:siteId:/pages-folders/${folderId}`);
57
+ }
36
58
  }
37
59
  exports.Pages = Pages;
@@ -76,6 +76,9 @@ export class ApiClient {
76
76
  put(url, data, config) {
77
77
  return this.request({ ...config, url, method: 'PUT', body: JSON.stringify(data) });
78
78
  }
79
+ patch(url, data, config) {
80
+ return this.request({ ...config, url, method: 'PATCH', body: JSON.stringify(data) });
81
+ }
79
82
  delete(url, config) {
80
83
  return this.request({ ...config, url, method: 'DELETE' });
81
84
  }
@@ -30,4 +30,26 @@ export class Pages {
30
30
  const response = await this.api.get(`/sites/:siteId:/pages-folders/${folderId}`);
31
31
  return response.data;
32
32
  }
33
+ /**
34
+ * Update a folder's properties
35
+ */
36
+ async updateFolder(folderId, data) {
37
+ const response = await this.api.patch(`/sites/:siteId:/pages-folders/${folderId}`, data);
38
+ return response.data;
39
+ }
40
+ /**
41
+ * Create a new folder
42
+ */
43
+ async createFolder(data) {
44
+ const response = await this.api.post('/sites/:siteId:/pages-folders', data);
45
+ return response.data;
46
+ }
47
+ /**
48
+ * Delete a folder and its items
49
+ * @throws {NotFoundException} When the folder is not found
50
+ * @throws {ForbiddenException} When the folder does not belong to the site
51
+ */
52
+ async deleteFolder(folderId) {
53
+ await this.api.delete(`/sites/:siteId:/pages-folders/${folderId}`);
54
+ }
33
55
  }
@@ -15,6 +15,9 @@ export declare class ApiClient {
15
15
  put<T>(url: string, data?: unknown, config?: RequestInit & {
16
16
  params?: object;
17
17
  }): Promise<FlexbeResponse<T>>;
18
+ patch<T>(url: string, data?: unknown, config?: RequestInit & {
19
+ params?: object;
20
+ }): Promise<FlexbeResponse<T>>;
18
21
  delete<T>(url: string, config?: RequestInit & {
19
22
  params?: object;
20
23
  }): Promise<FlexbeResponse<T>>;
@@ -1,4 +1,4 @@
1
- import { Page, GetPagesParams, PageListResponse, PageFolder, PageFolderListResponse } from '../types/pages';
1
+ import { Page, GetPagesParams, PageListResponse, PageFolder, PageFolderListResponse, UpdateFolderParams, CreateFolderParams } from '../types/pages';
2
2
  import { ApiClient } from './api-client';
3
3
  export declare class Pages {
4
4
  private readonly api;
@@ -19,4 +19,18 @@ export declare class Pages {
19
19
  * Get a single folder by ID
20
20
  */
21
21
  getFolder(folderId: number): Promise<PageFolder>;
22
+ /**
23
+ * Update a folder's properties
24
+ */
25
+ updateFolder(folderId: number, data: UpdateFolderParams): Promise<PageFolder>;
26
+ /**
27
+ * Create a new folder
28
+ */
29
+ createFolder(data: CreateFolderParams): Promise<PageFolder>;
30
+ /**
31
+ * Delete a folder and its items
32
+ * @throws {NotFoundException} When the folder is not found
33
+ * @throws {ForbiddenException} When the folder does not belong to the site
34
+ */
35
+ deleteFolder(folderId: number): Promise<void>;
22
36
  }
@@ -44,3 +44,11 @@ export interface PageFolder {
44
44
  export interface PageFolderListResponse {
45
45
  folders: PageFolder[];
46
46
  }
47
+ export interface UpdateFolderParams {
48
+ title?: string;
49
+ sortIndex?: number;
50
+ }
51
+ export interface CreateFolderParams {
52
+ title: string;
53
+ sortIndex?: number;
54
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexbe/sdk",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript SDK for Flexbe API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",