@agility/management-sdk 0.1.3 → 0.1.7

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 (112) hide show
  1. package/README.md +459 -395
  2. package/dist/apiClient.d.ts +19 -0
  3. package/dist/apiClient.js +24 -0
  4. package/dist/apiMethods/apiClient.d.ts +19 -0
  5. package/dist/apiMethods/apiClient.js +24 -0
  6. package/dist/apiMethods/assetMethods.d.ts +14 -14
  7. package/dist/apiMethods/assetMethods.js +172 -172
  8. package/dist/apiMethods/batchMethods.d.ts +11 -11
  9. package/dist/apiMethods/batchMethods.js +117 -117
  10. package/dist/apiMethods/clientInstance.d.ts +8 -8
  11. package/dist/apiMethods/clientInstance.js +156 -137
  12. package/dist/apiMethods/containerMethods.d.ts +16 -16
  13. package/dist/apiMethods/containerMethods.js +189 -189
  14. package/dist/apiMethods/contentMethods.d.ts +20 -20
  15. package/dist/apiMethods/contentMethods.js +359 -359
  16. package/dist/apiMethods/instanceUserMethods.d.ts +13 -13
  17. package/dist/apiMethods/instanceUserMethods.js +111 -111
  18. package/dist/apiMethods/modelMethods.d.ts +13 -13
  19. package/dist/apiMethods/modelMethods.js +150 -150
  20. package/dist/apiMethods/pageMethods.d.ts +20 -20
  21. package/dist/apiMethods/pageMethods.js +323 -323
  22. package/dist/enums/batchOperationType.d.ts +19 -19
  23. package/dist/enums/batchOperationType.js +23 -23
  24. package/dist/enums/batchState..d.ts +7 -7
  25. package/dist/enums/batchState..js +11 -11
  26. package/dist/index.d.ts +14 -21
  27. package/dist/index.js +30 -33
  28. package/dist/models/batch.d.ts +29 -29
  29. package/dist/models/batch.js +9 -9
  30. package/dist/models/batchItem.d.ts +13 -13
  31. package/dist/models/batchItem.js +9 -9
  32. package/dist/models/container.d.ts +47 -47
  33. package/dist/models/container.js +9 -9
  34. package/dist/models/contentItem.d.ts +37 -37
  35. package/dist/models/contentItem.js +33 -33
  36. package/dist/models/contentViewColumn.d.ts +8 -8
  37. package/dist/models/contentViewColumn.js +9 -9
  38. package/dist/models/exception.d.ts +4 -4
  39. package/dist/models/exception.js +28 -26
  40. package/dist/models/instanceRole.d.ts +7 -7
  41. package/dist/models/instanceRole.js +9 -9
  42. package/dist/models/instanceUser.d.ts +14 -14
  43. package/dist/models/instanceUser.js +9 -9
  44. package/dist/models/media.d.ts +30 -30
  45. package/dist/models/media.js +15 -15
  46. package/dist/models/model.d.ts +30 -30
  47. package/dist/models/model.js +15 -15
  48. package/dist/models/notification.d.ts +13 -13
  49. package/dist/models/notification.js +9 -9
  50. package/dist/models/options.d.ts +7 -10
  51. package/dist/models/options.js +9 -28
  52. package/dist/models/pageItem.d.ts +56 -56
  53. package/dist/models/pageItem.js +39 -39
  54. package/dist/models/sitemap.d.ts +20 -20
  55. package/dist/models/sitemap.js +15 -15
  56. package/dist/models/websiteUser.d.ts +22 -22
  57. package/dist/models/websiteUser.js +15 -15
  58. package/dist/src/apiMethods/assetMethods.d.ts +14 -0
  59. package/dist/src/apiMethods/assetMethods.js +172 -0
  60. package/dist/src/apiMethods/batchMethods.d.ts +11 -0
  61. package/dist/src/apiMethods/batchMethods.js +117 -0
  62. package/dist/src/apiMethods/clientInstance.d.ts +8 -0
  63. package/dist/src/apiMethods/clientInstance.js +156 -0
  64. package/dist/src/apiMethods/containerMethods.d.ts +16 -0
  65. package/dist/src/apiMethods/containerMethods.js +189 -0
  66. package/dist/src/apiMethods/contentMethods.d.ts +20 -0
  67. package/dist/src/apiMethods/contentMethods.js +359 -0
  68. package/dist/src/apiMethods/instanceUserMethods.d.ts +13 -0
  69. package/dist/src/apiMethods/instanceUserMethods.js +111 -0
  70. package/dist/src/apiMethods/modelMethods.d.ts +13 -0
  71. package/dist/src/apiMethods/modelMethods.js +150 -0
  72. package/dist/src/apiMethods/pageMethods.d.ts +20 -0
  73. package/dist/src/apiMethods/pageMethods.js +323 -0
  74. package/dist/src/enums/batchOperationType.d.ts +19 -0
  75. package/dist/src/enums/batchOperationType.js +23 -0
  76. package/dist/src/enums/batchState..d.ts +7 -0
  77. package/dist/src/enums/batchState..js +11 -0
  78. package/dist/src/index.d.ts +14 -0
  79. package/dist/src/index.js +30 -0
  80. package/dist/src/models/batch.d.ts +29 -0
  81. package/dist/src/models/batch.js +9 -0
  82. package/dist/src/models/batchItem.d.ts +13 -0
  83. package/dist/src/models/batchItem.js +9 -0
  84. package/dist/src/models/container.d.ts +47 -0
  85. package/dist/src/models/container.js +9 -0
  86. package/dist/src/models/contentItem.d.ts +37 -0
  87. package/dist/src/models/contentItem.js +33 -0
  88. package/dist/src/models/contentViewColumn.d.ts +8 -0
  89. package/dist/src/models/contentViewColumn.js +9 -0
  90. package/dist/src/models/exception.d.ts +4 -0
  91. package/dist/src/models/exception.js +28 -0
  92. package/dist/src/models/instanceRole.d.ts +7 -0
  93. package/dist/src/models/instanceRole.js +9 -0
  94. package/dist/src/models/instanceUser.d.ts +14 -0
  95. package/dist/src/models/instanceUser.js +9 -0
  96. package/dist/src/models/media.d.ts +30 -0
  97. package/dist/src/models/media.js +15 -0
  98. package/dist/src/models/model.d.ts +30 -0
  99. package/dist/src/models/model.js +15 -0
  100. package/dist/src/models/notification.d.ts +13 -0
  101. package/dist/src/models/notification.js +9 -0
  102. package/dist/src/models/options.d.ts +7 -0
  103. package/dist/src/models/options.js +9 -0
  104. package/dist/src/models/pageItem.d.ts +56 -0
  105. package/dist/src/models/pageItem.js +39 -0
  106. package/dist/src/models/sitemap.d.ts +20 -0
  107. package/dist/src/models/sitemap.js +15 -0
  108. package/dist/src/models/websiteUser.d.ts +22 -0
  109. package/dist/src/models/websiteUser.js +15 -0
  110. package/license.txt +20 -20
  111. package/package.json +39 -39
  112. package/tsconfig.json +14 -14
