@agility/management-sdk 0.1.37 → 0.1.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.
- package/.github/workflows/npm-publish.yml +61 -0
- package/README.md +396 -371
- package/dist/apiMethods/instanceMethods.d.ts +13 -0
- package/dist/apiMethods/instanceMethods.js +48 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/exception.d.ts +4 -0
- package/dist/models/exception.js +17 -1
- package/dist/models/fetchApiStatus.d.ts +38 -0
- package/dist/models/fetchApiStatus.js +2 -0
- package/docs/asset-methods.md +381 -381
- package/docs/auth-component.md +360 -360
- package/docs/auth.md +593 -593
- package/docs/batch-methods.md +243 -243
- package/docs/cicd.md +606 -606
- package/docs/container-methods.md +267 -267
- package/docs/content-methods.md +491 -491
- package/docs/instance-methods.md +185 -105
- package/docs/instance-user-methods.md +230 -230
- package/docs/model-methods.md +433 -433
- package/docs/multi-instance-operations.md +191 -191
- package/docs/page-methods.md +737 -737
- package/docs/server-user-methods.md +279 -279
- package/docs/webhook-methods.md +451 -451
- package/license.txt +20 -20
- package/package.json +42 -41
- package/tsconfig.json +14 -14
package/docs/page-methods.md
CHANGED
|
@@ -1,738 +1,738 @@
|
|
|
1
|
-
# Agility CMS & Management API TypeScript SDK
|
|
2
|
-
|
|
3
|
-
## PageMethods
|
|
4
|
-
|
|
5
|
-
This class provides comprehensive page management operations for Agility CMS. Pages are the structural foundation of your website, defining the navigation hierarchy and content organization.
|
|
6
|
-
|
|
7
|
-
**Important Notes:**
|
|
8
|
-
- Pages define the structure and navigation of your website
|
|
9
|
-
- Each page has a unique path and can contain multiple content zones
|
|
10
|
-
- Pages support workflow states (published, unpublished, approved, etc.)
|
|
11
|
-
- Page operations support both immediate return and batch processing
|
|
12
|
-
- Page templates define the layout and content zones available
|
|
13
|
-
- Pages can be organized in a hierarchical structure with parent-child relationships
|
|
14
|
-
|
|
15
|
-
### Function List
|
|
16
|
-
- [getPage](#getpage) - Retrieves a specific page by ID
|
|
17
|
-
- [getPageByPath](#getpagebypath) - Retrieves a page by its URL path
|
|
18
|
-
- [getPageHistory](#getpagehistory) - Retrieves version history for a page
|
|
19
|
-
- [getPageComments](#getpagecomments) - Retrieves comments for a page
|
|
20
|
-
- [getPageList](#getpagelist) - Retrieves list of pages with filtering
|
|
21
|
-
- [getPageListByPageTemplateID](#getpagelistbypagetemplateid) - Retrieves pages using specific template
|
|
22
|
-
- [getPageListByPage](#getpagelistbypage) - Retrieves pages with pagination
|
|
23
|
-
- [getPageListByPageAndPageTemplateID](#getpagelistbypageandpagetemplateid) - Retrieves paginated pages by template
|
|
24
|
-
- [getPageTree](#getpagetree) - Retrieves complete page hierarchy
|
|
25
|
-
- [getPageTemplateList](#getpagetemplatelist) - Retrieves available page templates
|
|
26
|
-
- [getPageSecurity](#getpagesecurity) - Retrieves security settings for a page
|
|
27
|
-
- [getPageItemTemplateList](#getpageitemtemplatelist) - Retrieves page item templates
|
|
28
|
-
- [getPageContentZones](#getpagecontentzones) - Retrieves content zones for a page
|
|
29
|
-
- [savePage](#savepage) - Creates or updates a page
|
|
30
|
-
- [savePageSecurity](#savepagesecurity) - Updates page security settings
|
|
31
|
-
- [movePageItem](#movepageitem) - Moves a page item within the hierarchy
|
|
32
|
-
- [deletePage](#deletepage) - Deletes a page by ID
|
|
33
|
-
- [batchWorkflowPages](#batchworkflowpages) - Batch workflow operation on multiple pages
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
### getPage
|
|
38
|
-
|
|
39
|
-
Retrieves a specific page by its unique ID.
|
|
40
|
-
|
|
41
|
-
| Parameter | Type | Required | Description |
|
|
42
|
-
|-----------|------|----------|-------------|
|
|
43
|
-
| `pageID` | `number` | Yes | The page ID to retrieve |
|
|
44
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
45
|
-
|
|
46
|
-
**Returns:** `PageItem` - Complete page object with content zones and metadata
|
|
47
|
-
|
|
48
|
-
**Usage Example:**
|
|
49
|
-
```typescript
|
|
50
|
-
const page = await apiClient.pageMethods.getPage(123, guid);
|
|
51
|
-
console.log('Page title:', page.title);
|
|
52
|
-
console.log('Page path:', page.path);
|
|
53
|
-
console.log('Page template:', page.templateName);
|
|
54
|
-
console.log('Last modified:', page.modifiedDate);
|
|
55
|
-
console.log('Content zones:', page.contentZones.length);
|
|
56
|
-
|
|
57
|
-
// Display content zones
|
|
58
|
-
page.contentZones.forEach(zone => {
|
|
59
|
-
console.log(`Zone: ${zone.name}`);
|
|
60
|
-
console.log(` Items: ${zone.items.length}`);
|
|
61
|
-
});
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
**Error Handling:**
|
|
65
|
-
- Throws `Exception` when page not found
|
|
66
|
-
|
|
67
|
-
### getPageByPath
|
|
68
|
-
|
|
69
|
-
Retrieves a page by its URL path.
|
|
70
|
-
|
|
71
|
-
| Parameter | Type | Required | Description |
|
|
72
|
-
|-----------|------|----------|-------------|
|
|
73
|
-
| `path` | `string` | Yes | The URL path of the page (e.g., '/about-us') |
|
|
74
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
75
|
-
|
|
76
|
-
**Returns:** `PageItem` - Page object matching the path
|
|
77
|
-
|
|
78
|
-
**Usage Example:**
|
|
79
|
-
```typescript
|
|
80
|
-
const page = await apiClient.pageMethods.getPageByPath('/about-us', guid);
|
|
81
|
-
if (page) {
|
|
82
|
-
console.log('Page found:', page.title);
|
|
83
|
-
console.log('Page ID:', page.pageID);
|
|
84
|
-
console.log('Template:', page.templateName);
|
|
85
|
-
} else {
|
|
86
|
-
console.log('Page not found at path');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Validate page paths
|
|
90
|
-
const validatePath = async (path) => {
|
|
91
|
-
try {
|
|
92
|
-
const page = await apiClient.pageMethods.getPageByPath(path, guid);
|
|
93
|
-
return page !== null;
|
|
94
|
-
} catch (error) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
if (await validatePath('/blog')) {
|
|
100
|
-
console.log('Blog page exists');
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Error Handling:**
|
|
105
|
-
- Throws `Exception` when page not found or path invalid
|
|
106
|
-
|
|
107
|
-
### getPageHistory
|
|
108
|
-
|
|
109
|
-
Retrieves the version history for a specific page.
|
|
110
|
-
|
|
111
|
-
| Parameter | Type | Required | Description |
|
|
112
|
-
|-----------|------|----------|-------------|
|
|
113
|
-
| `pageID` | `number` | Yes | The page ID |
|
|
114
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
115
|
-
|
|
116
|
-
**Returns:** `PageHistory[]` - Array of historical versions
|
|
117
|
-
|
|
118
|
-
**Usage Example:**
|
|
119
|
-
```typescript
|
|
120
|
-
const history = await apiClient.pageMethods.getPageHistory(123, guid);
|
|
121
|
-
console.log(`Found ${history.length} historical versions`);
|
|
122
|
-
|
|
123
|
-
// Display version details
|
|
124
|
-
history.forEach((version, index) => {
|
|
125
|
-
console.log(`Version ${index + 1}:`);
|
|
126
|
-
console.log(` Date: ${version.modifiedDate}`);
|
|
127
|
-
console.log(` User: ${version.modifiedByUser}`);
|
|
128
|
-
console.log(` Action: ${version.action}`);
|
|
129
|
-
console.log(` Notes: ${version.notes}`);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
// Get latest version
|
|
133
|
-
const latestVersion = history[0];
|
|
134
|
-
console.log('Latest change:', latestVersion.action);
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Error Handling:**
|
|
138
|
-
- Throws `Exception` when page not found
|
|
139
|
-
|
|
140
|
-
### getPageComments
|
|
141
|
-
|
|
142
|
-
Retrieves all comments for a specific page.
|
|
143
|
-
|
|
144
|
-
| Parameter | Type | Required | Description |
|
|
145
|
-
|-----------|------|----------|-------------|
|
|
146
|
-
| `pageID` | `number` | Yes | The page ID |
|
|
147
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
148
|
-
|
|
149
|
-
**Returns:** `ItemComments[]` - Array of page comments
|
|
150
|
-
|
|
151
|
-
**Usage Example:**
|
|
152
|
-
```typescript
|
|
153
|
-
const comments = await apiClient.pageMethods.getPageComments(123, guid);
|
|
154
|
-
console.log(`Found ${comments.length} comments`);
|
|
155
|
-
|
|
156
|
-
// Display comments
|
|
157
|
-
comments.forEach(comment => {
|
|
158
|
-
console.log(`${comment.userName} (${comment.date}):`);
|
|
159
|
-
console.log(` ${comment.comment}`);
|
|
160
|
-
console.log(` Status: ${comment.status}`);
|
|
161
|
-
});
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
**Error Handling:**
|
|
165
|
-
- Throws `Exception` when page not found
|
|
166
|
-
|
|
167
|
-
### getPageList
|
|
168
|
-
|
|
169
|
-
Retrieves a list of pages with optional filtering and sorting.
|
|
170
|
-
|
|
171
|
-
| Parameter | Type | Required | Description |
|
|
172
|
-
|-----------|------|----------|-------------|
|
|
173
|
-
| `listParams` | `ListParams` | Yes | Filtering and sorting parameters |
|
|
174
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
175
|
-
|
|
176
|
-
**Returns:** `PageItem[]` - Array of page items
|
|
177
|
-
|
|
178
|
-
**Usage Example:**
|
|
179
|
-
```typescript
|
|
180
|
-
// Get all pages
|
|
181
|
-
const allPages = await apiClient.pageMethods.getPageList({}, guid);
|
|
182
|
-
|
|
183
|
-
// Get pages with filtering
|
|
184
|
-
const params = {
|
|
185
|
-
filter: 'title contains "blog"',
|
|
186
|
-
sort: 'modifiedDate desc',
|
|
187
|
-
take: 10,
|
|
188
|
-
skip: 0
|
|
189
|
-
};
|
|
190
|
-
const filteredPages = await apiClient.pageMethods.getPageList(params, guid);
|
|
191
|
-
|
|
192
|
-
// Get recently modified pages
|
|
193
|
-
const recentPages = await apiClient.pageMethods.getPageList({
|
|
194
|
-
sort: 'modifiedDate desc',
|
|
195
|
-
take: 5
|
|
196
|
-
}, guid);
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
**Error Handling:**
|
|
200
|
-
- Throws `Exception` when retrieval fails
|
|
201
|
-
|
|
202
|
-
### getPageListByPageTemplateID
|
|
203
|
-
|
|
204
|
-
Retrieves pages that use a specific page template.
|
|
205
|
-
|
|
206
|
-
| Parameter | Type | Required | Description |
|
|
207
|
-
|-----------|------|----------|-------------|
|
|
208
|
-
| `pageTemplateID` | `number` | Yes | The page template ID |
|
|
209
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
210
|
-
|
|
211
|
-
**Returns:** `PageItem[]` - Array of pages using the template
|
|
212
|
-
|
|
213
|
-
**Usage Example:**
|
|
214
|
-
```typescript
|
|
215
|
-
const pages = await apiClient.pageMethods.getPageListByPageTemplateID(456, guid);
|
|
216
|
-
console.log(`Found ${pages.length} pages using this template`);
|
|
217
|
-
|
|
218
|
-
// Group by status
|
|
219
|
-
const pagesByStatus = pages.reduce((acc, page) => {
|
|
220
|
-
const status = page.state || 'draft';
|
|
221
|
-
if (!acc[status]) acc[status] = [];
|
|
222
|
-
acc[status].push(page);
|
|
223
|
-
return acc;
|
|
224
|
-
}, {});
|
|
225
|
-
|
|
226
|
-
console.log('Pages by status:', pagesByStatus);
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
**Error Handling:**
|
|
230
|
-
- Throws `Exception` when template not found
|
|
231
|
-
|
|
232
|
-
### getPageListByPage
|
|
233
|
-
|
|
234
|
-
Retrieves pages with pagination support.
|
|
235
|
-
|
|
236
|
-
| Parameter | Type | Required | Description |
|
|
237
|
-
|-----------|------|----------|-------------|
|
|
238
|
-
| `pageSize` | `number` | Yes | Number of pages per page |
|
|
239
|
-
| `pageNumber` | `number` | Yes | Page number (1-based) |
|
|
240
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
241
|
-
|
|
242
|
-
**Returns:** `PageItem[]` - Array of pages for the specified page
|
|
243
|
-
|
|
244
|
-
**Usage Example:**
|
|
245
|
-
```typescript
|
|
246
|
-
const pageSize = 20;
|
|
247
|
-
const pageNumber = 1;
|
|
248
|
-
|
|
249
|
-
const firstPage = await apiClient.pageMethods.getPageListByPage(
|
|
250
|
-
pageSize,
|
|
251
|
-
pageNumber,
|
|
252
|
-
guid
|
|
253
|
-
);
|
|
254
|
-
console.log(`Page ${pageNumber}: ${firstPage.length} pages`);
|
|
255
|
-
|
|
256
|
-
// Paginated processing
|
|
257
|
-
let currentPage = 1;
|
|
258
|
-
let hasMore = true;
|
|
259
|
-
while (hasMore) {
|
|
260
|
-
const pageItems = await apiClient.pageMethods.getPageListByPage(
|
|
261
|
-
pageSize,
|
|
262
|
-
currentPage,
|
|
263
|
-
guid
|
|
264
|
-
);
|
|
265
|
-
|
|
266
|
-
if (pageItems.length === 0) {
|
|
267
|
-
hasMore = false;
|
|
268
|
-
} else {
|
|
269
|
-
console.log(`Processing page ${currentPage} with ${pageItems.length} pages`);
|
|
270
|
-
// Process pages...
|
|
271
|
-
currentPage++;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
**Error Handling:**
|
|
277
|
-
- Throws `Exception` when retrieval fails
|
|
278
|
-
|
|
279
|
-
### getPageListByPageAndPageTemplateID
|
|
280
|
-
|
|
281
|
-
Retrieves paginated pages filtered by template.
|
|
282
|
-
|
|
283
|
-
| Parameter | Type | Required | Description |
|
|
284
|
-
|-----------|------|----------|-------------|
|
|
285
|
-
| `pageTemplateID` | `number` | Yes | The page template ID |
|
|
286
|
-
| `pageSize` | `number` | Yes | Number of pages per page |
|
|
287
|
-
| `pageNumber` | `number` | Yes | Page number (1-based) |
|
|
288
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
289
|
-
|
|
290
|
-
**Returns:** `PageItem[]` - Array of pages for the specified page and template
|
|
291
|
-
|
|
292
|
-
**Usage Example:**
|
|
293
|
-
```typescript
|
|
294
|
-
const templatePages = await apiClient.pageMethods.getPageListByPageAndPageTemplateID(
|
|
295
|
-
456,
|
|
296
|
-
10,
|
|
297
|
-
1,
|
|
298
|
-
guid
|
|
299
|
-
);
|
|
300
|
-
console.log(`Template pages: ${templatePages.length}`);
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
**Error Handling:**
|
|
304
|
-
- Throws `Exception` when template not found
|
|
305
|
-
|
|
306
|
-
### getPageTree
|
|
307
|
-
|
|
308
|
-
Retrieves the complete page hierarchy as a tree structure.
|
|
309
|
-
|
|
310
|
-
| Parameter | Type | Required | Description |
|
|
311
|
-
|-----------|------|----------|-------------|
|
|
312
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
313
|
-
|
|
314
|
-
**Returns:** `PageItem[]` - Hierarchical array of pages with parent-child relationships
|
|
315
|
-
|
|
316
|
-
**Usage Example:**
|
|
317
|
-
```typescript
|
|
318
|
-
const pageTree = await apiClient.pageMethods.getPageTree(guid);
|
|
319
|
-
console.log(`Root pages: ${pageTree.length}`);
|
|
320
|
-
|
|
321
|
-
// Display page hierarchy
|
|
322
|
-
const displayPageTree = (pages, level = 0) => {
|
|
323
|
-
pages.forEach(page => {
|
|
324
|
-
const indent = ' '.repeat(level);
|
|
325
|
-
console.log(`${indent}${page.title} (${page.path})`);
|
|
326
|
-
|
|
327
|
-
if (page.children && page.children.length > 0) {
|
|
328
|
-
displayPageTree(page.children, level + 1);
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
displayPageTree(pageTree);
|
|
334
|
-
|
|
335
|
-
// Find page by path in tree
|
|
336
|
-
const findPageInTree = (pages, targetPath) => {
|
|
337
|
-
for (const page of pages) {
|
|
338
|
-
if (page.path === targetPath) {
|
|
339
|
-
return page;
|
|
340
|
-
}
|
|
341
|
-
if (page.children) {
|
|
342
|
-
const found = findPageInTree(page.children, targetPath);
|
|
343
|
-
if (found) return found;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
return null;
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
const aboutPage = findPageInTree(pageTree, '/about-us');
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
**Error Handling:**
|
|
353
|
-
- Throws `Exception` when retrieval fails
|
|
354
|
-
|
|
355
|
-
### getPageTemplateList
|
|
356
|
-
|
|
357
|
-
Retrieves all available page templates.
|
|
358
|
-
|
|
359
|
-
| Parameter | Type | Required | Description |
|
|
360
|
-
|-----------|------|----------|-------------|
|
|
361
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
362
|
-
|
|
363
|
-
**Returns:** `PageTemplate[]` - Array of available page templates
|
|
364
|
-
|
|
365
|
-
**Usage Example:**
|
|
366
|
-
```typescript
|
|
367
|
-
const templates = await apiClient.pageMethods.getPageTemplateList(guid);
|
|
368
|
-
console.log(`Available templates: ${templates.length}`);
|
|
369
|
-
|
|
370
|
-
// Display template information
|
|
371
|
-
templates.forEach(template => {
|
|
372
|
-
console.log(`Template: ${template.name}`);
|
|
373
|
-
console.log(` Description: ${template.description}`);
|
|
374
|
-
console.log(` Content Zones: ${template.contentZones.length}`);
|
|
375
|
-
console.log(` Template File: ${template.templateFile}`);
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
// Create template dropdown options
|
|
379
|
-
const templateOptions = templates.map(template => ({
|
|
380
|
-
value: template.id,
|
|
381
|
-
label: template.name,
|
|
382
|
-
description: template.description
|
|
383
|
-
}));
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
**Error Handling:**
|
|
387
|
-
- Throws `Exception` when retrieval fails
|
|
388
|
-
|
|
389
|
-
### getPageSecurity
|
|
390
|
-
|
|
391
|
-
Retrieves security settings for a specific page.
|
|
392
|
-
|
|
393
|
-
| Parameter | Type | Required | Description |
|
|
394
|
-
|-----------|------|----------|-------------|
|
|
395
|
-
| `pageID` | `number` | Yes | The page ID |
|
|
396
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
397
|
-
|
|
398
|
-
**Returns:** `PageSecurity` - Page security configuration
|
|
399
|
-
|
|
400
|
-
**Usage Example:**
|
|
401
|
-
```typescript
|
|
402
|
-
const security = await apiClient.pageMethods.getPageSecurity(123, guid);
|
|
403
|
-
console.log('Page security settings:', security);
|
|
404
|
-
|
|
405
|
-
// Check if page is public
|
|
406
|
-
if (security.isPublic) {
|
|
407
|
-
console.log('Page is publicly accessible');
|
|
408
|
-
} else {
|
|
409
|
-
console.log('Page has restricted access');
|
|
410
|
-
console.log('Allowed roles:', security.allowedRoles);
|
|
411
|
-
}
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
**Error Handling:**
|
|
415
|
-
- Throws `Exception` when page not found
|
|
416
|
-
|
|
417
|
-
### getPageItemTemplateList
|
|
418
|
-
|
|
419
|
-
Retrieves available page item templates.
|
|
420
|
-
|
|
421
|
-
| Parameter | Type | Required | Description |
|
|
422
|
-
|-----------|------|----------|-------------|
|
|
423
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
424
|
-
|
|
425
|
-
**Returns:** `PageItemTemplate[]` - Array of page item templates
|
|
426
|
-
|
|
427
|
-
**Usage Example:**
|
|
428
|
-
```typescript
|
|
429
|
-
const itemTemplates = await apiClient.pageMethods.getPageItemTemplateList(guid);
|
|
430
|
-
console.log(`Available item templates: ${itemTemplates.length}`);
|
|
431
|
-
|
|
432
|
-
// Display template types
|
|
433
|
-
itemTemplates.forEach(template => {
|
|
434
|
-
console.log(`Template: ${template.name}`);
|
|
435
|
-
console.log(` Type: ${template.type}`);
|
|
436
|
-
console.log(` Description: ${template.description}`);
|
|
437
|
-
});
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
**Error Handling:**
|
|
441
|
-
- Throws `Exception` when retrieval fails
|
|
442
|
-
|
|
443
|
-
### getPageContentZones
|
|
444
|
-
|
|
445
|
-
Retrieves content zones for a specific page.
|
|
446
|
-
|
|
447
|
-
| Parameter | Type | Required | Description |
|
|
448
|
-
|-----------|------|----------|-------------|
|
|
449
|
-
| `pageID` | `number` | Yes | The page ID |
|
|
450
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
451
|
-
|
|
452
|
-
**Returns:** `ContentZone[]` - Array of content zones
|
|
453
|
-
|
|
454
|
-
**Usage Example:**
|
|
455
|
-
```typescript
|
|
456
|
-
const zones = await apiClient.pageMethods.getPageContentZones(123, guid);
|
|
457
|
-
console.log(`Page has ${zones.length} content zones`);
|
|
458
|
-
|
|
459
|
-
// Display zone information
|
|
460
|
-
zones.forEach(zone => {
|
|
461
|
-
console.log(`Zone: ${zone.name}`);
|
|
462
|
-
console.log(` Items: ${zone.items.length}`);
|
|
463
|
-
console.log(` Template: ${zone.templateName}`);
|
|
464
|
-
|
|
465
|
-
// Display zone items
|
|
466
|
-
zone.items.forEach(item => {
|
|
467
|
-
console.log(` Item: ${item.title} (${item.type})`);
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
**Error Handling:**
|
|
473
|
-
- Throws `Exception` when page not found
|
|
474
|
-
|
|
475
|
-
### savePage
|
|
476
|
-
|
|
477
|
-
Creates a new page or updates an existing one.
|
|
478
|
-
|
|
479
|
-
| Parameter | Type | Required | Description |
|
|
480
|
-
|-----------|------|----------|-------------|
|
|
481
|
-
| `page` | `PageItem` | Yes | Page object to save |
|
|
482
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
483
|
-
| `returnBatchId` | `boolean` | No | If `true`, returns batch ID immediately. If `false` (default), waits for completion |
|
|
484
|
-
|
|
485
|
-
**Returns:** `PageItem | number` - Saved page (if `returnBatchId` is false) or batch ID (if true)
|
|
486
|
-
|
|
487
|
-
**Usage Example:**
|
|
488
|
-
```typescript
|
|
489
|
-
// Create a new page
|
|
490
|
-
const newPage = {
|
|
491
|
-
title: 'New About Page',
|
|
492
|
-
path: '/about-us',
|
|
493
|
-
templateName: 'About Template',
|
|
494
|
-
parentPageID: null, // Root level page
|
|
495
|
-
menuText: 'About Us',
|
|
496
|
-
isVisible: true,
|
|
497
|
-
contentZones: [
|
|
498
|
-
{
|
|
499
|
-
name: 'MainContent',
|
|
500
|
-
items: [
|
|
501
|
-
{
|
|
502
|
-
type: 'content',
|
|
503
|
-
contentID: 456,
|
|
504
|
-
title: 'About Us Content'
|
|
505
|
-
}
|
|
506
|
-
]
|
|
507
|
-
}
|
|
508
|
-
]
|
|
509
|
-
};
|
|
510
|
-
|
|
511
|
-
const savedPage = await apiClient.pageMethods.savePage(newPage, guid);
|
|
512
|
-
console.log('Page created with ID:', savedPage.pageID);
|
|
513
|
-
|
|
514
|
-
// Update existing page
|
|
515
|
-
const existingPage = await apiClient.pageMethods.getPage(123, guid);
|
|
516
|
-
existingPage.title = 'Updated Page Title';
|
|
517
|
-
existingPage.menuText = 'Updated Menu';
|
|
518
|
-
const updatedPage = await apiClient.pageMethods.savePage(existingPage, guid);
|
|
519
|
-
|
|
520
|
-
// Save with batch processing
|
|
521
|
-
const batchId = await apiClient.pageMethods.savePage(newPage, guid, true);
|
|
522
|
-
console.log('Batch created with ID:', batchId);
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
**Error Handling:**
|
|
526
|
-
- Throws `Exception` when validation fails or save operation fails
|
|
527
|
-
|
|
528
|
-
### savePageSecurity
|
|
529
|
-
|
|
530
|
-
Updates security settings for a specific page.
|
|
531
|
-
|
|
532
|
-
| Parameter | Type | Required | Description |
|
|
533
|
-
|-----------|------|----------|-------------|
|
|
534
|
-
| `pageID` | `number` | Yes | The page ID |
|
|
535
|
-
| `security` | `PageSecurity` | Yes | Security configuration to apply |
|
|
536
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
537
|
-
|
|
538
|
-
**Returns:** `PageSecurity` - Updated security configuration
|
|
539
|
-
|
|
540
|
-
**Usage Example:**
|
|
541
|
-
```typescript
|
|
542
|
-
// Make page public
|
|
543
|
-
const publicSecurity = {
|
|
544
|
-
isPublic: true,
|
|
545
|
-
allowedRoles: [],
|
|
546
|
-
requiresAuthentication: false
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
const updatedSecurity = await apiClient.pageMethods.savePageSecurity(
|
|
550
|
-
123,
|
|
551
|
-
publicSecurity,
|
|
552
|
-
guid
|
|
553
|
-
);
|
|
554
|
-
|
|
555
|
-
// Restrict page to specific roles
|
|
556
|
-
const restrictedSecurity = {
|
|
557
|
-
isPublic: false,
|
|
558
|
-
allowedRoles: ['Administrator', 'Editor'],
|
|
559
|
-
requiresAuthentication: true
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
await apiClient.pageMethods.savePageSecurity(123, restrictedSecurity, guid);
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
**Error Handling:**
|
|
566
|
-
- Throws `Exception` when page not found or security update fails
|
|
567
|
-
|
|
568
|
-
### movePageItem
|
|
569
|
-
|
|
570
|
-
Moves a page item within the page hierarchy.
|
|
571
|
-
|
|
572
|
-
| Parameter | Type | Required | Description |
|
|
573
|
-
|-----------|------|----------|-------------|
|
|
574
|
-
| `pageID` | `number` | Yes | The page ID to move |
|
|
575
|
-
| `parentPageID` | `number` | Yes | The new parent page ID (0 for root level) |
|
|
576
|
-
| `sortOrder` | `number` | Yes | The sort order within the parent |
|
|
577
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
578
|
-
|
|
579
|
-
**Returns:** `PageItem` - Updated page object
|
|
580
|
-
|
|
581
|
-
**Usage Example:**
|
|
582
|
-
```typescript
|
|
583
|
-
// Move page to root level
|
|
584
|
-
const movedPage = await apiClient.pageMethods.movePageItem(123, 0, 1, guid);
|
|
585
|
-
|
|
586
|
-
// Move page under another page
|
|
587
|
-
const childPage = await apiClient.pageMethods.movePageItem(123, 456, 2, guid);
|
|
588
|
-
|
|
589
|
-
// Reorder pages
|
|
590
|
-
const reorderPages = async (parentID, pageIDs) => {
|
|
591
|
-
for (let i = 0; i < pageIDs.length; i++) {
|
|
592
|
-
await apiClient.pageMethods.movePageItem(
|
|
593
|
-
pageIDs[i],
|
|
594
|
-
parentID,
|
|
595
|
-
i + 1,
|
|
596
|
-
guid
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
**Error Handling:**
|
|
603
|
-
- Throws `Exception` when page not found or move operation fails
|
|
604
|
-
|
|
605
|
-
### deletePage
|
|
606
|
-
|
|
607
|
-
Deletes a page by its ID.
|
|
608
|
-
|
|
609
|
-
| Parameter | Type | Required | Description |
|
|
610
|
-
|-----------|------|----------|-------------|
|
|
611
|
-
| `pageID` | `number` | Yes | The page ID to delete |
|
|
612
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
613
|
-
|
|
614
|
-
**Returns:** `string` - Confirmation message of successful deletion
|
|
615
|
-
|
|
616
|
-
**Usage Example:**
|
|
617
|
-
```typescript
|
|
618
|
-
try {
|
|
619
|
-
const result = await apiClient.pageMethods.deletePage(123, guid);
|
|
620
|
-
console.log(result); // "Page deleted successfully"
|
|
621
|
-
} catch (error) {
|
|
622
|
-
if (error.message.includes('has children')) {
|
|
623
|
-
console.log('Cannot delete page: has child pages');
|
|
624
|
-
} else if (error.message.includes('referenced')) {
|
|
625
|
-
console.log('Cannot delete page: referenced by other content');
|
|
626
|
-
} else {
|
|
627
|
-
console.error('Failed to delete page:', error.message);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
// Safe page deletion with checks
|
|
632
|
-
const safeDeletePage = async (pageID) => {
|
|
633
|
-
try {
|
|
634
|
-
const page = await apiClient.pageMethods.getPage(pageID, guid);
|
|
635
|
-
|
|
636
|
-
// Check if page has children
|
|
637
|
-
if (page.children && page.children.length > 0) {
|
|
638
|
-
console.log(`Cannot delete page "${page.title}": has child pages`);
|
|
639
|
-
return false;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
// Perform deletion
|
|
643
|
-
await apiClient.pageMethods.deletePage(pageID, guid);
|
|
644
|
-
console.log('Page deleted successfully');
|
|
645
|
-
return true;
|
|
646
|
-
} catch (error) {
|
|
647
|
-
console.error('Failed to delete page:', error.message);
|
|
648
|
-
return false;
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
**Error Handling:**
|
|
654
|
-
- Throws `Exception` when page not found, has children, or deletion fails
|
|
655
|
-
|
|
656
|
-
**Note:** Pages cannot be deleted if they have child pages or are referenced by other content.
|
|
657
|
-
|
|
658
|
-
---
|
|
659
|
-
|
|
660
|
-
### batchWorkflowPages
|
|
661
|
-
|
|
662
|
-
Performs a batch workflow operation on multiple pages. Supports Publish, Unpublish, Approve, Decline, and RequestApproval operations.
|
|
663
|
-
|
|
664
|
-
| Parameter | Type | Required | Description |
|
|
665
|
-
|-----------|------|----------|-------------|
|
|
666
|
-
| `pageIDs` | `number[]` | Yes | Array of page IDs to process |
|
|
667
|
-
| `guid` | `string` | Yes | Current website GUID |
|
|
668
|
-
| `locale` | `string` | Yes | The locale code |
|
|
669
|
-
| `operation` | `WorkflowOperationType` | Yes | The workflow operation (Publish, Unpublish, Approve, Decline, RequestApproval) |
|
|
670
|
-
| `returnBatchId` | `boolean` | No | If `true`, returns batch ID immediately without waiting |
|
|
671
|
-
|
|
672
|
-
**Returns:** `Promise<number[]>` - Array of page IDs that were processed
|
|
673
|
-
|
|
674
|
-
**Usage Example:**
|
|
675
|
-
```typescript
|
|
676
|
-
import { WorkflowOperationType } from '@agility/management-sdk';
|
|
677
|
-
|
|
678
|
-
// Publish multiple pages
|
|
679
|
-
const pageIDs = [201, 202, 203];
|
|
680
|
-
const publishedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
681
|
-
pageIDs,
|
|
682
|
-
'your-guid',
|
|
683
|
-
'en-us',
|
|
684
|
-
WorkflowOperationType.Publish
|
|
685
|
-
);
|
|
686
|
-
console.log('Published page IDs:', publishedPageIDs);
|
|
687
|
-
|
|
688
|
-
// Unpublish multiple pages
|
|
689
|
-
const unpublishedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
690
|
-
pageIDs,
|
|
691
|
-
'your-guid',
|
|
692
|
-
'en-us',
|
|
693
|
-
WorkflowOperationType.Unpublish
|
|
694
|
-
);
|
|
695
|
-
|
|
696
|
-
// Request approval for multiple pages
|
|
697
|
-
const approvalRequestedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
698
|
-
pageIDs,
|
|
699
|
-
'your-guid',
|
|
700
|
-
'en-us',
|
|
701
|
-
WorkflowOperationType.RequestApproval
|
|
702
|
-
);
|
|
703
|
-
|
|
704
|
-
// Approve multiple pages
|
|
705
|
-
const approvedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
706
|
-
pageIDs,
|
|
707
|
-
'your-guid',
|
|
708
|
-
'en-us',
|
|
709
|
-
WorkflowOperationType.Approve
|
|
710
|
-
);
|
|
711
|
-
|
|
712
|
-
// Decline multiple pages
|
|
713
|
-
const declinedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
714
|
-
pageIDs,
|
|
715
|
-
'your-guid',
|
|
716
|
-
'en-us',
|
|
717
|
-
WorkflowOperationType.Decline
|
|
718
|
-
);
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
**Error Handling:**
|
|
722
|
-
- Throws `Exception` when batch operation fails
|
|
723
|
-
|
|
724
|
-
---
|
|
725
|
-
|
|
726
|
-
## Navigation
|
|
727
|
-
- [← Back to Main Documentation](../README.md)
|
|
728
|
-
- [Authentication & Setup](./auth.md)
|
|
729
|
-
- [AssetMethods](./asset-methods.md)
|
|
730
|
-
- [BatchMethods](./batch-methods.md)
|
|
731
|
-
- [ContainerMethods](./container-methods.md)
|
|
732
|
-
- [ContentMethods](./content-methods.md)
|
|
733
|
-
- [InstanceMethods](./instance-methods.md)
|
|
734
|
-
- [InstanceUserMethods](./instance-user-methods.md)
|
|
735
|
-
- [ModelMethods](./model-methods.md)
|
|
736
|
-
- [ServerUserMethods](./server-user-methods.md)
|
|
737
|
-
- [WebhookMethods](./webhook-methods.md)
|
|
1
|
+
# Agility CMS & Management API TypeScript SDK
|
|
2
|
+
|
|
3
|
+
## PageMethods
|
|
4
|
+
|
|
5
|
+
This class provides comprehensive page management operations for Agility CMS. Pages are the structural foundation of your website, defining the navigation hierarchy and content organization.
|
|
6
|
+
|
|
7
|
+
**Important Notes:**
|
|
8
|
+
- Pages define the structure and navigation of your website
|
|
9
|
+
- Each page has a unique path and can contain multiple content zones
|
|
10
|
+
- Pages support workflow states (published, unpublished, approved, etc.)
|
|
11
|
+
- Page operations support both immediate return and batch processing
|
|
12
|
+
- Page templates define the layout and content zones available
|
|
13
|
+
- Pages can be organized in a hierarchical structure with parent-child relationships
|
|
14
|
+
|
|
15
|
+
### Function List
|
|
16
|
+
- [getPage](#getpage) - Retrieves a specific page by ID
|
|
17
|
+
- [getPageByPath](#getpagebypath) - Retrieves a page by its URL path
|
|
18
|
+
- [getPageHistory](#getpagehistory) - Retrieves version history for a page
|
|
19
|
+
- [getPageComments](#getpagecomments) - Retrieves comments for a page
|
|
20
|
+
- [getPageList](#getpagelist) - Retrieves list of pages with filtering
|
|
21
|
+
- [getPageListByPageTemplateID](#getpagelistbypagetemplateid) - Retrieves pages using specific template
|
|
22
|
+
- [getPageListByPage](#getpagelistbypage) - Retrieves pages with pagination
|
|
23
|
+
- [getPageListByPageAndPageTemplateID](#getpagelistbypageandpagetemplateid) - Retrieves paginated pages by template
|
|
24
|
+
- [getPageTree](#getpagetree) - Retrieves complete page hierarchy
|
|
25
|
+
- [getPageTemplateList](#getpagetemplatelist) - Retrieves available page templates
|
|
26
|
+
- [getPageSecurity](#getpagesecurity) - Retrieves security settings for a page
|
|
27
|
+
- [getPageItemTemplateList](#getpageitemtemplatelist) - Retrieves page item templates
|
|
28
|
+
- [getPageContentZones](#getpagecontentzones) - Retrieves content zones for a page
|
|
29
|
+
- [savePage](#savepage) - Creates or updates a page
|
|
30
|
+
- [savePageSecurity](#savepagesecurity) - Updates page security settings
|
|
31
|
+
- [movePageItem](#movepageitem) - Moves a page item within the hierarchy
|
|
32
|
+
- [deletePage](#deletepage) - Deletes a page by ID
|
|
33
|
+
- [batchWorkflowPages](#batchworkflowpages) - Batch workflow operation on multiple pages
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### getPage
|
|
38
|
+
|
|
39
|
+
Retrieves a specific page by its unique ID.
|
|
40
|
+
|
|
41
|
+
| Parameter | Type | Required | Description |
|
|
42
|
+
|-----------|------|----------|-------------|
|
|
43
|
+
| `pageID` | `number` | Yes | The page ID to retrieve |
|
|
44
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
45
|
+
|
|
46
|
+
**Returns:** `PageItem` - Complete page object with content zones and metadata
|
|
47
|
+
|
|
48
|
+
**Usage Example:**
|
|
49
|
+
```typescript
|
|
50
|
+
const page = await apiClient.pageMethods.getPage(123, guid);
|
|
51
|
+
console.log('Page title:', page.title);
|
|
52
|
+
console.log('Page path:', page.path);
|
|
53
|
+
console.log('Page template:', page.templateName);
|
|
54
|
+
console.log('Last modified:', page.modifiedDate);
|
|
55
|
+
console.log('Content zones:', page.contentZones.length);
|
|
56
|
+
|
|
57
|
+
// Display content zones
|
|
58
|
+
page.contentZones.forEach(zone => {
|
|
59
|
+
console.log(`Zone: ${zone.name}`);
|
|
60
|
+
console.log(` Items: ${zone.items.length}`);
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Error Handling:**
|
|
65
|
+
- Throws `Exception` when page not found
|
|
66
|
+
|
|
67
|
+
### getPageByPath
|
|
68
|
+
|
|
69
|
+
Retrieves a page by its URL path.
|
|
70
|
+
|
|
71
|
+
| Parameter | Type | Required | Description |
|
|
72
|
+
|-----------|------|----------|-------------|
|
|
73
|
+
| `path` | `string` | Yes | The URL path of the page (e.g., '/about-us') |
|
|
74
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
75
|
+
|
|
76
|
+
**Returns:** `PageItem` - Page object matching the path
|
|
77
|
+
|
|
78
|
+
**Usage Example:**
|
|
79
|
+
```typescript
|
|
80
|
+
const page = await apiClient.pageMethods.getPageByPath('/about-us', guid);
|
|
81
|
+
if (page) {
|
|
82
|
+
console.log('Page found:', page.title);
|
|
83
|
+
console.log('Page ID:', page.pageID);
|
|
84
|
+
console.log('Template:', page.templateName);
|
|
85
|
+
} else {
|
|
86
|
+
console.log('Page not found at path');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Validate page paths
|
|
90
|
+
const validatePath = async (path) => {
|
|
91
|
+
try {
|
|
92
|
+
const page = await apiClient.pageMethods.getPageByPath(path, guid);
|
|
93
|
+
return page !== null;
|
|
94
|
+
} catch (error) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
if (await validatePath('/blog')) {
|
|
100
|
+
console.log('Blog page exists');
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Error Handling:**
|
|
105
|
+
- Throws `Exception` when page not found or path invalid
|
|
106
|
+
|
|
107
|
+
### getPageHistory
|
|
108
|
+
|
|
109
|
+
Retrieves the version history for a specific page.
|
|
110
|
+
|
|
111
|
+
| Parameter | Type | Required | Description |
|
|
112
|
+
|-----------|------|----------|-------------|
|
|
113
|
+
| `pageID` | `number` | Yes | The page ID |
|
|
114
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
115
|
+
|
|
116
|
+
**Returns:** `PageHistory[]` - Array of historical versions
|
|
117
|
+
|
|
118
|
+
**Usage Example:**
|
|
119
|
+
```typescript
|
|
120
|
+
const history = await apiClient.pageMethods.getPageHistory(123, guid);
|
|
121
|
+
console.log(`Found ${history.length} historical versions`);
|
|
122
|
+
|
|
123
|
+
// Display version details
|
|
124
|
+
history.forEach((version, index) => {
|
|
125
|
+
console.log(`Version ${index + 1}:`);
|
|
126
|
+
console.log(` Date: ${version.modifiedDate}`);
|
|
127
|
+
console.log(` User: ${version.modifiedByUser}`);
|
|
128
|
+
console.log(` Action: ${version.action}`);
|
|
129
|
+
console.log(` Notes: ${version.notes}`);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// Get latest version
|
|
133
|
+
const latestVersion = history[0];
|
|
134
|
+
console.log('Latest change:', latestVersion.action);
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Error Handling:**
|
|
138
|
+
- Throws `Exception` when page not found
|
|
139
|
+
|
|
140
|
+
### getPageComments
|
|
141
|
+
|
|
142
|
+
Retrieves all comments for a specific page.
|
|
143
|
+
|
|
144
|
+
| Parameter | Type | Required | Description |
|
|
145
|
+
|-----------|------|----------|-------------|
|
|
146
|
+
| `pageID` | `number` | Yes | The page ID |
|
|
147
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
148
|
+
|
|
149
|
+
**Returns:** `ItemComments[]` - Array of page comments
|
|
150
|
+
|
|
151
|
+
**Usage Example:**
|
|
152
|
+
```typescript
|
|
153
|
+
const comments = await apiClient.pageMethods.getPageComments(123, guid);
|
|
154
|
+
console.log(`Found ${comments.length} comments`);
|
|
155
|
+
|
|
156
|
+
// Display comments
|
|
157
|
+
comments.forEach(comment => {
|
|
158
|
+
console.log(`${comment.userName} (${comment.date}):`);
|
|
159
|
+
console.log(` ${comment.comment}`);
|
|
160
|
+
console.log(` Status: ${comment.status}`);
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Error Handling:**
|
|
165
|
+
- Throws `Exception` when page not found
|
|
166
|
+
|
|
167
|
+
### getPageList
|
|
168
|
+
|
|
169
|
+
Retrieves a list of pages with optional filtering and sorting.
|
|
170
|
+
|
|
171
|
+
| Parameter | Type | Required | Description |
|
|
172
|
+
|-----------|------|----------|-------------|
|
|
173
|
+
| `listParams` | `ListParams` | Yes | Filtering and sorting parameters |
|
|
174
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
175
|
+
|
|
176
|
+
**Returns:** `PageItem[]` - Array of page items
|
|
177
|
+
|
|
178
|
+
**Usage Example:**
|
|
179
|
+
```typescript
|
|
180
|
+
// Get all pages
|
|
181
|
+
const allPages = await apiClient.pageMethods.getPageList({}, guid);
|
|
182
|
+
|
|
183
|
+
// Get pages with filtering
|
|
184
|
+
const params = {
|
|
185
|
+
filter: 'title contains "blog"',
|
|
186
|
+
sort: 'modifiedDate desc',
|
|
187
|
+
take: 10,
|
|
188
|
+
skip: 0
|
|
189
|
+
};
|
|
190
|
+
const filteredPages = await apiClient.pageMethods.getPageList(params, guid);
|
|
191
|
+
|
|
192
|
+
// Get recently modified pages
|
|
193
|
+
const recentPages = await apiClient.pageMethods.getPageList({
|
|
194
|
+
sort: 'modifiedDate desc',
|
|
195
|
+
take: 5
|
|
196
|
+
}, guid);
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Error Handling:**
|
|
200
|
+
- Throws `Exception` when retrieval fails
|
|
201
|
+
|
|
202
|
+
### getPageListByPageTemplateID
|
|
203
|
+
|
|
204
|
+
Retrieves pages that use a specific page template.
|
|
205
|
+
|
|
206
|
+
| Parameter | Type | Required | Description |
|
|
207
|
+
|-----------|------|----------|-------------|
|
|
208
|
+
| `pageTemplateID` | `number` | Yes | The page template ID |
|
|
209
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
210
|
+
|
|
211
|
+
**Returns:** `PageItem[]` - Array of pages using the template
|
|
212
|
+
|
|
213
|
+
**Usage Example:**
|
|
214
|
+
```typescript
|
|
215
|
+
const pages = await apiClient.pageMethods.getPageListByPageTemplateID(456, guid);
|
|
216
|
+
console.log(`Found ${pages.length} pages using this template`);
|
|
217
|
+
|
|
218
|
+
// Group by status
|
|
219
|
+
const pagesByStatus = pages.reduce((acc, page) => {
|
|
220
|
+
const status = page.state || 'draft';
|
|
221
|
+
if (!acc[status]) acc[status] = [];
|
|
222
|
+
acc[status].push(page);
|
|
223
|
+
return acc;
|
|
224
|
+
}, {});
|
|
225
|
+
|
|
226
|
+
console.log('Pages by status:', pagesByStatus);
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Error Handling:**
|
|
230
|
+
- Throws `Exception` when template not found
|
|
231
|
+
|
|
232
|
+
### getPageListByPage
|
|
233
|
+
|
|
234
|
+
Retrieves pages with pagination support.
|
|
235
|
+
|
|
236
|
+
| Parameter | Type | Required | Description |
|
|
237
|
+
|-----------|------|----------|-------------|
|
|
238
|
+
| `pageSize` | `number` | Yes | Number of pages per page |
|
|
239
|
+
| `pageNumber` | `number` | Yes | Page number (1-based) |
|
|
240
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
241
|
+
|
|
242
|
+
**Returns:** `PageItem[]` - Array of pages for the specified page
|
|
243
|
+
|
|
244
|
+
**Usage Example:**
|
|
245
|
+
```typescript
|
|
246
|
+
const pageSize = 20;
|
|
247
|
+
const pageNumber = 1;
|
|
248
|
+
|
|
249
|
+
const firstPage = await apiClient.pageMethods.getPageListByPage(
|
|
250
|
+
pageSize,
|
|
251
|
+
pageNumber,
|
|
252
|
+
guid
|
|
253
|
+
);
|
|
254
|
+
console.log(`Page ${pageNumber}: ${firstPage.length} pages`);
|
|
255
|
+
|
|
256
|
+
// Paginated processing
|
|
257
|
+
let currentPage = 1;
|
|
258
|
+
let hasMore = true;
|
|
259
|
+
while (hasMore) {
|
|
260
|
+
const pageItems = await apiClient.pageMethods.getPageListByPage(
|
|
261
|
+
pageSize,
|
|
262
|
+
currentPage,
|
|
263
|
+
guid
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
if (pageItems.length === 0) {
|
|
267
|
+
hasMore = false;
|
|
268
|
+
} else {
|
|
269
|
+
console.log(`Processing page ${currentPage} with ${pageItems.length} pages`);
|
|
270
|
+
// Process pages...
|
|
271
|
+
currentPage++;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Error Handling:**
|
|
277
|
+
- Throws `Exception` when retrieval fails
|
|
278
|
+
|
|
279
|
+
### getPageListByPageAndPageTemplateID
|
|
280
|
+
|
|
281
|
+
Retrieves paginated pages filtered by template.
|
|
282
|
+
|
|
283
|
+
| Parameter | Type | Required | Description |
|
|
284
|
+
|-----------|------|----------|-------------|
|
|
285
|
+
| `pageTemplateID` | `number` | Yes | The page template ID |
|
|
286
|
+
| `pageSize` | `number` | Yes | Number of pages per page |
|
|
287
|
+
| `pageNumber` | `number` | Yes | Page number (1-based) |
|
|
288
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
289
|
+
|
|
290
|
+
**Returns:** `PageItem[]` - Array of pages for the specified page and template
|
|
291
|
+
|
|
292
|
+
**Usage Example:**
|
|
293
|
+
```typescript
|
|
294
|
+
const templatePages = await apiClient.pageMethods.getPageListByPageAndPageTemplateID(
|
|
295
|
+
456,
|
|
296
|
+
10,
|
|
297
|
+
1,
|
|
298
|
+
guid
|
|
299
|
+
);
|
|
300
|
+
console.log(`Template pages: ${templatePages.length}`);
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Error Handling:**
|
|
304
|
+
- Throws `Exception` when template not found
|
|
305
|
+
|
|
306
|
+
### getPageTree
|
|
307
|
+
|
|
308
|
+
Retrieves the complete page hierarchy as a tree structure.
|
|
309
|
+
|
|
310
|
+
| Parameter | Type | Required | Description |
|
|
311
|
+
|-----------|------|----------|-------------|
|
|
312
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
313
|
+
|
|
314
|
+
**Returns:** `PageItem[]` - Hierarchical array of pages with parent-child relationships
|
|
315
|
+
|
|
316
|
+
**Usage Example:**
|
|
317
|
+
```typescript
|
|
318
|
+
const pageTree = await apiClient.pageMethods.getPageTree(guid);
|
|
319
|
+
console.log(`Root pages: ${pageTree.length}`);
|
|
320
|
+
|
|
321
|
+
// Display page hierarchy
|
|
322
|
+
const displayPageTree = (pages, level = 0) => {
|
|
323
|
+
pages.forEach(page => {
|
|
324
|
+
const indent = ' '.repeat(level);
|
|
325
|
+
console.log(`${indent}${page.title} (${page.path})`);
|
|
326
|
+
|
|
327
|
+
if (page.children && page.children.length > 0) {
|
|
328
|
+
displayPageTree(page.children, level + 1);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
displayPageTree(pageTree);
|
|
334
|
+
|
|
335
|
+
// Find page by path in tree
|
|
336
|
+
const findPageInTree = (pages, targetPath) => {
|
|
337
|
+
for (const page of pages) {
|
|
338
|
+
if (page.path === targetPath) {
|
|
339
|
+
return page;
|
|
340
|
+
}
|
|
341
|
+
if (page.children) {
|
|
342
|
+
const found = findPageInTree(page.children, targetPath);
|
|
343
|
+
if (found) return found;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return null;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
const aboutPage = findPageInTree(pageTree, '/about-us');
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Error Handling:**
|
|
353
|
+
- Throws `Exception` when retrieval fails
|
|
354
|
+
|
|
355
|
+
### getPageTemplateList
|
|
356
|
+
|
|
357
|
+
Retrieves all available page templates.
|
|
358
|
+
|
|
359
|
+
| Parameter | Type | Required | Description |
|
|
360
|
+
|-----------|------|----------|-------------|
|
|
361
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
362
|
+
|
|
363
|
+
**Returns:** `PageTemplate[]` - Array of available page templates
|
|
364
|
+
|
|
365
|
+
**Usage Example:**
|
|
366
|
+
```typescript
|
|
367
|
+
const templates = await apiClient.pageMethods.getPageTemplateList(guid);
|
|
368
|
+
console.log(`Available templates: ${templates.length}`);
|
|
369
|
+
|
|
370
|
+
// Display template information
|
|
371
|
+
templates.forEach(template => {
|
|
372
|
+
console.log(`Template: ${template.name}`);
|
|
373
|
+
console.log(` Description: ${template.description}`);
|
|
374
|
+
console.log(` Content Zones: ${template.contentZones.length}`);
|
|
375
|
+
console.log(` Template File: ${template.templateFile}`);
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
// Create template dropdown options
|
|
379
|
+
const templateOptions = templates.map(template => ({
|
|
380
|
+
value: template.id,
|
|
381
|
+
label: template.name,
|
|
382
|
+
description: template.description
|
|
383
|
+
}));
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**Error Handling:**
|
|
387
|
+
- Throws `Exception` when retrieval fails
|
|
388
|
+
|
|
389
|
+
### getPageSecurity
|
|
390
|
+
|
|
391
|
+
Retrieves security settings for a specific page.
|
|
392
|
+
|
|
393
|
+
| Parameter | Type | Required | Description |
|
|
394
|
+
|-----------|------|----------|-------------|
|
|
395
|
+
| `pageID` | `number` | Yes | The page ID |
|
|
396
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
397
|
+
|
|
398
|
+
**Returns:** `PageSecurity` - Page security configuration
|
|
399
|
+
|
|
400
|
+
**Usage Example:**
|
|
401
|
+
```typescript
|
|
402
|
+
const security = await apiClient.pageMethods.getPageSecurity(123, guid);
|
|
403
|
+
console.log('Page security settings:', security);
|
|
404
|
+
|
|
405
|
+
// Check if page is public
|
|
406
|
+
if (security.isPublic) {
|
|
407
|
+
console.log('Page is publicly accessible');
|
|
408
|
+
} else {
|
|
409
|
+
console.log('Page has restricted access');
|
|
410
|
+
console.log('Allowed roles:', security.allowedRoles);
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
**Error Handling:**
|
|
415
|
+
- Throws `Exception` when page not found
|
|
416
|
+
|
|
417
|
+
### getPageItemTemplateList
|
|
418
|
+
|
|
419
|
+
Retrieves available page item templates.
|
|
420
|
+
|
|
421
|
+
| Parameter | Type | Required | Description |
|
|
422
|
+
|-----------|------|----------|-------------|
|
|
423
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
424
|
+
|
|
425
|
+
**Returns:** `PageItemTemplate[]` - Array of page item templates
|
|
426
|
+
|
|
427
|
+
**Usage Example:**
|
|
428
|
+
```typescript
|
|
429
|
+
const itemTemplates = await apiClient.pageMethods.getPageItemTemplateList(guid);
|
|
430
|
+
console.log(`Available item templates: ${itemTemplates.length}`);
|
|
431
|
+
|
|
432
|
+
// Display template types
|
|
433
|
+
itemTemplates.forEach(template => {
|
|
434
|
+
console.log(`Template: ${template.name}`);
|
|
435
|
+
console.log(` Type: ${template.type}`);
|
|
436
|
+
console.log(` Description: ${template.description}`);
|
|
437
|
+
});
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
**Error Handling:**
|
|
441
|
+
- Throws `Exception` when retrieval fails
|
|
442
|
+
|
|
443
|
+
### getPageContentZones
|
|
444
|
+
|
|
445
|
+
Retrieves content zones for a specific page.
|
|
446
|
+
|
|
447
|
+
| Parameter | Type | Required | Description |
|
|
448
|
+
|-----------|------|----------|-------------|
|
|
449
|
+
| `pageID` | `number` | Yes | The page ID |
|
|
450
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
451
|
+
|
|
452
|
+
**Returns:** `ContentZone[]` - Array of content zones
|
|
453
|
+
|
|
454
|
+
**Usage Example:**
|
|
455
|
+
```typescript
|
|
456
|
+
const zones = await apiClient.pageMethods.getPageContentZones(123, guid);
|
|
457
|
+
console.log(`Page has ${zones.length} content zones`);
|
|
458
|
+
|
|
459
|
+
// Display zone information
|
|
460
|
+
zones.forEach(zone => {
|
|
461
|
+
console.log(`Zone: ${zone.name}`);
|
|
462
|
+
console.log(` Items: ${zone.items.length}`);
|
|
463
|
+
console.log(` Template: ${zone.templateName}`);
|
|
464
|
+
|
|
465
|
+
// Display zone items
|
|
466
|
+
zone.items.forEach(item => {
|
|
467
|
+
console.log(` Item: ${item.title} (${item.type})`);
|
|
468
|
+
});
|
|
469
|
+
});
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
**Error Handling:**
|
|
473
|
+
- Throws `Exception` when page not found
|
|
474
|
+
|
|
475
|
+
### savePage
|
|
476
|
+
|
|
477
|
+
Creates a new page or updates an existing one.
|
|
478
|
+
|
|
479
|
+
| Parameter | Type | Required | Description |
|
|
480
|
+
|-----------|------|----------|-------------|
|
|
481
|
+
| `page` | `PageItem` | Yes | Page object to save |
|
|
482
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
483
|
+
| `returnBatchId` | `boolean` | No | If `true`, returns batch ID immediately. If `false` (default), waits for completion |
|
|
484
|
+
|
|
485
|
+
**Returns:** `PageItem | number` - Saved page (if `returnBatchId` is false) or batch ID (if true)
|
|
486
|
+
|
|
487
|
+
**Usage Example:**
|
|
488
|
+
```typescript
|
|
489
|
+
// Create a new page
|
|
490
|
+
const newPage = {
|
|
491
|
+
title: 'New About Page',
|
|
492
|
+
path: '/about-us',
|
|
493
|
+
templateName: 'About Template',
|
|
494
|
+
parentPageID: null, // Root level page
|
|
495
|
+
menuText: 'About Us',
|
|
496
|
+
isVisible: true,
|
|
497
|
+
contentZones: [
|
|
498
|
+
{
|
|
499
|
+
name: 'MainContent',
|
|
500
|
+
items: [
|
|
501
|
+
{
|
|
502
|
+
type: 'content',
|
|
503
|
+
contentID: 456,
|
|
504
|
+
title: 'About Us Content'
|
|
505
|
+
}
|
|
506
|
+
]
|
|
507
|
+
}
|
|
508
|
+
]
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
const savedPage = await apiClient.pageMethods.savePage(newPage, guid);
|
|
512
|
+
console.log('Page created with ID:', savedPage.pageID);
|
|
513
|
+
|
|
514
|
+
// Update existing page
|
|
515
|
+
const existingPage = await apiClient.pageMethods.getPage(123, guid);
|
|
516
|
+
existingPage.title = 'Updated Page Title';
|
|
517
|
+
existingPage.menuText = 'Updated Menu';
|
|
518
|
+
const updatedPage = await apiClient.pageMethods.savePage(existingPage, guid);
|
|
519
|
+
|
|
520
|
+
// Save with batch processing
|
|
521
|
+
const batchId = await apiClient.pageMethods.savePage(newPage, guid, true);
|
|
522
|
+
console.log('Batch created with ID:', batchId);
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
**Error Handling:**
|
|
526
|
+
- Throws `Exception` when validation fails or save operation fails
|
|
527
|
+
|
|
528
|
+
### savePageSecurity
|
|
529
|
+
|
|
530
|
+
Updates security settings for a specific page.
|
|
531
|
+
|
|
532
|
+
| Parameter | Type | Required | Description |
|
|
533
|
+
|-----------|------|----------|-------------|
|
|
534
|
+
| `pageID` | `number` | Yes | The page ID |
|
|
535
|
+
| `security` | `PageSecurity` | Yes | Security configuration to apply |
|
|
536
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
537
|
+
|
|
538
|
+
**Returns:** `PageSecurity` - Updated security configuration
|
|
539
|
+
|
|
540
|
+
**Usage Example:**
|
|
541
|
+
```typescript
|
|
542
|
+
// Make page public
|
|
543
|
+
const publicSecurity = {
|
|
544
|
+
isPublic: true,
|
|
545
|
+
allowedRoles: [],
|
|
546
|
+
requiresAuthentication: false
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
const updatedSecurity = await apiClient.pageMethods.savePageSecurity(
|
|
550
|
+
123,
|
|
551
|
+
publicSecurity,
|
|
552
|
+
guid
|
|
553
|
+
);
|
|
554
|
+
|
|
555
|
+
// Restrict page to specific roles
|
|
556
|
+
const restrictedSecurity = {
|
|
557
|
+
isPublic: false,
|
|
558
|
+
allowedRoles: ['Administrator', 'Editor'],
|
|
559
|
+
requiresAuthentication: true
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
await apiClient.pageMethods.savePageSecurity(123, restrictedSecurity, guid);
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**Error Handling:**
|
|
566
|
+
- Throws `Exception` when page not found or security update fails
|
|
567
|
+
|
|
568
|
+
### movePageItem
|
|
569
|
+
|
|
570
|
+
Moves a page item within the page hierarchy.
|
|
571
|
+
|
|
572
|
+
| Parameter | Type | Required | Description |
|
|
573
|
+
|-----------|------|----------|-------------|
|
|
574
|
+
| `pageID` | `number` | Yes | The page ID to move |
|
|
575
|
+
| `parentPageID` | `number` | Yes | The new parent page ID (0 for root level) |
|
|
576
|
+
| `sortOrder` | `number` | Yes | The sort order within the parent |
|
|
577
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
578
|
+
|
|
579
|
+
**Returns:** `PageItem` - Updated page object
|
|
580
|
+
|
|
581
|
+
**Usage Example:**
|
|
582
|
+
```typescript
|
|
583
|
+
// Move page to root level
|
|
584
|
+
const movedPage = await apiClient.pageMethods.movePageItem(123, 0, 1, guid);
|
|
585
|
+
|
|
586
|
+
// Move page under another page
|
|
587
|
+
const childPage = await apiClient.pageMethods.movePageItem(123, 456, 2, guid);
|
|
588
|
+
|
|
589
|
+
// Reorder pages
|
|
590
|
+
const reorderPages = async (parentID, pageIDs) => {
|
|
591
|
+
for (let i = 0; i < pageIDs.length; i++) {
|
|
592
|
+
await apiClient.pageMethods.movePageItem(
|
|
593
|
+
pageIDs[i],
|
|
594
|
+
parentID,
|
|
595
|
+
i + 1,
|
|
596
|
+
guid
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
**Error Handling:**
|
|
603
|
+
- Throws `Exception` when page not found or move operation fails
|
|
604
|
+
|
|
605
|
+
### deletePage
|
|
606
|
+
|
|
607
|
+
Deletes a page by its ID.
|
|
608
|
+
|
|
609
|
+
| Parameter | Type | Required | Description |
|
|
610
|
+
|-----------|------|----------|-------------|
|
|
611
|
+
| `pageID` | `number` | Yes | The page ID to delete |
|
|
612
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
613
|
+
|
|
614
|
+
**Returns:** `string` - Confirmation message of successful deletion
|
|
615
|
+
|
|
616
|
+
**Usage Example:**
|
|
617
|
+
```typescript
|
|
618
|
+
try {
|
|
619
|
+
const result = await apiClient.pageMethods.deletePage(123, guid);
|
|
620
|
+
console.log(result); // "Page deleted successfully"
|
|
621
|
+
} catch (error) {
|
|
622
|
+
if (error.message.includes('has children')) {
|
|
623
|
+
console.log('Cannot delete page: has child pages');
|
|
624
|
+
} else if (error.message.includes('referenced')) {
|
|
625
|
+
console.log('Cannot delete page: referenced by other content');
|
|
626
|
+
} else {
|
|
627
|
+
console.error('Failed to delete page:', error.message);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// Safe page deletion with checks
|
|
632
|
+
const safeDeletePage = async (pageID) => {
|
|
633
|
+
try {
|
|
634
|
+
const page = await apiClient.pageMethods.getPage(pageID, guid);
|
|
635
|
+
|
|
636
|
+
// Check if page has children
|
|
637
|
+
if (page.children && page.children.length > 0) {
|
|
638
|
+
console.log(`Cannot delete page "${page.title}": has child pages`);
|
|
639
|
+
return false;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// Perform deletion
|
|
643
|
+
await apiClient.pageMethods.deletePage(pageID, guid);
|
|
644
|
+
console.log('Page deleted successfully');
|
|
645
|
+
return true;
|
|
646
|
+
} catch (error) {
|
|
647
|
+
console.error('Failed to delete page:', error.message);
|
|
648
|
+
return false;
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
**Error Handling:**
|
|
654
|
+
- Throws `Exception` when page not found, has children, or deletion fails
|
|
655
|
+
|
|
656
|
+
**Note:** Pages cannot be deleted if they have child pages or are referenced by other content.
|
|
657
|
+
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
### batchWorkflowPages
|
|
661
|
+
|
|
662
|
+
Performs a batch workflow operation on multiple pages. Supports Publish, Unpublish, Approve, Decline, and RequestApproval operations.
|
|
663
|
+
|
|
664
|
+
| Parameter | Type | Required | Description |
|
|
665
|
+
|-----------|------|----------|-------------|
|
|
666
|
+
| `pageIDs` | `number[]` | Yes | Array of page IDs to process |
|
|
667
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
668
|
+
| `locale` | `string` | Yes | The locale code |
|
|
669
|
+
| `operation` | `WorkflowOperationType` | Yes | The workflow operation (Publish, Unpublish, Approve, Decline, RequestApproval) |
|
|
670
|
+
| `returnBatchId` | `boolean` | No | If `true`, returns batch ID immediately without waiting |
|
|
671
|
+
|
|
672
|
+
**Returns:** `Promise<number[]>` - Array of page IDs that were processed
|
|
673
|
+
|
|
674
|
+
**Usage Example:**
|
|
675
|
+
```typescript
|
|
676
|
+
import { WorkflowOperationType } from '@agility/management-sdk';
|
|
677
|
+
|
|
678
|
+
// Publish multiple pages
|
|
679
|
+
const pageIDs = [201, 202, 203];
|
|
680
|
+
const publishedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
681
|
+
pageIDs,
|
|
682
|
+
'your-guid',
|
|
683
|
+
'en-us',
|
|
684
|
+
WorkflowOperationType.Publish
|
|
685
|
+
);
|
|
686
|
+
console.log('Published page IDs:', publishedPageIDs);
|
|
687
|
+
|
|
688
|
+
// Unpublish multiple pages
|
|
689
|
+
const unpublishedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
690
|
+
pageIDs,
|
|
691
|
+
'your-guid',
|
|
692
|
+
'en-us',
|
|
693
|
+
WorkflowOperationType.Unpublish
|
|
694
|
+
);
|
|
695
|
+
|
|
696
|
+
// Request approval for multiple pages
|
|
697
|
+
const approvalRequestedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
698
|
+
pageIDs,
|
|
699
|
+
'your-guid',
|
|
700
|
+
'en-us',
|
|
701
|
+
WorkflowOperationType.RequestApproval
|
|
702
|
+
);
|
|
703
|
+
|
|
704
|
+
// Approve multiple pages
|
|
705
|
+
const approvedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
706
|
+
pageIDs,
|
|
707
|
+
'your-guid',
|
|
708
|
+
'en-us',
|
|
709
|
+
WorkflowOperationType.Approve
|
|
710
|
+
);
|
|
711
|
+
|
|
712
|
+
// Decline multiple pages
|
|
713
|
+
const declinedPageIDs = await client.pageMethods.batchWorkflowPages(
|
|
714
|
+
pageIDs,
|
|
715
|
+
'your-guid',
|
|
716
|
+
'en-us',
|
|
717
|
+
WorkflowOperationType.Decline
|
|
718
|
+
);
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
**Error Handling:**
|
|
722
|
+
- Throws `Exception` when batch operation fails
|
|
723
|
+
|
|
724
|
+
---
|
|
725
|
+
|
|
726
|
+
## Navigation
|
|
727
|
+
- [← Back to Main Documentation](../README.md)
|
|
728
|
+
- [Authentication & Setup](./auth.md)
|
|
729
|
+
- [AssetMethods](./asset-methods.md)
|
|
730
|
+
- [BatchMethods](./batch-methods.md)
|
|
731
|
+
- [ContainerMethods](./container-methods.md)
|
|
732
|
+
- [ContentMethods](./content-methods.md)
|
|
733
|
+
- [InstanceMethods](./instance-methods.md)
|
|
734
|
+
- [InstanceUserMethods](./instance-user-methods.md)
|
|
735
|
+
- [ModelMethods](./model-methods.md)
|
|
736
|
+
- [ServerUserMethods](./server-user-methods.md)
|
|
737
|
+
- [WebhookMethods](./webhook-methods.md)
|
|
738
738
|
- [Multi-Instance Operations](./multi-instance-operations.md)
|