@agility/management-sdk 0.1.33 → 0.1.34

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.
Files changed (239) hide show
  1. package/.cursor/api-coverage.md +217 -0
  2. package/.cursor/github-actions-improvements.md +76 -0
  3. package/.cursor/hardening.md +271 -0
  4. package/.cursor/linting-fix.md +160 -0
  5. package/.cursor/mocks.md +100 -0
  6. package/.cursor/test-coverage.md +841 -0
  7. package/README.md +87 -315
  8. package/coverage/base.css +224 -0
  9. package/coverage/block-navigation.js +87 -0
  10. package/coverage/coverage-summary.json +43 -0
  11. package/coverage/favicon.png +0 -0
  12. package/coverage/index.html +161 -0
  13. package/coverage/lcov-report/base.css +224 -0
  14. package/coverage/lcov-report/block-navigation.js +87 -0
  15. package/coverage/lcov-report/favicon.png +0 -0
  16. package/coverage/lcov-report/index.html +161 -0
  17. package/coverage/lcov-report/prettify.css +1 -0
  18. package/coverage/lcov-report/prettify.js +2 -0
  19. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  20. package/coverage/lcov-report/sorter.js +210 -0
  21. package/coverage/lcov-report/src/apiClient.ts.html +199 -0
  22. package/coverage/lcov-report/src/apiMethods/assetMethods.ts.html +682 -0
  23. package/coverage/lcov-report/src/apiMethods/batchMethods.ts.html +736 -0
  24. package/coverage/lcov-report/src/apiMethods/clientInstance.ts.html +403 -0
  25. package/coverage/lcov-report/src/apiMethods/containerMethods.ts.html +460 -0
  26. package/coverage/lcov-report/src/apiMethods/contentMethods.ts.html +1183 -0
  27. package/coverage/lcov-report/src/apiMethods/index.html +266 -0
  28. package/coverage/lcov-report/src/apiMethods/instanceMethods.ts.html +160 -0
  29. package/coverage/lcov-report/src/apiMethods/instanceUserMethods.ts.html +268 -0
  30. package/coverage/lcov-report/src/apiMethods/modelMethods.ts.html +352 -0
  31. package/coverage/lcov-report/src/apiMethods/pageMethods.ts.html +1276 -0
  32. package/coverage/lcov-report/src/apiMethods/serverUserMethods.ts.html +196 -0
  33. package/coverage/lcov-report/src/apiMethods/webhookMethods.ts.html +271 -0
  34. package/coverage/lcov-report/src/enums/batchItemType.ts.html +106 -0
  35. package/coverage/lcov-report/src/enums/batchOperationType.ts.html +142 -0
  36. package/coverage/lcov-report/src/enums/batchState..ts.html +106 -0
  37. package/coverage/lcov-report/src/enums/index.html +161 -0
  38. package/coverage/lcov-report/src/enums/workflowOperationType.ts.html +175 -0
  39. package/coverage/lcov-report/src/index.html +116 -0
  40. package/coverage/lcov-report/src/models/assetContainer.ts.html +106 -0
  41. package/coverage/lcov-report/src/models/assetGalleries.ts.html +103 -0
  42. package/coverage/lcov-report/src/models/assetMediaGrouping.ts.html +136 -0
  43. package/coverage/lcov-report/src/models/assetMediaGroupingMetaData.ts.html +97 -0
  44. package/coverage/lcov-report/src/models/batch.ts.html +178 -0
  45. package/coverage/lcov-report/src/models/batchItem.ts.html +127 -0
  46. package/coverage/lcov-report/src/models/container.ts.html +232 -0
  47. package/coverage/lcov-report/src/models/contentDefinitionTypeID.ts.html +142 -0
  48. package/coverage/lcov-report/src/models/contentItem.ts.html +202 -0
  49. package/coverage/lcov-report/src/models/contentSectionDefaultModule.ts.html +106 -0
  50. package/coverage/lcov-report/src/models/contentSectionDefinition.ts.html +196 -0
  51. package/coverage/lcov-report/src/models/contentViewColumn.ts.html +109 -0
  52. package/coverage/lcov-report/src/models/exception.ts.html +109 -0
  53. package/coverage/lcov-report/src/models/index.html +476 -0
  54. package/coverage/lcov-report/src/models/instanceRole.ts.html +106 -0
  55. package/coverage/lcov-report/src/models/instanceUser.ts.html +130 -0
  56. package/coverage/lcov-report/src/models/locales.ts.html +100 -0
  57. package/coverage/lcov-report/src/models/media.ts.html +178 -0
  58. package/coverage/lcov-report/src/models/model.ts.html +172 -0
  59. package/coverage/lcov-report/src/models/notification.ts.html +124 -0
  60. package/coverage/lcov-report/src/models/options.ts.html +109 -0
  61. package/coverage/lcov-report/src/models/pageItem.ts.html +268 -0
  62. package/coverage/lcov-report/src/models/pageModel.ts.html +130 -0
  63. package/coverage/lcov-report/src/models/sharedModule.ts.html +106 -0
  64. package/coverage/lcov-report/src/models/sitemap.ts.html +148 -0
  65. package/coverage/lcov-report/src/models/websiteUser.ts.html +157 -0
  66. package/coverage/lcov.info +1459 -0
  67. package/coverage/prettify.css +1 -0
  68. package/coverage/prettify.js +2 -0
  69. package/coverage/sort-arrow-sprite.png +0 -0
  70. package/coverage/sorter.js +210 -0
  71. package/coverage/src/apiClient.ts.html +199 -0
  72. package/coverage/src/apiMethods/assetMethods.ts.html +682 -0
  73. package/coverage/src/apiMethods/batchMethods.ts.html +736 -0
  74. package/coverage/src/apiMethods/clientInstance.ts.html +403 -0
  75. package/coverage/src/apiMethods/containerMethods.ts.html +460 -0
  76. package/coverage/src/apiMethods/contentMethods.ts.html +1183 -0
  77. package/coverage/src/apiMethods/index.html +266 -0
  78. package/coverage/src/apiMethods/instanceMethods.ts.html +160 -0
  79. package/coverage/src/apiMethods/instanceUserMethods.ts.html +268 -0
  80. package/coverage/src/apiMethods/modelMethods.ts.html +352 -0
  81. package/coverage/src/apiMethods/pageMethods.ts.html +1276 -0
  82. package/coverage/src/apiMethods/serverUserMethods.ts.html +196 -0
  83. package/coverage/src/apiMethods/webhookMethods.ts.html +271 -0
  84. package/coverage/src/enums/batchItemType.ts.html +106 -0
  85. package/coverage/src/enums/batchOperationType.ts.html +142 -0
  86. package/coverage/src/enums/batchState..ts.html +106 -0
  87. package/coverage/src/enums/index.html +161 -0
  88. package/coverage/src/enums/workflowOperationType.ts.html +175 -0
  89. package/coverage/src/index.html +116 -0
  90. package/coverage/src/models/assetContainer.ts.html +106 -0
  91. package/coverage/src/models/assetGalleries.ts.html +103 -0
  92. package/coverage/src/models/assetMediaGrouping.ts.html +136 -0
  93. package/coverage/src/models/assetMediaGroupingMetaData.ts.html +97 -0
  94. package/coverage/src/models/batch.ts.html +178 -0
  95. package/coverage/src/models/batchItem.ts.html +127 -0
  96. package/coverage/src/models/container.ts.html +232 -0
  97. package/coverage/src/models/contentDefinitionTypeID.ts.html +142 -0
  98. package/coverage/src/models/contentItem.ts.html +202 -0
  99. package/coverage/src/models/contentSectionDefaultModule.ts.html +106 -0
  100. package/coverage/src/models/contentSectionDefinition.ts.html +196 -0
  101. package/coverage/src/models/contentViewColumn.ts.html +109 -0
  102. package/coverage/src/models/exception.ts.html +109 -0
  103. package/coverage/src/models/index.html +476 -0
  104. package/coverage/src/models/instanceRole.ts.html +106 -0
  105. package/coverage/src/models/instanceUser.ts.html +130 -0
  106. package/coverage/src/models/locales.ts.html +100 -0
  107. package/coverage/src/models/media.ts.html +178 -0
  108. package/coverage/src/models/model.ts.html +172 -0
  109. package/coverage/src/models/notification.ts.html +124 -0
  110. package/coverage/src/models/options.ts.html +109 -0
  111. package/coverage/src/models/pageItem.ts.html +268 -0
  112. package/coverage/src/models/pageModel.ts.html +130 -0
  113. package/coverage/src/models/sharedModule.ts.html +106 -0
  114. package/coverage/src/models/sitemap.ts.html +148 -0
  115. package/coverage/src/models/websiteUser.ts.html +157 -0
  116. package/dist/.tsbuildinfo +1 -0
  117. package/dist/apiClient.d.ts.map +1 -0
  118. package/dist/apiClient.js.map +1 -0
  119. package/dist/apiMethods/assetMethods.d.ts.map +1 -0
  120. package/dist/apiMethods/assetMethods.js.map +1 -0
  121. package/dist/apiMethods/batchMethods.d.ts.map +1 -0
  122. package/dist/apiMethods/batchMethods.js.map +1 -0
  123. package/dist/apiMethods/clientInstance.d.ts.map +1 -0
  124. package/dist/apiMethods/clientInstance.js.map +1 -0
  125. package/dist/apiMethods/containerMethods.d.ts.map +1 -0
  126. package/dist/apiMethods/containerMethods.js.map +1 -0
  127. package/dist/apiMethods/contentMethods.d.ts.map +1 -0
  128. package/dist/apiMethods/contentMethods.js.map +1 -0
  129. package/dist/apiMethods/instanceMethods.d.ts.map +1 -0
  130. package/dist/apiMethods/instanceMethods.js.map +1 -0
  131. package/dist/apiMethods/instanceUserMethods.d.ts.map +1 -0
  132. package/dist/apiMethods/instanceUserMethods.js.map +1 -0
  133. package/dist/apiMethods/modelMethods.d.ts.map +1 -0
  134. package/dist/apiMethods/modelMethods.js.map +1 -0
  135. package/dist/apiMethods/pageMethods.d.ts +2 -1
  136. package/dist/apiMethods/pageMethods.d.ts.map +1 -0
  137. package/dist/apiMethods/pageMethods.js +7 -1
  138. package/dist/apiMethods/pageMethods.js.map +1 -0
  139. package/dist/apiMethods/serverUserMethods.d.ts.map +1 -0
  140. package/dist/apiMethods/serverUserMethods.js.map +1 -0
  141. package/dist/apiMethods/webhookMethods.d.ts.map +1 -0
  142. package/dist/apiMethods/webhookMethods.js.map +1 -0
  143. package/dist/enums/assetGroupingType.d.ts.map +1 -0
  144. package/dist/enums/assetGroupingType.js.map +1 -0
  145. package/dist/enums/batchItemType.d.ts.map +1 -0
  146. package/dist/enums/batchItemType.js.map +1 -0
  147. package/dist/enums/batchOperationType.d.ts.map +1 -0
  148. package/dist/enums/batchOperationType.js.map +1 -0
  149. package/dist/enums/batchState..d.ts.map +1 -0
  150. package/dist/enums/batchState..js.map +1 -0
  151. package/dist/enums/pageItemTemplateType.d.ts.map +1 -0
  152. package/dist/enums/pageItemTemplateType.js.map +1 -0
  153. package/dist/enums/workflowOperationType.d.ts.map +1 -0
  154. package/dist/enums/workflowOperationType.js.map +1 -0
  155. package/dist/index.d.ts.map +1 -0
  156. package/dist/index.js.map +1 -0
  157. package/dist/models/assetContainer.d.ts.map +1 -0
  158. package/dist/models/assetContainer.js.map +1 -0
  159. package/dist/models/assetGalleries.d.ts.map +1 -0
  160. package/dist/models/assetGalleries.js.map +1 -0
  161. package/dist/models/assetMediaGrouping.d.ts.map +1 -0
  162. package/dist/models/assetMediaGrouping.js.map +1 -0
  163. package/dist/models/assetMediaGroupingMetaData.d.ts.map +1 -0
  164. package/dist/models/assetMediaGroupingMetaData.js.map +1 -0
  165. package/dist/models/batch.d.ts.map +1 -0
  166. package/dist/models/batch.js.map +1 -0
  167. package/dist/models/batchItem.d.ts.map +1 -0
  168. package/dist/models/batchItem.js.map +1 -0
  169. package/dist/models/batchTypes.d.ts.map +1 -0
  170. package/dist/models/batchTypes.js.map +1 -0
  171. package/dist/models/container.d.ts.map +1 -0
  172. package/dist/models/container.js.map +1 -0
  173. package/dist/models/contentDefinitionTypeID.d.ts.map +1 -0
  174. package/dist/models/contentDefinitionTypeID.js.map +1 -0
  175. package/dist/models/contentItem.d.ts.map +1 -0
  176. package/dist/models/contentItem.js.map +1 -0
  177. package/dist/models/contentItemHistory.d.ts.map +1 -0
  178. package/dist/models/contentItemHistory.js.map +1 -0
  179. package/dist/models/contentListFilterModel.d.ts.map +1 -0
  180. package/dist/models/contentListFilterModel.js.map +1 -0
  181. package/dist/models/contentSectionDefaultModule.d.ts.map +1 -0
  182. package/dist/models/contentSectionDefaultModule.js.map +1 -0
  183. package/dist/models/contentSectionDefinition.d.ts.map +1 -0
  184. package/dist/models/contentSectionDefinition.js.map +1 -0
  185. package/dist/models/contentViewColumn.d.ts.map +1 -0
  186. package/dist/models/contentViewColumn.js.map +1 -0
  187. package/dist/models/exception.d.ts.map +1 -0
  188. package/dist/models/exception.js.map +1 -0
  189. package/dist/models/instanceRole.d.ts.map +1 -0
  190. package/dist/models/instanceRole.js.map +1 -0
  191. package/dist/models/instanceUser.d.ts.map +1 -0
  192. package/dist/models/instanceUser.js.map +1 -0
  193. package/dist/models/itemComments.d.ts.map +1 -0
  194. package/dist/models/itemComments.js.map +1 -0
  195. package/dist/models/listParams.d.ts.map +1 -0
  196. package/dist/models/listParams.js.map +1 -0
  197. package/dist/models/locales.d.ts.map +1 -0
  198. package/dist/models/locales.js.map +1 -0
  199. package/dist/models/media.d.ts.map +1 -0
  200. package/dist/models/media.js.map +1 -0
  201. package/dist/models/model.d.ts.map +1 -0
  202. package/dist/models/model.js.map +1 -0
  203. package/dist/models/notification.d.ts.map +1 -0
  204. package/dist/models/notification.js.map +1 -0
  205. package/dist/models/options.d.ts.map +1 -0
  206. package/dist/models/options.js.map +1 -0
  207. package/dist/models/pageHistory.d.ts.map +1 -0
  208. package/dist/models/pageHistory.js.map +1 -0
  209. package/dist/models/pageItem.d.ts.map +1 -0
  210. package/dist/models/pageItem.js.map +1 -0
  211. package/dist/models/pageModel.d.ts.map +1 -0
  212. package/dist/models/pageModel.js.map +1 -0
  213. package/dist/models/serverUser.d.ts.map +1 -0
  214. package/dist/models/serverUser.js.map +1 -0
  215. package/dist/models/sharedModule.d.ts.map +1 -0
  216. package/dist/models/sharedModule.js.map +1 -0
  217. package/dist/models/sitemap.d.ts.map +1 -0
  218. package/dist/models/sitemap.js.map +1 -0
  219. package/dist/models/webhook.d.ts.map +1 -0
  220. package/dist/models/webhook.js.map +1 -0
  221. package/dist/models/websiteListing.d.ts.map +1 -0
  222. package/dist/models/websiteListing.js.map +1 -0
  223. package/dist/models/websiteUser.d.ts.map +1 -0
  224. package/dist/models/websiteUser.js.map +1 -0
  225. package/docs/asset-methods.md +382 -0
  226. package/docs/auth-component.md +361 -0
  227. package/docs/auth.md +594 -0
  228. package/docs/batch-methods.md +244 -0
  229. package/docs/cicd.md +607 -0
  230. package/docs/container-methods.md +268 -0
  231. package/docs/content-methods.md +423 -0
  232. package/docs/instance-methods.md +105 -0
  233. package/docs/instance-user-methods.md +231 -0
  234. package/docs/model-methods.md +434 -0
  235. package/docs/multi-instance-operations.md +192 -0
  236. package/docs/page-methods.md +671 -0
  237. package/docs/server-user-methods.md +280 -0
  238. package/docs/webhook-methods.md +452 -0
  239. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Agility CMS & Management API TypeScript SDK