package/README.md CHANGED
@@ -1,396 +1,460 @@
1
- # Agility CMS & Management API TypeScript SDK
2
-
3
- ## About the Management API SDK
4
-
5
- - Provides a facility to developers to use the new Agility Management API more effectively.
6
- - Provides methods to perform operations on Assets, Batches, Containers, Content, Models, Pages, and Users.
7
- - Supports the creation of Pages and Content in batches.
8
- - Ability to generate Content in bulk for a Website.
9
-
10
- ## Getting Started
11
-
12
- ### Prerequisites
13
- 1. Clone the repository agility-cms-management-sdk-typescript.
14
- 2. Import the index file to make use of the Options class.
15
- 3. Create an object of the Options class to provide values of -
16
- - token -> Bearer token to authenticate a Rest Request to perform an operation.
17
- - locale -> The locale under which your application is hosted. Example en-us.
18
- - guid -> The guid under which your application is hosted.
19
- 4. Create an object of Method class(es), which can be used to create and perform operations. Following is the description of Classes and their respective methods -
20
-
21
- ### Making a Request
22
- ```Javascript
23
- import * as index from "./index";
24
-
25
- //initialize the Options Class
26
- let options = new index.Options();
27
-
28
- options.token = "<<Provide Auth Token>>";
29
- options.guid = "<<Provide the Guid of the Website>>";
30
- options.locale = "<<Provide the locale of the Website>>"; //Example: en-us
31
-
32
- //Initialize the Method Class
33
- let contentMethods = new index.ContentMethods(options);
34
-
35
- //make the request: get a content item with the ID '22'
36
- var contentItem = await contentMethods.getContentItem(22);
37
-
38
- //To log the response of the contentItem object in console.
39
- console.log(JSON.stringify(contentItem));
40
- ```
41
- ## Class AssetMethods
42
- This class is used to perform operations related to Assets. The following are the methods: -
43
-
44
- ### upload
45
- | Parameter | Type | Description |
46
- | :-------- | :------- | :------------------------- |
47
- | `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>>');`|
48
- | `agilityFolderPath` | `string` | Path of the folder in Agility where the file(s) needs to be uploaded.|
49
- | `groupingID` | `number` | Path of the folder in Agility where the file(s) needs to be uploaded.|
50
-
51
- Returns: A collection of ```Media``` class Object.
52
-
53
- ### deleteFile
54
- | Parameter | Type | Description |
55
- | :-------- | :------- | :------------------------- |
56
- | `mediaID` | `number` | The mediaID of the asset which needs to be deleted.|
57
- Returns
58
- A ```string``` response if a file has been deleted.
59
-
60
- ### moveFile
61
- | Parameter | Type | Description |
62
- | :-------- | :------- | :------------------------- |
63
- | `mediaID` | `number` | The mediaID of the file that needs to be moved.|
64
- | `newFolder` | `string` | The new location (in Agility) where the file needs to be moved.|
65
-
66
- Returns: An object of ```Media``` class with the new location of the file.
67
-
68
- ### getMediaList
69
- | Parameter | Type | Description |
70
- | :-------- | :------- | :------------------------- |
71
- | `pageSize` | `number` | The page size on which the assets needs to selected.|
72
- | `recordOffset` | `number` | The record offset value to skip search results.|
73
-
74
- Returns: An object of ```AssetMediaList``` class.
75
-
76
- ### getAssetByID
77
- | Parameter | Type | Description |
78
- | :-------- | :------- | :------------------------- |
79
- | `mediaID` | `number` | The mediaID of the requested asset.|
80
-
81
- Returns: An object of ```Media``` class with the information of the asset.
82
-
83
- ### getAssetByUrl
84
- | Parameter | Type | Description |
85
- | :-------- | :------- | :------------------------- |
86
- | `url` | `string` | The url of the requested asset.|
87
-
88
- Returns: An object of ```Media``` class with the information of the asset.
89
-
90
- ## Class BatchMethods
91
- This class is used to perform operations related to Batches. The following are the methods: -
92
-
93
- ### getBatch
94
- | Parameter | Type | Description |
95
- | :-------- | :------- | :------------------------- |
96
- | `id` | `number` | The batchID of the requested batch.|
97
-
98
- Returns: A object of ```Batch``` class.
99
-
100
- ## Class ContainerMethods
101
- This class is used to perform operations related to Containers. The following are the methods: -
102
-
103
- ### getContainerByID
104
- | Parameter | Type | Description |
105
- | :-------- | :------- | :------------------------- |
106
- | `id` | `number` | The container id of the requested container.|
107
-
108
- Returns: A object of ```Container``` class.
109
-
110
- ### getContainerByReferenceName
111
- | Parameter | Type | Description |
112
- | :-------- | :------- | :------------------------- |
113
- | `referenceName` | `string` | The container reference name of the requested container.|
114
-
115
- Returns: A object of ```Container``` class.
116
-
117
- ### getContainerSecurity
118
- | Parameter | Type | Description |
119
- | :-------- | :------- | :------------------------- |
120
- | `id` | `number` | The container id of the requested container.|
121
-
122
- Returns: A object of ```Container``` class.
123
-
124
- ### getContainerList
125
- Returns: A collection object of ```Container``` class.
126
-
127
- ### getNotificationList
128
- | Parameter | Type | Description |
129
- | :-------- | :------- | :------------------------- |
130
- | `id` | `number` | The container id of the requested container.|
131
-
132
- Returns: A collection object of ```Notification``` class.
133
-
134
- ### saveContainer
135
- | Parameter | Type | Description |
136
- | :-------- | :------- | :------------------------- |
137
- | `container` | `Container` | A Container type object to create or update a container.|
138
-
139
- Returns: An object of ```Container``` class.
140
-
141
- ### deleteContainer
142
- | Parameter | Type | Description |
143
- | :-------- | :------- | :------------------------- |
144
- | `id` | `number` | The container id of the requested container.|
145
-
146
- Returns: A ```string``` response if a container has been deleted.
147
-
148
- ## Class ContentMethods
149
- This class is used to perform operations related to Content. The following are the methods: -
150
-
151
- ### getContentItem
152
- | Parameter | Type | Description |
153
- | :-------- | :------- | :------------------------- |
154
- | `contentID` | `number` | The contentid of the requested content.|
155
-
156
- Returns: An object of ```ContentItem``` class.
157
-
158
- ### publishContent
159
- | Parameter | Type | Description |
160
- | :-------- | :------- | :------------------------- |
161
- | `contentID` | `number` | The contentid of the requested content.|
162
- | `comments` | `string` | Additional comments for a batch request.|
163
-
164
- Returns: An array of ```contentID``` of the requested content.
165
-
166
- ### unPublishContent
167
- | Parameter | Type | Description |
168
- | :-------- | :------- | :------------------------- |
169
- | `contentID` | `number` | The contentid of the requested content.|
170
- | `comments` | `string` | Additional comments for a batch request.|
171
-
172
- Returns: An array of ```contentID``` of the requested content.
173
-
174
- ### contentRequestApproval
175
- | Parameter | Type | Description |
176
- | :-------- | :------- | :------------------------- |
177
- | `contentID` | `number` | The contentid of the requested content.|
178
- | `comments` | `string` | Additional comments for a batch request.|
179
-
180
- Returns: An array of ```contentID``` of the requested content.
181
-
182
- ### approveContent
183
- | Parameter | Type | Description |
184
- | :-------- | :------- | :------------------------- |
185
- | `contentID` | `number` | The contentid of the requested content.|
186
- | `comments` | `string` | Additional comments for a batch request.|
187
-
188
- Returns: An array of ```contentID``` of the requested content.
189
-
190
- ### declineContent
191
- | Parameter | Type | Description |
192
- | :-------- | :------- | :------------------------- |
193
- | `contentID` | `number` | The contentid of the requested content.|
194
- | `comments` | `string` | Additional comments for a batch request.|
195
-
196
- Returns: An array of ```contentID``` of the requested content.
197
-
198
- ### saveContentItem
199
- | Parameter | Type | Description |
200
- | :-------- | :------- | :------------------------- |
201
- | `contentItem` | `ContentItem` | A contentItem object to create or update a content.|
202
-
203
- Returns: An array of ```contentID``` of the requested content.
204
-
205
- ### saveContentItems
206
- | Parameter | Type | Description |
207
- | :-------- | :------- | :------------------------- |
208
- | `contentItems` | `ContentItem[]` | A collection of contentItems object to create or update multiple contents.|
209
-
210
- Returns: An array of ```contentID``` of the requested content.
211
-
212
- ### deleteContent
213
- | Parameter | Type | Description |
214
- | :-------- | :------- | :------------------------- |
215
- | `contentID` | `number` | The contentid of the requested content.|
216
- | `comments` | `string` | Additional comments for a batch request.|
217
-
218
- Returns: An array of ```contentID``` of the requested content.
219
-
220
- ### getContentItems
221
- | Parameter | Type | Description |
222
- | :-------- | :------- | :------------------------- |
223
- | `referenceName` | `string` | The reference name of the container for the requested content.|
224
- | `filter` | `string` | The filter condition for the requested content.|
225
- | `fields` | `string` | The fields mapped to the container.|
226
- | `sortDirection` | `string` | The direction to sort the result.|
227
- | `sortField` | `string` | The field on which the sort needs to be performed.|
228
- | `take` | `number` | The page size for the result.|
229
- | `skip` | `number` | The record offset for the result.|
230
-
231
- Returns: An object of ```ContentList``` class of the requested content.
232
-
233
- ## Class InstanceUserMethods
234
- This class is used to perform operations related to User. The following are the methods: -
235
-
236
- ### getUsers
237
- Returns: A collection of ```WebsiteUser``` class of the requested content.
238
-
239
- ### saveUser
240
- | Parameter | Type | Description |
241
- | :-------- | :------- | :------------------------- |
242
- | `emailAddress` | `string` | The email address of the requested user.|
243
- | `roles` | `InstanceRole[]` | Collection object of InstanceRole class for the requested user.|
244
- | `firstName` | `string` | The first name of the requested user.|
245
- | `lastName` | `string` | The last name of the requested user.|
246
-
247
- Returns: An object of the ```InstanceUser``` class.
248
-
249
- ### deleteUser
250
- | Parameter | Type | Description |
251
- | :-------- | :------- | :------------------------- |
252
- | `userID` | `number` | The userID of the requested user.|
253
-
254
- Returns: A ```string``` response if a user has been deleted.
255
-
256
- ## Class ModelMethods
257
- This class is used to perform operations related to Models. The following are the methods: -
258
-
259
- ### getContentModel
260
- | Parameter | Type | Description |
261
- | :-------- | :------- | :------------------------- |
262
- | `id` | `number` | The id of the requested model.|
263
-
264
- Returns: An object of ```Model``` class.
265
-
266
- ### getContentModules
267
- | Parameter | Type | Description |
268
- | :-------- | :------- | :------------------------- |
269
- | `includeDefaults` | `bool` | Boolean value to include defaults.|
270
- | `includeModules` | `bool` | Boolean value to include modules.|
271
-
272
- Returns: A collection object of ```Model``` class.
273
-
274
- ### getPageModules
275
- | Parameter | Type | Description |
276
- | :-------- | :------- | :------------------------- |
277
- | `includeDefault` | `bool` | Boolean value to include defaults.|
278
-
279
- Returns: A collection object of ```Model``` class.
280
-
281
- ### saveModel
282
- | Parameter | Type | Description |
283
- | :-------- | :------- | :------------------------- |
284
- | `model` | `Model` | The object of Model to for the requested model.|
285
-
286
- Returns: An object of ```Model``` class.
287
-
288
- ### deleteModel
289
- | Parameter | Type | Description |
290
- | :-------- | :------- | :------------------------- |
291
- | `id` | `number` | The id for the requested model.|
292
-
293
- Returns: A ```string``` response if a model is deleted.
294
-
295
- ## Class PageMethods
296
- This class is used to perform operations related to Pages. The following are the methods: -
297
-
298
- ### getSitemap
299
- Returns: A collection object of ```Sitemap``` class.
300
-
301
- ### getPage
302
- | Parameter | Type | Description |
303
- | :-------- | :------- | :------------------------- |
304
- | `pageID` | `number` | The id of the requested page.|
305
-
306
- Returns: An object of ```PageItem``` class.
307
-
308
- ### publishPage
309
- | Parameter | Type | Description |
310
- | :-------- | :------- | :------------------------- |
311
- | `pageID` | `number` | The pageID of the requested page.|
312
- | `comments` | `string` | Additional comments for a batch request.|
313
-
314
- Returns: An array of ```pageID``` of the requested page.
315
-
316
- ### unPublishPage
317
- | Parameter | Type | Description |
318
- | :-------- | :------- | :------------------------- |
319
- | `pageID` | `number` | The pageID of the requested page.|
320
- | `comments` | `string` | Additional comments for a batch request.|
321
-
322
- Returns: An array of ```pageID``` of the requested page.
323
-
324
- ### deletePage
325
- | Parameter | Type | Description |
326
- | :-------- | :------- | :------------------------- |
327
- | `pageID` | `number` | The pageID of the requested page.|
328
- | `comments` | `string` | Additional comments for a batch request.|
329
-
330
- Returns: An array of ```pageID``` of the requested page.
331
-
332
- ### approvePage
333
- | Parameter | Type | Description |
334
- | :-------- | :------- | :------------------------- |
335
- | `pageID` | `number` | The pageID of the requested page.|
336
- | `comments` | `string` | Additional comments for a batch request.|
337
-
338
- Returns: An array of ```pageID``` of the requested page.
339
-
340
- ### declinePage
341
- | Parameter | Type | Description |
342
- | :-------- | :------- | :------------------------- |
343
- | `pageID` | `number` | The pageID of the requested page.|
344
- | `comments` | `string` | Additional comments for a batch request.|
345
-
346
- Returns: An array of ```pageID``` of the requested page.
347
-
348
- ### pageRequestApproval
349
- | Parameter | Type | Description |
350
- | :-------- | :------- | :------------------------- |
351
- | `pageID` | `number` | The pageID of the requested page.|
352
- | `comments` | `string` | Additional comments for a batch request.|
353
-
354
- Returns: An array of ```pageID``` of the requested page.
355
-
356
- ### savePage
357
- | Parameter | Type | Description |
358
- | :-------- | :------- | :------------------------- |
359
- | `pageItem` | `PageItem` | The object of PageItem class for the requested Page.|
360
- | `parentPageID` | `number` | The id of the parent page.|
361
- | `placeBeforePageItemID` | `number` | The id of the page before the page.|
362
-
363
- Returns: An array of ```pageID``` of the requested page.
364
-
365
-
366
- ## Running the SDK Locally
367
-
368
- - `npm run clean`
369
- - `npm run prepare`
370
- - `npm run build`
371
-
372
- ## How It Works
373
-
374
- - [How Pages Work](https://help.agilitycms.com/hc/en-us/articles/4404222849677)
375
- - [How Page Modules Work](https://help.agilitycms.com/hc/en-us/articles/4404222989453)
376
- - [How Page Templates Work](https://help.agilitycms.com/hc/en-us/articles/4404229108877)
377
-
378
- ## Resources
379
-
380
- ### Agility CMS
381
-
382
- - [Official site](https://agilitycms.com)
383
- - [Documentation](https://help.agilitycms.com/hc/en-us)
384
-
385
- ### Community
386
-
387
- - [Official Slack](https://join.slack.com/t/agilitycommunity/shared_invite/enQtNzI2NDc3MzU4Njc2LWI2OTNjZTI3ZGY1NWRiNTYzNmEyNmI0MGZlZTRkYzI3NmRjNzkxYmI5YTZjNTg2ZTk4NGUzNjg5NzY3OWViZGI)
388
- - [Blog](https://agilitycms.com/resources/posts)
389
- - [GitHub](https://github.com/agility)
390
- - [Forums](https://help.agilitycms.com/hc/en-us/community/topics)
391
- - [Facebook](https://www.facebook.com/AgilityCMS/)
392
- - [Twitter](https://twitter.com/AgilityCMS)
393
-
394
- ## Feedback and Questions
395
-
1
+ # Agility CMS & Management API TypeScript SDK
2
+
3
+ ## About the Management API SDK
4
+
5
+ - Provides a facility to developers to use the new Agility Management API more effectively.
6
+ - Provides methods to perform operations on Assets, Batches, Containers, Content, Models, Pages, and Users.
7
+ - Supports the creation of Pages and Content in batches.
8
+ - Ability to generate Content in bulk for a Website.
9
+
10
+ ## Getting Started
11
+
12
+ ### Prerequisites
13
+ 1. Clone the repository agility-cms-management-sdk-typescript.
14
+ 2. Import the index file to make use of the Options class.
15
+ 3. Create an object of the Options class to provide values of -
16
+ - token -> Bearer token to authenticate a Rest Request to perform an operation.
17
+ 4. Create an object of Method class(es), which can be used to create and perform operations. Following is the description of Classes and their respective methods -
18
+
19
+ ### Making a Request
20
+ ```Javascript
21
+ import * as index from "./index";
22
+
23
+ //initialize the Options Class
24
+ let options = new index.Options();
25
+
26
+ //Initialize the APIClient Class
27
+ let apiClient = new index.ApiClient(options);
28
+
29
+ let token = "<<Provide Auth Token>>";
30
+ let guid = "<<Provide the Guid of the Website>>";
31
+ let locale = "<<Provide the locale of the Website>>"; //Example: en-us
32
+
33
+
34
+
35
+ //make the request: get a content item with the ID '22'
36
+ var contentItem = await apiClient.contentMethods.getContentItem(22,guid, locale);
37
+
38
+ //To log the response of the contentItem object in console.
39
+ console.log(JSON.stringify(contentItem));
40
+ ```
41
+ ## Class AssetMethods
42
+ This class is used to perform operations related to Assets. The following are the methods: -
43
+
44
+ ### upload
45
+ | Parameter | Type | Description |
46
+ | :-------- | :------- | :------------------------- |
47
+ | `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>>');`|
48
+ | `agilityFolderPath` | `string` | Path of the folder in Agility where the file(s) needs to be uploaded.|
49
+ | `guid` | `string` | Current website guid.|
50
+ | `groupingID` | `number` | Path of the folder in Agility where the file(s) needs to be uploaded.|
51
+
52
+ Returns: A collection of ```Media``` class Object.
53
+
54
+ ### deleteFile
55
+ | Parameter | Type | Description |
56
+ | :-------- | :------- | :------------------------- |
57
+ | `mediaID` | `number` | The mediaID of the asset which needs to be deleted.|
58
+ | `guid` | `string` | Current website guid.|
59
+ Returns
60
+ A ```string``` response if a file has been deleted.
61
+
62
+ ### moveFile
63
+ | Parameter | Type | Description |
64
+ | :-------- | :------- | :------------------------- |
65
+ | `mediaID` | `number` | The mediaID of the file that needs to be moved.|
66
+ | `newFolder` | `string` | The new location (in Agility) where the file needs to be moved.|
67
+ | `guid` | `string` | Current website guid.|
68
+
69
+ Returns: An object of ```Media``` class with the new location of the file.
70
+
71
+ ### getMediaList
72
+ | Parameter | Type | Description |
73
+ | :-------- | :------- | :------------------------- |
74
+ | `pageSize` | `number` | The page size on which the assets needs to selected.|
75
+ | `recordOffset` | `number` | The record offset value to skip search results.|
76
+ | `guid` | `string` | Current website guid.|
77
+
78
+ Returns: An object of ```AssetMediaList``` class.
79
+
80
+ ### getAssetByID
81
+ | Parameter | Type | Description |
82
+ | :-------- | :------- | :------------------------- |
83
+ | `mediaID` | `number` | The mediaID of the requested asset.|
84
+ | `guid` | `string` | Current website guid.|
85
+
86
+ Returns: An object of ```Media``` class with the information of the asset.
87
+
88
+ ### getAssetByUrl
89
+ | Parameter | Type | Description |
90
+ | :-------- | :------- | :------------------------- |
91
+ | `url` | `string` | The url of the requested asset.|
92
+ | `guid` | `string` | Current website guid.|
93
+
94
+ Returns: An object of ```Media``` class with the information of the asset.
95
+
96
+ ## Class BatchMethods
97
+ This class is used to perform operations related to Batches. The following are the methods: -
98
+
99
+ ### getBatch
100
+ | Parameter | Type | Description |
101
+ | :-------- | :------- | :------------------------- |
102
+ | `id` | `number` | The batchID of the requested batch.|
103
+ | `guid` | `string` | Current website guid.|
104
+
105
+ Returns: A object of ```Batch``` class.
106
+
107
+ ## Class ContainerMethods
108
+ This class is used to perform operations related to Containers. The following are the methods: -
109
+
110
+ ### getContainerByID
111
+ | Parameter | Type | Description |
112
+ | :-------- | :------- | :------------------------- |
113
+ | `id` | `number` | The container id of the requested container.|
114
+ | `guid` | `string` | Current website guid.|
115
+
116
+ Returns: A object of ```Container``` class.
117
+
118
+ ### getContainerByReferenceName
119
+ | Parameter | Type | Description |
120
+ | :-------- | :------- | :------------------------- |
121
+ | `referenceName` | `string` | The container reference name of the requested container.|
122
+ | `guid` | `string` | Current website guid.|
123
+
124
+ Returns: A object of ```Container``` class.
125
+
126
+ ### getContainerSecurity
127
+ | Parameter | Type | Description |
128
+ | :-------- | :------- | :------------------------- |
129
+ | `id` | `number` | The container id of the requested container.|
130
+ | `guid` | `string` | Current website guid.|
131
+
132
+ Returns: A object of ```Container``` class.
133
+
134
+ ### getContainerList
135
+ | Parameter | Type | Description |
136
+ | :-------- | :------- | :------------------------- |
137
+ | `guid` | `string` | Current website guid.|
138
+ Returns: A collection object of ```Container``` class.
139
+
140
+ ### getNotificationList
141
+ | Parameter | Type | Description |
142
+ | :-------- | :------- | :------------------------- |
143
+ | `id` | `number` | The container id of the requested container.|
144
+ | `guid` | `string` | Current website guid.|
145
+ Returns: A collection object of ```Notification``` class.
146
+
147
+ ### saveContainer
148
+ | Parameter | Type | Description |
149
+ | :-------- | :------- | :------------------------- |
150
+ | `container` | `Container` | A Container type object to create or update a container.|
151
+ | `guid` | `string` | Current website guid.|
152
+
153
+ Returns: An object of ```Container``` class.
154
+
155
+ ### deleteContainer
156
+ | Parameter | Type | Description |
157
+ | :-------- | :------- | :------------------------- |
158
+ | `id` | `number` | The container id of the requested container.|
159
+ | `guid` | `string` | Current website guid.|
160
+ Returns: A ```string``` response if a container has been deleted.
161
+
162
+ ## Class ContentMethods
163
+ This class is used to perform operations related to Content. The following are the methods: -
164
+
165
+ ### getContentItem
166
+ | Parameter | Type | Description |
167
+ | :-------- | :------- | :------------------------- |
168
+ | `contentID` | `number` | The contentid of the requested content.|
169
+ | `guid` | `string` | Current website guid.|
170
+ | `locale` | `string` | Current website locale.|
171
+
172
+ Returns: An object of ```ContentItem``` class.
173
+
174
+ ### publishContent
175
+ | Parameter | Type | Description |
176
+ | :-------- | :------- | :------------------------- |
177
+ | `contentID` | `number` | The contentid of the requested content.|
178
+ | `guid` | `string` | Current website guid.|
179
+ | `locale` | `string` | Current website locale.|
180
+ | `comments` | `string` | Additional comments for a batch request.|
181
+
182
+ Returns: An array of ```contentID``` of the requested content.
183
+
184
+ ### unPublishContent
185
+ | Parameter | Type | Description |
186
+ | :-------- | :------- | :------------------------- |
187
+ | `contentID` | `number` | The contentid of the requested content.|
188
+ | `guid` | `string` | Current website guid.|
189
+ | `locale` | `string` | Current website locale.|
190
+ | `comments` | `string` | Additional comments for a batch request.|
191
+
192
+ Returns: An array of ```contentID``` of the requested content.
193
+
194
+ ### contentRequestApproval
195
+ | Parameter | Type | Description |
196
+ | :-------- | :------- | :------------------------- |
197
+ | `contentID` | `number` | The contentid of the requested content.|
198
+ | `guid` | `string` | Current website guid.|
199
+ | `locale` | `string` | Current website locale.|
200
+ | `comments` | `string` | Additional comments for a batch request.|
201
+
202
+ Returns: An array of ```contentID``` of the requested content.
203
+
204
+ ### approveContent
205
+ | Parameter | Type | Description |
206
+ | :-------- | :------- | :------------------------- |
207
+ | `contentID` | `number` | The contentid of the requested content.|
208
+ | `guid` | `string` | Current website guid.|
209
+ | `locale` | `string` | Current website locale.|
210
+ | `comments` | `string` | Additional comments for a batch request.|
211
+
212
+ Returns: An array of ```contentID``` of the requested content.
213
+
214
+ ### declineContent
215
+ | Parameter | Type | Description |
216
+ | :-------- | :------- | :------------------------- |
217
+ | `contentID` | `number` | The contentid of the requested content.|
218
+ | `guid` | `string` | Current website guid.|
219
+ | `locale` | `string` | Current website locale.|
220
+ | `comments` | `string` | Additional comments for a batch request.|
221
+
222
+ Returns: An array of ```contentID``` of the requested content.
223
+
224
+ ### saveContentItem
225
+ | Parameter | Type | Description |
226
+ | :-------- | :------- | :------------------------- |
227
+ | `contentItem` | `ContentItem` | A contentItem object to create or update a content.|
228
+ | `guid` | `string` | Current website guid.|
229
+ | `locale` | `string` | Current website locale.|
230
+
231
+ Returns: An array of ```contentID``` of the requested content.
232
+
233
+ ### saveContentItems
234
+ | Parameter | Type | Description |
235
+ | :-------- | :------- | :------------------------- |
236
+ | `contentItems` | `ContentItem[]` | A collection of contentItems object to create or update multiple contents.|
237
+ | `guid` | `string` | Current website guid.|
238
+ | `locale` | `string` | Current website locale.|
239
+
240
+ Returns: An array of ```contentID``` of the requested content.
241
+
242
+ ### deleteContent
243
+ | Parameter | Type | Description |
244
+ | :-------- | :------- | :------------------------- |
245
+ | `contentID` | `number` | The contentid of the requested content.|
246
+ | `guid` | `string` | Current website guid.|
247
+ | `locale` | `string` | Current website locale.|
248
+ | `comments` | `string` | Additional comments for a batch request.|
249
+
250
+ Returns: An array of ```contentID``` of the requested content.
251
+
252
+ ### getContentItems
253
+ | Parameter | Type | Description |
254
+ | :-------- | :------- | :------------------------- |
255
+ | `referenceName` | `string` | The reference name of the container for the requested content.|
256
+ | `guid` | `string` | Current website guid.|
257
+ | `locale` | `string` | Current website locale.|
258
+ | `filter` | `string` | The filter condition for the requested content.|
259
+ | `fields` | `string` | The fields mapped to the container.|
260
+ | `sortDirection` | `string` | The direction to sort the result.|
261
+ | `sortField` | `string` | The field on which the sort needs to be performed.|
262
+ | `take` | `number` | The page size for the result.|
263
+ | `skip` | `number` | The record offset for the result.|
264
+
265
+ Returns: An object of ```ContentList``` class of the requested content.
266
+
267
+ ## Class InstanceUserMethods
268
+ This class is used to perform operations related to User. The following are the methods: -
269
+
270
+ ### getUsers
271
+ | Parameter | Type | Description |
272
+ | :-------- | :------- | :------------------------- |
273
+ | `guid` | `string` | Current website guid.|
274
+ Returns: A collection of ```WebsiteUser``` class of the requested content.
275
+
276
+ ### saveUser
277
+ | Parameter | Type | Description |
278
+ | :-------- | :------- | :------------------------- |
279
+ | `emailAddress` | `string` | The email address of the requested user.|
280
+ | `roles` | `InstanceRole[]` | Collection object of InstanceRole class for the requested user.|
281
+ | `guid` | `string` | Current website guid.|
282
+ | `firstName` | `string` | The first name of the requested user.|
283
+ | `lastName` | `string` | The last name of the requested user.|
284
+
285
+ Returns: An object of the ```InstanceUser``` class.
286
+
287
+ ### deleteUser
288
+ | Parameter | Type | Description |
289
+ | :-------- | :------- | :------------------------- |
290
+ | `userID` | `number` | The userID of the requested user.|
291
+ | `guid` | `string` | Current website guid.|
292
+
293
+ Returns: A ```string``` response if a user has been deleted.
294
+
295
+ ## Class ModelMethods
296
+ This class is used to perform operations related to Models. The following are the methods: -
297
+
298
+ ### getContentModel
299
+ | Parameter | Type | Description |
300
+ | :-------- | :------- | :------------------------- |
301
+ | `id` | `number` | The id of the requested model.|
302
+ | `guid` | `string` | Current website guid.|
303
+
304
+ Returns: An object of ```Model``` class.
305
+
306
+ ### getContentModules
307
+ | Parameter | Type | Description |
308
+ | :-------- | :------- | :------------------------- |
309
+ | `includeDefaults` | `bool` | Boolean value to include defaults.|
310
+ | `guid` | `string` | Current website guid.|
311
+ | `includeModules` | `bool` | Boolean value to include modules.|
312
+
313
+ Returns: A collection object of ```Model``` class.
314
+
315
+ ### getPageModules
316
+ | Parameter | Type | Description |
317
+ | :-------- | :------- | :------------------------- |
318
+ | `includeDefault` | `bool` | Boolean value to include defaults.|
319
+ | `guid` | `string` | Current website guid.|
320
+
321
+ Returns: A collection object of ```Model``` class.
322
+
323
+ ### saveModel
324
+ | Parameter | Type | Description |
325
+ | :-------- | :------- | :------------------------- |
326
+ | `model` | `Model` | The object of Model to for the requested model.|
327
+ | `guid` | `string` | Current website guid.|
328
+
329
+ Returns: An object of ```Model``` class.
330
+
331
+ ### deleteModel
332
+ | Parameter | Type | Description |
333
+ | :-------- | :------- | :------------------------- |
334
+ | `id` | `number` | The id for the requested model.|
335
+ | `guid` | `string` | Current website guid.|
336
+
337
+ Returns: A ```string``` response if a model is deleted.
338
+
339
+ ## Class PageMethods
340
+ This class is used to perform operations related to Pages. The following are the methods: -
341
+
342
+ ### getSitemap
343
+ | Parameter | Type | Description |
344
+ | :-------- | :------- | :------------------------- |
345
+ | `guid` | `string` | Current website guid.|
346
+ | `locale` | `string` | Current website locale.|
347
+ Returns: A collection object of ```Sitemap``` class.
348
+
349
+ ### getPage
350
+ | Parameter | Type | Description |
351
+ | :-------- | :------- | :------------------------- |
352
+ | `pageID` | `number` | The id of the requested page.|
353
+ | `guid` | `string` | Current website guid.|
354
+ | `locale` | `string` | Current website locale.|
355
+
356
+ Returns: An object of ```PageItem``` class.
357
+
358
+ ### publishPage
359
+ | Parameter | Type | Description |
360
+ | :-------- | :------- | :------------------------- |
361
+ | `pageID` | `number` | The pageID of the requested page.|
362
+ | `guid` | `string` | Current website guid.|
363
+ | `locale` | `string` | Current website locale.|
364
+ | `comments` | `string` | Additional comments for a batch request.|
365
+
366
+ Returns: An array of ```pageID``` of the requested page.
367
+
368
+ ### unPublishPage
369
+ | Parameter | Type | Description |
370
+ | :-------- | :------- | :------------------------- |
371
+ | `pageID` | `number` | The pageID of the requested page.|
372
+ | `guid` | `string` | Current website guid.|
373
+ | `locale` | `string` | Current website locale.|
374
+ | `comments` | `string` | Additional comments for a batch request.|
375
+
376
+ Returns: An array of ```pageID``` of the requested page.
377
+
378
+ ### deletePage
379
+ | Parameter | Type | Description |
380
+ | :-------- | :------- | :------------------------- |
381
+ | `pageID` | `number` | The pageID of the requested page.|
382
+ | `guid` | `string` | Current website guid.|
383
+ | `locale` | `string` | Current website locale.|
384
+ | `comments` | `string` | Additional comments for a batch request.|
385
+
386
+ Returns: An array of ```pageID``` of the requested page.
387
+
388
+ ### approvePage
389
+ | Parameter | Type | Description |
390
+ | :-------- | :------- | :------------------------- |
391
+ | `pageID` | `number` | The pageID of the requested page.|
392
+ | `guid` | `string` | Current website guid.|
393
+ | `locale` | `string` | Current website locale.|
394
+ | `comments` | `string` | Additional comments for a batch request.|
395
+
396
+ Returns: An array of ```pageID``` of the requested page.
397
+
398
+ ### declinePage
399
+ | Parameter | Type | Description |
400
+ | :-------- | :------- | :------------------------- |
401
+ | `pageID` | `number` | The pageID of the requested page.|
402
+ | `guid` | `string` | Current website guid.|
403
+ | `locale` | `string` | Current website locale.|
404
+ | `comments` | `string` | Additional comments for a batch request.|
405
+
406
+ Returns: An array of ```pageID``` of the requested page.
407
+
408
+ ### pageRequestApproval
409
+ | Parameter | Type | Description |
410
+ | :-------- | :------- | :------------------------- |
411
+ | `pageID` | `number` | The pageID of the requested page.|
412
+ | `guid` | `string` | Current website guid.|
413
+ | `locale` | `string` | Current website locale.|
414
+ | `comments` | `string` | Additional comments for a batch request.|
415
+
416
+ Returns: An array of ```pageID``` of the requested page.
417
+
418
+ ### savePage
419
+ | Parameter | Type | Description |
420
+ | :-------- | :------- | :------------------------- |
421
+ | `pageItem` | `PageItem` | The object of PageItem class for the requested Page.|
422
+ | `guid` | `string` | Current website guid.|
423
+ | `locale` | `string` | Current website locale.|
424
+ | `parentPageID` | `number` | The id of the parent page.|
425
+ | `placeBeforePageItemID` | `number` | The id of the page before the page.|
426
+
427
+ Returns: An array of ```pageID``` of the requested page.
428
+
429
+
430
+ ## Running the SDK Locally
431
+
432
+ - `npm run clean`
433
+ - `npm run prepare`
434
+ - `npm run build`
435
+
436
+ ## How It Works
437
+
438
+ - [How Pages Work](https://help.agilitycms.com/hc/en-us/articles/4404222849677)
439
+ - [How Page Modules Work](https://help.agilitycms.com/hc/en-us/articles/4404222989453)
440
+ - [How Page Templates Work](https://help.agilitycms.com/hc/en-us/articles/4404229108877)
441
+
442
+ ## Resources
443
+
444
+ ### Agility CMS
445
+
446
+ - [Official site](https://agilitycms.com)
447
+ - [Documentation](https://help.agilitycms.com/hc/en-us)
448
+
449
+ ### Community
450
+
451
+ - [Official Slack](https://join.slack.com/t/agilitycommunity/shared_invite/enQtNzI2NDc3MzU4Njc2LWI2OTNjZTI3ZGY1NWRiNTYzNmEyNmI0MGZlZTRkYzI3NmRjNzkxYmI5YTZjNTg2ZTk4NGUzNjg5NzY3OWViZGI)
452
+ - [Blog](https://agilitycms.com/resources/posts)
453
+ - [GitHub](https://github.com/agility)
454
+ - [Forums](https://help.agilitycms.com/hc/en-us/community/topics)
455
+ - [Facebook](https://www.facebook.com/AgilityCMS/)
456
+ - [Twitter](https://twitter.com/AgilityCMS)
457
+
458
+ ## Feedback and Questions
459
+
396
460
  If you have feedback or questions about this starter, please use the [Github Issues](https://github.com/agility/agility-cms-management-sdk-typescript/issues) on this repo, join our [Community Slack Channel](https://join.slack.com/t/agilitycommunity/shared_invite/enQtNzI2NDc3MzU4Njc2LWI2OTNjZTI3ZGY1NWRiNTYzNmEyNmI0MGZlZTRkYzI3NmRjNzkxYmI5YTZjNTg2ZTk4NGUzNjg5NzY3OWViZGI) or create a post on the [Agility Developer Community](https://help.agilitycms.com/hc/en-us/community/topics).