@agility/management-sdk 0.1.36 → 0.1.37

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 (259) hide show
  1. package/README.md +371 -317
  2. package/dist/apiMethods/clientInstance.d.ts +2 -0
  3. package/dist/apiMethods/clientInstance.js +11 -2
  4. package/dist/apiMethods/containerMethods.d.ts +3 -0
  5. package/dist/apiMethods/containerMethods.js +43 -9
  6. package/dist/apiMethods/contentMethods.d.ts +12 -0
  7. package/dist/apiMethods/contentMethods.js +100 -46
  8. package/dist/apiMethods/pageMethods.d.ts +12 -0
  9. package/dist/apiMethods/pageMethods.js +88 -34
  10. package/dist/enums/contentViewType.d.ts +6 -0
  11. package/dist/enums/contentViewType.js +10 -0
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.js +2 -0
  14. package/dist/models/pagedResult.d.ts +4 -0
  15. package/dist/models/pagedResult.js +2 -0
  16. package/docs/asset-methods.md +381 -381
  17. package/docs/auth-component.md +360 -360
  18. package/docs/auth.md +593 -593
  19. package/docs/batch-methods.md +243 -243
  20. package/docs/cicd.md +606 -606
  21. package/docs/container-methods.md +267 -267
  22. package/docs/content-methods.md +491 -422
  23. package/docs/instance-methods.md +104 -104
  24. package/docs/instance-user-methods.md +230 -230
  25. package/docs/model-methods.md +433 -433
  26. package/docs/multi-instance-operations.md +191 -191
  27. package/docs/page-methods.md +737 -670
  28. package/docs/server-user-methods.md +279 -279
  29. package/docs/webhook-methods.md +451 -451
  30. package/license.txt +20 -20
  31. package/package.json +40 -40
  32. package/tsconfig.json +14 -14
  33. package/.cursor/api-coverage.md +0 -217
  34. package/.cursor/api-documentation-manifest.md +0 -275
  35. package/.cursor/api-functions-analysis.md +0 -111
  36. package/.cursor/breakout-manifest.md +0 -278
  37. package/.cursor/docs-final-check.md +0 -269
  38. package/.cursor/github-actions-improvements.md +0 -76
  39. package/.cursor/hardening.md +0 -271
  40. package/.cursor/linting-fix.md +0 -160
  41. package/.cursor/manifest.md +0 -243
  42. package/.cursor/mocks.md +0 -100
  43. package/.cursor/test-coverage.md +0 -841
  44. package/.env +0 -92
  45. package/coverage/base.css +0 -224
  46. package/coverage/block-navigation.js +0 -87
  47. package/coverage/coverage-summary.json +0 -43
  48. package/coverage/favicon.png +0 -0
  49. package/coverage/index.html +0 -161
  50. package/coverage/lcov-report/base.css +0 -224
  51. package/coverage/lcov-report/block-navigation.js +0 -87
  52. package/coverage/lcov-report/favicon.png +0 -0
  53. package/coverage/lcov-report/index.html +0 -161
  54. package/coverage/lcov-report/prettify.css +0 -1
  55. package/coverage/lcov-report/prettify.js +0 -2
  56. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  57. package/coverage/lcov-report/sorter.js +0 -210
  58. package/coverage/lcov-report/src/apiClient.ts.html +0 -199
  59. package/coverage/lcov-report/src/apiMethods/assetMethods.ts.html +0 -682
  60. package/coverage/lcov-report/src/apiMethods/batchMethods.ts.html +0 -736
  61. package/coverage/lcov-report/src/apiMethods/clientInstance.ts.html +0 -403
  62. package/coverage/lcov-report/src/apiMethods/containerMethods.ts.html +0 -460
  63. package/coverage/lcov-report/src/apiMethods/contentMethods.ts.html +0 -1183
  64. package/coverage/lcov-report/src/apiMethods/index.html +0 -266
  65. package/coverage/lcov-report/src/apiMethods/instanceMethods.ts.html +0 -160
  66. package/coverage/lcov-report/src/apiMethods/instanceUserMethods.ts.html +0 -268
  67. package/coverage/lcov-report/src/apiMethods/modelMethods.ts.html +0 -352
  68. package/coverage/lcov-report/src/apiMethods/pageMethods.ts.html +0 -1276
  69. package/coverage/lcov-report/src/apiMethods/serverUserMethods.ts.html +0 -196
  70. package/coverage/lcov-report/src/apiMethods/webhookMethods.ts.html +0 -271
  71. package/coverage/lcov-report/src/enums/batchItemType.ts.html +0 -106
  72. package/coverage/lcov-report/src/enums/batchOperationType.ts.html +0 -142
  73. package/coverage/lcov-report/src/enums/batchState..ts.html +0 -106
  74. package/coverage/lcov-report/src/enums/index.html +0 -161
  75. package/coverage/lcov-report/src/enums/workflowOperationType.ts.html +0 -175
  76. package/coverage/lcov-report/src/index.html +0 -116
  77. package/coverage/lcov-report/src/models/assetContainer.ts.html +0 -106
  78. package/coverage/lcov-report/src/models/assetGalleries.ts.html +0 -103
  79. package/coverage/lcov-report/src/models/assetMediaGrouping.ts.html +0 -136
  80. package/coverage/lcov-report/src/models/assetMediaGroupingMetaData.ts.html +0 -97
  81. package/coverage/lcov-report/src/models/batch.ts.html +0 -178
  82. package/coverage/lcov-report/src/models/batchItem.ts.html +0 -127
  83. package/coverage/lcov-report/src/models/container.ts.html +0 -232
  84. package/coverage/lcov-report/src/models/contentDefinitionTypeID.ts.html +0 -142
  85. package/coverage/lcov-report/src/models/contentItem.ts.html +0 -202
  86. package/coverage/lcov-report/src/models/contentSectionDefaultModule.ts.html +0 -106
  87. package/coverage/lcov-report/src/models/contentSectionDefinition.ts.html +0 -196
  88. package/coverage/lcov-report/src/models/contentViewColumn.ts.html +0 -109
  89. package/coverage/lcov-report/src/models/exception.ts.html +0 -109
  90. package/coverage/lcov-report/src/models/index.html +0 -476
  91. package/coverage/lcov-report/src/models/instanceRole.ts.html +0 -106
  92. package/coverage/lcov-report/src/models/instanceUser.ts.html +0 -130
  93. package/coverage/lcov-report/src/models/locales.ts.html +0 -100
  94. package/coverage/lcov-report/src/models/media.ts.html +0 -178
  95. package/coverage/lcov-report/src/models/model.ts.html +0 -172
  96. package/coverage/lcov-report/src/models/notification.ts.html +0 -124
  97. package/coverage/lcov-report/src/models/options.ts.html +0 -109
  98. package/coverage/lcov-report/src/models/pageItem.ts.html +0 -268
  99. package/coverage/lcov-report/src/models/pageModel.ts.html +0 -130
  100. package/coverage/lcov-report/src/models/sharedModule.ts.html +0 -106
  101. package/coverage/lcov-report/src/models/sitemap.ts.html +0 -148
  102. package/coverage/lcov-report/src/models/websiteUser.ts.html +0 -157
  103. package/coverage/lcov.info +0 -1459
  104. package/coverage/prettify.css +0 -1
  105. package/coverage/prettify.js +0 -2
  106. package/coverage/sort-arrow-sprite.png +0 -0
  107. package/coverage/sorter.js +0 -210
  108. package/coverage/src/apiClient.ts.html +0 -199
  109. package/coverage/src/apiMethods/assetMethods.ts.html +0 -682
  110. package/coverage/src/apiMethods/batchMethods.ts.html +0 -736
  111. package/coverage/src/apiMethods/clientInstance.ts.html +0 -403
  112. package/coverage/src/apiMethods/containerMethods.ts.html +0 -460
  113. package/coverage/src/apiMethods/contentMethods.ts.html +0 -1183
  114. package/coverage/src/apiMethods/index.html +0 -266
  115. package/coverage/src/apiMethods/instanceMethods.ts.html +0 -160
  116. package/coverage/src/apiMethods/instanceUserMethods.ts.html +0 -268
  117. package/coverage/src/apiMethods/modelMethods.ts.html +0 -352
  118. package/coverage/src/apiMethods/pageMethods.ts.html +0 -1276
  119. package/coverage/src/apiMethods/serverUserMethods.ts.html +0 -196
  120. package/coverage/src/apiMethods/webhookMethods.ts.html +0 -271
  121. package/coverage/src/enums/batchItemType.ts.html +0 -106
  122. package/coverage/src/enums/batchOperationType.ts.html +0 -142
  123. package/coverage/src/enums/batchState..ts.html +0 -106
  124. package/coverage/src/enums/index.html +0 -161
  125. package/coverage/src/enums/workflowOperationType.ts.html +0 -175
  126. package/coverage/src/index.html +0 -116
  127. package/coverage/src/models/assetContainer.ts.html +0 -106
  128. package/coverage/src/models/assetGalleries.ts.html +0 -103
  129. package/coverage/src/models/assetMediaGrouping.ts.html +0 -136
  130. package/coverage/src/models/assetMediaGroupingMetaData.ts.html +0 -97
  131. package/coverage/src/models/batch.ts.html +0 -178
  132. package/coverage/src/models/batchItem.ts.html +0 -127
  133. package/coverage/src/models/container.ts.html +0 -232
  134. package/coverage/src/models/contentDefinitionTypeID.ts.html +0 -142
  135. package/coverage/src/models/contentItem.ts.html +0 -202
  136. package/coverage/src/models/contentSectionDefaultModule.ts.html +0 -106
  137. package/coverage/src/models/contentSectionDefinition.ts.html +0 -196
  138. package/coverage/src/models/contentViewColumn.ts.html +0 -109
  139. package/coverage/src/models/exception.ts.html +0 -109
  140. package/coverage/src/models/index.html +0 -476
  141. package/coverage/src/models/instanceRole.ts.html +0 -106
  142. package/coverage/src/models/instanceUser.ts.html +0 -130
  143. package/coverage/src/models/locales.ts.html +0 -100
  144. package/coverage/src/models/media.ts.html +0 -178
  145. package/coverage/src/models/model.ts.html +0 -172
  146. package/coverage/src/models/notification.ts.html +0 -124
  147. package/coverage/src/models/options.ts.html +0 -109
  148. package/coverage/src/models/pageItem.ts.html +0 -268
  149. package/coverage/src/models/pageModel.ts.html +0 -130
  150. package/coverage/src/models/sharedModule.ts.html +0 -106
  151. package/coverage/src/models/sitemap.ts.html +0 -148
  152. package/coverage/src/models/websiteUser.ts.html +0 -157
  153. package/dist/.tsbuildinfo +0 -1
  154. package/dist/apiClient.d.ts.map +0 -1
  155. package/dist/apiClient.js.map +0 -1
  156. package/dist/apiMethods/assetMethods.d.ts.map +0 -1
  157. package/dist/apiMethods/assetMethods.js.map +0 -1
  158. package/dist/apiMethods/batchMethods.d.ts.map +0 -1
  159. package/dist/apiMethods/batchMethods.js.map +0 -1
  160. package/dist/apiMethods/clientInstance.d.ts.map +0 -1
  161. package/dist/apiMethods/clientInstance.js.map +0 -1
  162. package/dist/apiMethods/containerMethods.d.ts.map +0 -1
  163. package/dist/apiMethods/containerMethods.js.map +0 -1
  164. package/dist/apiMethods/contentMethods.d.ts.map +0 -1
  165. package/dist/apiMethods/contentMethods.js.map +0 -1
  166. package/dist/apiMethods/instanceMethods.d.ts.map +0 -1
  167. package/dist/apiMethods/instanceMethods.js.map +0 -1
  168. package/dist/apiMethods/instanceUserMethods.d.ts.map +0 -1
  169. package/dist/apiMethods/instanceUserMethods.js.map +0 -1
  170. package/dist/apiMethods/modelMethods.d.ts.map +0 -1
  171. package/dist/apiMethods/modelMethods.js.map +0 -1
  172. package/dist/apiMethods/pageMethods.d.ts.map +0 -1
  173. package/dist/apiMethods/pageMethods.js.map +0 -1
  174. package/dist/apiMethods/serverUserMethods.d.ts.map +0 -1
  175. package/dist/apiMethods/serverUserMethods.js.map +0 -1
  176. package/dist/apiMethods/webhookMethods.d.ts.map +0 -1
  177. package/dist/apiMethods/webhookMethods.js.map +0 -1
  178. package/dist/enums/assetGroupingType.d.ts.map +0 -1
  179. package/dist/enums/assetGroupingType.js.map +0 -1
  180. package/dist/enums/batchItemType.d.ts.map +0 -1
  181. package/dist/enums/batchItemType.js.map +0 -1
  182. package/dist/enums/batchOperationType.d.ts.map +0 -1
  183. package/dist/enums/batchOperationType.js.map +0 -1
  184. package/dist/enums/batchState..d.ts.map +0 -1
  185. package/dist/enums/batchState..js.map +0 -1
  186. package/dist/enums/pageItemTemplateType.d.ts.map +0 -1
  187. package/dist/enums/pageItemTemplateType.js.map +0 -1
  188. package/dist/enums/workflowOperationType.d.ts.map +0 -1
  189. package/dist/enums/workflowOperationType.js.map +0 -1
  190. package/dist/index.d.ts.map +0 -1
  191. package/dist/index.js.map +0 -1
  192. package/dist/models/assetContainer.d.ts.map +0 -1
  193. package/dist/models/assetContainer.js.map +0 -1
  194. package/dist/models/assetGalleries.d.ts.map +0 -1
  195. package/dist/models/assetGalleries.js.map +0 -1
  196. package/dist/models/assetMediaGrouping.d.ts.map +0 -1
  197. package/dist/models/assetMediaGrouping.js.map +0 -1
  198. package/dist/models/assetMediaGroupingMetaData.d.ts.map +0 -1
  199. package/dist/models/assetMediaGroupingMetaData.js.map +0 -1
  200. package/dist/models/batch.d.ts.map +0 -1
  201. package/dist/models/batch.js.map +0 -1
  202. package/dist/models/batchItem.d.ts.map +0 -1
  203. package/dist/models/batchItem.js.map +0 -1
  204. package/dist/models/batchTypes.d.ts.map +0 -1
  205. package/dist/models/batchTypes.js.map +0 -1
  206. package/dist/models/container.d.ts.map +0 -1
  207. package/dist/models/container.js.map +0 -1
  208. package/dist/models/contentDefinitionTypeID.d.ts.map +0 -1
  209. package/dist/models/contentDefinitionTypeID.js.map +0 -1
  210. package/dist/models/contentItem.d.ts.map +0 -1
  211. package/dist/models/contentItem.js.map +0 -1
  212. package/dist/models/contentItemHistory.d.ts.map +0 -1
  213. package/dist/models/contentItemHistory.js.map +0 -1
  214. package/dist/models/contentListFilterModel.d.ts.map +0 -1
  215. package/dist/models/contentListFilterModel.js.map +0 -1
  216. package/dist/models/contentSectionDefaultModule.d.ts.map +0 -1
  217. package/dist/models/contentSectionDefaultModule.js.map +0 -1
  218. package/dist/models/contentSectionDefinition.d.ts.map +0 -1
  219. package/dist/models/contentSectionDefinition.js.map +0 -1
  220. package/dist/models/contentViewColumn.d.ts.map +0 -1
  221. package/dist/models/contentViewColumn.js.map +0 -1
  222. package/dist/models/exception.d.ts.map +0 -1
  223. package/dist/models/exception.js.map +0 -1
  224. package/dist/models/instanceRole.d.ts.map +0 -1
  225. package/dist/models/instanceRole.js.map +0 -1
  226. package/dist/models/instanceUser.d.ts.map +0 -1
  227. package/dist/models/instanceUser.js.map +0 -1
  228. package/dist/models/itemComments.d.ts.map +0 -1
  229. package/dist/models/itemComments.js.map +0 -1
  230. package/dist/models/listParams.d.ts.map +0 -1
  231. package/dist/models/listParams.js.map +0 -1
  232. package/dist/models/locales.d.ts.map +0 -1
  233. package/dist/models/locales.js.map +0 -1
  234. package/dist/models/media.d.ts.map +0 -1
  235. package/dist/models/media.js.map +0 -1
  236. package/dist/models/model.d.ts.map +0 -1
  237. package/dist/models/model.js.map +0 -1
  238. package/dist/models/notification.d.ts.map +0 -1
  239. package/dist/models/notification.js.map +0 -1
  240. package/dist/models/options.d.ts.map +0 -1
  241. package/dist/models/options.js.map +0 -1
  242. package/dist/models/pageHistory.d.ts.map +0 -1
  243. package/dist/models/pageHistory.js.map +0 -1
  244. package/dist/models/pageItem.d.ts.map +0 -1
  245. package/dist/models/pageItem.js.map +0 -1
  246. package/dist/models/pageModel.d.ts.map +0 -1
  247. package/dist/models/pageModel.js.map +0 -1
  248. package/dist/models/serverUser.d.ts.map +0 -1
  249. package/dist/models/serverUser.js.map +0 -1
  250. package/dist/models/sharedModule.d.ts.map +0 -1
  251. package/dist/models/sharedModule.js.map +0 -1
  252. package/dist/models/sitemap.d.ts.map +0 -1
  253. package/dist/models/sitemap.js.map +0 -1
  254. package/dist/models/webhook.d.ts.map +0 -1
  255. package/dist/models/webhook.js.map +0 -1
  256. package/dist/models/websiteListing.d.ts.map +0 -1
  257. package/dist/models/websiteListing.js.map +0 -1
  258. package/dist/models/websiteUser.d.ts.map +0 -1
  259. package/dist/models/websiteUser.js.map +0 -1
