@flexbe/sdk 0.2.13 → 0.2.15

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.
@@ -238,4 +238,38 @@ export class Pages {
238
238
  return response.data;
239
239
  });
240
240
  }
241
+ /**
242
+ * Get page content
243
+ * @param pageId - ID of the page to get content for
244
+ * @returns The page content
245
+ * @throws {UnauthorizedException} When the API key is invalid or expired
246
+ * @throws {NotFoundException} When the page is not found
247
+ * @throws {ForbiddenException} When the page does not belong to the site
248
+ * @throws {ServerException} When the server encounters an error
249
+ * @throws {TimeoutException} When the request times out
250
+ */
251
+ getPageContent(pageId) {
252
+ return __awaiter(this, void 0, void 0, function* () {
253
+ const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/content`);
254
+ return response.data;
255
+ });
256
+ }
257
+ /**
258
+ * Update page content
259
+ * @param pageId - ID of the page to update content for
260
+ * @param content - The new page content
261
+ * @returns The updated page content
262
+ * @throws {UnauthorizedException} When the API key is invalid or expired
263
+ * @throws {NotFoundException} When the page is not found
264
+ * @throws {ForbiddenException} When the page does not belong to the site
265
+ * @throws {BadRequestException} When the update parameters are invalid
266
+ * @throws {ServerException} When the server encounters an error
267
+ * @throws {TimeoutException} When the request times out
268
+ */
269
+ updatePageContent(pageId, content) {
270
+ return __awaiter(this, void 0, void 0, function* () {
271
+ const response = yield this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
272
+ return response.data;
273
+ });
274
+ }
241
275
  }
@@ -212,5 +212,35 @@ class Pages {
212
212
  });
213
213
  return response.data;
214
214
  }
215
+ /**
216
+ * Get page content
217
+ * @param pageId - ID of the page to get content for
218
+ * @returns The page content
219
+ * @throws {UnauthorizedException} When the API key is invalid or expired
220
+ * @throws {NotFoundException} When the page is not found
221
+ * @throws {ForbiddenException} When the page does not belong to the site
222
+ * @throws {ServerException} When the server encounters an error
223
+ * @throws {TimeoutException} When the request times out
224
+ */
225
+ async getPageContent(pageId) {
226
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/content`);
227
+ return response.data;
228
+ }
229
+ /**
230
+ * Update page content
231
+ * @param pageId - ID of the page to update content for
232
+ * @param content - The new page content
233
+ * @returns The updated page content
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 {BadRequestException} When the update parameters are invalid
238
+ * @throws {ServerException} When the server encounters an error
239
+ * @throws {TimeoutException} When the request times out
240
+ */
241
+ async updatePageContent(pageId, content) {
242
+ const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
243
+ return response.data;
244
+ }
215
245
  }
216
246
  exports.Pages = Pages;
@@ -209,4 +209,34 @@ export class Pages {
209
209
  });
210
210
  return response.data;
211
211
  }
