@flexbe/sdk 0.1.4 → 0.2.1

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
  }
@@ -13,6 +13,14 @@ export class Pages {
13
13
  }
14
14
  /**
15
15
  * Get list of pages for a site
16
+ * @param params - Query parameters including:
17
+ * - offset: Number of items to skip (default: 0)
18
+ * - limit: Maximum number of items to return (default: 100)
19
+ * - type: Filter by page type
20
+ * - status: Filter by page status
21
+ * - uri: Search by URI (exact match with '/' or partial match with '%word%')
22
+ * - title: Search by title
23
+ * - folderId: Filter by folder ID
16
24
  */
17
25
  getPages(params) {
18
26
  return __awaiter(this, void 0, void 0, function* () {
@@ -47,4 +55,39 @@ export class Pages {
47
55
  return response.data;
48
56
  });
49
57
  }
58
+ /**
59
+ * Update a folder's properties
60
+ * @param folderId - ID of the folder to update
61
+ * @param data - Update parameters:
62
+ * - title: New title for the folder
63
+ * - sortIndex: New position in the folder list
64
+ */
65
+ updateFolder(folderId, data) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const response = yield this.api.patch(`/sites/:siteId:/pages-folders/${folderId}`, data);
68
+ return response.data;
69
+ });
70
+ }
71
+ /**
72
+ * Create a new folder
73
+ * @param data - Create parameters:
74
+ * - title: Title of the new folder (required)
75
+ * - sortIndex: Position in the folder list (optional)
76
+ */
77
+ createFolder(data) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const response = yield this.api.post('/sites/:siteId:/pages-folders', data);
80
+ return response.data;
81
+ });
82
+ }
83
+ /**
84
+ * Delete a folder and its items
85
+ * @throws {NotFoundException} When the folder is not found
86
+ * @throws {ForbiddenException} When the folder does not belong to the site
87
+ */
88
+ deleteFolder(folderId) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ yield this.api.delete(`/sites/:siteId:/pages-folders/${folderId}`);
91
+ });
92
+ }
50
93
  }
@@ -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
  }
@@ -7,6 +7,14 @@ class Pages {
7
7
  }
8
8
  /**
9
9
  * Get list of pages for a site
10
+ * @param params - Query parameters including:
11
+ * - offset: Number of items to skip (default: 0)
12
+ * - limit: Maximum number of items to return (default: 100)
13
+ * - type: Filter by page type
14
+ * - status: Filter by page status
15
+ * - uri: Search by URI (exact match with '/' or partial match with '%word%')
16
+ * - title: Search by title
17
+ * - folderId: Filter by folder ID
10
18
  */
11
19
  async getPages(params) {
12
20
  const response = await this.api.get('/sites/:siteId:/pages', { params });
@@ -33,5 +41,34 @@ class Pages {
33
41
  const response = await this.api.get(`/sites/:siteId:/pages-folders/${folderId}`);
34
42
  return response.data;
35
43
  }
44
+ /**
45
+ * Update a folder's properties
46
+ * @param folderId - ID of the folder to update
47
+ * @param data - Update parameters:
48
+ * - title: New title for the folder
49
+ * - sortIndex: New position in the folder list
50
+ */
51
+ async updateFolder(folderId, data) {
52
+ const response = await this.api.patch(`/sites/:siteId:/pages-folders/${folderId}`, data);
53
+ return response.data;
54
+ }
55
+ /**
56
+ * Create a new folder
57
+ * @param data - Create parameters:
58
+ * - title: Title of the new folder (required)
59
+ * - sortIndex: Position in the folder list (optional)
60
+ */
61
+ async createFolder(data) {
62
+ const response = await this.api.post('/sites/:siteId:/pages-folders', data);
63
+ return response.data;
64
+ }
65
+ /**
66
+ * Delete a folder and its items
67
+ * @throws {NotFoundException} When the folder is not found
68
+ * @throws {ForbiddenException} When the folder does not belong to the site
69
+ */
70
+ async deleteFolder(folderId) {
71
+ await this.api.delete(`/sites/:siteId:/pages-folders/${folderId}`);
72
+ }
36
73
  }
37
74
  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
  }
@@ -4,6 +4,14 @@ export class Pages {
4
4
  }
5
5
  /**
6
6
  * Get list of pages for a site
7
+ * @param params - Query parameters including:
8
+ * - offset: Number of items to skip (default: 0)
9
+ * - limit: Maximum number of items to return (default: 100)
10
+ * - type: Filter by page type
11
+ * - status: Filter by page status
12
+ * - uri: Search by URI (exact match with '/' or partial match with '%word%')
13
+ * - title: Search by title
14
+ * - folderId: Filter by folder ID
7
15
  */