2
2
 
3
+ ## Table of Contents
4
+
5
+ - [About the Management API SDK](#about-the-management-api-sdk)
6
+ - [Getting Started](#getting-started)
7
+ - [Authentication & Setup](./docs/auth.md)
8
+ - [API Method Classes](#api-method-classes)
9
+ - [Examples](#examples)
10
+ - [TypeScript Interfaces](#typescript-interfaces)
11
+ - [Available Enums](#available-enums)
12
+
13
+ ---
14
+
3
15
  ## About the Management API SDK
4
16
 
5
17
  - Provides a facility to developers to use the new Agility Management API more effectively.
@@ -17,9 +29,11 @@
17
29
  3. You will need valid Agility CMS credentials to authenticate and obtain an access token.
18
30
 
19
31
  ### Authentication
20
- Before using the SDK, you must authenticate against the Agility Management API to obtain a valid access token. This token is required for all subsequent API requests.
32
+ For detailed authentication instructions, including OAuth 2.0 setup, token management, and security best practices, see the **[Authentication & Setup Guide](./docs/auth.md)**.
33
+
34
+ ### Making a Request
21
35
 
22
- The authentication process uses OAuth 2.0 and requires multiple steps:
36
+ #### Simple OAuth Authentication (Recommended)
23
37
 
24
38
  1. First, initiate the authorization flow by making a GET request to the authorization endpoint:
25
39
  ```javascript
@@ -88,329 +102,107 @@ const response = await fetch('https://mgmt.aglty.io/oauth/refresh', {
88
102
  const { access_token, refresh_token, expires_in } = await response.json();
89
103
  ```
90
104
 
91
- Note:
92
- - The access token has a limited lifetime (typically 1 hour)
93
- - The refresh token can be used to obtain new access tokens
94
- - Store refresh tokens securely and never expose them in client-side code
95
- - Implement proper error handling for authentication failures
96
105
 
97
-
98
- ### Making a Request
99
- ```Javascript
106
+ #### Manual Token Authentication (For CI/CD)
107
+ ```typescript
100
108
  import * as mgmtApi from "@agility/management-sdk";
101
109
 
102
- //initialize the Options Class
103
- let options = new mgmtApi.Options();
104
-
105
- options.token = "<<Provide Auth Token>>"
106
- //Initialize the APIClient Class
107
- let apiClient = new mgmtApi.ApiClient(options);
108
-
109
- let guid = "<<Provide the Guid of the Website>>";
110
- let locale = "<<Provide the locale of the Website>>"; //Example: en-us
111
-
112
-
113
-
114
- //make the request: get a content item with the ID '22'
115
- var contentItem = await apiClient.contentMethods.getContentItem(22,guid, locale);
116
-
117
- //To log the response of the contentItem object in console.
118
- console.log(JSON.stringify(contentItem));
119
- ```
120
-
121
- ## Understanding Agility CMS Batch Architecture
122
-
123
- Agility CMS uses a simple approach for working with content and batches:
124
-
125
- ### Content/Page Creation (Handled by Respective Controllers)
126
- - **contentMethods.saveContentItem()** - Creates a single new content item and adds it to a batch
127
- - **contentMethods.saveContentItems()** - Creates multiple new content items and adds them to a batch
128
- - **pageMethods.savePage()** - Creates a new page and adds it to a batch
129
- - These methods create the content AND automatically handle batch creation/management
130
-
131
- ### Batch Workflow Operations (Handled by Batch Controller)
132
- - **batchMethods.publishBatch()** - Publishes all items in an existing batch
133
- - **batchMethods.unpublishBatch()** - Unpublishes all items in an existing batch
134
- - **batchMethods.approveBatch()** - Approves all items in an existing batch
135
- - **batchMethods.declineBatch()** - Declines all items in an existing batch
136
- - **batchMethods.requestApprovalBatch()** - Requests approval for all items in an existing batch
137
- - **batchMethods.getBatch()** - Retrieves details of an existing batch
138
- - **batchMethods.getBatchTypes()** - Retrieves all batch-related enum types for developer discovery
139
-
140
- ## Class AssetMethods
141
- This class is used to perform operations related to Assets. The following are the methods: -
142
-
143
- ### upload
144
- | Parameter | Type | Description |
145
- | :-------- | :------- | :------------------------- |
146
- | `formData` | `FormData` | This is an object of type FormData where files can be posted eg : `const file = fs.readFileSync(<<Local File>>, null);const form = new FormData(); form.append('files',file,'<<File Name>>');`|
147
- | `agilityFolderPath` | `string` | Path of the folder in Agility where the file(s) needs to be uploaded.|
148
- | `guid` | `string` | Current website guid.|
149
- | `groupingID` | `number` | Path of the folder in Agility where the file(s) needs to be uploaded.|
150
-
151
- Returns: A collection of ```Media``` class Object.
152
-
153
- ### createFolder
154
- | Parameter | Type | Description |
155
- | :-------- | :------- | :------------------------- |
156
- | `originKey` | `string` | The origin key of the requested folder. |
157
- | `guid` | `string` | Current website guid.|
158
-
159
- Returns: A collection of ```Media``` class Object.
160
-
161
- ### deleteFolder
162
- | Parameter | Type | Description |
163
- | :-------- | :------- | :------------------------- |
164
- | `originKey` | `string` | The origin key of the requested folder. |
165
- | `guid` | `string` | Current website guid.|
166
- | `mediaID` | `number` | The mediaID of the folder that needs to be deleted.|
167
-
168
- ### renameFolder
169
- | Parameter | Type | Description |
170
- | :-------- | :------- | :------------------------- |
171
- | `folderName` | `string` | The original folder name. |
172
- | `newFolderName` | `string` | The new folder name. |
173
- | `guid` | `string` | Current website guid.|
174
- | `mediaID` | `number` | The mediaID of the folder that needs to be renamed.|
175
-
176
- ### deleteFile
177
- | Parameter | Type | Description |
178
- | :-------- | :------- | :------------------------- |
179
- | `mediaID` | `number` | The mediaID of the asset which needs to be deleted.|
180
- | `guid` | `string` | Current website guid.|
181
- Returns
182
- A ```string``` response if a file has been deleted.
183
-
184
- ### moveFile
185
- | Parameter | Type | Description |
186
- | :-------- | :------- | :------------------------- |
187
- | `mediaID` | `number` | The mediaID of the file that needs to be moved.|
188
- | `newFolder` | `string` | The new location (in Agility) where the file needs to be moved.|
189
- | `guid` | `string` | Current website guid.|
190
-
191
- Returns: An object of ```Media``` class with the new location of the file.
192
-
193
- ### getMediaList
194
- | Parameter | Type | Description |
195
- | :-------- | :------- | :------------------------- |
196
- | `pageSize` | `number` | The page size on which the assets needs to selected.|
197
- | `recordOffset` | `number` | The record offset value to skip search results.|
198
- | `guid` | `string` | Current website guid.|
199
-
200
- Returns: An object of ```AssetMediaList``` class.
201
-
202
- ### getGalleryById
203
- | Parameter | Type | Description |
204
- | :-------- | :------- | :------------------------- |
205
- | `guid` | `string` | Current website guid.|
206
- | `id` | `number` | The ID of the requested gallery.|
207
-
208
- Returns: An object of ```assetMediaGrouping``` class.
209
-
210
- ### getGalleryByName
211
- | Parameter | Type | Description |
212
- | :-------- | :------- | :------------------------- |
213
- | `guid` | `string` | Current website guid.|
214
- | `galleryName` | `string` | The name of the requested gallery.|
215
-
216
- Returns: An object of ```assetMediaGrouping``` class.
217
-
218
- ### getDefaultContainer
219
- | Parameter | Type | Description |
220
- | :-------- | :------- | :------------------------- |
221
- | `guid` | `string` | Current website guid.|
222
-
223
- Returns: An object of ```assetContainer``` class.
224
-
225
- ### getGalleries
226
- | Parameter | Type | Description |
227
- | :-------- | :------- | :------------------------- |
228
- | `guid` | `string` | Current website guid.|
229
- | `search` | `string` | String to search a specific gallery item.|
230
- | `pageSize` | `number` | The pageSize on which the galleries needs to be selected.|
231
- | `rowIndex` | `number` | The rowIndex value for the resultant record set.|
232
-
233
- Returns: An object of ```assetGalleries``` class.
234
-
235
- ### saveGallery
236
- | Parameter | Type | Description |
237
- | :-------- | :------- | :------------------------- |
238
- | `guid` | `string` | Current website guid.|
239
- | `gallery` | `assetMediaGrouping` | Object of AssetMediaGrouping class.|
240
-
241
- Returns: An object of ```assetMediaGrouping``` class.
242
-
243
- ### deleteGallery
244
- | Parameter | Type | Description |
245
- | :-------- | :------- | :------------------------- |
246
- | `guid` | `string` | Current website guid.|
247
- | `id` | `number` | The id of the gallery to be deleted.|
248
-
249
- A ```string``` response if the gallery has been deleted.
250
-
251
- ### getAssetByID
252
- | Parameter | Type | Description |
253
- | :-------- | :------- | :------------------------- |
254
- | `mediaID` | `number` | The mediaID of the requested asset.|
255
- | `guid` | `string` | Current website guid.|
256
-
257
- Returns: An object of ```Media``` class with the information of the asset.
258
-
259
- ### getAssetByUrl
260
- | Parameter | Type | Description |
261
- | :-------- | :------- | :------------------------- |
262
- | `url` | `string` | The url of the requested asset.|
263
- | `guid` | `string` | Current website guid.|
264
-
265
- Returns: An object of ```Media``` class with the information of the asset.
266
-
267
- ## Class BatchMethods
268
- This class is used to perform **workflow operations** on existing batches.
269
-
270
- **Important**: To CREATE new content or pages, use `contentMethods.saveContentItem(s)` or `pageMethods.savePage()` instead. These batch methods are for managing workflow operations (publish, unpublish, approve, etc.) on existing batches.
271
-
272
- ### getBatch
273
- Retrieves details of an existing batch.
274
-
275
- | Parameter | Type | Description |
276
- | :-------- | :------- | :------------------------- |
277
- | `batchID` | `number` | The batchID of the requested batch.|
278
- | `guid` | `string` | Current website guid.|
279
- | `expandItems` | `boolean` | *(Optional)* Whether to include full item details. Default: `true`|
110
+ // Token-based approach for CI/CD and automated environments
111
+ const options = new mgmtApi.Options();
112
+ options.token = process.env.AGILITY_API_TOKEN;
113
+ const apiClient = new mgmtApi.ApiClient(options);
280
114
 
281
- Returns: An object of ```Batch``` class.
115
+ const guid = process.env.AGILITY_GUID;
116
+ const locale = "en-us";
282
117
 
283
- ```javascript
284
- // Get batch with full item details (default)
285
- const batch = await apiClient.batchMethods.getBatch(123, guid);
286
-
287
- // Get basic batch information only (performance optimization)
288
- const batchBasic = await apiClient.batchMethods.getBatch(123, guid, false);
118
+ const contentItem = await apiClient.contentMethods.getContentItem(22, guid, locale);
119
+ console.log('Content retrieved:', contentItem.fields.title);
289
120
  ```
290
121
 
291
- ### publishBatch
292
- Publishes all items in an existing batch.
122
+ > 💡 **Note**: The new OAuth authentication requires `keytar` for secure token storage. See the [Authentication & Setup Guide](./docs/auth.md) for OAuth setup or [CI/CD & Automated Environments](./docs/cicd.md) for token-based authentication.
293
123
 
294
- | Parameter | Type | Description |
295
- | :-------- | :------- | :------------------------- |
296
- | `batchID` | `number` | The batchID of the batch to publish.|
297
- | `guid` | `string` | Current website guid.|
298
- | `returnBatchId` | `boolean` | *(Optional)* If `true`, returns batch ID immediately. If `false` (default), waits for completion.|
124
+ ## API Method Classes
299
125
 
300
- Returns: A ```number``` representing the batch ID.
126
+ ### File and Media Management
127
+ - **[AssetMethods](./docs/asset-methods.md)** - File and media management operations (15 functions)
128
+ - [deleteFile](./docs/asset-methods.md#deletefile), [moveFile](./docs/asset-methods.md#movefile), [getMediaList](./docs/asset-methods.md#getmedialist), [getGalleries](./docs/asset-methods.md#getgalleries), [getGalleryById](./docs/asset-methods.md#getgallerybyid), [getGalleryByName](./docs/asset-methods.md#getgallerybyname), [getDefaultContainer](./docs/asset-methods.md#getdefaultcontainer), [saveGallery](./docs/asset-methods.md#savegallery), [deleteGallery](./docs/asset-methods.md#deletegallery), [getAssetByID](./docs/asset-methods.md#getassetbyid), [getAssetByUrl](./docs/asset-methods.md#getassetbyurl), [upload](./docs/asset-methods.md#upload), [createFolder](./docs/asset-methods.md#createfolder), [deleteFolder](./docs/asset-methods.md#deletefolder), [renameFolder](./docs/asset-methods.md#renamefolder)
301
129
 
302
- ```javascript
303
- // Publish batch and wait for completion (default)
304
- const batchId = await apiClient.batchMethods.publishBatch(123, guid);
305
-
306
- // Publish batch and return immediately for custom polling
307
- const batchId = await apiClient.batchMethods.publishBatch(123, guid, true);
308
- ```
130
+ ### Workflow Operations
131
+ - **[BatchMethods](./docs/batch-methods.md)** - Batch workflow operations (7 functions)
132
+ - [getBatch](./docs/batch-methods.md#getbatch), [publishBatch](./docs/batch-methods.md#publishbatch), [unpublishBatch](./docs/batch-methods.md#unpublishbatch), [approveBatch](./docs/batch-methods.md#approvebatch), [declineBatch](./docs/batch-methods.md#declinebatch), [requestApprovalBatch](./docs/batch-methods.md#requestapprovalbatch), [getBatchTypes](./docs/batch-methods.md#getbatchtypes)
309
133
 
310
- ### unpublishBatch
311
- Unpublishes all items in an existing batch.
134
+ ### Content Management
135
+ - **[ContainerMethods](./docs/container-methods.md)** - Container management operations (8 functions)
136
+ - [getContainerByID](./docs/container-methods.md#getcontainerbyid), [getContainersByModel](./docs/container-methods.md#getcontainersbymodel), [getContainerByReferenceName](./docs/container-methods.md#getcontainerbyreferencename), [getContainerSecurity](./docs/container-methods.md#getcontainersecurity), [getContainerList](./docs/container-methods.md#getcontainerlist), [getNotificationList](./docs/container-methods.md#getnotificationlist), [saveContainer](./docs/container-methods.md#savecontainer), [deleteContainer](./docs/container-methods.md#deletecontainer)
312
137
 
313
- | Parameter | Type | Description |
314
- | :-------- | :------- | :------------------------- |
315
- | `batchID` | `number` | The batchID of the batch to unpublish.|
316
- | `guid` | `string` | Current website guid.|
317
- | `returnBatchId` | `boolean` | *(Optional)* If `true`, returns batch ID immediately. If `false` (default), waits for completion.|
138
+ - **[ContentMethods](./docs/content-methods.md)** - Content item operations (13 functions)
139
+ - [getContentItem](./docs/content-methods.md#getcontentitem), [publishContent](./docs/content-methods.md#publishcontent), [unPublishContent](./docs/content-methods.md#unpublishcontent), [contentRequestApproval](./docs/content-methods.md#contentrequestapproval), [approveContent](./docs/content-methods.md#approvecontent), [declineContent](./docs/content-methods.md#declinecontent), [deleteContent](./docs/content-methods.md#deletecontent), [saveContentItem](./docs/content-methods.md#savecontentitem), [saveContentItems](./docs/content-methods.md#savecontentitems), [getContentItems](./docs/content-methods.md#getcontentitems), [getContentList](./docs/content-methods.md#getcontentlist), [getContentHistory](./docs/content-methods.md#getcontenthistory), [getContentComments](./docs/content-methods.md#getcontentcomments)
318
140
 
319
- Returns: A ```number``` representing the batch ID.
141
+ - **[ModelMethods](./docs/model-methods.md)** - Content model operations (6 functions)
142
+ - [getContentModel](./docs/model-methods.md#getcontentmodel), [getModelByReferenceName](./docs/model-methods.md#getmodelbyreferencename), [getContentModules](./docs/model-methods.md#getcontentmodules), [getPageModules](./docs/model-methods.md#getpagemodules), [saveModel](./docs/model-methods.md#savemodel), [deleteModel](./docs/model-methods.md#deletemodel)
320
143
 
321
- ### approveBatch
322
- Approves all items in an existing batch.
144
+ ### Page Management
145
+ - **[PageMethods](./docs/page-methods.md)** - Page management operations (17 functions)
146
+ - [getPage](./docs/page-methods.md#getpage), [getPageByPath](./docs/page-methods.md#getpagebypath), [getPageHistory](./docs/page-methods.md#getpagehistory), [getPageComments](./docs/page-methods.md#getpagecomments), [getPageList](./docs/page-methods.md#getpagelist), [getPageListByPageTemplateID](./docs/page-methods.md#getpagelistbypagetemplateid), [getPageListByPage](./docs/page-methods.md#getpagelistbypage), [getPageListByPageAndPageTemplateID](./docs/page-methods.md#getpagelistbypageandpagetemplateid), [getPageTree](./docs/page-methods.md#getpagetree), [getPageTemplateList](./docs/page-methods.md#getpagetemplatelist), [getPageSecurity](./docs/page-methods.md#getpagesecurity), [getPageItemTemplateList](./docs/page-methods.md#getpageitemtemplatelist), [getPageContentZones](./docs/page-methods.md#getpagecontentzones), [savePage](./docs/page-methods.md#savepage), [savePageSecurity](./docs/page-methods.md#savepagesecurity), [movePageItem](./docs/page-methods.md#movepageitem), [deletePage](./docs/page-methods.md#deletepage)
323
147
 
324
- | Parameter | Type | Description |
325
- | :-------- | :------- | :------------------------- |
326
- | `batchID` | `number` | The batchID of the batch to approve.|
327
- | `guid` | `string` | Current website guid.|
328
- | `returnBatchId` | `boolean` | *(Optional)* If `true`, returns batch ID immediately. If `false` (default), waits for completion.|
148
+ ### User Management
149
+ - **[InstanceMethods](./docs/instance-methods.md)** - Instance-level operations (1 function)
150
+ - [getLocales](./docs/instance-methods.md#getlocales)
329
151
 
330
- Returns: A ```number``` representing the batch ID.
152
+ - **[InstanceUserMethods](./docs/instance-user-methods.md)** - Instance user management (3 functions)
153
+ - [getUsers](./docs/instance-user-methods.md#getusers), [saveUser](./docs/instance-user-methods.md#saveuser), [deleteUser](./docs/instance-user-methods.md#deleteuser)
331
154
 
332
- ### declineBatch
333
- Declines all items in an existing batch.
155
+ - **[ServerUserMethods](./docs/server-user-methods.md)** - Server user operations (2 functions)
156
+ - [me](./docs/server-user-methods.md#me), [you](./docs/server-user-methods.md#you)
334
157
 
335
- | Parameter | Type | Description |
336
- | :-------- | :------- | :------------------------- |
337
- | `batchID` | `number` | The batchID of the batch to decline.|
338
- | `guid` | `string` | Current website guid.|
339
- | `returnBatchId` | `boolean` | *(Optional)* If `true`, returns batch ID immediately. If `false` (default), waits for completion.|
158
+ ### Integration
159
+ - **[WebhookMethods](./docs/webhook-methods.md)** - Webhook management (4 functions)
160
+ - [getWebhook](./docs/webhook-methods.md#getwebhook), [webhookList](./docs/webhook-methods.md#webhooklist), [saveWebhook](./docs/webhook-methods.md#savewebhook), [deleteWebhook](./docs/webhook-methods.md#deletewebhook)
340
161
 
341
- Returns: A ```number``` representing the batch ID.
162
+ ### Multi-Instance Operations
163
+ - **[Multi-Instance Operations](./docs/multi-instance-operations.md)** - Advanced workflows for managing content across multiple instances and locales
164
+ - Configuration-driven content creation across multiple environments
165
+ - Parallel processing and batch operations
166
+ - Performance optimization and error handling
167
+ - Cross-instance synchronization and reporting
342
168
 
343
- ### requestApprovalBatch
344
- Requests approval for all items in an existing batch.
169
+ ### CI/CD & Automation
170
+ - **[CI/CD & Automated Environments](./docs/cicd.md)** - Token-based authentication for automated environments
171
+ - CI/CD pipeline examples (GitHub Actions, GitLab CI, Jenkins)
172
+ - Serverless functions (AWS Lambda, Vercel)
173
+ - Environment configuration and security best practices
174
+ - Token management and rotation
345
175
 
346
- | Parameter | Type | Description |
347
- | :-------- | :------- | :------------------------- |
348
- | `batchID` | `number` | The batchID of the batch to request approval for.|
349
- | `guid` | `string` | Current website guid.|
350
- | `returnBatchId` | `boolean` | *(Optional)* If `true`, returns batch ID immediately. If `false` (default), waits for completion.|
176
+ ## Examples
351
177
 
352
- Returns: A ```number``` representing the batch ID.
178
+ ### Understanding Agility CMS Batch Architecture
353
179
 
354
- ### getBatchTypes
355
- Retrieves all batch-related enum types for developer discovery and dynamic UI population.
180
+ Agility CMS uses a simple approach for working with content and batches:
356
181
 
357
- | Parameter | Type | Description |
358
- | :-------- | :------- | :------------------------- |
359
- | `guid` | `string` | Current website guid.|
182
+ #### Content/Page Creation (Handled by Respective Controllers)
183
+ - **contentMethods.saveContentItem()** - Creates a single new content item and adds it to a batch
184
+ - **contentMethods.saveContentItems()** - Creates multiple new content items and adds them to a batch
185
+ - **pageMethods.savePage()** - Creates a new page and adds it to a batch
186
+ - These methods create the content AND automatically handle batch creation/management
360
187
 
361
- Returns: A ```BatchTypesResponse``` object containing all enum types.
188
+ #### Batch Workflow Operations (Handled by Batch Controller)
189
+ - **batchMethods.publishBatch()** - Publishes all items in an existing batch
190
+ - **batchMethods.unpublishBatch()** - Unpublishes all items in an existing batch
191
+ - **batchMethods.approveBatch()** - Approves all items in an existing batch
192
+ - **batchMethods.declineBatch()** - Declines all items in an existing batch
193
+ - **batchMethods.requestApprovalBatch()** - Requests approval for all items in an existing batch
194
+ - **batchMethods.getBatch()** - Retrieves details of an existing batch
195
+ - **batchMethods.getBatchTypes()** - Retrieves all batch-related enum types for developer discovery
362
196
 
363
- ```javascript
364
- // Get all batch types for dynamic UI population
365
- const types = await apiClient.batchMethods.getBatchTypes(guid);
366
-
367
- // Create dropdown options for item types
368
- const itemTypeOptions = types.itemTypes.map(type => ({
369
- label: type.name,
370
- value: type.value
371
- }));
372
-
373
- // Validate operation type
374
- const isValidWorkflowOperation = (value) =>
375
- types.workflowOperations.some(op => op.value === value);
376
-
377
- // Access specific enum data
378
- console.log('Available item types:', types.itemTypes);
379
- console.log('Available workflow operations:', types.workflowOperations);
380
- console.log('Available batch states:', types.states);
381
- console.log('All operation types:', types.operationTypes);
382
- ```
197
+ ### Complete Workflow Example
383
198
 
384
- **Response Structure:**
385
199
  ```typescript
386
- interface BatchTypesResponse {
387
- itemTypes: EnumInfo[]; // Page, ContentItem, ContentList, Tag, ModuleDef
388
- operationTypes: EnumInfo[]; // All operation types
389
- workflowOperations: EnumInfo[]; // Publish, Unpublish, Approve, Decline, RequestApproval
390
- states: EnumInfo[]; // None, Pending, InProcess, Processed, Deleted
391
- }
392
-
393
- interface EnumInfo {
394
- value: number; // Numeric enum value
395
- name: string; // String name (e.g., "Publish")
396
- description: string; // Human-readable description
397
- }
398
- ```
399
-
400
- **Benefits:**
401
- - 🎨 **Dynamic UI Population** - Frontend dropdowns populate automatically
402
- - ✅ **Client Validation** - Validate inputs against live API data
403
- - 🔍 **API Discovery** - Explore options without reading docs
404
- - 🚀 **Future-Proof** - New enum values appear automatically
200
+ import * as mgmtApi from '@agility/management-sdk';
405
201
 
406
- ## Complete Workflow Example
202
+ // Authenticate with simple OAuth flow
203
+ const client = new mgmtApi.ApiClient();
204
+ await client.auth();
407
205
 
408
- Here's a complete example showing how to work with batches:
409
-
410
- ```typescript
411
- import { ApiClient } from '@agility/management-sdk';
412
-
413
- const client = new ApiClient({ token: 'your-token' });
414
206
  const guid = 'your-instance-guid';
415
207
  const locale = 'en-us';
416
208
 
@@ -458,26 +250,6 @@ console.log('Batch submitted for publishing:', batchId);
458
250
  console.log('All operations completed successfully!');
459
251
  ```
460
252
 
461
- ## Summary: Complete BatchMethods API
462
-
463
- The `BatchMethods` class provides **7 essential methods** for batch workflow management:
464
-
465
- ### **Batch Operations (7 methods)**
466
- - `getBatch()` - Retrieve batch details and status
467
- - `publishBatch()` - Publish all items in a batch
468
- - `unpublishBatch()` - Unpublish all items in a batch
469
- - `approveBatch()` - Approve all items in a batch
470
- - `declineBatch()` - Decline all items in a batch
471
- - `requestApprovalBatch()` - Request approval for all items in a batch
472
- - `getBatchTypes()` - Get all enum types for dynamic UIs
473
-
474
- **Developer Experience Features:**
475
- - 🎨 **Dynamic UI Support** - `getBatchTypes()` populates dropdowns automatically
476
- - ✅ **Strong Typing** - Full TypeScript support with intellisense
477
- - 🔄 **Auto-Retry Logic** - Built-in polling for operation completion
478
- - 📚 **Self-Documenting** - Enum discovery eliminates hard-coded values
479
- - ⚡ **Streamlined API** - Focused on essential batch workflow operations
480
-
481
253
  ## TypeScript Interfaces
482
254
 
483
255
  ### Batch Response Interfaces