212
+ /**
213
+ * Get page content
214
+ * @param pageId - ID of the page to get content for
215
+ * @returns The page content
216
+ * @throws {UnauthorizedException} When the API key is invalid or expired
217
+ * @throws {NotFoundException} When the page is not found
218
+ * @throws {ForbiddenException} When the page does not belong to the site
219
+ * @throws {ServerException} When the server encounters an error
220
+ * @throws {TimeoutException} When the request times out
221
+ */
222
+ async getPageContent(pageId) {
223
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/content`);
224
+ return response.data;
225
+ }
226
+ /**
227
+ * Update page content
228
+ * @param pageId - ID of the page to update content for
229
+ * @param content - The new page content
230
+ * @returns The updated page content
231
+ * @throws {UnauthorizedException} When the API key is invalid or expired
232
+ * @throws {NotFoundException} When the page is not found
233
+ * @throws {ForbiddenException} When the page does not belong to the site
234
+ * @throws {BadRequestException} When the update parameters are invalid
235
+ * @throws {ServerException} When the server encounters an error
236
+ * @throws {TimeoutException} When the request times out
237
+ */
238
+ async updatePageContent(pageId, content) {
239
+ const response = await this.api.put(`/sites/${this.siteId}/pages/${pageId}/content`, content);
240
+ return response.data;
241
+ }
212
242
  }
@@ -1,4 +1,4 @@
1
- import { Page, GetPagesParams, PageListResponse, PageFolder, PageFolderListResponse, UpdateFolderParams, CreateFolderParams, UpdatePageParams, BulkUpdatePageItem, BulkUpdateResponse, BulkUpdateFolderItem, BulkUpdateFolderResponse, BulkDeleteResponseDto } from '../types/pages';
1
+ import { Page, GetPagesParams, PageListResponse, PageFolder, PageFolderListResponse, UpdateFolderParams, CreateFolderParams, UpdatePageParams, BulkUpdatePageItem, BulkUpdateResponse, BulkUpdateFolderItem, BulkUpdateFolderResponse, BulkDeleteResponse, PageContent } from '../types/pages';
2
2
  import { ApiClient } from './api-client';
3
3
  export declare class Pages {
4
4
  private readonly api;
@@ -168,5 +168,29 @@ export declare class Pages {
168
168
  * @throws {ServerException} When the server encounters an error
169
169
  * @throws {TimeoutException} When the request times out
170
170
  */
171
- bulkDeletePages(ids: number[]): Promise<BulkDeleteResponseDto>;
171
+ bulkDeletePages(ids: number[]): Promise<BulkDeleteResponse>;
172
+ /**
173
+ * Get page content
174
+ * @param pageId - ID of the page to get content for
175
+ * @returns The page content
176
+ * @throws {UnauthorizedException} When the API key is invalid or expired
177
+ * @throws {NotFoundException} When the page is not found
178
+ * @throws {ForbiddenException} When the page does not belong to the site
179
+ * @throws {ServerException} When the server encounters an error
180
+ * @throws {TimeoutException} When the request times out
181
+ */
182
+ getPageContent(pageId: number): Promise<PageContent>;
183
+ /**
184
+ * Update page content
185
+ * @param pageId - ID of the page to update content for
186
+ * @param content - The new page content
187
+ * @returns The updated page content
188
+ * @throws {UnauthorizedException} When the API key is invalid or expired
189
+ * @throws {NotFoundException} When the page is not found
190
+ * @throws {ForbiddenException} When the page does not belong to the site
191
+ * @throws {BadRequestException} When the update parameters are invalid
192
+ * @throws {ServerException} When the server encounters an error
193
+ * @throws {TimeoutException} When the request times out
194
+ */
195
+ updatePageContent(pageId: number, content: Partial<PageContent>): Promise<PageContent>;
172
196
  }
@@ -94,15 +94,7 @@ export interface UpdatePageParams {
94
94
  language?: string;
95
95
  folderId?: number;
96
96
  sortIndex?: number;
97
- meta?: {
98
- title?: string;
99
- description?: string;
100
- keywords?: string;
101
- ogImage?: string;
102
- ogTitle?: string;
103
- ogDescription?: string;
104
- noindex?: boolean;
105
- };
97
+ meta?: Partial<PageMeta>;
106
98
  }
107
99
  export interface BulkUpdatePageItem extends UpdatePageParams {
108
100
  id: number;
@@ -128,7 +120,7 @@ export interface BulkUpdateFolderResponse {
128
120
  updated: PageFolder[];
129
121
  errors: BulkUpdateFolderError[];
130
122
  }
131
- export interface BulkDeletePagesDto {
123
+ export interface BulkDeletePages {
132
124
  pageIds: number[];
133
125
  }
134
126
  export interface BulkDeleteError {
@@ -136,7 +128,164 @@ export interface BulkDeleteError {
136
128
  code: number;
137
129
  message: string;
138
130
  }
139
- export interface BulkDeleteResponseDto {
131
+ export interface BulkDeleteResponse {
140
132
  deleted: number[];
141
133
  errors: BulkDeleteError[];
142
134
  }
135
+ export interface PageBackground {
136
+ image: {
137
+ id: number;
138
+ ext: string;
139
+ average: string;
140
+ preview: string;
141
+ width: number;
142
+ height: number;
143
+ proportion: number;
144
+ border: string;
145
+ animated: boolean;
146
+ transparent: number;
147
+ } | null;
148
+ styles: {
149
+ backgroundRepeat: string;
150
+ backgroundPosition: string;
151
+ backgroundSize: string;
152
+ backgroundFixed: boolean;
153
+ backgroundColor: string;
154
+ contrast: string;
155
+ };
156
+ }
157
+ export interface PageGrid {
158
+ color: string;
159
+ desktop: {
160
+ columns: string;
161
+ containerWidth: string;
162
+ columnWidth: string;
163
+ gap: string;
164
+ };
165
+ mobile: {
166
+ columns: string;
167
+ containerWidth: string;
168
+ columnWidth: string;
169
+ gap: string;
170
+ };
171
+ }
172
+ export interface PageFont {
173
+ set: Array<{
174
+ id: string;
175
+ uid: string;
176
+ protected: boolean;
177
+ title: string;
178
+ style: {
179
+ fontId: string;
180
+ family: string;
181
+ weight: number;
182
+ size: string;
183
+ line_height: number;
184
+ letter_spacing: number;
185
+ registry: string;
186
+ decoration_italic: boolean;
187
+ color: string;
188
+ contrast: string;
189
+ decoration_strike: boolean;
190
+ decoration_underline: boolean;
191
+ colors: {
192
+ enable: boolean;
193
+ light: {
194
+ color: string;
195
+ opacity: number;
196
+ contrast: string;
197
+ };
198
+ dark: {
199
+ color: string;
200
+ opacity: number;
201
+ contrast: string;
202
+ };
203
+ };
204
+ };
205
+ mobile: {
206
+ weight: string;
207
+ size: string;
208
+ line_height: number;
209
+ letter_spacing: string;
210
+ fontId: string;
211
+ family: string;
212
+ registry: string;
213
+ decoration_italic: string;
214
+ decoration_strike: string;
215
+ decoration_underline: string;
216
+ colors: {
217
+ light: string;
218
+ dark: string;
219
+ };
220
+ };
221
+ subsets: string[];
222
+ }>;
223
+ }
224
+ export interface PageBlock {
225
+ update_time: number;
226
+ data: Record<string, unknown>;
227
+ id: string;
228
+ is: string;
229
+ template_id: string;
230
+ refPageId?: number;
231
+ p_id: number;
232
+ aboveTheFold?: boolean;
233
+ }
234
+ export interface PageElement {
235
+ update_time: number;
236
+ data: Record<string, unknown>;
237
+ id: string;
238
+ is: string;
239
+ template_id: string;
240
+ mod_id?: string;
241
+ p_id: number;
242
+ aboveTheFold?: boolean;
243
+ hidden?: string;
244
+ }
245
+ export interface PageWidget {
246
+ update_time: number;
247
+ data: Record<string, unknown>;
248
+ id: string;
249
+ is: string;
250
+ template_id: string;
251
+ untouched?: boolean;
252
+ p_id: number;
253
+ }
254
+ export interface PageABTest {
255
+ a: string;
256
+ b: string;
257
+ current: 'a' | 'b';
258
+ is_active: number;
259
+ id: number;
260
+ }
261
+ export interface PageModal {
262
+ update_time: number;
263
+ data: Record<string, unknown>;
264
+ id: string;
265
+ is: string;
266
+ template_id: string;
267
+ mod_id: string;
268
+ p_id: number;
269
+ screenshot: {
270
+ id: number;
271
+ ext: string;
272
+ average: string;
273
+ preview: string;
274
+ width: number;
275
+ height: number;
276
+ proportion: number;
277
+ animated: boolean;
278
+ transparent: number;
279
+ };
280
+ }
281
+ export interface PageContent {
282
+ blocks: PageBlock[];
283
+ modals: PageModal[];
284
+ elements: PageElement[];
285
+ widgets: PageWidget[];
286
+ codes: string[];
287
+ background: PageBackground;
288
+ fonts: PageFont;
289
+ abtests: PageABTest[];
290
+ responsive: string | boolean;
291
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexbe/sdk",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "TypeScript SDK for Flexbe API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",