8
16
  async getPages(params) {
9
17
  const response = await this.api.get('/sites/:siteId:/pages', { params });
@@ -30,4 +38,33 @@ export class Pages {
30
38
  const response = await this.api.get(`/sites/:siteId:/pages-folders/${folderId}`);
31
39
  return response.data;
32
40
  }
41
+ /**
42
+ * Update a folder's properties
43
+ * @param folderId - ID of the folder to update
44
+ * @param data - Update parameters:
45
+ * - title: New title for the folder
46
+ * - sortIndex: New position in the folder list
47
+ */
48
+ async updateFolder(folderId, data) {
49
+ const response = await this.api.patch(`/sites/:siteId:/pages-folders/${folderId}`, data);
50
+ return response.data;
51
+ }
52
+ /**
53
+ * Create a new folder
54
+ * @param data - Create parameters:
55
+ * - title: Title of the new folder (required)
56
+ * - sortIndex: Position in the folder list (optional)
57
+ */
58
+ async createFolder(data) {
59
+ const response = await this.api.post('/sites/:siteId:/pages-folders', data);
60
+ return response.data;
61
+ }
62
+ /**
63
+ * Delete a folder and its items
64
+ * @throws {NotFoundException} When the folder is not found
65
+ * @throws {ForbiddenException} When the folder does not belong to the site
66
+ */
67
+ async deleteFolder(folderId) {
68
+ await this.api.delete(`/sites/:siteId:/pages-folders/${folderId}`);
69
+ }
33
70
  }
@@ -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,10 +1,18 @@
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;
5
5
  constructor(api: ApiClient);
6
6
  /**
7
7
  * Get list of pages for a site
8
+ * @param params - Query parameters including:
9
+ * - offset: Number of items to skip (default: 0)
10
+ * - limit: Maximum number of items to return (default: 100)
11
+ * - type: Filter by page type
12
+ * - status: Filter by page status
13
+ * - uri: Search by URI (exact match with '/' or partial match with '%word%')
14
+ * - title: Search by title
15
+ * - folderId: Filter by folder ID
8
16
  */
9
17
  getPages(params?: GetPagesParams): Promise<PageListResponse>;
10
18
  /**
@@ -19,4 +27,25 @@ export declare class Pages {
19
27
  * Get a single folder by ID
20
28
  */
21
29
  getFolder(folderId: number): Promise<PageFolder>;
30
+ /**
31
+ * Update a folder's properties
32
+ * @param folderId - ID of the folder to update
33
+ * @param data - Update parameters:
34
+ * - title: New title for the folder
35
+ * - sortIndex: New position in the folder list
36
+ */
37
+ updateFolder(folderId: number, data: UpdateFolderParams): Promise<PageFolder>;
38
+ /**
39
+ * Create a new folder
40
+ * @param data - Create parameters:
41
+ * - title: Title of the new folder (required)
42
+ * - sortIndex: Position in the folder list (optional)
43
+ */
44
+ createFolder(data: CreateFolderParams): Promise<PageFolder>;
45
+ /**
46
+ * Delete a folder and its items
47
+ * @throws {NotFoundException} When the folder is not found
48
+ * @throws {ForbiddenException} When the folder does not belong to the site
49
+ */
50
+ deleteFolder(folderId: number): Promise<void>;
22
51
  }
@@ -1,4 +1,33 @@
1
1
  import { Pagination } from './index';
2
+ export interface GridConfig {
3
+ color?: string;
4
+ desktop?: {
5
+ columns: number;
6
+ containerWidth: number;
7
+ columnWidth: number;
8
+ gap: number;
9
+ };
10
+ mobile?: {
11
+ columns: number;
12
+ containerWidth: number;
13
+ columnWidth: number;
14
+ gap: number;
15
+ };
16
+ }
17
+ export interface Screenshot {
18
+ id: number | null;
19
+ ext: string;
20
+ url: string | null;
21
+ }
22
+ export interface PageMeta {
23
+ title: string | null;
24
+ description: string | null;
25
+ keywords: string | null;
26
+ ogImage: string | null;
27
+ ogTitle: string | null;
28
+ ogDescription: string | null;
29
+ noindex: boolean;
30
+ }
2
31
  export declare enum PageType {
3
32
  PAGE = "page",
4
33
  FILE = "file",
@@ -16,20 +45,25 @@ export declare enum PageStatus {
16
45
  export interface Page {
17
46
  id: number;
18
47
  type: PageType;
19
- uri: string;
20
- title: string | null;
21
48
  status: PageStatus;
22
- updatedAt?: Date;
23
- imgId: number | null;
24
- folderId: number | null;
49
+ name: string;
50
+ uri: string | null;
51
+ language: string;
52
+ folderId: number;
25
53
  sortIndex: number;
54
+ updatedAt?: Date;
55
+ deletedAt: Date | null;
56
+ screenshot: Screenshot | null;
57
+ meta: PageMeta | null;
58
+ grid?: GridConfig;
26
59
  }
27
60
  export interface GetPagesParams {
28
61
  offset?: number;
29
62
  limit?: number;
30
63
  type?: PageType;
31
64
  status?: PageStatus;
32
- search?: string;
65
+ uri?: string;
66
+ title?: string;
33
67
  folderId?: number;
34
68
  }
35
69
  export interface PageListResponse {
@@ -44,3 +78,11 @@ export interface PageFolder {
44
78
  export interface PageFolderListResponse {
45
79
  folders: PageFolder[];
46
80
  }
81
+ export interface UpdateFolderParams {
82
+ title?: string;
83
+ sortIndex?: number;
84
+ }
85
+ export interface CreateFolderParams {
86
+ title: string;
87
+ sortIndex?: number;
88
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexbe/sdk",
3
- "version": "0.1.4",
3
+ "version": "0.2.1",
4
4
  "description": "TypeScript SDK for Flexbe API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",