@@ -1,382 +1,382 @@
1
- # Agility CMS & Management API TypeScript SDK
2
-
3
- ## AssetMethods
4
-
5
- This class provides comprehensive file and media management operations for the Agility CMS platform. It handles file uploads, downloads, folder management, and gallery operations.
6
-
7
- **Important Notes:**
8
- - All file operations require proper authentication and valid GUID
9
- - FormData uploads support multiple file types and formats
10
- - Gallery operations are used for organizing media assets
11
-
12
- ### Function List
13
- - [upload](#upload) - Uploads files to Agility CMS
14
- - [deleteFile](#deletefile) - Deletes a specific file by media ID
15
- - [moveFile](#movefile) - Moves a file to a different folder
16
- - [getMediaList](#getmedialist) - Retrieves paginated list of media assets
17
- - [getAssetByID](#getassetbyid) - Retrieves a specific media asset by ID
18
- - [getAssetByUrl](#getassetbyurl) - Retrieves a media asset by URL
19
- - [createFolder](#createfolder) - Creates a new folder in media library
20
- - [deleteFolder](#deletefolder) - Deletes a folder from media library
21
- - [renameFolder](#renamefolder) - Renames an existing folder
22
- - [getGalleries](#getgalleries) - Retrieves list of media galleries
23
- - [getGalleryById](#getgallerybyid) - Retrieves a specific gallery by ID
24
- - [getGalleryByName](#getgallerybyname) - Retrieves a gallery by name
25
- - [getDefaultContainer](#getdefaultcontainer) - Retrieves the default asset container
26
- - [saveGallery](#savegallery) - Creates or updates a media gallery
27
- - [deleteGallery](#deletegallery) - Deletes a gallery by ID
28
-
29
- ---
30
-
31
- ### upload
32
-
33
- Uploads one or more files to a specified folder path in Agility CMS.
34
-
35
- | Parameter | Type | Required | Description |
36
- |-----------|------|----------|-------------|
37
- | `formData` | `FormData` | Yes | FormData object containing files to upload |
38
- | `agilityFolderPath` | `string` | Yes | Target folder path in Agility CMS |
39
- | `guid` | `string` | Yes | Current website GUID |
40
- | `groupingID` | `number` | No | Gallery grouping ID *(Optional, default: -1)* |
41
-
42
- **Returns:** `Media[]` - Array of uploaded media objects
43
-
44
- **Usage Example:**
45
- ```typescript
46
- const form = new FormData();
47
- form.append('files', file, 'myFile.jpg');
48
-
49
- const uploadedFiles = await apiClient.assetMethods.upload(
50
- form,
51
- '/images/products',
52
- guid,
53
- 123
54
- );
55
- ```
56
-
57
- **Error Handling:**
58
- - Throws `Exception` when upload fails or folder path is invalid
59
-
60
- ### deleteFile
61
-
62
- Deletes a specific file from Agility CMS by its media ID.
63
-
64
- | Parameter | Type | Required | Description |
65
- |-----------|------|----------|-------------|
66
- | `mediaID` | `number` | Yes | The media ID of the file to delete |
67
- | `guid` | `string` | Yes | Current website GUID |
68
-
69
- **Returns:** `string` - Confirmation message of successful deletion
70
-
71
- **Usage Example:**
72
- ```typescript
73
- const result = await apiClient.assetMethods.deleteFile(12345, guid);
74
- console.log(result); // "File deleted successfully"
75
- ```
76
-
77
- **Error Handling:**
78
- - Throws `Exception` when file not found or deletion fails
79
-
80
- ### moveFile
81
-
82
- Moves a file to a different folder location within Agility CMS.
83
-
84
- | Parameter | Type | Required | Description |
85
- |-----------|------|----------|-------------|
86
- | `mediaID` | `number` | Yes | The media ID of the file to move |
87
- | `newFolder` | `string` | Yes | Target folder path |
88
- | `guid` | `string` | Yes | Current website GUID |
89
-
90
- **Returns:** `Media` - Updated media object with new location
91
-
92
- **Usage Example:**
93
- ```typescript
94
- const movedFile = await apiClient.assetMethods.moveFile(
95
- 12345,
96
- '/images/archived',
97
- guid
98
- );
99
- ```
100
-
101
- **Error Handling:**
102
- - Throws `Exception` when file or target folder not found
103
-
104
- ### getMediaList
105
-
106
- Retrieves a paginated list of media assets.
107
-
108
- | Parameter | Type | Required | Description |
109
- |-----------|------|----------|-------------|
110
- | `pageSize` | `number` | Yes | Number of items per page |
111
- | `recordOffset` | `number` | Yes | Number of records to skip |
112
- | `guid` | `string` | Yes | Current website GUID |
113
-
114
- **Returns:** `AssetMediaList` - Paginated list of media assets
115
-
116
- **Usage Example:**
117
- ```typescript
118
- const mediaList = await apiClient.assetMethods.getMediaList(50, 0, guid);
119
- console.log(`Total items: ${mediaList.totalCount}`);
120
- ```
121
-
122
- **Error Handling:**
123
- - Throws `Exception` when retrieval fails
124
-
125
- ### getAssetByID
126
-
127
- Retrieves a specific media asset by its ID.
128
-
129
- | Parameter | Type | Required | Description |
130
- |-----------|------|----------|-------------|
131
- | `mediaID` | `number` | Yes | The media ID to retrieve |
132
- | `guid` | `string` | Yes | Current website GUID |
133
-
134
- **Returns:** `Media` - Media object with complete asset information
135
-
136
- **Usage Example:**
137
- ```typescript
138
- const asset = await apiClient.assetMethods.getAssetByID(12345, guid);
139
- console.log(asset.url);
140
- ```
141
-
142
- **Error Handling:**
143
- - Throws `Exception` when asset not found
144
-
145
- ### getAssetByUrl
146
-
147
- Retrieves a media asset by its URL.
148
-
149
- | Parameter | Type | Required | Description |
150
- |-----------|------|----------|-------------|
151
- | `url` | `string` | Yes | The URL of the asset to retrieve |
152
- | `guid` | `string` | Yes | Current website GUID |
153
-
154
- **Returns:** `Media` - Media object matching the URL
155
-
156
- **Usage Example:**
157
- ```typescript
158
- const asset = await apiClient.assetMethods.getAssetByUrl(
159
- 'https://cdn.agilitycms.com/myfile.jpg',
160
- guid
161
- );
162
- ```
163
-
164
- **Error Handling:**
165
- - Throws `Exception` when asset not found by URL
166
-
167
- ### createFolder
168
-
169
- Creates a new folder in the Agility CMS media library.
170
-
171
- | Parameter | Type | Required | Description |
172
- |-----------|------|----------|-------------|
173
- | `originKey` | `string` | Yes | Unique identifier for the folder |
174
- | `guid` | `string` | Yes | Current website GUID |
175
-
176
- **Returns:** `Media` - Created folder object
177
-
178
- **Usage Example:**
179
- ```typescript
180
- const newFolder = await apiClient.assetMethods.createFolder(
181
- '/images/new-category',
182
- guid
183
- );
184
- ```
185
-
186
- **Error Handling:**
187
- - Throws `Exception` when folder creation fails or path already exists
188
-
189
- ### deleteFolder
190
-
191
- Deletes a folder from the Agility CMS media library.
192
-
193
- | Parameter | Type | Required | Description |
194
- |-----------|------|----------|-------------|
195
- | `originKey` | `string` | Yes | Folder path identifier |
196
- | `guid` | `string` | Yes | Current website GUID |
197
- | `mediaID` | `number` | No | Media ID of the folder *(Optional, default: 0)* |
198
-
199
- **Returns:** `void` - No return value
200
-
201
- **Usage Example:**
202
- ```typescript
203
- await apiClient.assetMethods.deleteFolder('/images/old-category', guid, 456);
204
- ```
205
-
206
- **Error Handling:**
207
- - Throws `Exception` when folder not found or contains files
208
-
209
- ### renameFolder
210
-
211
- Renames an existing folder in the media library.
212
-
213
- | Parameter | Type | Required | Description |
214
- |-----------|------|----------|-------------|
215
- | `folderName` | `string` | Yes | Current folder name |
216
- | `newFolderName` | `string` | Yes | New folder name |
217
- | `guid` | `string` | Yes | Current website GUID |
218
- | `mediaID` | `number` | No | Media ID of the folder *(Optional, default: 0)* |
219
-
220
- **Returns:** `void` - No return value
221
-
222
- **Usage Example:**
223
- ```typescript
224
- await apiClient.assetMethods.renameFolder(
225
- 'old-name',
226
- 'new-name',
227
- guid,
228
- 456
229
- );
230
- ```
231
-
232
- **Error Handling:**
233
- - Throws `Exception` when folder not found or name conflict exists
234
-
235
- ### getGalleries
236
-
237
- Retrieves a list of media galleries with optional search filtering.
238
-
239
- | Parameter | Type | Required | Description |
240
- |-----------|------|----------|-------------|
241
- | `guid` | `string` | Yes | Current website GUID |
242
- | `search` | `string` | No | Search term to filter galleries *(Optional)* |
243
- | `pageSize` | `number` | No | Number of galleries per page *(Optional)* |
244
- | `rowIndex` | `number` | No | Starting row index *(Optional)* |
245
-
246
- **Returns:** `assetGalleries` - Collection of gallery objects
247
-
248
- **Usage Example:**
249
- ```typescript
250
- const galleries = await apiClient.assetMethods.getGalleries(
251
- guid,
252
- 'product',
253
- 20,
254
- 0
255
- );
256
- ```
257
-
258
- **Error Handling:**
259
- - Throws `Exception` when retrieval fails
260
-
261
- ### getGalleryById
262
-
263
- Retrieves a specific gallery by its ID.
264
-
265
- | Parameter | Type | Required | Description |
266
- |-----------|------|----------|-------------|
267
- | `guid` | `string` | Yes | Current website GUID |
268
- | `id` | `number` | Yes | Gallery ID to retrieve |
269
-
270
- **Returns:** `assetMediaGrouping` - Gallery object with metadata
271
-
272
- **Usage Example:**
273
- ```typescript
274
- const gallery = await apiClient.assetMethods.getGalleryById(guid, 123);
275
- console.log(gallery.name);
276
- ```
277
-
278
- **Error Handling:**
279
- - Throws `Exception` when gallery not found
280
-
281
- ### getGalleryByName
282
-
283
- Retrieves a gallery by its name.
284
-
285
- | Parameter | Type | Required | Description |
286
- |-----------|------|----------|-------------|
287
- | `guid` | `string` | Yes | Current website GUID |
288
- | `galleryName` | `string` | Yes | Name of the gallery to retrieve |
289
-
290
- **Returns:** `assetMediaGrouping` - Gallery object matching the name
291
-
292
- **Usage Example:**
293
- ```typescript
294
- const gallery = await apiClient.assetMethods.getGalleryByName(
295
- guid,
296
- 'Product Images'
297
- );
298
- ```
299
-
300
- **Error Handling:**
301
- - Throws `Exception` when gallery not found by name
302
-
303
- ### getDefaultContainer
304
-
305
- Retrieves the default asset container for the website.
306
-
307
- | Parameter | Type | Required | Description |
308
- |-----------|------|----------|-------------|
309
- | `guid` | `string` | Yes | Current website GUID |
310
-
311
- **Returns:** `assetContainer` - Default container configuration
312
-
313
- **Usage Example:**
314
- ```typescript
315
- const container = await apiClient.assetMethods.getDefaultContainer(guid);
316
- console.log(container.name);
317
- ```
318
-
319
- **Error Handling:**
320
- - Throws `Exception` when container retrieval fails
321
-
322
- ### saveGallery
323
-
324
- Creates or updates a media gallery.
325
-
326
- | Parameter | Type | Required | Description |
327
- |-----------|------|----------|-------------|
328
- | `guid` | `string` | Yes | Current website GUID |
329
- | `gallery` | `assetMediaGrouping` | Yes | Gallery object to save |
330
-
331
- **Returns:** `assetMediaGrouping` - Saved gallery object with updated metadata
332
-
333
- **Usage Example:**
334
- ```typescript
335
- const gallery = {
336
- name: 'New Product Gallery',
337
- description: 'Images for product showcase'
338
- };
339
-
340
- const savedGallery = await apiClient.assetMethods.saveGallery(guid, gallery);
341
- ```
342
-
343
- **Error Handling:**
344
- - Throws `Exception` when save operation fails
345
-
346
- ### deleteGallery
347
-
348
- Deletes a gallery by its ID.
349
-
350
- | Parameter | Type | Required | Description |
351
- |-----------|------|----------|-------------|
352
- | `guid` | `string` | Yes | Current website GUID |
353
- | `id` | `number` | Yes | Gallery ID to delete |
354
-
355
- **Returns:** `string` - Confirmation message of successful deletion
356
-
357
- **Usage Example:**
358
- ```typescript
359
- const result = await apiClient.assetMethods.deleteGallery(guid, 123);
360
- console.log(result); // "Gallery deleted successfully"
361
- ```
362
-
363
- **Error Handling:**
364
- - Throws `Exception` when gallery not found or deletion fails
365
-
366
- ---
367
-
368
- ## Navigation
369
- - [← Back to Main Documentation](../README.md)
370
- - [Authentication & Setup](./auth.md)
371
- - [CI/CD & Automated Environments](./cicd.md)
372
- - [BatchMethods](./batch-methods.md)
373
- - [ContainerMethods](./container-methods.md)
374
- - [ContentMethods](./content-methods.md)
375
- - [InstanceMethods](./instance-methods.md)
376
- - [InstanceUserMethods](./instance-user-methods.md)
377
- - [ModelMethods](./model-methods.md)
378
- - [PageMethods](./page-methods.md)
379
- - [ServerUserMethods](./server-user-methods.md)
380
- - [WebhookMethods](./webhook-methods.md)
381
- - [Multi-Instance Operations](./multi-instance-operations.md)
1
+ # Agility CMS & Management API TypeScript SDK
2
+
3
+ ## AssetMethods
4
+
5
+ This class provides comprehensive file and media management operations for the Agility CMS platform. It handles file uploads, downloads, folder management, and gallery operations.
6
+
7
+ **Important Notes:**
8
+ - All file operations require proper authentication and valid GUID
9
+ - FormData uploads support multiple file types and formats
10
+ - Gallery operations are used for organizing media assets
11
+
12
+ ### Function List
13
+ - [upload](#upload) - Uploads files to Agility CMS
14
+ - [deleteFile](#deletefile) - Deletes a specific file by media ID
15
+ - [moveFile](#movefile) - Moves a file to a different folder
16
+ - [getMediaList](#getmedialist) - Retrieves paginated list of media assets
17
+ - [getAssetByID](#getassetbyid) - Retrieves a specific media asset by ID
18
+ - [getAssetByUrl](#getassetbyurl) - Retrieves a media asset by URL
19
+ - [createFolder](#createfolder) - Creates a new folder in media library
20
+ - [deleteFolder](#deletefolder) - Deletes a folder from media library
21
+ - [renameFolder](#renamefolder) - Renames an existing folder
22
+ - [getGalleries](#getgalleries) - Retrieves list of media galleries
23
+ - [getGalleryById](#getgallerybyid) - Retrieves a specific gallery by ID
24
+ - [getGalleryByName](#getgallerybyname) - Retrieves a gallery by name
25
+ - [getDefaultContainer](#getdefaultcontainer) - Retrieves the default asset container
26
+ - [saveGallery](#savegallery) - Creates or updates a media gallery
27
+ - [deleteGallery](#deletegallery) - Deletes a gallery by ID
28
+
29
+ ---
30
+
31
+ ### upload
32
+
33
+ Uploads one or more files to a specified folder path in Agility CMS.
34
+
35
+ | Parameter | Type | Required | Description |
36
+ |-----------|------|----------|-------------|
37
+ | `formData` | `FormData` | Yes | FormData object containing files to upload |
38
+ | `agilityFolderPath` | `string` | Yes | Target folder path in Agility CMS |
39
+ | `guid` | `string` | Yes | Current website GUID |
40
+ | `groupingID` | `number` | No | Gallery grouping ID *(Optional, default: -1)* |
41
+
42
+ **Returns:** `Media[]` - Array of uploaded media objects
43
+
44
+ **Usage Example:**
45
+ ```typescript
46
+ const form = new FormData();
47
+ form.append('files', file, 'myFile.jpg');
48
+
49
+ const uploadedFiles = await apiClient.assetMethods.upload(
50
+ form,
51
+ '/images/products',
52
+ guid,
53
+ 123
54
+ );
55
+ ```
56
+
57
+ **Error Handling:**
58
+ - Throws `Exception` when upload fails or folder path is invalid
59
+
60
+ ### deleteFile
61
+
62
+ Deletes a specific file from Agility CMS by its media ID.
63
+
64
+ | Parameter | Type | Required | Description |
65
+ |-----------|------|----------|-------------|
66
+ | `mediaID` | `number` | Yes | The media ID of the file to delete |
67
+ | `guid` | `string` | Yes | Current website GUID |
68
+
69
+ **Returns:** `string` - Confirmation message of successful deletion
70
+
71
+ **Usage Example:**
72
+ ```typescript
73
+ const result = await apiClient.assetMethods.deleteFile(12345, guid);
74
+ console.log(result); // "File deleted successfully"
75
+ ```
76
+
77
+ **Error Handling:**
78
+ - Throws `Exception` when file not found or deletion fails
79
+
80
+ ### moveFile
81
+
82
+ Moves a file to a different folder location within Agility CMS.
83
+
84
+ | Parameter | Type | Required | Description |
85
+ |-----------|------|----------|-------------|
86
+ | `mediaID` | `number` | Yes | The media ID of the file to move |
87
+ | `newFolder` | `string` | Yes | Target folder path |
88
+ | `guid` | `string` | Yes | Current website GUID |
89
+
90
+ **Returns:** `Media` - Updated media object with new location
91
+
92
+ **Usage Example:**
93
+ ```typescript
94
+ const movedFile = await apiClient.assetMethods.moveFile(
95
+ 12345,
96
+ '/images/archived',
97
+ guid
98
+ );
99
+ ```
100
+
101
+ **Error Handling:**
102
+ - Throws `Exception` when file or target folder not found
103
+
104
+ ### getMediaList
105
+
106
+ Retrieves a paginated list of media assets.
107
+
108
+ | Parameter | Type | Required | Description |
109
+ |-----------|------|----------|-------------|
110
+ | `pageSize` | `number` | Yes | Number of items per page |
111
+ | `recordOffset` | `number` | Yes | Number of records to skip |
112
+ | `guid` | `string` | Yes | Current website GUID |
113
+
114
+ **Returns:** `AssetMediaList` - Paginated list of media assets
115
+
116
+ **Usage Example:**
117
+ ```typescript
118
+ const mediaList = await apiClient.assetMethods.getMediaList(50, 0, guid);
119
+ console.log(`Total items: ${mediaList.totalCount}`);
120
+ ```
121
+
122
+ **Error Handling:**
123
+ - Throws `Exception` when retrieval fails
124
+
125
+ ### getAssetByID
126
+
127
+ Retrieves a specific media asset by its ID.
128
+
129
+ | Parameter | Type | Required | Description |
130
+ |-----------|------|----------|-------------|
131
+ | `mediaID` | `number` | Yes | The media ID to retrieve |
132
+ | `guid` | `string` | Yes | Current website GUID |
133
+
134
+ **Returns:** `Media` - Media object with complete asset information
135
+
136
+ **Usage Example:**
137
+ ```typescript
138
+ const asset = await apiClient.assetMethods.getAssetByID(12345, guid);
139
+ console.log(asset.url);
140
+ ```
141
+
142
+ **Error Handling:**
143
+ - Throws `Exception` when asset not found
144
+
145
+ ### getAssetByUrl
146
+
147
+ Retrieves a media asset by its URL.
148
+
149
+ | Parameter | Type | Required | Description |
150
+ |-----------|------|----------|-------------|
151
+ | `url` | `string` | Yes | The URL of the asset to retrieve |
152
+ | `guid` | `string` | Yes | Current website GUID |
153
+
154
+ **Returns:** `Media` - Media object matching the URL
155
+
156
+ **Usage Example:**
157
+ ```typescript
158
+ const asset = await apiClient.assetMethods.getAssetByUrl(
159
+ 'https://cdn.agilitycms.com/myfile.jpg',
160
+ guid
161
+ );
162
+ ```
163
+
164
+ **Error Handling:**
165
+ - Throws `Exception` when asset not found by URL
166
+
167
+ ### createFolder
168
+
169
+ Creates a new folder in the Agility CMS media library.
170
+
171
+ | Parameter | Type | Required | Description |
172
+ |-----------|------|----------|-------------|
173
+ | `originKey` | `string` | Yes | Unique identifier for the folder |
174
+ | `guid` | `string` | Yes | Current website GUID |
175
+
176
+ **Returns:** `Media` - Created folder object
177
+
178
+ **Usage Example:**
179
+ ```typescript
180
+ const newFolder = await apiClient.assetMethods.createFolder(
181
+ '/images/new-category',
182
+ guid
183
+ );
184
+ ```
185
+
186
+ **Error Handling:**
187
+ - Throws `Exception` when folder creation fails or path already exists
188
+
189
+ ### deleteFolder
190
+
191
+ Deletes a folder from the Agility CMS media library.
192
+
193
+ | Parameter | Type | Required | Description |
194
+ |-----------|------|----------|-------------|
195
+ | `originKey` | `string` | Yes | Folder path identifier |
196
+ | `guid` | `string` | Yes | Current website GUID |
197
+ | `mediaID` | `number` | No | Media ID of the folder *(Optional, default: 0)* |
198
+
199
+ **Returns:** `void` - No return value
200
+
201
+ **Usage Example:**
202
+ ```typescript
203
+ await apiClient.assetMethods.deleteFolder('/images/old-category', guid, 456);
204
+ ```
205
+
206
+ **Error Handling:**
207
+ - Throws `Exception` when folder not found or contains files
208
+
209
+ ### renameFolder
210
+
211
+ Renames an existing folder in the media library.
212
+
213
+ | Parameter | Type | Required | Description |
214
+ |-----------|------|----------|-------------|
215
+ | `folderName` | `string` | Yes | Current folder name |
216
+ | `newFolderName` | `string` | Yes | New folder name |
217
+ | `guid` | `string` | Yes | Current website GUID |
218
+ | `mediaID` | `number` | No | Media ID of the folder *(Optional, default: 0)* |
219
+
220
+ **Returns:** `void` - No return value
221
+
222
+ **Usage Example:**
223
+ ```typescript
224
+ await apiClient.assetMethods.renameFolder(
225
+ 'old-name',
226
+ 'new-name',
227
+ guid,
228
+ 456
229
+ );
230
+ ```
231
+
232
+ **Error Handling:**
233
+ - Throws `Exception` when folder not found or name conflict exists
234
+
235
+ ### getGalleries
236
+
237
+ Retrieves a list of media galleries with optional search filtering.
238
+
239
+ | Parameter | Type | Required | Description |
240
+ |-----------|------|----------|-------------|
241
+ | `guid` | `string` | Yes | Current website GUID |
242
+ | `search` | `string` | No | Search term to filter galleries *(Optional)* |
243
+ | `pageSize` | `number` | No | Number of galleries per page *(Optional)* |
244
+ | `rowIndex` | `number` | No | Starting row index *(Optional)* |
245
+
246
+ **Returns:** `assetGalleries` - Collection of gallery objects
247
+
248
+ **Usage Example:**
249
+ ```typescript
250
+ const galleries = await apiClient.assetMethods.getGalleries(
251
+ guid,
252
+ 'product',
253
+ 20,
254
+ 0
255
+ );
256
+ ```
257
+
258
+ **Error Handling:**
259
+ - Throws `Exception` when retrieval fails
260
+
261
+ ### getGalleryById
262
+
263
+ Retrieves a specific gallery by its ID.
264
+
265
+ | Parameter | Type | Required | Description |
266
+ |-----------|------|----------|-------------|
267
+ | `guid` | `string` | Yes | Current website GUID |
268
+ | `id` | `number` | Yes | Gallery ID to retrieve |
269
+
270
+ **Returns:** `assetMediaGrouping` - Gallery object with metadata
271
+
272
+ **Usage Example:**
273
+ ```typescript
274
+ const gallery = await apiClient.assetMethods.getGalleryById(guid, 123);
275
+ console.log(gallery.name);
276
+ ```
277
+
278
+ **Error Handling:**
279
+ - Throws `Exception` when gallery not found
280
+
281
+ ### getGalleryByName
282
+
283
+ Retrieves a gallery by its name.
284
+
285
+ | Parameter | Type | Required | Description |
286
+ |-----------|------|----------|-------------|
287
+ | `guid` | `string` | Yes | Current website GUID |
288
+ | `galleryName` | `string` | Yes | Name of the gallery to retrieve |
289
+
290
+ **Returns:** `assetMediaGrouping` - Gallery object matching the name
291
+
292
+ **Usage Example:**
293
+ ```typescript
294
+ const gallery = await apiClient.assetMethods.getGalleryByName(
295
+ guid,
296
+ 'Product Images'
297
+ );
298
+ ```
299
+
300
+ **Error Handling:**
301
+ - Throws `Exception` when gallery not found by name
302
+
303
+ ### getDefaultContainer
304
+
305
+ Retrieves the default asset container for the website.
306
+
307
+ | Parameter | Type | Required | Description |
308
+ |-----------|------|----------|-------------|
309
+ | `guid` | `string` | Yes | Current website GUID |
310
+
311
+ **Returns:** `assetContainer` - Default container configuration
312
+
313
+ **Usage Example:**
314
+ ```typescript
315
+ const container = await apiClient.assetMethods.getDefaultContainer(guid);
316
+ console.log(container.name);
317
+ ```
318
+
319
+ **Error Handling:**
320
+ - Throws `Exception` when container retrieval fails
321
+
322
+ ### saveGallery
323
+
324
+ Creates or updates a media gallery.
325
+
326
+ | Parameter | Type | Required | Description |
327
+ |-----------|------|----------|-------------|
328
+ | `guid` | `string` | Yes | Current website GUID |
329
+ | `gallery` | `assetMediaGrouping` | Yes | Gallery object to save |
330
+
331
+ **Returns:** `assetMediaGrouping` - Saved gallery object with updated metadata
332
+
333
+ **Usage Example:**
334
+ ```typescript
335
+ const gallery = {
336
+ name: 'New Product Gallery',
337
+ description: 'Images for product showcase'
338
+ };
339
+
340
+ const savedGallery = await apiClient.assetMethods.saveGallery(guid, gallery);
341
+ ```
342
+
343
+ **Error Handling:**
344
+ - Throws `Exception` when save operation fails
345
+
346
+ ### deleteGallery
347
+
348
+ Deletes a gallery by its ID.
349
+
350
+ | Parameter | Type | Required | Description |
351
+ |-----------|------|----------|-------------|
352
+ | `guid` | `string` | Yes | Current website GUID |
353
+ | `id` | `number` | Yes | Gallery ID to delete |
354
+
355
+ **Returns:** `string` - Confirmation message of successful deletion
356
+
357
+ **Usage Example:**
358
+ ```typescript
359
+ const result = await apiClient.assetMethods.deleteGallery(guid, 123);
360
+ console.log(result); // "Gallery deleted successfully"
361
+ ```
362
+
363
+ **Error Handling:**
364
+ - Throws `Exception` when gallery not found or deletion fails
365
+
366
+ ---
367
+
368
+ ## Navigation
369
+ - [← Back to Main Documentation](../README.md)
370
+ - [Authentication & Setup](./auth.md)
371
+ - [CI/CD & Automated Environments](./cicd.md)
372
+ - [BatchMethods](./batch-methods.md)
373
+ - [ContainerMethods](./container-methods.md)
374
+ - [ContentMethods](./content-methods.md)
375
+ - [InstanceMethods](./instance-methods.md)
376
+ - [InstanceUserMethods](./instance-user-methods.md)
377
+ - [ModelMethods](./model-methods.md)
378
+ - [PageMethods](./page-methods.md)
379
+ - [ServerUserMethods](./server-user-methods.md)
380
+ - [WebhookMethods](./webhook-methods.md)
381
+ - [Multi-Instance Operations](./multi-instance-operations.md)
382
382