@agility/management-sdk 0.1.35 → 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.
- package/README.md +371 -317
- package/dist/apiMethods/clientInstance.d.ts +2 -0
- package/dist/apiMethods/clientInstance.js +11 -2
- package/dist/apiMethods/containerMethods.d.ts +3 -0
- package/dist/apiMethods/containerMethods.js +43 -9
- package/dist/apiMethods/contentMethods.d.ts +12 -0
- package/dist/apiMethods/contentMethods.js +119 -48
- package/dist/apiMethods/pageMethods.d.ts +12 -0
- package/dist/apiMethods/pageMethods.js +88 -34
- package/dist/enums/contentViewType.d.ts +6 -0
- package/dist/enums/contentViewType.js +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/models/pagedResult.d.ts +4 -0
- package/dist/models/pagedResult.js +2 -0
- package/dist/util/queryString.d.ts +8 -0
- package/dist/util/queryString.js +27 -0
- package/docs/asset-methods.md +381 -381
- package/docs/auth-component.md +360 -360
- package/docs/auth.md +593 -593
- package/docs/batch-methods.md +243 -243
- package/docs/cicd.md +606 -606
- package/docs/container-methods.md +267 -267
- package/docs/content-methods.md +491 -422
- package/docs/instance-methods.md +104 -104
- package/docs/instance-user-methods.md +230 -230
- package/docs/model-methods.md +433 -433
- package/docs/multi-instance-operations.md +191 -191
- package/docs/page-methods.md +737 -670
- package/docs/server-user-methods.md +279 -279
- package/docs/webhook-methods.md +451 -451
- package/license.txt +20 -20
- package/package.json +40 -40
- package/tsconfig.json +14 -14
- package/.cursor/api-coverage.md +0 -217
- package/.cursor/api-documentation-manifest.md +0 -275
- package/.cursor/api-functions-analysis.md +0 -111
- package/.cursor/breakout-manifest.md +0 -278
- package/.cursor/docs-final-check.md +0 -269
- package/.cursor/github-actions-improvements.md +0 -76
- package/.cursor/hardening.md +0 -271
- package/.cursor/linting-fix.md +0 -160
- package/.cursor/manifest.md +0 -243
- package/.cursor/mocks.md +0 -100
- package/.cursor/test-coverage.md +0 -841
- package/.env +0 -92
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/coverage-summary.json +0 -43
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -161
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -161
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/src/apiClient.ts.html +0 -199
- package/coverage/lcov-report/src/apiMethods/assetMethods.ts.html +0 -682
- package/coverage/lcov-report/src/apiMethods/batchMethods.ts.html +0 -736
- package/coverage/lcov-report/src/apiMethods/clientInstance.ts.html +0 -403
- package/coverage/lcov-report/src/apiMethods/containerMethods.ts.html +0 -460
- package/coverage/lcov-report/src/apiMethods/contentMethods.ts.html +0 -1183
- package/coverage/lcov-report/src/apiMethods/index.html +0 -266
- package/coverage/lcov-report/src/apiMethods/instanceMethods.ts.html +0 -160
- package/coverage/lcov-report/src/apiMethods/instanceUserMethods.ts.html +0 -268
- package/coverage/lcov-report/src/apiMethods/modelMethods.ts.html +0 -352
- package/coverage/lcov-report/src/apiMethods/pageMethods.ts.html +0 -1276
- package/coverage/lcov-report/src/apiMethods/serverUserMethods.ts.html +0 -196
- package/coverage/lcov-report/src/apiMethods/webhookMethods.ts.html +0 -271
- package/coverage/lcov-report/src/enums/batchItemType.ts.html +0 -106
- package/coverage/lcov-report/src/enums/batchOperationType.ts.html +0 -142
- package/coverage/lcov-report/src/enums/batchState..ts.html +0 -106
- package/coverage/lcov-report/src/enums/index.html +0 -161
- package/coverage/lcov-report/src/enums/workflowOperationType.ts.html +0 -175
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/src/models/assetContainer.ts.html +0 -106
- package/coverage/lcov-report/src/models/assetGalleries.ts.html +0 -103
- package/coverage/lcov-report/src/models/assetMediaGrouping.ts.html +0 -136
- package/coverage/lcov-report/src/models/assetMediaGroupingMetaData.ts.html +0 -97
- package/coverage/lcov-report/src/models/batch.ts.html +0 -178
- package/coverage/lcov-report/src/models/batchItem.ts.html +0 -127
- package/coverage/lcov-report/src/models/container.ts.html +0 -232
- package/coverage/lcov-report/src/models/contentDefinitionTypeID.ts.html +0 -142
- package/coverage/lcov-report/src/models/contentItem.ts.html +0 -202
- package/coverage/lcov-report/src/models/contentSectionDefaultModule.ts.html +0 -106
- package/coverage/lcov-report/src/models/contentSectionDefinition.ts.html +0 -196
- package/coverage/lcov-report/src/models/contentViewColumn.ts.html +0 -109
- package/coverage/lcov-report/src/models/exception.ts.html +0 -109
- package/coverage/lcov-report/src/models/index.html +0 -476
- package/coverage/lcov-report/src/models/instanceRole.ts.html +0 -106
- package/coverage/lcov-report/src/models/instanceUser.ts.html +0 -130
- package/coverage/lcov-report/src/models/locales.ts.html +0 -100
- package/coverage/lcov-report/src/models/media.ts.html +0 -178
- package/coverage/lcov-report/src/models/model.ts.html +0 -172
- package/coverage/lcov-report/src/models/notification.ts.html +0 -124
- package/coverage/lcov-report/src/models/options.ts.html +0 -109
- package/coverage/lcov-report/src/models/pageItem.ts.html +0 -268
- package/coverage/lcov-report/src/models/pageModel.ts.html +0 -130
- package/coverage/lcov-report/src/models/sharedModule.ts.html +0 -106
- package/coverage/lcov-report/src/models/sitemap.ts.html +0 -148
- package/coverage/lcov-report/src/models/websiteUser.ts.html +0 -157
- package/coverage/lcov.info +0 -1459
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/src/apiClient.ts.html +0 -199
- package/coverage/src/apiMethods/assetMethods.ts.html +0 -682
- package/coverage/src/apiMethods/batchMethods.ts.html +0 -736
- package/coverage/src/apiMethods/clientInstance.ts.html +0 -403
- package/coverage/src/apiMethods/containerMethods.ts.html +0 -460
- package/coverage/src/apiMethods/contentMethods.ts.html +0 -1183
- package/coverage/src/apiMethods/index.html +0 -266
- package/coverage/src/apiMethods/instanceMethods.ts.html +0 -160
- package/coverage/src/apiMethods/instanceUserMethods.ts.html +0 -268
- package/coverage/src/apiMethods/modelMethods.ts.html +0 -352
- package/coverage/src/apiMethods/pageMethods.ts.html +0 -1276
- package/coverage/src/apiMethods/serverUserMethods.ts.html +0 -196
- package/coverage/src/apiMethods/webhookMethods.ts.html +0 -271
- package/coverage/src/enums/batchItemType.ts.html +0 -106
- package/coverage/src/enums/batchOperationType.ts.html +0 -142
- package/coverage/src/enums/batchState..ts.html +0 -106
- package/coverage/src/enums/index.html +0 -161
- package/coverage/src/enums/workflowOperationType.ts.html +0 -175
- package/coverage/src/index.html +0 -116
- package/coverage/src/models/assetContainer.ts.html +0 -106
- package/coverage/src/models/assetGalleries.ts.html +0 -103
- package/coverage/src/models/assetMediaGrouping.ts.html +0 -136
- package/coverage/src/models/assetMediaGroupingMetaData.ts.html +0 -97
- package/coverage/src/models/batch.ts.html +0 -178
- package/coverage/src/models/batchItem.ts.html +0 -127
- package/coverage/src/models/container.ts.html +0 -232
- package/coverage/src/models/contentDefinitionTypeID.ts.html +0 -142
- package/coverage/src/models/contentItem.ts.html +0 -202
- package/coverage/src/models/contentSectionDefaultModule.ts.html +0 -106
- package/coverage/src/models/contentSectionDefinition.ts.html +0 -196
- package/coverage/src/models/contentViewColumn.ts.html +0 -109
- package/coverage/src/models/exception.ts.html +0 -109
- package/coverage/src/models/index.html +0 -476
- package/coverage/src/models/instanceRole.ts.html +0 -106
- package/coverage/src/models/instanceUser.ts.html +0 -130
- package/coverage/src/models/locales.ts.html +0 -100
- package/coverage/src/models/media.ts.html +0 -178
- package/coverage/src/models/model.ts.html +0 -172
- package/coverage/src/models/notification.ts.html +0 -124
- package/coverage/src/models/options.ts.html +0 -109
- package/coverage/src/models/pageItem.ts.html +0 -268
- package/coverage/src/models/pageModel.ts.html +0 -130
- package/coverage/src/models/sharedModule.ts.html +0 -106
- package/coverage/src/models/sitemap.ts.html +0 -148
- package/coverage/src/models/websiteUser.ts.html +0 -157
- package/dist/.tsbuildinfo +0 -1
- package/dist/apiClient.d.ts.map +0 -1
- package/dist/apiClient.js.map +0 -1
- package/dist/apiMethods/assetMethods.d.ts.map +0 -1
- package/dist/apiMethods/assetMethods.js.map +0 -1
- package/dist/apiMethods/batchMethods.d.ts.map +0 -1
- package/dist/apiMethods/batchMethods.js.map +0 -1
- package/dist/apiMethods/clientInstance.d.ts.map +0 -1
- package/dist/apiMethods/clientInstance.js.map +0 -1
- package/dist/apiMethods/containerMethods.d.ts.map +0 -1
- package/dist/apiMethods/containerMethods.js.map +0 -1
- package/dist/apiMethods/contentMethods.d.ts.map +0 -1
- package/dist/apiMethods/contentMethods.js.map +0 -1
- package/dist/apiMethods/instanceMethods.d.ts.map +0 -1
- package/dist/apiMethods/instanceMethods.js.map +0 -1
- package/dist/apiMethods/instanceUserMethods.d.ts.map +0 -1
- package/dist/apiMethods/instanceUserMethods.js.map +0 -1
- package/dist/apiMethods/modelMethods.d.ts.map +0 -1
- package/dist/apiMethods/modelMethods.js.map +0 -1
- package/dist/apiMethods/pageMethods.d.ts.map +0 -1
- package/dist/apiMethods/pageMethods.js.map +0 -1
- package/dist/apiMethods/serverUserMethods.d.ts.map +0 -1
- package/dist/apiMethods/serverUserMethods.js.map +0 -1
- package/dist/apiMethods/webhookMethods.d.ts.map +0 -1
- package/dist/apiMethods/webhookMethods.js.map +0 -1
- package/dist/enums/assetGroupingType.d.ts.map +0 -1
- package/dist/enums/assetGroupingType.js.map +0 -1
- package/dist/enums/batchItemType.d.ts.map +0 -1
- package/dist/enums/batchItemType.js.map +0 -1
- package/dist/enums/batchOperationType.d.ts.map +0 -1
- package/dist/enums/batchOperationType.js.map +0 -1
- package/dist/enums/batchState..d.ts.map +0 -1
- package/dist/enums/batchState..js.map +0 -1
- package/dist/enums/pageItemTemplateType.d.ts.map +0 -1
- package/dist/enums/pageItemTemplateType.js.map +0 -1
- package/dist/enums/workflowOperationType.d.ts.map +0 -1
- package/dist/enums/workflowOperationType.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/models/assetContainer.d.ts.map +0 -1
- package/dist/models/assetContainer.js.map +0 -1
- package/dist/models/assetGalleries.d.ts.map +0 -1
- package/dist/models/assetGalleries.js.map +0 -1
- package/dist/models/assetMediaGrouping.d.ts.map +0 -1
- package/dist/models/assetMediaGrouping.js.map +0 -1
- package/dist/models/assetMediaGroupingMetaData.d.ts.map +0 -1
- package/dist/models/assetMediaGroupingMetaData.js.map +0 -1
- package/dist/models/batch.d.ts.map +0 -1
- package/dist/models/batch.js.map +0 -1
- package/dist/models/batchItem.d.ts.map +0 -1
- package/dist/models/batchItem.js.map +0 -1
- package/dist/models/batchTypes.d.ts.map +0 -1
- package/dist/models/batchTypes.js.map +0 -1
- package/dist/models/container.d.ts.map +0 -1
- package/dist/models/container.js.map +0 -1
- package/dist/models/contentDefinitionTypeID.d.ts.map +0 -1
- package/dist/models/contentDefinitionTypeID.js.map +0 -1
- package/dist/models/contentItem.d.ts.map +0 -1
- package/dist/models/contentItem.js.map +0 -1
- package/dist/models/contentItemHistory.d.ts.map +0 -1
- package/dist/models/contentItemHistory.js.map +0 -1
- package/dist/models/contentListFilterModel.d.ts.map +0 -1
- package/dist/models/contentListFilterModel.js.map +0 -1
- package/dist/models/contentSectionDefaultModule.d.ts.map +0 -1
- package/dist/models/contentSectionDefaultModule.js.map +0 -1
- package/dist/models/contentSectionDefinition.d.ts.map +0 -1
- package/dist/models/contentSectionDefinition.js.map +0 -1
- package/dist/models/contentViewColumn.d.ts.map +0 -1
- package/dist/models/contentViewColumn.js.map +0 -1
- package/dist/models/exception.d.ts.map +0 -1
- package/dist/models/exception.js.map +0 -1
- package/dist/models/instanceRole.d.ts.map +0 -1
- package/dist/models/instanceRole.js.map +0 -1
- package/dist/models/instanceUser.d.ts.map +0 -1
- package/dist/models/instanceUser.js.map +0 -1
- package/dist/models/itemComments.d.ts.map +0 -1
- package/dist/models/itemComments.js.map +0 -1
- package/dist/models/listParams.d.ts.map +0 -1
- package/dist/models/listParams.js.map +0 -1
- package/dist/models/locales.d.ts.map +0 -1
- package/dist/models/locales.js.map +0 -1
- package/dist/models/media.d.ts.map +0 -1
- package/dist/models/media.js.map +0 -1
- package/dist/models/model.d.ts.map +0 -1
- package/dist/models/model.js.map +0 -1
- package/dist/models/notification.d.ts.map +0 -1
- package/dist/models/notification.js.map +0 -1
- package/dist/models/options.d.ts.map +0 -1
- package/dist/models/options.js.map +0 -1
- package/dist/models/pageHistory.d.ts.map +0 -1
- package/dist/models/pageHistory.js.map +0 -1
- package/dist/models/pageItem.d.ts.map +0 -1
- package/dist/models/pageItem.js.map +0 -1
- package/dist/models/pageModel.d.ts.map +0 -1
- package/dist/models/pageModel.js.map +0 -1
- package/dist/models/serverUser.d.ts.map +0 -1
- package/dist/models/serverUser.js.map +0 -1
- package/dist/models/sharedModule.d.ts.map +0 -1
- package/dist/models/sharedModule.js.map +0 -1
- package/dist/models/sitemap.d.ts.map +0 -1
- package/dist/models/sitemap.js.map +0 -1
- package/dist/models/webhook.d.ts.map +0 -1
- package/dist/models/webhook.js.map +0 -1
- package/dist/models/websiteListing.d.ts.map +0 -1
- package/dist/models/websiteListing.js.map +0 -1
- package/dist/models/websiteUser.d.ts.map +0 -1
- package/dist/models/websiteUser.js.map +0 -1
package/docs/asset-methods.md
CHANGED
|
@@ -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
|
|