@agility/management-sdk 0.1.3 → 0.1.4-beta.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.
- package/.cursor/api-documentation-manifest.md +275 -0
- package/.cursor/api-functions-analysis.md +111 -0
- package/.cursor/docs-final-check.md +269 -0
- package/.cursor/manifest.md +153 -0
- package/.env +92 -0
- package/README.md +219 -352
- package/dist/apiClient.d.ts +86 -0
- package/dist/apiClient.js +229 -0
- package/dist/apiClient.js.map +1 -0
- package/dist/apiMethods/assetMethods.d.ts +28 -6
- package/dist/apiMethods/assetMethods.js +224 -29
- package/dist/apiMethods/assetMethods.js.map +1 -0
- package/dist/apiMethods/authMethods.d.ts +239 -0
- package/dist/apiMethods/authMethods.js +604 -0
- package/dist/apiMethods/batchMethods.d.ts +32 -1
- package/dist/apiMethods/batchMethods.js +241 -11
- package/dist/apiMethods/batchMethods.js.map +1 -0
- package/dist/apiMethods/clientInstance.d.ts +58 -4
- package/dist/apiMethods/clientInstance.js +311 -44
- package/dist/apiMethods/clientInstance.js.map +1 -0
- package/dist/apiMethods/containerMethods.d.ts +15 -7
- package/dist/apiMethods/containerMethods.js +70 -38
- package/dist/apiMethods/containerMethods.js.map +1 -0
- package/dist/apiMethods/contentMethods.d.ts +17 -10
- package/dist/apiMethods/contentMethods.js +169 -70
- package/dist/apiMethods/contentMethods.js.map +1 -0
- package/dist/apiMethods/instanceMethods.d.ts +9 -0
- package/dist/apiMethods/instanceMethods.js +69 -0
- package/dist/apiMethods/instanceMethods.js.map +1 -0
- package/dist/apiMethods/instanceUserMethods.d.ts +3 -3
- package/dist/apiMethods/instanceUserMethods.js +18 -18
- package/dist/apiMethods/instanceUserMethods.js.map +1 -0
- package/dist/apiMethods/modelMethods.d.ts +6 -5
- package/dist/apiMethods/modelMethods.js +46 -26
- package/dist/apiMethods/modelMethods.js.map +1 -0
- package/dist/apiMethods/pageMethods.d.ts +21 -9
- package/dist/apiMethods/pageMethods.js +278 -76
- package/dist/apiMethods/pageMethods.js.map +1 -0
- package/dist/apiMethods/serverUserMethods.d.ts +10 -0
- package/dist/apiMethods/serverUserMethods.js +89 -0
- package/dist/apiMethods/serverUserMethods.js.map +1 -0
- package/dist/apiMethods/webhookMethods.d.ts +12 -0
- package/dist/apiMethods/webhookMethods.js +131 -0
- package/dist/apiMethods/webhookMethods.js.map +1 -0
- package/dist/enums/assetGroupingType.d.ts +3 -0
- package/dist/enums/assetGroupingType.js +7 -0
- package/dist/enums/assetGroupingType.js.map +1 -0
- package/dist/enums/batchItemType.d.ts +7 -0
- package/dist/enums/batchItemType.js +11 -0
- package/dist/enums/batchOperationType.js +1 -1
- package/dist/enums/batchOperationType.js.map +1 -0
- package/dist/enums/batchState..js +1 -1
- package/dist/enums/batchState.d.ts +7 -0
- package/dist/enums/batchState.js +12 -0
- package/dist/enums/batchState.js.map +1 -0
- package/dist/enums/pageItemTemplateType.d.ts +4 -0
- package/dist/enums/pageItemTemplateType.js +8 -0
- package/dist/enums/pageItemTemplateType.js.map +1 -0
- package/dist/enums/workflowOperationType.d.ts +26 -0
- package/dist/enums/workflowOperationType.js +30 -0
- package/dist/errors/exception.d.ts +4 -0
- package/dist/errors/exception.js +11 -0
- package/dist/errors/exception.js.map +1 -0
- package/dist/index.d.ts +41 -9
- package/dist/index.js +48 -10
- package/dist/index.js.map +1 -0
- package/dist/models/assetContainer.d.ts +7 -0
- package/dist/models/assetContainer.js +9 -0
- package/dist/models/assetGalleries.d.ts +5 -0
- package/dist/models/assetGalleries.js +9 -0
- package/dist/models/assetMediaGrouping.d.ts +17 -0
- package/dist/models/assetMediaGrouping.js +9 -0
- package/dist/models/assetMediaGroupingMetaData.d.ts +4 -0
- package/dist/models/assetMediaGroupingMetaData.js +9 -0
- package/dist/models/authTokens.d.ts +73 -0
- package/dist/models/authTokens.js +2 -0
- package/dist/models/batchItem.d.ts +1 -0
- package/dist/models/batchRequests.d.ts +67 -0
- package/dist/models/batchRequests.js +2 -0
- package/dist/models/batchTypes.d.ts +34 -0
- package/dist/models/batchTypes.js +2 -0
- package/dist/models/container.d.ts +2 -1
- package/dist/models/contentDefinitionTypeID.d.ts +17 -0
- package/dist/models/contentDefinitionTypeID.js +21 -0
- package/dist/models/contentItemHistory.d.ts +20 -0
- package/dist/models/contentItemHistory.js +15 -0
- package/dist/models/contentListFilterModel.d.ts +26 -0
- package/dist/models/contentListFilterModel.js +33 -0
- package/dist/models/contentSectionDefaultModule.d.ts +7 -0
- package/dist/models/contentSectionDefaultModule.js +9 -0
- package/dist/models/contentSectionDefinition.d.ts +35 -0
- package/dist/models/contentSectionDefinition.js +9 -0
- package/dist/models/exception.js +2 -0
- package/dist/models/itemComments.d.ts +14 -0
- package/dist/models/itemComments.js +15 -0
- package/dist/models/listParams.d.ts +9 -0
- package/dist/models/listParams.js +16 -0
- package/dist/models/locales.d.ts +3 -0
- package/dist/models/locales.js +30 -0
- package/dist/models/options.d.ts +2 -5
- package/dist/models/options.js +0 -19
- package/dist/models/pageHistory.d.ts +21 -0
- package/dist/models/pageHistory.js +15 -0
- package/dist/models/pageModel.d.ts +14 -0
- package/dist/models/pageModel.js +9 -0
- package/dist/models/serverUser.d.ts +21 -0
- package/dist/models/serverUser.js +9 -0
- package/dist/models/sharedModule.d.ts +7 -0
- package/dist/models/sharedModule.js +9 -0
- package/dist/models/webhook.d.ts +9 -0
- package/dist/models/webhook.js +9 -0
- package/dist/models/websiteListing.d.ts +16 -0
- package/dist/models/websiteListing.js +9 -0
- package/dist/tests/authHelper.d.ts +2 -0
- package/dist/tests/authHelper.js +14 -0
- package/dist/tests/authHelper.js.map +1 -0
- package/dist/tests/config/apiClient.config.d.ts +16 -0
- package/dist/tests/config/apiClient.config.js +84 -0
- package/dist/tests/config/apiClient.config.js.map +1 -0
- package/dist/tests/config/test.config.d.ts +24 -0
- package/dist/tests/config/test.config.js +47 -0
- package/dist/tests/config/test.config.js.map +1 -0
- package/dist/tokenStorage.d.ts +72 -0
- package/dist/tokenStorage.js +366 -0
- package/dist/types/apiResponse.d.ts +13 -0
- package/dist/types/apiResponse.js +3 -0
- package/dist/types/apiResponse.js.map +1 -0
- package/dist/types/assetContainer.d.ts +7 -0
- package/dist/types/assetContainer.js +3 -0
- package/dist/types/assetContainer.js.map +1 -0
- package/dist/types/assetGalleries.d.ts +5 -0
- package/dist/types/assetGalleries.js +3 -0
- package/dist/types/assetGalleries.js.map +1 -0
- package/dist/types/assetMediaGrouping.d.ts +17 -0
- package/dist/types/assetMediaGrouping.js +3 -0
- package/dist/types/assetMediaGrouping.js.map +1 -0
- package/dist/types/assetMediaGroupingMetaData.d.ts +4 -0
- package/dist/types/assetMediaGroupingMetaData.js +3 -0
- package/dist/types/assetMediaGroupingMetaData.js.map +1 -0
- package/dist/types/batch.d.ts +29 -0
- package/dist/types/batch.js +3 -0
- package/dist/types/batch.js.map +1 -0
- package/dist/types/batchItem.d.ts +13 -0
- package/dist/types/batchItem.js +3 -0
- package/dist/types/batchItem.js.map +1 -0
- package/dist/types/container.d.ts +47 -0
- package/dist/types/container.js +3 -0
- package/dist/types/container.js.map +1 -0
- package/dist/types/contentItem.d.ts +37 -0
- package/dist/types/contentItem.js +3 -0
- package/dist/types/contentItem.js.map +1 -0
- package/dist/types/contentItemHistory.d.ts +20 -0
- package/dist/types/contentItemHistory.js +3 -0
- package/dist/types/contentItemHistory.js.map +1 -0
- package/dist/types/contentListFilterModel.d.ts +26 -0
- package/dist/types/contentListFilterModel.js +3 -0
- package/dist/types/contentListFilterModel.js.map +1 -0
- package/dist/types/contentSectionDefaultModule.d.ts +7 -0
- package/dist/types/contentSectionDefaultModule.js +3 -0
- package/dist/types/contentSectionDefaultModule.js.map +1 -0
- package/dist/types/contentSectionDefinition.d.ts +35 -0
- package/dist/types/contentSectionDefinition.js +3 -0
- package/dist/types/contentSectionDefinition.js.map +1 -0
- package/dist/types/contentViewColumn.d.ts +8 -0
- package/dist/types/contentViewColumn.js +3 -0
- package/dist/types/contentViewColumn.js.map +1 -0
- package/dist/types/instanceRole.d.ts +7 -0
- package/dist/types/instanceRole.js +3 -0
- package/dist/types/instanceRole.js.map +1 -0
- package/dist/types/instanceUser.d.ts +14 -0
- package/dist/types/instanceUser.js +3 -0
- package/dist/types/instanceUser.js.map +1 -0
- package/dist/types/itemComments.d.ts +14 -0
- package/dist/types/itemComments.js +3 -0
- package/dist/types/itemComments.js.map +1 -0
- package/dist/types/listParams.d.ts +9 -0
- package/dist/types/listParams.js +3 -0
- package/dist/types/listParams.js.map +1 -0
- package/dist/types/locales.d.ts +1 -0
- package/dist/types/locales.js +3 -0
- package/dist/types/locales.js.map +1 -0
- package/dist/types/media.d.ts +30 -0
- package/dist/types/media.js +3 -0
- package/dist/types/media.js.map +1 -0
- package/dist/types/model.d.ts +30 -0
- package/dist/types/model.js +3 -0
- package/dist/types/model.js.map +1 -0
- package/dist/types/notification.d.ts +13 -0
- package/dist/types/notification.js +3 -0
- package/dist/types/notification.js.map +1 -0
- package/dist/types/options.d.ts +7 -0
- package/dist/types/options.js +3 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/pageHistory.d.ts +21 -0
- package/dist/types/pageHistory.js +3 -0
- package/dist/types/pageHistory.js.map +1 -0
- package/dist/types/pageItem.d.ts +56 -0
- package/dist/types/pageItem.js +3 -0
- package/dist/types/pageItem.js.map +1 -0
- package/dist/types/pageModel.d.ts +14 -0
- package/dist/types/pageModel.js +3 -0
- package/dist/types/pageModel.js.map +1 -0
- package/dist/types/serverUser.d.ts +21 -0
- package/dist/types/serverUser.js +3 -0
- package/dist/types/serverUser.js.map +1 -0
- package/dist/types/sharedModule.d.ts +7 -0
- package/dist/types/sharedModule.js +3 -0
- package/dist/types/sharedModule.js.map +1 -0
- package/dist/types/sitemap.d.ts +20 -0
- package/dist/types/sitemap.js +3 -0
- package/dist/types/sitemap.js.map +1 -0
- package/dist/types/tokenResponseData.d.ts +10 -0
- package/dist/types/tokenResponseData.js +3 -0
- package/dist/types/tokenResponseData.js.map +1 -0
- package/dist/types/webhook.d.ts +9 -0
- package/dist/types/webhook.js +3 -0
- package/dist/types/webhook.js.map +1 -0
- package/dist/types/websiteListing.d.ts +16 -0
- package/dist/types/websiteListing.js +3 -0
- package/dist/types/websiteListing.js.map +1 -0
- package/dist/types/websiteUser.d.ts +22 -0
- package/dist/types/websiteUser.js +3 -0
- package/dist/types/websiteUser.js.map +1 -0
- package/docs/asset-methods.md +382 -0
- package/docs/auth.md +594 -0
- package/docs/batch-methods.md +244 -0
- package/docs/cicd.md +607 -0
- package/docs/container-methods.md +268 -0
- package/docs/content-methods.md +423 -0
- package/docs/instance-methods.md +105 -0
- package/docs/instance-user-methods.md +231 -0
- package/docs/model-methods.md +434 -0
- package/docs/multi-instance-operations.md +192 -0
- package/docs/page-methods.md +671 -0
- package/docs/server-user-methods.md +280 -0
- package/docs/webhook-methods.md +452 -0
- package/package.json +14 -10
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Agility CMS & Management API TypeScript SDK
|
|
2
|
+
|
|
3
|
+
## ContainerMethods
|
|
4
|
+
|
|
5
|
+
This class provides comprehensive container management operations for organizing and managing content within Agility CMS. Containers are used to group related content items and control access permissions.
|
|
6
|
+
|
|
7
|
+
**Important Notes:**
|
|
8
|
+
- Containers organize content items by their definition types
|
|
9
|
+
- Each container has security settings that control user access
|
|
10
|
+
- Containers can have notification settings for workflow events
|
|
11
|
+
- Reference names must be unique within the instance
|
|
12
|
+
- Containers cannot be deleted if they contain content items
|
|
13
|
+
|
|
14
|
+
### Function List
|
|
15
|
+
- [getContainerByID](#getcontainerbyid) - Retrieves a specific container by ID
|
|
16
|
+
- [getContainersByModel](#getcontainersbymodel) - Retrieves containers associated with a content model
|
|
17
|
+
- [getContainerByReferenceName](#getcontainerbyreferencename) - Retrieves a container by reference name
|
|
18
|
+
- [getContainerSecurity](#getcontainersecurity) - Retrieves security settings for a container
|
|
19
|
+
- [getContainerList](#getcontainerlist) - Retrieves list of all containers
|
|
20
|
+
- [getNotificationList](#getnotificationlist) - Retrieves notification settings for a container
|
|
21
|
+
- [saveContainer](#savecontainer) - Creates or updates a container
|
|
22
|
+
- [deleteContainer](#deletecontainer) - Deletes a container by ID
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### getContainerByID
|
|
27
|
+
|
|
28
|
+
Retrieves a specific container by its unique ID.
|
|
29
|
+
|
|
30
|
+
| Parameter | Type | Required | Description |
|
|
31
|
+
|-----------|------|----------|-------------|
|
|
32
|
+
| `id` | `number` | Yes | The container ID to retrieve |
|
|
33
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
34
|
+
|
|
35
|
+
**Returns:** `Container` - Container object with complete configuration
|
|
36
|
+
|
|
37
|
+
**Usage Example:**
|
|
38
|
+
```typescript
|
|
39
|
+
const container = await apiClient.containerMethods.getContainerByID(123, guid);
|
|
40
|
+
console.log('Container name:', container.displayName);
|
|
41
|
+
console.log('Reference name:', container.referenceName);
|
|
42
|
+
console.log('Model ID:', container.modelId);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Error Handling:**
|
|
46
|
+
- Throws `Exception` when container not found
|
|
47
|
+
|
|
48
|
+
### getContainersByModel
|
|
49
|
+
|
|
50
|
+
Retrieves all containers associated with a specific content model.
|
|
51
|
+
|
|
52
|
+
| Parameter | Type | Required | Description |
|
|
53
|
+
|-----------|------|----------|-------------|
|
|
54
|
+
| `modelId` | `number` | Yes | The content model ID |
|
|
55
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
56
|
+
|
|
57
|
+
**Returns:** `Container[]` - Array of containers using the specified model
|
|
58
|
+
|
|
59
|
+
**Usage Example:**
|
|
60
|
+
```typescript
|
|
61
|
+
const containers = await apiClient.containerMethods.getContainersByModel(456, guid);
|
|
62
|
+
console.log(`Found ${containers.length} containers for this model`);
|
|
63
|
+
|
|
64
|
+
// Process each container
|
|
65
|
+
containers.forEach(container => {
|
|
66
|
+
console.log(`Container: ${container.displayName} (${container.referenceName})`);
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Error Handling:**
|
|
71
|
+
- Throws `Exception` when model not found or retrieval fails
|
|
72
|
+
|
|
73
|
+
### getContainerByReferenceName
|
|
74
|
+
|
|
75
|
+
Retrieves a container by its reference name. Returns null if the container doesn't exist.
|
|
76
|
+
|
|
77
|
+
| Parameter | Type | Required | Description |
|
|
78
|
+
|-----------|------|----------|-------------|
|
|
79
|
+
| `referenceName` | `string` | Yes | The reference name of the container |
|
|
80
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
81
|
+
|
|
82
|
+
**Returns:** `Container | null` - Container object or null if not found
|
|
83
|
+
|
|
84
|
+
**Usage Example:**
|
|
85
|
+
```typescript
|
|
86
|
+
const container = await apiClient.containerMethods.getContainerByReferenceName('blog-posts', guid);
|
|
87
|
+
if (container) {
|
|
88
|
+
console.log('Container found:', container.displayName);
|
|
89
|
+
console.log('Container ID:', container.id);
|
|
90
|
+
} else {
|
|
91
|
+
console.log('Container not found');
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Error Handling:**
|
|
96
|
+
- Returns `null` for 404 errors (container not found)
|
|
97
|
+
- Throws `Exception` for other errors
|
|
98
|
+
|
|
99
|
+
### getContainerSecurity
|
|
100
|
+
|
|
101
|
+
Retrieves the security settings for a specific container.
|
|
102
|
+
|
|
103
|
+
| Parameter | Type | Required | Description |
|
|
104
|
+
|-----------|------|----------|-------------|
|
|
105
|
+
| `id` | `number` | Yes | The container ID |
|
|
106
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
107
|
+
|
|
108
|
+
**Returns:** `Container` - Container object with security information
|
|
109
|
+
|
|
110
|
+
**Usage Example:**
|
|
111
|
+
```typescript
|
|
112
|
+
const security = await apiClient.containerMethods.getContainerSecurity(123, guid);
|
|
113
|
+
console.log('Security settings:', security.securitySettings);
|
|
114
|
+
|
|
115
|
+
// Check if container has specific permissions
|
|
116
|
+
if (security.securitySettings) {
|
|
117
|
+
console.log('Container has custom security settings');
|
|
118
|
+
} else {
|
|
119
|
+
console.log('Container uses default security settings');
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Error Handling:**
|
|
124
|
+
- Throws `Exception` when container not found or access denied
|
|
125
|
+
|
|
126
|
+
### getContainerList
|
|
127
|
+
|
|
128
|
+
Retrieves a list of all containers in the current website.
|
|
129
|
+
|
|
130
|
+
| Parameter | Type | Required | Description |
|
|
131
|
+
|-----------|------|----------|-------------|
|
|
132
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
133
|
+
|
|
134
|
+
**Returns:** `Container[]` - Array of all containers
|
|
135
|
+
|
|
136
|
+
**Usage Example:**
|
|
137
|
+
```typescript
|
|
138
|
+
const containers = await apiClient.containerMethods.getContainerList(guid);
|
|
139
|
+
console.log(`Total containers: ${containers.length}`);
|
|
140
|
+
|
|
141
|
+
// Filter by content type
|
|
142
|
+
const blogContainers = containers.filter(c => c.referenceName.includes('blog'));
|
|
143
|
+
console.log(`Blog-related containers: ${blogContainers.length}`);
|
|
144
|
+
|
|
145
|
+
// Group by model
|
|
146
|
+
const containersByModel = containers.reduce((acc, container) => {
|
|
147
|
+
const modelId = container.modelId;
|
|
148
|
+
if (!acc[modelId]) acc[modelId] = [];
|
|
149
|
+
acc[modelId].push(container);
|
|
150
|
+
return acc;
|
|
151
|
+
}, {});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Error Handling:**
|
|
155
|
+
- Throws `Exception` when retrieval fails
|
|
156
|
+
|
|
157
|
+
### getNotificationList
|
|
158
|
+
|
|
159
|
+
Retrieves the notification settings for a specific container.
|
|
160
|
+
|
|
161
|
+
| Parameter | Type | Required | Description |
|
|
162
|
+
|-----------|------|----------|-------------|
|
|
163
|
+
| `id` | `number` | Yes | The container ID |
|
|
164
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
165
|
+
|
|
166
|
+
**Returns:** `Notification[]` - Array of notification configurations
|
|
167
|
+
|
|
168
|
+
**Usage Example:**
|
|
169
|
+
```typescript
|
|
170
|
+
const notifications = await apiClient.containerMethods.getNotificationList(123, guid);
|
|
171
|
+
console.log(`Container has ${notifications.length} notification rules`);
|
|
172
|
+
|
|
173
|
+
notifications.forEach(notification => {
|
|
174
|
+
console.log(`Notification: ${notification.name}`);
|
|
175
|
+
console.log(`Type: ${notification.type}`);
|
|
176
|
+
console.log(`Recipients: ${notification.recipients}`);
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Error Handling:**
|
|
181
|
+
- Throws `Exception` when container not found or access denied
|
|
182
|
+
|
|
183
|
+
### saveContainer
|
|
184
|
+
|
|
185
|
+
Creates a new container or updates an existing one.
|
|
186
|
+
|
|
187
|
+
| Parameter | Type | Required | Description |
|
|
188
|
+
|-----------|------|----------|-------------|
|
|
189
|
+
| `container` | `Container` | Yes | Container object to save |
|
|
190
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
191
|
+
| `forceReferenceName` | `boolean` | No | Force reference name validation *(Optional, default: false)* |
|
|
192
|
+
|
|
193
|
+
**Returns:** `Container` - Saved container object with updated metadata
|
|
194
|
+
|
|
195
|
+
**Usage Example:**
|
|
196
|
+
```typescript
|
|
197
|
+
// Create a new container
|
|
198
|
+
const newContainer = {
|
|
199
|
+
referenceName: 'product-reviews',
|
|
200
|
+
displayName: 'Product Reviews',
|
|
201
|
+
modelId: 789,
|
|
202
|
+
isPublicListing: true,
|
|
203
|
+
description: 'Container for product review content items'
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const savedContainer = await apiClient.containerMethods.saveContainer(
|
|
207
|
+
newContainer,
|
|
208
|
+
guid,
|
|
209
|
+
true
|
|
210
|
+
);
|
|
211
|
+
console.log('Container saved with ID:', savedContainer.id);
|
|
212
|
+
|
|
213
|
+
// Update existing container
|
|
214
|
+
const existingContainer = await apiClient.containerMethods.getContainerByID(123, guid);
|
|
215
|
+
existingContainer.displayName = 'Updated Display Name';
|
|
216
|
+
const updatedContainer = await apiClient.containerMethods.saveContainer(existingContainer, guid);
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Error Handling:**
|
|
220
|
+
- Throws `Exception` when validation fails or save operation fails
|
|
221
|
+
|
|
222
|
+
### deleteContainer
|
|
223
|
+
|
|
224
|
+
Deletes a container by its ID.
|
|
225
|
+
|
|
226
|
+
| Parameter | Type | Required | Description |
|
|
227
|
+
|-----------|------|----------|-------------|
|
|
228
|
+
| `id` | `number` | Yes | The container ID to delete |
|
|
229
|
+
| `guid` | `string` | Yes | Current website GUID |
|
|
230
|
+
|
|
231
|
+
**Returns:** `string` - Confirmation message of successful deletion
|
|
232
|
+
|
|
233
|
+
**Usage Example:**
|
|
234
|
+
```typescript
|
|
235
|
+
try {
|
|
236
|
+
const result = await apiClient.containerMethods.deleteContainer(123, guid);
|
|
237
|
+
console.log(result); // "Container deleted successfully"
|
|
238
|
+
} catch (error) {
|
|
239
|
+
if (error.message.includes('contains content')) {
|
|
240
|
+
console.log('Cannot delete container: still contains content items');
|
|
241
|
+
// Handle by moving or deleting content first
|
|
242
|
+
} else {
|
|
243
|
+
console.error('Failed to delete container:', error.message);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Error Handling:**
|
|
249
|
+
- Throws `Exception` when container not found, has content, or deletion fails
|
|
250
|
+
|
|
251
|
+
**Note:** Containers cannot be deleted if they contain content items. Remove all content first.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Navigation
|
|
256
|
+
- [← Back to Main Documentation](../README.md)
|
|
257
|
+
- [Authentication & Setup](./auth.md)
|
|
258
|
+
- [CI/CD & Automated Environments](./cicd.md)
|
|
259
|
+
- [AssetMethods](./asset-methods.md)
|
|
260
|
+
- [BatchMethods](./batch-methods.md)
|
|
261
|
+
- [ContentMethods](./content-methods.md)
|
|
262
|
+
- [InstanceMethods](./instance-methods.md)
|
|
263
|
+
- [InstanceUserMethods](./instance-user-methods.md)
|
|
264
|
+
- [ModelMethods](./model-methods.md)
|
|
265
|
+
- [PageMethods](./page-methods.md)
|
|
266
|
+
- [ServerUserMethods](./server-user-methods.md)
|
|
267
|
+
- [WebhookMethods](./webhook-methods.md)
|
|
268
|
+
- [Multi-Instance Operations](./multi-instance-operations.md)
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
# ContentMethods API Documentation
|
|
2
|
+
|
|
3
|
+
The `ContentMethods` class provides comprehensive functionality for managing content items, including creation, publication, approval workflows, and retrieval operations.
|
|
4
|
+
|
|
5
|
+
## Function List
|
|
6
|
+
|
|
7
|
+
| Function | Description |
|
|
8
|
+
|----------|-------------|
|
|
9
|
+
| [getContentItem](#getcontentitem) | Retrieves a specific content item by ID |
|
|
10
|
+
| [publishContent](#publishcontent) | Publishes a content item |
|
|
11
|
+
| [unPublishContent](#unpublishcontent) | Unpublishes a content item |
|
|
12
|
+
| [contentRequestApproval](#contentrequestapproval) | Requests approval for a content item |
|
|
13
|
+
| [approveContent](#approvecontent) | Approves a content item |
|
|
14
|
+
| [declineContent](#declinecontent) | Declines a content item |
|
|
15
|
+
| [deleteContent](#deletecontent) | Deletes a content item |
|
|
16
|
+
| [saveContentItem](#savecontentitem) | Saves a single content item |
|
|
17
|
+
| [saveContentItems](#savecontentitems) | Saves multiple content items |
|
|
18
|
+
| [getContentItems](#getcontentitems) | Retrieves content items with filtering (deprecated) |
|
|
19
|
+
| [getContentList](#getcontentlist) | Retrieves content list with advanced filtering |
|
|
20
|
+
| [getContentHistory](#getcontenthistory) | Retrieves content item history |
|
|
21
|
+
| [getContentComments](#getcontentcomments) | Retrieves content item comments |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## getContentItem
|
|
26
|
+
|
|
27
|
+
Retrieves a specific content item by ID and locale.
|
|
28
|
+
|
|
29
|
+
### Parameters
|
|
30
|
+
|
|
31
|
+
| Parameter | Type | Required | Description |
|
|
32
|
+
|-----------|------|----------|-------------|
|
|
33
|
+
| contentID | number | Yes | The ID of the content item to retrieve |
|
|
34
|
+
| guid | string | Yes | The website GUID |
|
|
35
|
+
| locale | string | Yes | The locale code (e.g., 'en-us') |
|
|
36
|
+
|
|
37
|
+
### Returns
|
|
38
|
+
|
|
39
|
+
`Promise<ContentItem>` - The content item object
|
|
40
|
+
|
|
41
|
+
### Usage Example
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
const contentItem = await client.contentMethods.getContentItem(123, 'your-guid', 'en-us');
|
|
45
|
+
console.log(contentItem.fields.title);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## publishContent
|
|
51
|
+
|
|
52
|
+
Publishes a content item through the batch workflow system.
|
|
53
|
+
|
|
54
|
+
### Parameters
|
|
55
|
+
|
|
56
|
+
| Parameter | Type | Required | Description |
|
|
57
|
+
|-----------|------|----------|-------------|
|
|
58
|
+
| contentID | number | Yes | The ID of the content item to publish |
|
|
59
|
+
| guid | string | Yes | The website GUID |
|
|
60
|
+
| locale | string | Yes | The locale code |
|
|
61
|
+
| comments | string | No | Optional comments for the publish operation |
|
|
62
|
+
| returnBatchId | boolean | No | If true, returns batch ID immediately without waiting |
|
|
63
|
+
|
|
64
|
+
### Returns
|
|
65
|
+
|
|
66
|
+
`Promise<number[]>` - Array of content IDs that were published
|
|
67
|
+
|
|
68
|
+
### Usage Example
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// Wait for completion (default)
|
|
72
|
+
const publishedIds = await client.contentMethods.publishContent(123, 'your-guid', 'en-us', 'Publishing update');
|
|
73
|
+
|
|
74
|
+
// Return batch ID immediately for custom polling
|
|
75
|
+
const batchId = await client.contentMethods.publishContent(123, 'your-guid', 'en-us', null, true);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## unPublishContent
|
|
81
|
+
|
|
82
|
+
Unpublishes a content item through the batch workflow system.
|
|
83
|
+
|
|
84
|
+
### Parameters
|
|
85
|
+
|
|
86
|
+
| Parameter | Type | Required | Description |
|
|
87
|
+
|-----------|------|----------|-------------|
|
|
88
|
+
| contentID | number | Yes | The ID of the content item to unpublish |
|
|
89
|
+
| guid | string | Yes | The website GUID |
|
|
90
|
+
| locale | string | Yes | The locale code |
|
|
91
|
+
| comments | string | No | Optional comments for the unpublish operation |
|
|
92
|
+
| returnBatchId | boolean | No | If true, returns batch ID immediately without waiting |
|
|
93
|
+
|
|
94
|
+
### Returns
|
|
95
|
+
|
|
96
|
+
`Promise<number[]>` - Array of content IDs that were unpublished
|
|
97
|
+
|
|
98
|
+
### Usage Example
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
const unpublishedIds = await client.contentMethods.unPublishContent(123, 'your-guid', 'en-us', 'Temporary unpublish');
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## contentRequestApproval
|
|
107
|
+
|
|
108
|
+
Requests approval for a content item through the workflow system.
|
|
109
|
+
|
|
110
|
+
### Parameters
|
|
111
|
+
|
|
112
|
+
| Parameter | Type | Required | Description |
|
|
113
|
+
|-----------|------|----------|-------------|
|
|
114
|
+
| contentID | number | Yes | The ID of the content item |
|
|
115
|
+
| guid | string | Yes | The website GUID |
|
|
116
|
+
| locale | string | Yes | The locale code |
|
|
117
|
+
| comments | string | No | Optional comments for the approval request |
|
|
118
|
+
| returnBatchId | boolean | No | If true, returns batch ID immediately without waiting |
|
|
119
|
+
|
|
120
|
+
### Returns
|
|
121
|
+
|
|
122
|
+
`Promise<number[]>` - Array of content IDs that had approval requested
|
|
123
|
+
|
|
124
|
+
### Usage Example
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
const requestedIds = await client.contentMethods.contentRequestApproval(123, 'your-guid', 'en-us', 'Ready for review');
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## approveContent
|
|
133
|
+
|
|
134
|
+
Approves a content item in the workflow system.
|
|
135
|
+
|
|
136
|
+
### Parameters
|
|
137
|
+
|
|
138
|
+
| Parameter | Type | Required | Description |
|
|
139
|
+
|-----------|------|----------|-------------|
|
|
140
|
+
| contentID | number | Yes | The ID of the content item to approve |
|
|
141
|
+
| guid | string | Yes | The website GUID |
|
|
142
|
+
| locale | string | Yes | The locale code |
|
|
143
|
+
| comments | string | No | Optional comments for the approval |
|
|
144
|
+
| returnBatchId | boolean | No | If true, returns batch ID immediately without waiting |
|
|
145
|
+
|
|
146
|
+
### Returns
|
|
147
|
+
|
|
148
|
+
`Promise<number[]>` - Array of content IDs that were approved
|
|
149
|
+
|
|
150
|
+
### Usage Example
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
const approvedIds = await client.contentMethods.approveContent(123, 'your-guid', 'en-us', 'Approved for publication');
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## declineContent
|
|
159
|
+
|
|
160
|
+
Declines a content item in the workflow system.
|
|
161
|
+
|
|
162
|
+
### Parameters
|
|
163
|
+
|
|
164
|
+
| Parameter | Type | Required | Description |
|
|
165
|
+
|-----------|------|----------|-------------|
|
|
166
|
+
| contentID | number | Yes | The ID of the content item to decline |
|
|
167
|
+
| guid | string | Yes | The website GUID |
|
|
168
|
+
| locale | string | Yes | The locale code |
|
|
169
|
+
| comments | string | No | Optional comments for the decline |
|
|
170
|
+
| returnBatchId | boolean | No | If true, returns batch ID immediately without waiting |
|
|
171
|
+
|
|
172
|
+
### Returns
|
|
173
|
+
|
|
174
|
+
`Promise<number[]>` - Array of content IDs that were declined
|
|
175
|
+
|
|
176
|
+
### Usage Example
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
const declinedIds = await client.contentMethods.declineContent(123, 'your-guid', 'en-us', 'Needs revision');
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## deleteContent
|
|
185
|
+
|
|
186
|
+
Deletes a content item through the batch workflow system.
|
|
187
|
+
|
|
188
|
+
### Parameters
|
|
189
|
+
|
|
190
|
+
| Parameter | Type | Required | Description |
|
|
191
|
+
|-----------|------|----------|-------------|
|
|
192
|
+
| contentID | number | Yes | The ID of the content item to delete |
|
|
193
|
+
| guid | string | Yes | The website GUID |
|
|
194
|
+
| locale | string | Yes | The locale code |
|
|
195
|
+
| comments | string | No | Optional comments for the deletion |
|
|
196
|
+
| returnBatchId | boolean | No | If true, returns batch ID immediately without waiting |
|
|
197
|
+
|
|
198
|
+
### Returns
|
|
199
|
+
|
|
200
|
+
`Promise<number[]>` - Array of content IDs that were deleted
|
|
201
|
+
|
|
202
|
+
### Usage Example
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
const deletedIds = await client.contentMethods.deleteContent(123, 'your-guid', 'en-us', 'Removing outdated content');
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## saveContentItem
|
|
211
|
+
|
|
212
|
+
Saves a single content item (create or update) through the batch workflow system.
|
|
213
|
+
|
|
214
|
+
### Parameters
|
|
215
|
+
|
|
216
|
+
| Parameter | Type | Required | Description |
|
|
217
|
+
|-----------|------|----------|-------------|
|
|
218
|
+
| contentItem | ContentItem | Yes | The content item object to save |
|
|
219
|
+
| guid | string | Yes | The website GUID |
|
|
220
|
+
| locale | string | Yes | The locale code |
|
|
221
|
+
| returnBatchId | boolean | No | If true, returns batch ID immediately without waiting |
|
|
222
|
+
|
|
223
|
+
### Returns
|
|
224
|
+
|
|
225
|
+
`Promise<number[]>` - Array of content IDs that were saved
|
|
226
|
+
|
|
227
|
+
### Usage Example
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
const contentItem = {
|
|
231
|
+
contentID: 0, // 0 for new items
|
|
232
|
+
fields: {
|
|
233
|
+
title: 'New Article',
|
|
234
|
+
content: 'Article content...'
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const savedIds = await client.contentMethods.saveContentItem(contentItem, 'your-guid', 'en-us');
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## saveContentItems
|
|
244
|
+
|
|
245
|
+
Saves multiple content items in a single batch operation.
|
|
246
|
+
|
|
247
|
+
### Parameters
|
|
248
|
+
|
|
249
|
+
| Parameter | Type | Required | Description |
|
|
250
|
+
|-----------|------|----------|-------------|
|
|
251
|
+
| contentItems | ContentItem[] | Yes | Array of content item objects to save |
|
|
252
|
+
| guid | string | Yes | The website GUID |
|
|
253
|
+
| locale | string | Yes | The locale code |
|
|
254
|
+
| returnBatchId | boolean | No | If true, returns batch ID immediately without waiting |
|
|
255
|
+
|
|
256
|
+
### Returns
|
|
257
|
+
|
|
258
|
+
`Promise<number[]>` - Array of content IDs that were saved
|
|
259
|
+
|
|
260
|
+
### Usage Example
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
const contentItems = [
|
|
264
|
+
{ contentID: 0, fields: { title: 'Article 1' } },
|
|
265
|
+
{ contentID: 0, fields: { title: 'Article 2' } }
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
const savedIds = await client.contentMethods.saveContentItems(contentItems, 'your-guid', 'en-us');
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## getContentItems
|
|
274
|
+
|
|
275
|
+
Retrieves content items with basic filtering parameters (deprecated - use getContentList instead).
|
|
276
|
+
|
|
277
|
+
### Parameters
|
|
278
|
+
|
|
279
|
+
| Parameter | Type | Required | Description |
|
|
280
|
+
|-----------|------|----------|-------------|
|
|
281
|
+
| referenceName | string | Yes | The reference name of the content model |
|
|
282
|
+
| guid | string | Yes | The website GUID |
|
|
283
|
+
| locale | string | Yes | The locale code |
|
|
284
|
+
| listParams | ListParams | Yes | Pagination and filtering parameters |
|
|
285
|
+
|
|
286
|
+
### Returns
|
|
287
|
+
|
|
288
|
+
`Promise<ContentList>` - The content list with items and pagination info
|
|
289
|
+
|
|
290
|
+
### Usage Example
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
const listParams = {
|
|
294
|
+
take: 10,
|
|
295
|
+
skip: 0,
|
|
296
|
+
sortField: 'title',
|
|
297
|
+
sortDirection: 'asc'
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const contentList = await client.contentMethods.getContentItems('articles', 'your-guid', 'en-us', listParams);
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## getContentList
|
|
306
|
+
|
|
307
|
+
Retrieves content items with advanced filtering using POST request with filter object.
|
|
308
|
+
|
|
309
|
+
### Parameters
|
|
310
|
+
|
|
311
|
+
| Parameter | Type | Required | Description |
|
|
312
|
+
|-----------|------|----------|-------------|
|
|
313
|
+
| referenceName | string | Yes | The reference name of the content model |
|
|
314
|
+
| guid | string | Yes | The website GUID |
|
|
315
|
+
| locale | string | Yes | The locale code |
|
|
316
|
+
| listParams | ListParams | Yes | Pagination and filtering parameters |
|
|
317
|
+
| filterObject | ContentListFilterModel | No | Advanced filter criteria |
|
|
318
|
+
|
|
319
|
+
### Returns
|
|
320
|
+
|
|
321
|
+
`Promise<ContentList>` - The content list with items and pagination info
|
|
322
|
+
|
|
323
|
+
### Usage Example
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
const listParams = {
|
|
327
|
+
take: 20,
|
|
328
|
+
skip: 0,
|
|
329
|
+
sortField: 'dateCreated',
|
|
330
|
+
sortDirection: 'desc',
|
|
331
|
+
showDeleted: false
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const filterObject = {
|
|
335
|
+
publishedState: 'published',
|
|
336
|
+
searchText: 'important'
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
const contentList = await client.contentMethods.getContentList('articles', 'your-guid', 'en-us', listParams, filterObject);
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## getContentHistory
|
|
345
|
+
|
|
346
|
+
Retrieves the history of changes for a specific content item.
|
|
347
|
+
|
|
348
|
+
### Parameters
|
|
349
|
+
|
|
350
|
+
| Parameter | Type | Required | Description |
|
|
351
|
+
|-----------|------|----------|-------------|
|
|
352
|
+
| locale | string | Yes | The locale code |
|
|
353
|
+
| guid | string | Yes | The website GUID |
|
|
354
|
+
| contentID | number | Yes | The ID of the content item |
|
|
355
|
+
| take | number | No | Number of history entries to retrieve (default: 50) |
|
|
356
|
+
| skip | number | No | Number of history entries to skip (default: 0) |
|
|
357
|
+
|
|
358
|
+
### Returns
|
|
359
|
+
|
|
360
|
+
`Promise<ContentItemHistory>` - The content item history with pagination
|
|
361
|
+
|
|
362
|
+
### Usage Example
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
const history = await client.contentMethods.getContentHistory('en-us', 'your-guid', 123, 25, 0);
|
|
366
|
+
console.log(history.items.length);
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## getContentComments
|
|
372
|
+
|
|
373
|
+
Retrieves comments for a specific content item.
|
|
374
|
+
|
|
375
|
+
### Parameters
|
|
376
|
+
|
|
377
|
+
| Parameter | Type | Required | Description |
|
|
378
|
+
|-----------|------|----------|-------------|
|
|
379
|
+
| locale | string | Yes | The locale code |
|
|
380
|
+
| guid | string | Yes | The website GUID |
|
|
381
|
+
| contentID | number | Yes | The ID of the content item |
|
|
382
|
+
| take | number | No | Number of comments to retrieve (default: 50) |
|
|
383
|
+
| skip | number | No | Number of comments to skip (default: 0) |
|
|
384
|
+
|
|
385
|
+
### Returns
|
|
386
|
+
|
|
387
|
+
`Promise<ItemComments>` - The content item comments with pagination
|
|
388
|
+
|
|
389
|
+
### Usage Example
|
|
390
|
+
|
|
391
|
+
```typescript
|
|
392
|
+
const comments = await client.contentMethods.getContentComments('en-us', 'your-guid', 123, 10, 0);
|
|
393
|
+
console.log(comments.items.length);
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Error Handling
|
|
399
|
+
|
|
400
|
+
All methods throw `Exception` objects on failure:
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
try {
|
|
404
|
+
const contentItem = await client.contentMethods.getContentItem(123, 'your-guid', 'en-us');
|
|
405
|
+
} catch (error) {
|
|
406
|
+
console.error('Failed to get content item:', error.message);
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## Navigation
|
|
413
|
+
- [← Back to Main Documentation](../README.md)
|
|
414
|
+
- [Authentication & Setup](./auth.md)
|
|
415
|
+
- [AssetMethods](./asset-methods.md)
|
|
416
|
+
- [BatchMethods](./batch-methods.md)
|
|
417
|
+
- [ContainerMethods](./container-methods.md)
|
|
418
|
+
- [InstanceMethods](./instance-methods.md)
|
|
419
|
+
- [InstanceUserMethods](./instance-user-methods.md)
|
|
420
|
+
- [ModelMethods](./model-methods.md)
|
|
421
|
+
- [PageMethods](./page-methods.md)
|
|
422
|
+
- [ServerUserMethods](./server-user-methods.md)
|
|
423
|
+
- [WebhookMethods](./webhook-methods.md)
|