contentful-management 11.52.1 → 12.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (613) hide show
  1. package/README.md +73 -48
  2. package/dist/contentful-management.browser.js +23913 -28421
  3. package/dist/contentful-management.browser.min.js +1 -2
  4. package/dist/contentful-management.cjs +37008 -0
  5. package/dist/{es-modules → esm}/adapters/REST/endpoints/access-token.js +20 -22
  6. package/dist/esm/adapters/REST/endpoints/ai-action-invocation.js +7 -0
  7. package/dist/esm/adapters/REST/endpoints/ai-action.js +44 -0
  8. package/dist/esm/adapters/REST/endpoints/api-key.js +41 -0
  9. package/dist/esm/adapters/REST/endpoints/app-access-token.js +7 -0
  10. package/dist/esm/adapters/REST/endpoints/app-action-call.js +61 -0
  11. package/dist/esm/adapters/REST/endpoints/app-action.js +35 -0
  12. package/dist/esm/adapters/REST/endpoints/app-bundle.js +34 -0
  13. package/dist/esm/adapters/REST/endpoints/app-definition.js +39 -0
  14. package/dist/esm/adapters/REST/endpoints/app-details.js +13 -0
  15. package/dist/esm/adapters/REST/endpoints/app-event-subscription.js +13 -0
  16. package/dist/esm/adapters/REST/endpoints/app-installation.js +35 -0
  17. package/dist/esm/adapters/REST/endpoints/app-key.js +16 -0
  18. package/dist/esm/adapters/REST/endpoints/app-signed-request.js +7 -0
  19. package/dist/esm/adapters/REST/endpoints/app-signing-secret.js +13 -0
  20. package/dist/esm/adapters/REST/endpoints/app-upload.js +24 -0
  21. package/dist/esm/adapters/REST/endpoints/asset-key.js +31 -0
  22. package/dist/esm/adapters/REST/endpoints/asset.js +170 -0
  23. package/dist/esm/adapters/REST/endpoints/bulk-action.js +16 -0
  24. package/dist/esm/adapters/REST/endpoints/comment.js +85 -0
  25. package/dist/esm/adapters/REST/endpoints/concept-scheme.js +35 -0
  26. package/dist/esm/adapters/REST/endpoints/concept.js +54 -0
  27. package/dist/esm/adapters/REST/endpoints/content-type.js +47 -0
  28. package/dist/esm/adapters/REST/endpoints/editor-interface.js +20 -0
  29. package/dist/esm/adapters/REST/endpoints/entry.js +90 -0
  30. package/dist/esm/adapters/REST/endpoints/environment-alias.js +38 -0
  31. package/dist/esm/adapters/REST/endpoints/environment-template-installation.js +20 -0
  32. package/dist/esm/adapters/REST/endpoints/environment-template.js +38 -0
  33. package/dist/esm/adapters/REST/endpoints/environment.js +40 -0
  34. package/dist/esm/adapters/REST/endpoints/extension.js +36 -0
  35. package/dist/esm/adapters/REST/endpoints/function-log.js +20 -0
  36. package/dist/esm/adapters/REST/endpoints/function.js +21 -0
  37. package/dist/esm/adapters/REST/endpoints/http.js +22 -0
  38. package/dist/esm/adapters/REST/endpoints/index.js +137 -0
  39. package/dist/esm/adapters/REST/endpoints/locale.js +31 -0
  40. package/dist/{es-modules → esm}/adapters/REST/endpoints/oauth-application.js +21 -22
  41. package/dist/esm/adapters/REST/endpoints/organization-invitation.js +20 -0
  42. package/dist/esm/adapters/REST/endpoints/organization-membership.js +27 -0
  43. package/dist/esm/adapters/REST/endpoints/organization.js +25 -0
  44. package/dist/esm/adapters/REST/endpoints/personal-access-token.js +32 -0
  45. package/dist/esm/adapters/REST/endpoints/preview-api-key.js +12 -0
  46. package/dist/esm/adapters/REST/endpoints/raw.js +37 -0
  47. package/dist/esm/adapters/REST/endpoints/release-action.js +17 -0
  48. package/dist/esm/adapters/REST/endpoints/release.js +50 -0
  49. package/dist/esm/adapters/REST/endpoints/resource-provider.js +14 -0
  50. package/dist/esm/adapters/REST/endpoints/resource-type.js +24 -0
  51. package/dist/esm/adapters/REST/endpoints/resource.js +8 -0
  52. package/dist/esm/adapters/REST/endpoints/role.js +40 -0
  53. package/dist/esm/adapters/REST/endpoints/scheduled-action.js +38 -0
  54. package/dist/esm/adapters/REST/endpoints/snapshot.js +25 -0
  55. package/dist/esm/adapters/REST/endpoints/space-member.js +8 -0
  56. package/dist/esm/adapters/REST/endpoints/space-membership.js +51 -0
  57. package/dist/esm/adapters/REST/endpoints/space.js +27 -0
  58. package/dist/esm/adapters/REST/endpoints/tag.js +31 -0
  59. package/dist/esm/adapters/REST/endpoints/task.js +33 -0
  60. package/dist/esm/adapters/REST/endpoints/team-membership.js +28 -0
  61. package/dist/esm/adapters/REST/endpoints/team-space-membership.js +38 -0
  62. package/dist/esm/adapters/REST/endpoints/team.js +29 -0
  63. package/dist/esm/adapters/REST/endpoints/ui-config.js +19 -0
  64. package/dist/esm/adapters/REST/endpoints/upload-credentials.js +14 -0
  65. package/dist/esm/adapters/REST/endpoints/upload.js +38 -0
  66. package/dist/esm/adapters/REST/endpoints/usage.js +14 -0
  67. package/dist/esm/adapters/REST/endpoints/user-ui-config.js +19 -0
  68. package/dist/esm/adapters/REST/endpoints/user.js +21 -0
  69. package/dist/esm/adapters/REST/endpoints/utils.js +17 -0
  70. package/dist/esm/adapters/REST/endpoints/webhook.js +82 -0
  71. package/dist/esm/adapters/REST/endpoints/workflow-definition.js +35 -0
  72. package/dist/esm/adapters/REST/endpoints/workflow.js +42 -0
  73. package/dist/esm/adapters/REST/endpoints/workflows-changelog.js +9 -0
  74. package/dist/esm/adapters/REST/make-request.js +17 -0
  75. package/dist/esm/adapters/REST/rest-adapter.js +30 -0
  76. package/dist/esm/common-types.js +6 -0
  77. package/dist/esm/common-utils.js +32 -0
  78. package/dist/esm/constants/editor-interface-defaults/controls-defaults.js +153 -0
  79. package/dist/esm/constants/editor-interface-defaults/editors-defaults.js +37 -0
  80. package/dist/esm/constants/editor-interface-defaults/index.js +12 -0
  81. package/dist/esm/constants/editor-interface-defaults/sidebar-defaults.js +68 -0
  82. package/dist/esm/constants/editor-interface-defaults/types.js +15 -0
  83. package/dist/esm/create-adapter.js +19 -0
  84. package/dist/esm/create-app-definition-api.js +252 -0
  85. package/dist/esm/create-contentful-api.js +590 -0
  86. package/dist/esm/create-entry-api.js +479 -0
  87. package/dist/esm/create-environment-api.js +2401 -0
  88. package/dist/esm/create-environment-template-api.js +268 -0
  89. package/dist/esm/create-organization-api.js +1134 -0
  90. package/dist/esm/create-space-api.js +1589 -0
  91. package/dist/esm/create-ui-config-api.js +53 -0
  92. package/dist/esm/create-user-ui-config-api.js +53 -0
  93. package/dist/{es-modules → esm}/enhance-with-methods.js +13 -11
  94. package/dist/esm/entities/access-token.js +33 -0
  95. package/dist/esm/entities/ai-action-invocation.js +42 -0
  96. package/dist/esm/entities/ai-action.js +91 -0
  97. package/dist/esm/entities/api-key.js +56 -0
  98. package/dist/esm/entities/app-access-token.js +15 -0
  99. package/dist/esm/entities/app-action-call.js +61 -0
  100. package/dist/esm/entities/app-action.js +45 -0
  101. package/dist/esm/entities/app-bundle.js +45 -0
  102. package/dist/esm/entities/app-definition.js +26 -0
  103. package/dist/esm/entities/app-details.js +37 -0
  104. package/dist/esm/entities/app-event-subscription.js +32 -0
  105. package/dist/esm/entities/app-installation.js +52 -0
  106. package/dist/esm/entities/app-key.js +41 -0
  107. package/dist/{es-modules → esm}/entities/app-signed-request.js +7 -4
  108. package/dist/esm/entities/app-signing-secret.js +32 -0
  109. package/dist/esm/entities/app-upload.js +44 -0
  110. package/dist/{es-modules → esm}/entities/asset-key.js +7 -4
  111. package/dist/esm/entities/asset.js +121 -0
  112. package/dist/esm/entities/bulk-action.js +58 -0
  113. package/dist/esm/entities/comment.js +57 -0
  114. package/dist/esm/entities/concept-scheme.js +1 -0
  115. package/dist/esm/entities/concept.js +1 -0
  116. package/dist/esm/entities/content-type.js +117 -0
  117. package/dist/esm/entities/editor-interface.js +47 -0
  118. package/dist/esm/entities/entry.js +24 -0
  119. package/dist/esm/entities/environment-alias.js +55 -0
  120. package/dist/esm/entities/environment-template-installation.js +20 -0
  121. package/dist/esm/entities/environment-template.js +15 -0
  122. package/dist/esm/entities/environment.js +31 -0
  123. package/dist/esm/entities/extension.js +51 -0
  124. package/dist/{es-modules → esm}/entities/function-log.js +9 -7
  125. package/dist/esm/entities/function.js +63 -0
  126. package/dist/esm/entities/index.js +129 -0
  127. package/dist/esm/entities/locale.js +54 -0
  128. package/dist/esm/entities/oauth-application.js +63 -0
  129. package/dist/esm/entities/organization-invitation.js +15 -0
  130. package/dist/esm/entities/organization-membership.js +50 -0
  131. package/dist/esm/entities/organization.js +29 -0
  132. package/dist/esm/entities/personal-access-token.js +33 -0
  133. package/dist/esm/entities/preview-api-key.js +28 -0
  134. package/dist/esm/entities/release-action.js +52 -0
  135. package/dist/esm/entities/release.js +107 -0
  136. package/dist/esm/entities/resource-provider.js +137 -0
  137. package/dist/esm/entities/resource-type.js +94 -0
  138. package/dist/esm/entities/resource.js +10 -0
  139. package/dist/esm/entities/role.js +50 -0
  140. package/dist/esm/entities/scheduled-action.js +148 -0
  141. package/dist/esm/entities/snapshot.js +33 -0
  142. package/dist/esm/entities/space-member.js +20 -0
  143. package/dist/esm/entities/space-membership.js +50 -0
  144. package/dist/esm/entities/space.js +30 -0
  145. package/dist/esm/entities/tag.js +50 -0
  146. package/dist/esm/entities/task.js +51 -0
  147. package/dist/esm/entities/team-membership.js +51 -0
  148. package/dist/esm/entities/team-space-membership.js +50 -0
  149. package/dist/esm/entities/team.js +50 -0
  150. package/dist/esm/entities/ui-config.js +18 -0
  151. package/dist/esm/entities/upload.js +36 -0
  152. package/dist/esm/entities/usage.js +22 -0
  153. package/dist/esm/entities/user-ui-config.js +18 -0
  154. package/dist/esm/entities/user.js +25 -0
  155. package/dist/esm/entities/webhook.js +74 -0
  156. package/dist/esm/entities/workflow-definition.js +73 -0
  157. package/dist/esm/index.js +36 -0
  158. package/dist/esm/methods/action.js +49 -0
  159. package/dist/esm/methods/content-type.js +49 -0
  160. package/dist/esm/methods/utils.js +9 -0
  161. package/dist/esm/plain/as-iterator.js +30 -0
  162. package/dist/esm/plain/checks.js +10 -0
  163. package/dist/esm/plain/pagination-helper.js +54 -0
  164. package/dist/esm/plain/plain-client.js +514 -0
  165. package/dist/esm/plain/wrappers/wrap.js +24 -0
  166. package/dist/esm/upload-http-client.js +15 -0
  167. package/dist/stats-browser-min.html +4842 -0
  168. package/dist/{typings → types}/adapters/REST/endpoints/concept-scheme.d.ts +0 -1
  169. package/dist/{typings → types}/adapters/REST/endpoints/concept.d.ts +0 -1
  170. package/dist/{typings → types}/common-types.d.ts +22 -39
  171. package/dist/{typings → types}/create-contentful-api.d.ts +3 -2
  172. package/dist/{typings → types}/create-environment-api.d.ts +3 -3
  173. package/dist/{typings → types}/create-organization-api.d.ts +90 -90
  174. package/dist/{typings → types}/create-ui-config-api.d.ts +1 -1
  175. package/dist/{typings → types}/create-user-ui-config-api.d.ts +1 -1
  176. package/dist/{typings → types}/entities/access-token.d.ts +3 -3
  177. package/dist/{typings → types}/entities/ai-action-invocation.d.ts +4 -4
  178. package/dist/{typings → types}/entities/ai-action.d.ts +4 -21
  179. package/dist/{typings → types}/entities/api-key.d.ts +4 -8
  180. package/dist/{typings → types}/entities/app-access-token.d.ts +5 -5
  181. package/dist/{typings → types}/entities/app-action-call.d.ts +6 -6
  182. package/dist/{typings → types}/entities/app-action.d.ts +4 -4
  183. package/dist/{typings → types}/entities/app-bundle.d.ts +4 -4
  184. package/dist/{typings → types}/entities/app-definition.d.ts +3 -3
  185. package/dist/{typings → types}/entities/app-details.d.ts +4 -4
  186. package/dist/{typings → types}/entities/app-event-subscription.d.ts +4 -4
  187. package/dist/{typings → types}/entities/app-installation.d.ts +6 -6
  188. package/dist/{typings → types}/entities/app-key.d.ts +4 -4
  189. package/dist/{typings → types}/entities/app-signed-request.d.ts +5 -5
  190. package/dist/{typings → types}/entities/app-signing-secret.d.ts +4 -4
  191. package/dist/{typings → types}/entities/app-upload.d.ts +3 -3
  192. package/dist/{typings → types}/entities/asset.d.ts +1 -2
  193. package/dist/{typings → types}/entities/comment.d.ts +4 -4
  194. package/dist/{typings → types}/entities/content-type.d.ts +4 -4
  195. package/dist/{typings → types}/entities/editor-interface.d.ts +5 -11
  196. package/dist/{typings → types}/entities/entry.d.ts +5 -1
  197. package/dist/{typings → types}/entities/environment-alias.d.ts +4 -6
  198. package/dist/{typings → types}/entities/environment-template-installation.d.ts +1 -1
  199. package/dist/{typings → types}/entities/environment-template.d.ts +1 -1
  200. package/dist/{typings → types}/entities/environment.d.ts +6 -6
  201. package/dist/{typings → types}/entities/extension.d.ts +4 -4
  202. package/dist/{typings → types}/entities/locale.d.ts +4 -4
  203. package/dist/{typings → types}/entities/oauth-application.d.ts +1 -1
  204. package/dist/{typings → types}/entities/organization-invitation.d.ts +3 -5
  205. package/dist/{typings → types}/entities/organization-membership.d.ts +3 -5
  206. package/dist/{typings → types}/entities/organization.d.ts +1 -1
  207. package/dist/{typings → types}/entities/personal-access-token.d.ts +1 -1
  208. package/dist/{typings → types}/entities/preview-api-key.d.ts +1 -1
  209. package/dist/{typings → types}/entities/resource-provider.d.ts +5 -5
  210. package/dist/{typings → types}/entities/resource-type.d.ts +5 -5
  211. package/dist/{typings → types}/entities/resource.d.ts +4 -4
  212. package/dist/{typings → types}/entities/role.d.ts +3 -3
  213. package/dist/{typings → types}/entities/scheduled-action.d.ts +3 -5
  214. package/dist/{typings → types}/entities/snapshot.d.ts +1 -1
  215. package/dist/{typings → types}/entities/space-member.d.ts +3 -5
  216. package/dist/{typings → types}/entities/space-membership.d.ts +6 -6
  217. package/dist/{typings → types}/entities/space.d.ts +1 -1
  218. package/dist/{typings → types}/entities/tag.d.ts +4 -4
  219. package/dist/{typings → types}/entities/task.d.ts +4 -4
  220. package/dist/{typings → types}/entities/team-membership.d.ts +5 -11
  221. package/dist/{typings → types}/entities/team-space-membership.d.ts +5 -11
  222. package/dist/{typings → types}/entities/team.d.ts +3 -5
  223. package/dist/{typings → types}/entities/ui-config.d.ts +5 -5
  224. package/dist/{typings → types}/entities/upload-credential.d.ts +4 -4
  225. package/dist/{typings → types}/entities/upload.d.ts +4 -4
  226. package/dist/{typings → types}/entities/usage.d.ts +7 -7
  227. package/dist/{typings → types}/entities/user-ui-config.d.ts +5 -5
  228. package/dist/{typings → types}/entities/user.d.ts +1 -1
  229. package/dist/{typings → types}/entities/webhook.d.ts +10 -16
  230. package/dist/{typings → types}/entities/workflow-definition.d.ts +4 -4
  231. package/dist/{typings → types}/entities/workflow.d.ts +6 -6
  232. package/dist/{typings → types}/entities/workflows-changelog-entry.d.ts +2 -2
  233. package/dist/{typings → types}/export-types.d.ts +1 -1
  234. package/dist/{typings/contentful-management.d.ts → types/index.d.ts} +1 -1
  235. package/dist/types/plain/checks.d.ts +13 -0
  236. package/dist/{typings → types}/plain/common-types.d.ts +3 -2
  237. package/dist/{typings → types}/plain/entities/concept-scheme.d.ts +3 -20
  238. package/dist/{typings → types}/plain/entities/concept.d.ts +4 -21
  239. package/dist/{typings → types}/plain/entities/upload-credential.d.ts +1 -1
  240. package/package.json +49 -45
  241. package/dist/contentful-management.browser.js.map +0 -1
  242. package/dist/contentful-management.node.js +0 -32624
  243. package/dist/contentful-management.node.js.map +0 -1
  244. package/dist/contentful-management.node.min.js +0 -2
  245. package/dist/es-modules/adapters/REST/endpoints/ai-action-invocation.js +0 -6
  246. package/dist/es-modules/adapters/REST/endpoints/ai-action.js +0 -61
  247. package/dist/es-modules/adapters/REST/endpoints/api-key.js +0 -47
  248. package/dist/es-modules/adapters/REST/endpoints/app-access-token.js +0 -8
  249. package/dist/es-modules/adapters/REST/endpoints/app-action-call.js +0 -69
  250. package/dist/es-modules/adapters/REST/endpoints/app-action.js +0 -32
  251. package/dist/es-modules/adapters/REST/endpoints/app-bundle.js +0 -36
  252. package/dist/es-modules/adapters/REST/endpoints/app-definition.js +0 -45
  253. package/dist/es-modules/adapters/REST/endpoints/app-details.js +0 -10
  254. package/dist/es-modules/adapters/REST/endpoints/app-event-subscription.js +0 -10
  255. package/dist/es-modules/adapters/REST/endpoints/app-installation.js +0 -39
  256. package/dist/es-modules/adapters/REST/endpoints/app-key.js +0 -13
  257. package/dist/es-modules/adapters/REST/endpoints/app-signed-request.js +0 -4
  258. package/dist/es-modules/adapters/REST/endpoints/app-signing-secret.js +0 -10
  259. package/dist/es-modules/adapters/REST/endpoints/app-upload.js +0 -23
  260. package/dist/es-modules/adapters/REST/endpoints/asset-key.js +0 -33
  261. package/dist/es-modules/adapters/REST/endpoints/asset.js +0 -220
  262. package/dist/es-modules/adapters/REST/endpoints/bulk-action.js +0 -13
  263. package/dist/es-modules/adapters/REST/endpoints/comment.js +0 -101
  264. package/dist/es-modules/adapters/REST/endpoints/concept-scheme.js +0 -52
  265. package/dist/es-modules/adapters/REST/endpoints/concept.js +0 -85
  266. package/dist/es-modules/adapters/REST/endpoints/content-type.js +0 -61
  267. package/dist/es-modules/adapters/REST/endpoints/editor-interface.js +0 -24
  268. package/dist/es-modules/adapters/REST/endpoints/entry.js +0 -113
  269. package/dist/es-modules/adapters/REST/endpoints/environment-alias.js +0 -46
  270. package/dist/es-modules/adapters/REST/endpoints/environment-template-installation.js +0 -43
  271. package/dist/es-modules/adapters/REST/endpoints/environment-template.js +0 -88
  272. package/dist/es-modules/adapters/REST/endpoints/environment.js +0 -42
  273. package/dist/es-modules/adapters/REST/endpoints/extension.js +0 -44
  274. package/dist/es-modules/adapters/REST/endpoints/function-log.js +0 -22
  275. package/dist/es-modules/adapters/REST/endpoints/function.js +0 -20
  276. package/dist/es-modules/adapters/REST/endpoints/http.js +0 -39
  277. package/dist/es-modules/adapters/REST/endpoints/index.js +0 -134
  278. package/dist/es-modules/adapters/REST/endpoints/locale.js +0 -35
  279. package/dist/es-modules/adapters/REST/endpoints/organization-invitation.js +0 -22
  280. package/dist/es-modules/adapters/REST/endpoints/organization-membership.js +0 -35
  281. package/dist/es-modules/adapters/REST/endpoints/organization.js +0 -26
  282. package/dist/es-modules/adapters/REST/endpoints/personal-access-token.js +0 -33
  283. package/dist/es-modules/adapters/REST/endpoints/preview-api-key.js +0 -9
  284. package/dist/es-modules/adapters/REST/endpoints/raw.js +0 -42
  285. package/dist/es-modules/adapters/REST/endpoints/release-action.js +0 -21
  286. package/dist/es-modules/adapters/REST/endpoints/release.js +0 -58
  287. package/dist/es-modules/adapters/REST/endpoints/resource-provider.js +0 -13
  288. package/dist/es-modules/adapters/REST/endpoints/resource-type.js +0 -23
  289. package/dist/es-modules/adapters/REST/endpoints/resource.js +0 -5
  290. package/dist/es-modules/adapters/REST/endpoints/role.js +0 -44
  291. package/dist/es-modules/adapters/REST/endpoints/scheduled-action.js +0 -35
  292. package/dist/es-modules/adapters/REST/endpoints/snapshot.js +0 -22
  293. package/dist/es-modules/adapters/REST/endpoints/space-member.js +0 -5
  294. package/dist/es-modules/adapters/REST/endpoints/space-membership.js +0 -55
  295. package/dist/es-modules/adapters/REST/endpoints/space.js +0 -32
  296. package/dist/es-modules/adapters/REST/endpoints/tag.js +0 -46
  297. package/dist/es-modules/adapters/REST/endpoints/task.js +0 -47
  298. package/dist/es-modules/adapters/REST/endpoints/team-membership.js +0 -34
  299. package/dist/es-modules/adapters/REST/endpoints/team-space-membership.js +0 -45
  300. package/dist/es-modules/adapters/REST/endpoints/team.js +0 -35
  301. package/dist/es-modules/adapters/REST/endpoints/ui-config.js +0 -16
  302. package/dist/es-modules/adapters/REST/endpoints/upload-credentials.js +0 -11
  303. package/dist/es-modules/adapters/REST/endpoints/upload.js +0 -37
  304. package/dist/es-modules/adapters/REST/endpoints/usage.js +0 -11
  305. package/dist/es-modules/adapters/REST/endpoints/user-ui-config.js +0 -16
  306. package/dist/es-modules/adapters/REST/endpoints/user.js +0 -20
  307. package/dist/es-modules/adapters/REST/endpoints/utils.js +0 -28
  308. package/dist/es-modules/adapters/REST/endpoints/webhook.js +0 -93
  309. package/dist/es-modules/adapters/REST/endpoints/workflow-definition.js +0 -46
  310. package/dist/es-modules/adapters/REST/endpoints/workflow.js +0 -59
  311. package/dist/es-modules/adapters/REST/endpoints/workflows-changelog.js +0 -6
  312. package/dist/es-modules/adapters/REST/make-request.js +0 -28
  313. package/dist/es-modules/adapters/REST/rest-adapter.js +0 -42
  314. package/dist/es-modules/adapters/REST/types.js +0 -1
  315. package/dist/es-modules/common-types.js +0 -61
  316. package/dist/es-modules/common-utils.js +0 -30
  317. package/dist/es-modules/constants/editor-interface-defaults/controls-defaults.js +0 -255
  318. package/dist/es-modules/constants/editor-interface-defaults/editors-defaults.js +0 -34
  319. package/dist/es-modules/constants/editor-interface-defaults/index.js +0 -9
  320. package/dist/es-modules/constants/editor-interface-defaults/sidebar-defaults.js +0 -57
  321. package/dist/es-modules/constants/editor-interface-defaults/types.js +0 -14
  322. package/dist/es-modules/contentful-management.js +0 -66
  323. package/dist/es-modules/create-adapter.js +0 -16
  324. package/dist/es-modules/create-app-definition-api.js +0 -263
  325. package/dist/es-modules/create-contentful-api.js +0 -663
  326. package/dist/es-modules/create-entry-api.js +0 -548
  327. package/dist/es-modules/create-environment-api.js +0 -2525
  328. package/dist/es-modules/create-environment-template-api.js +0 -316
  329. package/dist/es-modules/create-organization-api.js +0 -1306
  330. package/dist/es-modules/create-space-api.js +0 -1750
  331. package/dist/es-modules/create-ui-config-api.js +0 -60
  332. package/dist/es-modules/create-user-ui-config-api.js +0 -60
  333. package/dist/es-modules/entities/access-token.js +0 -38
  334. package/dist/es-modules/entities/ai-action-invocation.js +0 -46
  335. package/dist/es-modules/entities/ai-action.js +0 -88
  336. package/dist/es-modules/entities/api-key.js +0 -55
  337. package/dist/es-modules/entities/app-access-token.js +0 -12
  338. package/dist/es-modules/entities/app-action-call.js +0 -70
  339. package/dist/es-modules/entities/app-action.js +0 -53
  340. package/dist/es-modules/entities/app-bundle.js +0 -44
  341. package/dist/es-modules/entities/app-definition.js +0 -24
  342. package/dist/es-modules/entities/app-details.js +0 -35
  343. package/dist/es-modules/entities/app-event-subscription.js +0 -30
  344. package/dist/es-modules/entities/app-installation.js +0 -51
  345. package/dist/es-modules/entities/app-key.js +0 -40
  346. package/dist/es-modules/entities/app-signing-secret.js +0 -30
  347. package/dist/es-modules/entities/app-upload.js +0 -43
  348. package/dist/es-modules/entities/asset.js +0 -131
  349. package/dist/es-modules/entities/bulk-action.js +0 -61
  350. package/dist/es-modules/entities/comment.js +0 -77
  351. package/dist/es-modules/entities/concept-scheme.js +0 -1
  352. package/dist/es-modules/entities/concept.js +0 -1
  353. package/dist/es-modules/entities/content-type-fields.js +0 -1
  354. package/dist/es-modules/entities/content-type.js +0 -146
  355. package/dist/es-modules/entities/editor-interface.js +0 -46
  356. package/dist/es-modules/entities/entry.js +0 -22
  357. package/dist/es-modules/entities/environment-alias.js +0 -54
  358. package/dist/es-modules/entities/environment-template-installation.js +0 -17
  359. package/dist/es-modules/entities/environment-template.js +0 -12
  360. package/dist/es-modules/entities/environment.js +0 -29
  361. package/dist/es-modules/entities/extension.js +0 -50
  362. package/dist/es-modules/entities/field-type.js +0 -1
  363. package/dist/es-modules/entities/function.js +0 -61
  364. package/dist/es-modules/entities/index.js +0 -126
  365. package/dist/es-modules/entities/locale.js +0 -53
  366. package/dist/es-modules/entities/oauth-application.js +0 -62
  367. package/dist/es-modules/entities/organization-invitation.js +0 -12
  368. package/dist/es-modules/entities/organization-membership.js +0 -49
  369. package/dist/es-modules/entities/organization.js +0 -32
  370. package/dist/es-modules/entities/personal-access-token.js +0 -38
  371. package/dist/es-modules/entities/preview-api-key.js +0 -27
  372. package/dist/es-modules/entities/release-action.js +0 -53
  373. package/dist/es-modules/entities/release.js +0 -105
  374. package/dist/es-modules/entities/resource-provider.js +0 -139
  375. package/dist/es-modules/entities/resource-type.js +0 -93
  376. package/dist/es-modules/entities/resource.js +0 -7
  377. package/dist/es-modules/entities/role.js +0 -49
  378. package/dist/es-modules/entities/scheduled-action.js +0 -155
  379. package/dist/es-modules/entities/snapshot.js +0 -31
  380. package/dist/es-modules/entities/space-member.js +0 -18
  381. package/dist/es-modules/entities/space-membership.js +0 -49
  382. package/dist/es-modules/entities/space.js +0 -28
  383. package/dist/es-modules/entities/tag.js +0 -56
  384. package/dist/es-modules/entities/task.js +0 -57
  385. package/dist/es-modules/entities/team-membership.js +0 -50
  386. package/dist/es-modules/entities/team-space-membership.js +0 -49
  387. package/dist/es-modules/entities/team.js +0 -49
  388. package/dist/es-modules/entities/ui-config.js +0 -15
  389. package/dist/es-modules/entities/upload-credential.js +0 -33
  390. package/dist/es-modules/entities/upload.js +0 -34
  391. package/dist/es-modules/entities/usage.js +0 -20
  392. package/dist/es-modules/entities/user-ui-config.js +0 -15
  393. package/dist/es-modules/entities/user.js +0 -23
  394. package/dist/es-modules/entities/utils.js +0 -1
  395. package/dist/es-modules/entities/webhook.js +0 -80
  396. package/dist/es-modules/entities/widget-parameters.js +0 -1
  397. package/dist/es-modules/entities/workflow-definition.js +0 -87
  398. package/dist/es-modules/entities/workflow.js +0 -76
  399. package/dist/es-modules/entities/workflows-changelog-entry.js +0 -24
  400. package/dist/es-modules/export-types.js +0 -3
  401. package/dist/es-modules/methods/action.js +0 -54
  402. package/dist/es-modules/methods/bulk-action.js +0 -15
  403. package/dist/es-modules/methods/content-type.js +0 -47
  404. package/dist/es-modules/methods/release-action.js +0 -17
  405. package/dist/es-modules/methods/utils.js +0 -7
  406. package/dist/es-modules/plain/as-iterator.js +0 -47
  407. package/dist/es-modules/plain/checks.js +0 -8
  408. package/dist/es-modules/plain/common-types.js +0 -1
  409. package/dist/es-modules/plain/entities/ai-action-invocation.js +0 -1
  410. package/dist/es-modules/plain/entities/ai-action.js +0 -1
  411. package/dist/es-modules/plain/entities/app-access-token.js +0 -1
  412. package/dist/es-modules/plain/entities/app-action-call.js +0 -1
  413. package/dist/es-modules/plain/entities/app-action.js +0 -1
  414. package/dist/es-modules/plain/entities/app-bundle.js +0 -1
  415. package/dist/es-modules/plain/entities/app-definition.js +0 -1
  416. package/dist/es-modules/plain/entities/app-details.js +0 -1
  417. package/dist/es-modules/plain/entities/app-event-subscription.js +0 -1
  418. package/dist/es-modules/plain/entities/app-installation.js +0 -1
  419. package/dist/es-modules/plain/entities/app-key.js +0 -1
  420. package/dist/es-modules/plain/entities/app-signed-request.js +0 -1
  421. package/dist/es-modules/plain/entities/app-signing-secret.js +0 -1
  422. package/dist/es-modules/plain/entities/app-upload.js +0 -1
  423. package/dist/es-modules/plain/entities/comment.js +0 -1
  424. package/dist/es-modules/plain/entities/concept-scheme.js +0 -1
  425. package/dist/es-modules/plain/entities/concept.js +0 -1
  426. package/dist/es-modules/plain/entities/editor-interface.js +0 -1
  427. package/dist/es-modules/plain/entities/environment-alias.js +0 -1
  428. package/dist/es-modules/plain/entities/environment.js +0 -1
  429. package/dist/es-modules/plain/entities/extension.js +0 -1
  430. package/dist/es-modules/plain/entities/function-log.js +0 -1
  431. package/dist/es-modules/plain/entities/function.js +0 -1
  432. package/dist/es-modules/plain/entities/locale.js +0 -1
  433. package/dist/es-modules/plain/entities/oauth-application.js +0 -1
  434. package/dist/es-modules/plain/entities/organization.js +0 -1
  435. package/dist/es-modules/plain/entities/resource-provider.js +0 -1
  436. package/dist/es-modules/plain/entities/resource-type.js +0 -1
  437. package/dist/es-modules/plain/entities/resource.js +0 -1
  438. package/dist/es-modules/plain/entities/role.js +0 -1
  439. package/dist/es-modules/plain/entities/space-member.js +0 -1
  440. package/dist/es-modules/plain/entities/space-membership.js +0 -1
  441. package/dist/es-modules/plain/entities/space.js +0 -1
  442. package/dist/es-modules/plain/entities/tag.js +0 -1
  443. package/dist/es-modules/plain/entities/task.js +0 -1
  444. package/dist/es-modules/plain/entities/team-membership.js +0 -1
  445. package/dist/es-modules/plain/entities/team-space-membership.js +0 -1
  446. package/dist/es-modules/plain/entities/team.js +0 -1
  447. package/dist/es-modules/plain/entities/ui-config.js +0 -1
  448. package/dist/es-modules/plain/entities/upload-credential.js +0 -1
  449. package/dist/es-modules/plain/entities/upload.js +0 -1
  450. package/dist/es-modules/plain/entities/usage.js +0 -1
  451. package/dist/es-modules/plain/entities/user-ui-config.js +0 -1
  452. package/dist/es-modules/plain/entities/user.js +0 -1
  453. package/dist/es-modules/plain/entities/webhook.js +0 -1
  454. package/dist/es-modules/plain/entities/workflow-definition.js +0 -1
  455. package/dist/es-modules/plain/entities/workflow.js +0 -1
  456. package/dist/es-modules/plain/entities/workflows-changelog.js +0 -1
  457. package/dist/es-modules/plain/pagination-helper.js +0 -76
  458. package/dist/es-modules/plain/plain-client.js +0 -544
  459. package/dist/es-modules/plain/wrappers/wrap.js +0 -46
  460. package/dist/es-modules/plain/wrappers/wrap.test-d.js +0 -15
  461. package/dist/es-modules/upload-http-client.js +0 -17
  462. package/dist/typings/plain/checks.d.ts +0 -13
  463. /package/dist/{typings → types}/adapters/REST/endpoints/access-token.d.ts +0 -0
  464. /package/dist/{typings → types}/adapters/REST/endpoints/ai-action-invocation.d.ts +0 -0
  465. /package/dist/{typings → types}/adapters/REST/endpoints/ai-action.d.ts +0 -0
  466. /package/dist/{typings → types}/adapters/REST/endpoints/api-key.d.ts +0 -0
  467. /package/dist/{typings → types}/adapters/REST/endpoints/app-access-token.d.ts +0 -0
  468. /package/dist/{typings → types}/adapters/REST/endpoints/app-action-call.d.ts +0 -0
  469. /package/dist/{typings → types}/adapters/REST/endpoints/app-action.d.ts +0 -0
  470. /package/dist/{typings → types}/adapters/REST/endpoints/app-bundle.d.ts +0 -0
  471. /package/dist/{typings → types}/adapters/REST/endpoints/app-definition.d.ts +0 -0
  472. /package/dist/{typings → types}/adapters/REST/endpoints/app-details.d.ts +0 -0
  473. /package/dist/{typings → types}/adapters/REST/endpoints/app-event-subscription.d.ts +0 -0
  474. /package/dist/{typings → types}/adapters/REST/endpoints/app-installation.d.ts +0 -0
  475. /package/dist/{typings → types}/adapters/REST/endpoints/app-key.d.ts +0 -0
  476. /package/dist/{typings → types}/adapters/REST/endpoints/app-signed-request.d.ts +0 -0
  477. /package/dist/{typings → types}/adapters/REST/endpoints/app-signing-secret.d.ts +0 -0
  478. /package/dist/{typings → types}/adapters/REST/endpoints/app-upload.d.ts +0 -0
  479. /package/dist/{typings → types}/adapters/REST/endpoints/asset-key.d.ts +0 -0
  480. /package/dist/{typings → types}/adapters/REST/endpoints/asset.d.ts +0 -0
  481. /package/dist/{typings → types}/adapters/REST/endpoints/bulk-action.d.ts +0 -0
  482. /package/dist/{typings → types}/adapters/REST/endpoints/comment.d.ts +0 -0
  483. /package/dist/{typings → types}/adapters/REST/endpoints/content-type.d.ts +0 -0
  484. /package/dist/{typings → types}/adapters/REST/endpoints/editor-interface.d.ts +0 -0
  485. /package/dist/{typings → types}/adapters/REST/endpoints/entry.d.ts +0 -0
  486. /package/dist/{typings → types}/adapters/REST/endpoints/environment-alias.d.ts +0 -0
  487. /package/dist/{typings → types}/adapters/REST/endpoints/environment-template-installation.d.ts +0 -0
  488. /package/dist/{typings → types}/adapters/REST/endpoints/environment-template.d.ts +0 -0
  489. /package/dist/{typings → types}/adapters/REST/endpoints/environment.d.ts +0 -0
  490. /package/dist/{typings → types}/adapters/REST/endpoints/extension.d.ts +0 -0
  491. /package/dist/{typings → types}/adapters/REST/endpoints/function-log.d.ts +0 -0
  492. /package/dist/{typings → types}/adapters/REST/endpoints/function.d.ts +0 -0
  493. /package/dist/{typings → types}/adapters/REST/endpoints/http.d.ts +0 -0
  494. /package/dist/{typings → types}/adapters/REST/endpoints/index.d.ts +0 -0
  495. /package/dist/{typings → types}/adapters/REST/endpoints/locale.d.ts +0 -0
  496. /package/dist/{typings → types}/adapters/REST/endpoints/oauth-application.d.ts +0 -0
  497. /package/dist/{typings → types}/adapters/REST/endpoints/organization-invitation.d.ts +0 -0
  498. /package/dist/{typings → types}/adapters/REST/endpoints/organization-membership.d.ts +0 -0
  499. /package/dist/{typings → types}/adapters/REST/endpoints/organization.d.ts +0 -0
  500. /package/dist/{typings → types}/adapters/REST/endpoints/personal-access-token.d.ts +0 -0
  501. /package/dist/{typings → types}/adapters/REST/endpoints/preview-api-key.d.ts +0 -0
  502. /package/dist/{typings → types}/adapters/REST/endpoints/raw.d.ts +0 -0
  503. /package/dist/{typings → types}/adapters/REST/endpoints/release-action.d.ts +0 -0
  504. /package/dist/{typings → types}/adapters/REST/endpoints/release.d.ts +0 -0
  505. /package/dist/{typings → types}/adapters/REST/endpoints/resource-provider.d.ts +0 -0
  506. /package/dist/{typings → types}/adapters/REST/endpoints/resource-type.d.ts +0 -0
  507. /package/dist/{typings → types}/adapters/REST/endpoints/resource.d.ts +0 -0
  508. /package/dist/{typings → types}/adapters/REST/endpoints/role.d.ts +0 -0
  509. /package/dist/{typings → types}/adapters/REST/endpoints/scheduled-action.d.ts +0 -0
  510. /package/dist/{typings → types}/adapters/REST/endpoints/snapshot.d.ts +0 -0
  511. /package/dist/{typings → types}/adapters/REST/endpoints/space-member.d.ts +0 -0
  512. /package/dist/{typings → types}/adapters/REST/endpoints/space-membership.d.ts +0 -0
  513. /package/dist/{typings → types}/adapters/REST/endpoints/space.d.ts +0 -0
  514. /package/dist/{typings → types}/adapters/REST/endpoints/tag.d.ts +0 -0
  515. /package/dist/{typings → types}/adapters/REST/endpoints/task.d.ts +0 -0
  516. /package/dist/{typings → types}/adapters/REST/endpoints/team-membership.d.ts +0 -0
  517. /package/dist/{typings → types}/adapters/REST/endpoints/team-space-membership.d.ts +0 -0
  518. /package/dist/{typings → types}/adapters/REST/endpoints/team.d.ts +0 -0
  519. /package/dist/{typings → types}/adapters/REST/endpoints/ui-config.d.ts +0 -0
  520. /package/dist/{typings → types}/adapters/REST/endpoints/upload-credentials.d.ts +0 -0
  521. /package/dist/{typings → types}/adapters/REST/endpoints/upload.d.ts +0 -0
  522. /package/dist/{typings → types}/adapters/REST/endpoints/usage.d.ts +0 -0
  523. /package/dist/{typings → types}/adapters/REST/endpoints/user-ui-config.d.ts +0 -0
  524. /package/dist/{typings → types}/adapters/REST/endpoints/user.d.ts +0 -0
  525. /package/dist/{typings → types}/adapters/REST/endpoints/utils.d.ts +0 -0
  526. /package/dist/{typings → types}/adapters/REST/endpoints/webhook.d.ts +0 -0
  527. /package/dist/{typings → types}/adapters/REST/endpoints/workflow-definition.d.ts +0 -0
  528. /package/dist/{typings → types}/adapters/REST/endpoints/workflow.d.ts +0 -0
  529. /package/dist/{typings → types}/adapters/REST/endpoints/workflows-changelog.d.ts +0 -0
  530. /package/dist/{typings → types}/adapters/REST/make-request.d.ts +0 -0
  531. /package/dist/{typings → types}/adapters/REST/rest-adapter.d.ts +0 -0
  532. /package/dist/{typings → types}/adapters/REST/types.d.ts +0 -0
  533. /package/dist/{typings → types}/common-utils.d.ts +0 -0
  534. /package/dist/{typings → types}/constants/editor-interface-defaults/controls-defaults.d.ts +0 -0
  535. /package/dist/{typings → types}/constants/editor-interface-defaults/editors-defaults.d.ts +0 -0
  536. /package/dist/{typings → types}/constants/editor-interface-defaults/index.d.ts +0 -0
  537. /package/dist/{typings → types}/constants/editor-interface-defaults/sidebar-defaults.d.ts +0 -0
  538. /package/dist/{typings → types}/constants/editor-interface-defaults/types.d.ts +0 -0
  539. /package/dist/{typings → types}/create-adapter.d.ts +0 -0
  540. /package/dist/{typings → types}/create-app-definition-api.d.ts +0 -0
  541. /package/dist/{typings → types}/create-entry-api.d.ts +0 -0
  542. /package/dist/{typings → types}/create-environment-template-api.d.ts +0 -0
  543. /package/dist/{typings → types}/create-space-api.d.ts +0 -0
  544. /package/dist/{typings → types}/enhance-with-methods.d.ts +0 -0
  545. /package/dist/{typings → types}/entities/asset-key.d.ts +0 -0
  546. /package/dist/{typings → types}/entities/bulk-action.d.ts +0 -0
  547. /package/dist/{typings → types}/entities/concept-scheme.d.ts +0 -0
  548. /package/dist/{typings → types}/entities/concept.d.ts +0 -0
  549. /package/dist/{typings → types}/entities/content-type-fields.d.ts +0 -0
  550. /package/dist/{typings → types}/entities/field-type.d.ts +0 -0
  551. /package/dist/{typings → types}/entities/function-log.d.ts +0 -0
  552. /package/dist/{typings → types}/entities/function.d.ts +0 -0
  553. /package/dist/{typings → types}/entities/index.d.ts +0 -0
  554. /package/dist/{typings → types}/entities/release-action.d.ts +0 -0
  555. /package/dist/{typings → types}/entities/release.d.ts +0 -0
  556. /package/dist/{typings → types}/entities/utils.d.ts +0 -0
  557. /package/dist/{typings → types}/entities/widget-parameters.d.ts +0 -0
  558. /package/dist/{typings → types}/methods/action.d.ts +0 -0
  559. /package/dist/{typings → types}/methods/bulk-action.d.ts +0 -0
  560. /package/dist/{typings → types}/methods/content-type.d.ts +0 -0
  561. /package/dist/{typings → types}/methods/release-action.d.ts +0 -0
  562. /package/dist/{typings → types}/methods/utils.d.ts +0 -0
  563. /package/dist/{typings → types}/plain/as-iterator.d.ts +0 -0
  564. /package/dist/{typings → types}/plain/entities/ai-action-invocation.d.ts +0 -0
  565. /package/dist/{typings → types}/plain/entities/ai-action.d.ts +0 -0
  566. /package/dist/{typings → types}/plain/entities/app-access-token.d.ts +0 -0
  567. /package/dist/{typings → types}/plain/entities/app-action-call.d.ts +0 -0
  568. /package/dist/{typings → types}/plain/entities/app-action.d.ts +0 -0
  569. /package/dist/{typings → types}/plain/entities/app-bundle.d.ts +0 -0
  570. /package/dist/{typings → types}/plain/entities/app-definition.d.ts +0 -0
  571. /package/dist/{typings → types}/plain/entities/app-details.d.ts +0 -0
  572. /package/dist/{typings → types}/plain/entities/app-event-subscription.d.ts +0 -0
  573. /package/dist/{typings → types}/plain/entities/app-installation.d.ts +0 -0
  574. /package/dist/{typings → types}/plain/entities/app-key.d.ts +0 -0
  575. /package/dist/{typings → types}/plain/entities/app-signed-request.d.ts +0 -0
  576. /package/dist/{typings → types}/plain/entities/app-signing-secret.d.ts +0 -0
  577. /package/dist/{typings → types}/plain/entities/app-upload.d.ts +0 -0
  578. /package/dist/{typings → types}/plain/entities/comment.d.ts +0 -0
  579. /package/dist/{typings → types}/plain/entities/editor-interface.d.ts +0 -0
  580. /package/dist/{typings → types}/plain/entities/environment-alias.d.ts +0 -0
  581. /package/dist/{typings → types}/plain/entities/environment.d.ts +0 -0
  582. /package/dist/{typings → types}/plain/entities/extension.d.ts +0 -0
  583. /package/dist/{typings → types}/plain/entities/function-log.d.ts +0 -0
  584. /package/dist/{typings → types}/plain/entities/function.d.ts +0 -0
  585. /package/dist/{typings → types}/plain/entities/locale.d.ts +0 -0
  586. /package/dist/{typings → types}/plain/entities/oauth-application.d.ts +0 -0
  587. /package/dist/{typings → types}/plain/entities/organization.d.ts +0 -0
  588. /package/dist/{typings → types}/plain/entities/resource-provider.d.ts +0 -0
  589. /package/dist/{typings → types}/plain/entities/resource-type.d.ts +0 -0
  590. /package/dist/{typings → types}/plain/entities/resource.d.ts +0 -0
  591. /package/dist/{typings → types}/plain/entities/role.d.ts +0 -0
  592. /package/dist/{typings → types}/plain/entities/space-member.d.ts +0 -0
  593. /package/dist/{typings → types}/plain/entities/space-membership.d.ts +0 -0
  594. /package/dist/{typings → types}/plain/entities/space.d.ts +0 -0
  595. /package/dist/{typings → types}/plain/entities/tag.d.ts +0 -0
  596. /package/dist/{typings → types}/plain/entities/task.d.ts +0 -0
  597. /package/dist/{typings → types}/plain/entities/team-membership.d.ts +0 -0
  598. /package/dist/{typings → types}/plain/entities/team-space-membership.d.ts +0 -0
  599. /package/dist/{typings → types}/plain/entities/team.d.ts +0 -0
  600. /package/dist/{typings → types}/plain/entities/ui-config.d.ts +0 -0
  601. /package/dist/{typings → types}/plain/entities/upload.d.ts +0 -0
  602. /package/dist/{typings → types}/plain/entities/usage.d.ts +0 -0
  603. /package/dist/{typings → types}/plain/entities/user-ui-config.d.ts +0 -0
  604. /package/dist/{typings → types}/plain/entities/user.d.ts +0 -0
  605. /package/dist/{typings → types}/plain/entities/webhook.d.ts +0 -0
  606. /package/dist/{typings → types}/plain/entities/workflow-definition.d.ts +0 -0
  607. /package/dist/{typings → types}/plain/entities/workflow.d.ts +0 -0
  608. /package/dist/{typings → types}/plain/entities/workflows-changelog.d.ts +0 -0
  609. /package/dist/{typings → types}/plain/pagination-helper.d.ts +0 -0
  610. /package/dist/{typings → types}/plain/plain-client.d.ts +0 -0
  611. /package/dist/{typings → types}/plain/wrappers/wrap.d.ts +0 -0
  612. /package/dist/{typings → types}/plain/wrappers/wrap.test-d.d.ts +0 -0
  613. /package/dist/{typings → types}/upload-http-client.d.ts +0 -0
@@ -1,1750 +0,0 @@
1
- /**
2
- * Contentful Space API. Contains methods to access any operations at a space
3
- * level, such as creating and reading entities contained in a space.
4
- */
5
-
6
- import { createRequestConfig } from 'contentful-sdk-core';
7
- import entities from './entities';
8
-
9
- /**
10
- * @private
11
- */
12
-
13
- /**
14
- * Creates API object with methods to access the Space API
15
- * @param {MakeRequest} makeRequest - function to make requests via an adapter
16
- * @return {ContentfulSpaceAPI}
17
- * @private
18
- */
19
- export default function createSpaceApi(makeRequest) {
20
- const {
21
- wrapSpace
22
- } = entities.space;
23
- const {
24
- wrapEnvironment,
25
- wrapEnvironmentCollection
26
- } = entities.environment;
27
- const {
28
- wrapWebhook,
29
- wrapWebhookCollection
30
- } = entities.webhook;
31
- const {
32
- wrapRole,
33
- wrapRoleCollection
34
- } = entities.role;
35
- const {
36
- wrapUser,
37
- wrapUserCollection
38
- } = entities.user;
39
- const {
40
- wrapSpaceMember,
41
- wrapSpaceMemberCollection
42
- } = entities.spaceMember;
43
- const {
44
- wrapSpaceMembership,
45
- wrapSpaceMembershipCollection
46
- } = entities.spaceMembership;
47
- const {
48
- wrapTeamSpaceMembership,
49
- wrapTeamSpaceMembershipCollection
50
- } = entities.teamSpaceMembership;
51
- const {
52
- wrapTeamCollection
53
- } = entities.team;
54
- const {
55
- wrapApiKey,
56
- wrapApiKeyCollection
57
- } = entities.apiKey;
58
- const {
59
- wrapEnvironmentAlias,
60
- wrapEnvironmentAliasCollection
61
- } = entities.environmentAlias;
62
- const {
63
- wrapPreviewApiKey,
64
- wrapPreviewApiKeyCollection
65
- } = entities.previewApiKey;
66
- const {
67
- wrapScheduledAction,
68
- wrapScheduledActionCollection
69
- } = entities.scheduledAction;
70
- const {
71
- wrapAiAction,
72
- wrapAiActionCollection
73
- } = entities.aiAction;
74
- const {
75
- wrapAiActionInvocation,
76
- wrapAiActionInvocationCollection
77
- } = entities.aiActionInvocation;
78
- return {
79
- /**
80
- * Deletes the space
81
- * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
82
- * @example ```javascript
83
- * const contentful = require('contentful-management')
84
- *
85
- * const client = contentful.createClient({
86
- * accessToken: '<content_management_api_key>'
87
- * })
88
- *
89
- * client.getSpace('<space_id>')
90
- * .then((space) => space.delete())
91
- * .then(() => console.log('Space deleted.'))
92
- * .catch(console.error)
93
- * ```
94
- */
95
- delete: function deleteSpace() {
96
- const raw = this.toPlainObject();
97
- return makeRequest({
98
- entityType: 'Space',
99
- action: 'delete',
100
- params: {
101
- spaceId: raw.sys.id
102
- }
103
- });
104
- },
105
- /**
106
- * Updates the space
107
- * @return Promise for the updated space.
108
- * @example ```javascript
109
- * const contentful = require('contentful-management')
110
- *
111
- * const client = contentful.createClient({
112
- * accessToken: '<content_management_api_key>'
113
- * })
114
- *
115
- * client.getSpace('<space_id>')
116
- * .then((space) => {
117
- * space.name = 'New name'
118
- * return space.update()
119
- * })
120
- * .then((space) => console.log(`Space ${space.sys.id} renamed.`)
121
- * .catch(console.error)
122
- * ```
123
- */
124
- update: function updateSpace() {
125
- const raw = this.toPlainObject();
126
- return makeRequest({
127
- entityType: 'Space',
128
- action: 'update',
129
- params: {
130
- spaceId: raw.sys.id
131
- },
132
- payload: raw,
133
- headers: {}
134
- }).then(data => wrapSpace(makeRequest, data));
135
- },
136
- /**
137
- * Gets an environment
138
- * @param id - Environment ID
139
- * @return Promise for an Environment
140
- * @example ```javascript
141
- * const contentful = require('contentful-management')
142
- *
143
- * const client = contentful.createClient({
144
- * accessToken: '<content_management_api_key>'
145
- * })
146
- *
147
- * client.getSpace('<space_id>')
148
- * .then((space) => space.getEnvironment('<environment_id>'))
149
- * .then((environment) => console.log(environment))
150
- * .catch(console.error)
151
- * ```
152
- */
153
- getEnvironment(environmentId) {
154
- const raw = this.toPlainObject();
155
- return makeRequest({
156
- entityType: 'Environment',
157
- action: 'get',
158
- params: {
159
- spaceId: raw.sys.id,
160
- environmentId
161
- }
162
- }).then(data => wrapEnvironment(makeRequest, data));
163
- },
164
- /**
165
- * Gets a collection of Environments
166
- * @return Promise for a collection of Environment
167
- * @example ```javascript
168
- * const contentful = require('contentful-management')
169
- *
170
- * const client = contentful.createClient({
171
- * accessToken: '<content_management_api_key>'
172
- * })
173
- *
174
- * client.getSpace('<space_id>')
175
- * .then((space) => space.getEnvironments())
176
- * .then((response) => console.log(response.items))
177
- * .catch(console.error)
178
- * ```
179
- */
180
- getEnvironments(query = {}) {
181
- const raw = this.toPlainObject();
182
- return makeRequest({
183
- entityType: 'Environment',
184
- action: 'getMany',
185
- params: {
186
- spaceId: raw.sys.id,
187
- query
188
- }
189
- }).then(data => wrapEnvironmentCollection(makeRequest, data));
190
- },
191
- /**
192
- * Creates an environment
193
- * @param data - Object representation of the Environment to be created
194
- * @return Promise for the newly created Environment
195
- * @example ```javascript
196
- * const contentful = require('contentful-management')
197
- *
198
- * const client = contentful.createClient({
199
- * accessToken: '<content_management_api_key>'
200
- * })
201
- *
202
- * client.getSpace('<space_id>')
203
- * .then((space) => space.createEnvironment({ name: 'Staging' }))
204
- * .then((environment) => console.log(environment))
205
- * .catch(console.error)
206
- * ```
207
- */
208
- createEnvironment(data = {}) {
209
- const raw = this.toPlainObject();
210
- return makeRequest({
211
- entityType: 'Environment',
212
- action: 'create',
213
- params: {
214
- spaceId: raw.sys.id
215
- },
216
- payload: data
217
- }).then(response => wrapEnvironment(makeRequest, response));
218
- },
219
- /**
220
- * Creates an Environment with a custom ID
221
- * @param id - Environment ID
222
- * @param data - Object representation of the Environment to be created
223
- * @param sourceEnvironmentId - ID of the source environment that will be copied to create the new environment. Default is "master"
224
- * @return Promise for the newly created Environment
225
- * @example ```javascript
226
- * const contentful = require('contentful-management')
227
- *
228
- * const client = contentful.createClient({
229
- * accessToken: '<content_management_api_key>'
230
- * })
231
- *
232
- * client.getSpace('<space_id>')
233
- * .then((space) => space.createEnvironmentWithId('<environment-id>', { name: 'Staging'}, 'master'))
234
- * .then((environment) => console.log(environment))
235
- * .catch(console.error)
236
- * ```
237
- */
238
- createEnvironmentWithId(id, data, sourceEnvironmentId) {
239
- const raw = this.toPlainObject();
240
- return makeRequest({
241
- entityType: 'Environment',
242
- action: 'createWithId',
243
- params: {
244
- spaceId: raw.sys.id,
245
- environmentId: id,
246
- sourceEnvironmentId
247
- },
248
- payload: data
249
- }).then(response => wrapEnvironment(makeRequest, response));
250
- },
251
- /**
252
- * Gets a Webhook
253
- * @param id - Webhook ID
254
- * @return Promise for a Webhook
255
- * @example ```javascript
256
- * const contentful = require('contentful-management')
257
- *
258
- * const client = contentful.createClient({
259
- * accessToken: '<content_management_api_key>'
260
- * })
261
- *
262
- * client.getSpace('<space_id>')
263
- * .then((space) => space.getWebhook('<webhook_id>'))
264
- * .then((webhook) => console.log(webhook))
265
- * .catch(console.error)
266
- * ```
267
- */
268
- getWebhook(id) {
269
- const raw = this.toPlainObject();
270
- return makeRequest({
271
- entityType: 'Webhook',
272
- action: 'get',
273
- params: {
274
- spaceId: raw.sys.id,
275
- webhookDefinitionId: id
276
- }
277
- }).then(data => wrapWebhook(makeRequest, data));
278
- },
279
- /**
280
- * Gets a collection of Webhooks
281
- * @return Promise for a collection of Webhooks
282
- * @example ```javascript
283
- * const contentful = require('contentful-management')
284
- *
285
- * const client = contentful.createClient({
286
- * accessToken: '<content_management_api_key>'
287
- * })
288
- *
289
- * client.getSpace('<space_id>')
290
- * .then((space) => space.getWebhooks())
291
- * .then((response) => console.log(response.items))
292
- * .catch(console.error)
293
- * ```
294
- */
295
- getWebhooks() {
296
- const raw = this.toPlainObject();
297
- return makeRequest({
298
- entityType: 'Webhook',
299
- action: 'getMany',
300
- params: {
301
- spaceId: raw.sys.id
302
- }
303
- }).then(data => wrapWebhookCollection(makeRequest, data));
304
- },
305
- /**
306
- * Fetch a webhook signing secret
307
- * @returns Promise for the redacted webhook signing secret in this space
308
- * @example ```javascript
309
- * const contentful = require('contentful-management')
310
- *
311
- * const client = contentful.createClient({
312
- * accessToken: '<content_management_api_key>'
313
- * })
314
- *
315
- * client.getSpace('<space_id>')
316
- * .then((space) => space.getWebhookSigningSecret())
317
- * .then((response) => console.log(response.redactedValue))
318
- * .catch(console.error)
319
- * ```
320
- */
321
- getWebhookSigningSecret: function getSigningSecret() {
322
- const raw = this.toPlainObject();
323
- return makeRequest({
324
- entityType: 'Webhook',
325
- action: 'getSigningSecret',
326
- params: {
327
- spaceId: raw.sys.id
328
- }
329
- });
330
- },
331
- /**
332
- * Fetch a webhook retry policy
333
- * @returns Promise for the redacted webhook retry policy in this space
334
- * @example ```javascript
335
- * const contentful = require('contentful-management')
336
- *
337
- * const client = contentful.createClient({
338
- * accessToken: '<content_management_api_key>'
339
- * })
340
- *
341
- * client.getSpace('<space_id>')
342
- * .then((space) => space.getRetryPolicy())
343
- * .then((response) => console.log(response.redactedValue))
344
- * .catch(console.error)
345
- * ```
346
- */
347
- getWebhookRetryPolicy: function getWebhookRetryPolicy() {
348
- const raw = this.toPlainObject();
349
- return makeRequest({
350
- entityType: 'Webhook',
351
- action: 'getRetryPolicy',
352
- params: {
353
- spaceId: raw.sys.id
354
- }
355
- });
356
- },
357
- /**
358
- * Creates a Webhook
359
- * @param data - Object representation of the Webhook to be created
360
- * @return Promise for the newly created Webhook
361
- * @example ```javascript
362
- * const contentful = require('contentful-management')
363
- *
364
- * client.getSpace('<space_id>')
365
- * .then((space) => space.createWebhook({
366
- * 'name': 'My webhook',
367
- * 'url': 'https://www.example.com/test',
368
- * 'topics': [
369
- * 'Entry.create',
370
- * 'ContentType.create',
371
- * '*.publish',
372
- * 'Asset.*'
373
- * ]
374
- * }))
375
- * .then((webhook) => console.log(webhook))
376
- * .catch(console.error)
377
- * ```
378
- */
379
- createWebhook(data) {
380
- const raw = this.toPlainObject();
381
- return makeRequest({
382
- entityType: 'Webhook',
383
- action: 'create',
384
- params: {
385
- spaceId: raw.sys.id
386
- },
387
- payload: data
388
- }).then(data => wrapWebhook(makeRequest, data));
389
- },
390
- /**
391
- * Creates a Webhook with a custom ID
392
- * @param id - Webhook ID
393
- * @param data - Object representation of the Webhook to be created
394
- * @return Promise for the newly created Webhook
395
- * @example ```javascript
396
- * const contentful = require('contentful-management')
397
- *
398
- * client.getSpace('<space_id>')
399
- * .then((space) => space.createWebhookWithId('<webhook_id>', {
400
- * 'name': 'My webhook',
401
- * 'url': 'https://www.example.com/test',
402
- * 'topics': [
403
- * 'Entry.create',
404
- * 'ContentType.create',
405
- * '*.publish',
406
- * 'Asset.*'
407
- * ]
408
- * }))
409
- * .then((webhook) => console.log(webhook))
410
- * .catch(console.error)
411
- * ```
412
- */
413
- createWebhookWithId(id, data) {
414
- const raw = this.toPlainObject();
415
- return makeRequest({
416
- entityType: 'Webhook',
417
- action: 'createWithId',
418
- params: {
419
- spaceId: raw.sys.id,
420
- webhookDefinitionId: id
421
- },
422
- payload: data
423
- }).then(data => wrapWebhook(makeRequest, data));
424
- },
425
- /**
426
- * Create or update the webhook signing secret for this space
427
- * @param data 64 character string that will be used to sign the webhook calls
428
- * @returns Promise for the redacted webhook signing secret that was created or updated
429
- * @example ```javascript
430
- * const contentful = require('contentful-management')
431
- * const crypto = require('crypto')
432
- *
433
- * const client = contentful.createClient({
434
- * accessToken: '<content_management_api_key>'
435
- * })
436
- *
437
- * const signingSecret = client.getSpace('<space_id>')
438
- * .then((space) => space.upsertWebhookSigningSecret({
439
- * value: crypto.randomBytes(32).toString('hex')
440
- * }))
441
- * .then((response) => console.log(response.redactedValue))
442
- * .catch(console.error)
443
- * ```
444
- */
445
- upsertWebhookSigningSecret: function getSigningSecret(data) {
446
- const raw = this.toPlainObject();
447
- return makeRequest({
448
- entityType: 'Webhook',
449
- action: 'upsertSigningSecret',
450
- params: {
451
- spaceId: raw.sys.id
452
- },
453
- payload: data
454
- });
455
- },
456
- /**
457
- * Create or update the webhook retry policy for this space
458
- * @param data the maxRetries with integer value >= 2 and <= 99 value to set in the Retry Policy
459
- * @returns Promise for the redacted webhook retry policy that was created or updated
460
- * @example ```javascript
461
- * const contentful = require('contentful-management')
462
- *
463
- * const client = contentful.createClient({
464
- * accessToken: '<content_management_api_key>'
465
- * })
466
- *
467
- * const retryPolicy = client.getSpace('<space_id>')
468
- * .then((space) => space.upsertWebhookRetryPolicy({
469
- * maxRetries: 15
470
- * }))
471
- * .then((response) => console.log(response.redactedValue))
472
- * .catch(console.error)
473
- * ```
474
- */
475
- upsertWebhookRetryPolicy: function upsertWebhookRetryPolicy(data) {
476
- const raw = this.toPlainObject();
477
- return makeRequest({
478
- entityType: 'Webhook',
479
- action: 'upsertRetryPolicy',
480
- params: {
481
- spaceId: raw.sys.id
482
- },
483
- payload: data
484
- });
485
- },
486
- /**
487
- * Delete the webhook signing secret for this space
488
- * @returns Promise<void>
489
- * @example ```javascript
490
- * const contentful = require('contentful-management')
491
- *
492
- * const client = contentful.createClient({
493
- * accessToken: '<content_management_api_key>'
494
- * })
495
- *
496
- * client.getSpace('<space_id>')
497
- * .then((space) => space.deleteWebhookSigningSecret())
498
- * .then(() => console.log("success"))
499
- * .catch(console.error)
500
- * ```
501
- */
502
- deleteWebhookSigningSecret: function getSigningSecret() {
503
- const raw = this.toPlainObject();
504
- return makeRequest({
505
- entityType: 'Webhook',
506
- action: 'deleteSigningSecret',
507
- params: {
508
- spaceId: raw.sys.id
509
- }
510
- });
511
- },
512
- /**
513
- * Delete the webhook retry policy for this space
514
- * @returns Promise<void>
515
- * @example ```javascript
516
- * const contentful = require('contentful-management')
517
- *
518
- * const client = contentful.createClient({
519
- * accessToken: '<content_management_api_key>'
520
- * })
521
- *
522
- * client.getSpace('<space_id>')
523
- * .then((space) => space.deleteWebhookRetryPolicy())
524
- * .then(() => console.log("success"))
525
- * .catch(console.error)
526
- * ```
527
- */
528
- deleteWebhookRetryPolicy: function deleteRetryPolicy() {
529
- const raw = this.toPlainObject();
530
- return makeRequest({
531
- entityType: 'Webhook',
532
- action: 'deleteRetryPolicy',
533
- params: {
534
- spaceId: raw.sys.id
535
- }
536
- });
537
- },
538
- /**
539
- * Gets a Role
540
- * @param id - Role ID
541
- * @return Promise for a Role
542
- * @example ```javascript
543
- * const contentful = require('contentful-management')
544
- *
545
- * const client = contentful.createClient({
546
- * accessToken: '<content_management_api_key>'
547
- * })
548
- *
549
- * client.getSpace('<space_id>')
550
- * .then((space) => space.createRole({
551
- * fields: {
552
- * title: {
553
- * 'en-US': 'Role title'
554
- * }
555
- * }
556
- * }))
557
- * .then((role) => console.log(role))
558
- * .catch(console.error)
559
- * ```
560
- */
561
- getRole(id) {
562
- const raw = this.toPlainObject();
563
- return makeRequest({
564
- entityType: 'Role',
565
- action: 'get',
566
- params: {
567
- spaceId: raw.sys.id,
568
- roleId: id
569
- }
570
- }).then(data => wrapRole(makeRequest, data));
571
- },
572
- /**
573
- * Gets a collection of Roles
574
- * @return Promise for a collection of Roles
575
- * @example ```javascript
576
- * const contentful = require('contentful-management')
577
- *
578
- * const client = contentful.createClient({
579
- * accessToken: '<content_management_api_key>'
580
- * })
581
- *
582
- * client.getSpace('<space_id>')
583
- * .then((space) => space.getRoles())
584
- * .then((response) => console.log(response.items))
585
- * .catch(console.error)
586
- * ```
587
- */
588
- getRoles(query = {}) {
589
- const raw = this.toPlainObject();
590
- return makeRequest({
591
- entityType: 'Role',
592
- action: 'getMany',
593
- params: {
594
- spaceId: raw.sys.id,
595
- query: createRequestConfig({
596
- query
597
- }).params
598
- }
599
- }).then(data => wrapRoleCollection(makeRequest, data));
600
- },
601
- /**
602
- * Creates a Role
603
- * @param data - Object representation of the Role to be created
604
- * @return Promise for the newly created Role
605
- * @example ```javascript
606
- * const contentful = require('contentful-management')
607
- *
608
- * const client = contentful.createClient({
609
- * accessToken: '<content_management_api_key>'
610
- * })
611
- * client.getSpace('<space_id>')
612
- * .then((space) => space.createRole({
613
- * name: 'My Role',
614
- * description: 'foobar role',
615
- * permissions: {
616
- * ContentDelivery: 'all',
617
- * ContentModel: ['read'],
618
- * Settings: []
619
- * },
620
- * policies: [
621
- * {
622
- * effect: 'allow',
623
- * actions: 'all',
624
- * constraint: {
625
- * and: [
626
- * {
627
- * equals: [
628
- * { doc: 'sys.type' },
629
- * 'Entry'
630
- * ]
631
- * },
632
- * {
633
- * equals: [
634
- * { doc: 'sys.type' },
635
- * 'Asset'
636
- * ]
637
- * }
638
- * ]
639
- * }
640
- * }
641
- * ]
642
- * }))
643
- * .then((role) => console.log(role))
644
- * .catch(console.error)
645
- * ```
646
- */
647
- createRole(data) {
648
- const raw = this.toPlainObject();
649
- return makeRequest({
650
- entityType: 'Role',
651
- action: 'create',
652
- params: {
653
- spaceId: raw.sys.id
654
- },
655
- payload: data
656
- }).then(data => wrapRole(makeRequest, data));
657
- },
658
- /**
659
- * Creates a Role with a custom ID
660
- * @param id - Role ID
661
- * @param data - Object representation of the Role to be created
662
- * @return Promise for the newly created Role
663
- * @example ```javascript
664
- * const contentful = require('contentful-management')
665
- *
666
- * const client = contentful.createClient({
667
- * accessToken: '<content_management_api_key>'
668
- * })
669
- * client.getSpace('<space_id>')
670
- * .then((space) => space.createRoleWithId('<role-id>', {
671
- * name: 'My Role',
672
- * description: 'foobar role',
673
- * permissions: {
674
- * ContentDelivery: 'all',
675
- * ContentModel: ['read'],
676
- * Settings: []
677
- * },
678
- * policies: [
679
- * {
680
- * effect: 'allow',
681
- * actions: 'all',
682
- * constraint: {
683
- * and: [
684
- * {
685
- * equals: [
686
- * { doc: 'sys.type' },
687
- * 'Entry'
688
- * ]
689
- * },
690
- * {
691
- * equals: [
692
- * { doc: 'sys.type' },
693
- * 'Asset'
694
- * ]
695
- * }
696
- * ]
697
- * }
698
- * }
699
- * ]
700
- * }))
701
- * .then((role) => console.log(role))
702
- * .catch(console.error)
703
- * ```
704
- */
705
- createRoleWithId(id, roleData) {
706
- const raw = this.toPlainObject();
707
- return makeRequest({
708
- entityType: 'Role',
709
- action: 'createWithId',
710
- params: {
711
- spaceId: raw.sys.id,
712
- roleId: id
713
- },
714
- payload: roleData
715
- }).then(data => wrapRole(makeRequest, data));
716
- },
717
- /**
718
- * Gets a User
719
- * @param userId - User ID
720
- * @return Promise for a User
721
- * @example ```javascript
722
- * const contentful = require('contentful-management')
723
- *
724
- * client.getSpace('<space_id>')
725
- * .then((space) => space.getSpaceUser('id'))
726
- * .then((user) => console.log(user))
727
- * .catch(console.error)
728
- * ```
729
- */
730
- getSpaceUser(userId) {
731
- const raw = this.toPlainObject();
732
- return makeRequest({
733
- entityType: 'User',
734
- action: 'getForSpace',
735
- params: {
736
- spaceId: raw.sys.id,
737
- userId
738
- }
739
- }).then(data => wrapUser(makeRequest, data));
740
- },
741
- /**
742
- * Gets a collection of Users in a space
743
- * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
744
- * @return Promise a collection of Users in a space
745
- * @example ```javascript
746
- * const contentful = require('contentful-management')
747
- *
748
- * client.getSpace('<space_id>')
749
- * .then((space) => space.getSpaceUsers(query))
750
- * .then((data) => console.log(data))
751
- * .catch(console.error)
752
- * ```
753
- */
754
- getSpaceUsers(query = {}) {
755
- const raw = this.toPlainObject();
756
- return makeRequest({
757
- entityType: 'User',
758
- action: 'getManyForSpace',
759
- params: {
760
- spaceId: raw.sys.id,
761
- query: createRequestConfig({
762
- query
763
- }).params
764
- }
765
- }).then(data => wrapUserCollection(makeRequest, data));
766
- },
767
- /**
768
- * Gets a collection of teams for a space
769
- * @param query
770
- * @return Promise for a collection of teams for a space
771
- * @example ```javascript
772
- * const contentful = require('contentful-management')
773
- *
774
- * client.getSpace('<space_id>')
775
- * .then((space) => space.getTeams())
776
- * .then((teamsCollection) => console.log(teamsCollection))
777
- * .catch(console.error)
778
- * ```
779
- */
780
- getTeams(query = {
781
- limit: 100
782
- }) {
783
- const raw = this.toPlainObject();
784
- return makeRequest({
785
- entityType: 'Team',
786
- action: 'getManyForSpace',
787
- params: {
788
- spaceId: raw.sys.id,
789
- query: createRequestConfig({
790
- query
791
- }).params
792
- }
793
- }).then(data => wrapTeamCollection(makeRequest, data));
794
- },
795
- /**
796
- * Gets a Space Member
797
- * @param id Get Space Member by user_id
798
- * @return Promise for a Space Member
799
- * @example ```javascript
800
- * const contentful = require('contentful-management')
801
- *
802
- * client.getSpace('<space_id>')
803
- * .then((space) => space.getSpaceMember(id))
804
- * .then((spaceMember) => console.log(spaceMember))
805
- * .catch(console.error)
806
- * ```
807
- */
808
- getSpaceMember(id) {
809
- const raw = this.toPlainObject();
810
- return makeRequest({
811
- entityType: 'SpaceMember',
812
- action: 'get',
813
- params: {
814
- spaceId: raw.sys.id,
815
- spaceMemberId: id
816
- }
817
- }).then(data => wrapSpaceMember(makeRequest, data));
818
- },
819
- /**
820
- * Gets a collection of Space Members
821
- * @param query
822
- * @return Promise for a collection of Space Members
823
- * @example ```javascript
824
- * const contentful = require('contentful-management')
825
- *
826
- * client.getSpace('<space_id>')
827
- * .then((space) => space.getSpaceMembers({'limit': 100}))
828
- * .then((spaceMemberCollection) => console.log(spaceMemberCollection))
829
- * .catch(console.error)
830
- * ```
831
- */
832
- getSpaceMembers(query = {}) {
833
- const raw = this.toPlainObject();
834
- return makeRequest({
835
- entityType: 'SpaceMember',
836
- action: 'getMany',
837
- params: {
838
- spaceId: raw.sys.id,
839
- query: createRequestConfig({
840
- query
841
- }).params
842
- }
843
- }).then(data => wrapSpaceMemberCollection(makeRequest, data));
844
- },
845
- /**
846
- * Gets a Space Membership
847
- * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
848
- * @param id - Space Membership ID
849
- * @return Promise for a Space Membership
850
- * @example ```javascript
851
- * const contentful = require('contentful-management')
852
- *
853
- * client.getSpace('<space_id>')
854
- * .then((space) => space.getSpaceMembership('id'))
855
- * .then((spaceMembership) => console.log(spaceMembership))
856
- * .catch(console.error)
857
- * ```
858
- */
859
- getSpaceMembership(id) {
860
- const raw = this.toPlainObject();
861
- return makeRequest({
862
- entityType: 'SpaceMembership',
863
- action: 'get',
864
- params: {
865
- spaceId: raw.sys.id,
866
- spaceMembershipId: id
867
- }
868
- }).then(data => wrapSpaceMembership(makeRequest, data));
869
- },
870
- /**
871
- * Gets a collection of Space Memberships
872
- * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
873
- * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
874
- * @return Promise for a collection of Space Memberships
875
- * @example ```javascript
876
- * const contentful = require('contentful-management')
877
- *
878
- * client.getSpace('<space_id>')
879
- * .then((space) => space.getSpaceMemberships({'limit': 100})) // you can add more queries as 'key': 'value'
880
- * .then((response) => console.log(response.items))
881
- * .catch(console.error)
882
- * ```
883
- */
884
- getSpaceMemberships(query = {}) {
885
- const raw = this.toPlainObject();
886
- return makeRequest({
887
- entityType: 'SpaceMembership',
888
- action: 'getMany',
889
- params: {
890
- spaceId: raw.sys.id,
891
- query: createRequestConfig({
892
- query
893
- }).params
894
- }
895
- }).then(data => wrapSpaceMembershipCollection(makeRequest, data));
896
- },
897
- /**
898
- * Creates a Space Membership
899
- * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
900
- * @param data - Object representation of the Space Membership to be created
901
- * @return Promise for the newly created Space Membership
902
- * @example ```javascript
903
- * const contentful = require('contentful-management')
904
- *
905
- * const client = contentful.createClient({
906
- * accessToken: '<content_management_api_key>'
907
- * })
908
- *
909
- * client.getSpace('<space_id>')
910
- * .then((space) => space.createSpaceMembership({
911
- * admin: false,
912
- * roles: [
913
- * {
914
- * type: 'Link',
915
- * linkType: 'Role',
916
- * id: '<role_id>'
917
- * }
918
- * ],
919
- * email: 'foo@example.com'
920
- * }))
921
- * .then((spaceMembership) => console.log(spaceMembership))
922
- * .catch(console.error)
923
- * ```
924
- */
925
- createSpaceMembership(data) {
926
- const raw = this.toPlainObject();
927
- return makeRequest({
928
- entityType: 'SpaceMembership',
929
- action: 'create',
930
- params: {
931
- spaceId: raw.sys.id
932
- },
933
- payload: data
934
- }).then(response => wrapSpaceMembership(makeRequest, response));
935
- },
936
- /**
937
- * Creates a Space Membership with a custom ID
938
- * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
939
- * @param id - Space Membership ID
940
- * @param data - Object representation of the Space Membership to be created
941
- * @return Promise for the newly created Space Membership
942
- * @example ```javascript
943
- * const contentful = require('contentful-management')
944
- *
945
- * const client = contentful.createClient({
946
- * accessToken: '<content_management_api_key>'
947
- * })
948
- *
949
- * client.getSpace('<space_id>')
950
- * .then((space) => space.createSpaceMembershipWithId('<space-membership-id>', {
951
- * admin: false,
952
- * roles: [
953
- * {
954
- * type: 'Link',
955
- * linkType: 'Role',
956
- * id: '<role_id>'
957
- * }
958
- * ],
959
- * email: 'foo@example.com'
960
- * }))
961
- * .then((spaceMembership) => console.log(spaceMembership))
962
- * .catch(console.error)
963
- * ```
964
- */
965
- createSpaceMembershipWithId(id, data) {
966
- const raw = this.toPlainObject();
967
- return makeRequest({
968
- entityType: 'SpaceMembership',
969
- action: 'createWithId',
970
- params: {
971
- spaceId: raw.sys.id,
972
- spaceMembershipId: id
973
- },
974
- payload: data
975
- }).then(response => wrapSpaceMembership(makeRequest, response));
976
- },
977
- /**
978
- * Gets a Team Space Membership
979
- * @param id - Team Space Membership ID
980
- * @return Promise for a Team Space Membership
981
- * @example ```javascript
982
- * const contentful = require('contentful-management')
983
- *
984
- * client.getSpace('<space_id>')
985
- * .then((space) => space.getTeamSpaceMembership('team_space_membership_id'))
986
- * .then((teamSpaceMembership) => console.log(teamSpaceMembership))
987
- * .catch(console.error)
988
- * ```
989
- */
990
- getTeamSpaceMembership(teamSpaceMembershipId) {
991
- const raw = this.toPlainObject();
992
- return makeRequest({
993
- entityType: 'TeamSpaceMembership',
994
- action: 'get',
995
- params: {
996
- spaceId: raw.sys.id,
997
- teamSpaceMembershipId
998
- }
999
- }).then(data => wrapTeamSpaceMembership(makeRequest, data));
1000
- },
1001
- /**
1002
- * Gets a collection of Team Space Memberships
1003
- * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
1004
- * @return Promise for a collection of Team Space Memberships
1005
- * @example ```javascript
1006
- * const contentful = require('contentful-management')
1007
- *
1008
- * client.getSpace('<space_id>')
1009
- * .then((space) => space.getTeamSpaceMemberships())
1010
- * .then((response) => console.log(response.items))
1011
- * .catch(console.error)
1012
- * ```
1013
- */
1014
- getTeamSpaceMemberships(query = {}) {
1015
- const raw = this.toPlainObject();
1016
- return makeRequest({
1017
- entityType: 'TeamSpaceMembership',
1018
- action: 'getMany',
1019
- params: {
1020
- spaceId: raw.sys.id,
1021
- query: createRequestConfig({
1022
- query: query
1023
- }).params
1024
- }
1025
- }).then(data => wrapTeamSpaceMembershipCollection(makeRequest, data));
1026
- },
1027
- /**
1028
- * Creates a Team Space Membership
1029
- * @param id - Team ID
1030
- * @param data - Object representation of the Team Space Membership to be created
1031
- * @return Promise for the newly created Team Space Membership
1032
- * @example ```javascript
1033
- * const contentful = require('contentful-management')
1034
- *
1035
- * const client = contentful.createClient({
1036
- * accessToken: '<content_management_api_key>'
1037
- * })
1038
- *
1039
- * client.getSpace('<space_id>')
1040
- * .then((space) => space.createTeamSpaceMembership('team_id', {
1041
- * admin: false,
1042
- * roles: [
1043
- * {
1044
- sys: {
1045
- * type: 'Link',
1046
- * linkType: 'Role',
1047
- * id: '<role_id>'
1048
- * }
1049
- * }
1050
- * ],
1051
- * }))
1052
- * .then((teamSpaceMembership) => console.log(teamSpaceMembership))
1053
- * .catch(console.error)
1054
- * ```
1055
- */
1056
- createTeamSpaceMembership(teamId, data) {
1057
- const raw = this.toPlainObject();
1058
- return makeRequest({
1059
- entityType: 'TeamSpaceMembership',
1060
- action: 'create',
1061
- params: {
1062
- spaceId: raw.sys.id,
1063
- teamId
1064
- },
1065
- payload: data
1066
- }).then(response => wrapTeamSpaceMembership(makeRequest, response));
1067
- },
1068
- /**
1069
- * Gets a Api Key
1070
- * @param id - API Key ID
1071
- * @return Promise for a Api Key
1072
- * @example ```javascript
1073
- * const contentful = require('contentful-management')
1074
- *
1075
- * const client = contentful.createClient({
1076
- * accessToken: '<content_management_api_key>'
1077
- * })
1078
- *
1079
- * client.getSpace('<space_id>')
1080
- * .then((space) => space.getApiKey('<apikey-id>'))
1081
- * .then((apikey) => console.log(apikey))
1082
- * .catch(console.error)
1083
- * ```
1084
- */
1085
- getApiKey(id) {
1086
- const raw = this.toPlainObject();
1087
- return makeRequest({
1088
- entityType: 'ApiKey',
1089
- action: 'get',
1090
- params: {
1091
- spaceId: raw.sys.id,
1092
- apiKeyId: id
1093
- }
1094
- }).then(data => wrapApiKey(makeRequest, data));
1095
- },
1096
- /**
1097
- * Gets a collection of Api Keys
1098
- * @return Promise for a collection of Api Keys
1099
- * @example ```javascript
1100
- * const contentful = require('contentful-management')
1101
- *
1102
- * const client = contentful.createClient({
1103
- * accessToken: '<content_management_api_key>'
1104
- * })
1105
- *
1106
- * client.getSpace('<space_id>')
1107
- * .then((space) => space.getApiKeys())
1108
- * .then((response) => console.log(response.items))
1109
- * .catch(console.error)
1110
- * ```
1111
- */
1112
- getApiKeys() {
1113
- const raw = this.toPlainObject();
1114
- return makeRequest({
1115
- entityType: 'ApiKey',
1116
- action: 'getMany',
1117
- params: {
1118
- spaceId: raw.sys.id
1119
- }
1120
- }).then(data => wrapApiKeyCollection(makeRequest, data));
1121
- },
1122
- /**
1123
- * Gets a collection of preview Api Keys
1124
- * @return Promise for a collection of Preview Api Keys
1125
- * @example ```javascript
1126
- * const contentful = require('contentful-management')
1127
- *
1128
- * const client = contentful.createClient({
1129
- * accessToken: '<content_management_api_key>'
1130
- * })
1131
- *
1132
- * client.getSpace('<space_id>')
1133
- * .then((space) => space.getPreviewApiKeys())
1134
- * .then((response) => console.log(response.items))
1135
- * .catch(console.error)
1136
- * ```
1137
- */
1138
- getPreviewApiKeys() {
1139
- const raw = this.toPlainObject();
1140
- return makeRequest({
1141
- entityType: 'PreviewApiKey',
1142
- action: 'getMany',
1143
- params: {
1144
- spaceId: raw.sys.id
1145
- }
1146
- }).then(data => wrapPreviewApiKeyCollection(makeRequest, data));
1147
- },
1148
- /**
1149
- * Gets a preview Api Key
1150
- * @param id - Preview API Key ID
1151
- * @return Promise for a Preview Api Key
1152
- * @example ```javascript
1153
- * const contentful = require('contentful-management')
1154
- *
1155
- * const client = contentful.createClient({
1156
- * accessToken: '<content_management_api_key>'
1157
- * })
1158
- *
1159
- * client.getSpace('<space_id>')
1160
- * .then((space) => space.getPreviewApiKey('<preview-apikey-id>'))
1161
- * .then((previewApikey) => console.log(previewApikey))
1162
- * .catch(console.error)
1163
- * ```
1164
- */
1165
- getPreviewApiKey(id) {
1166
- const raw = this.toPlainObject();
1167
- return makeRequest({
1168
- entityType: 'PreviewApiKey',
1169
- action: 'get',
1170
- params: {
1171
- spaceId: raw.sys.id,
1172
- previewApiKeyId: id
1173
- }
1174
- }).then(data => wrapPreviewApiKey(makeRequest, data));
1175
- },
1176
- /**
1177
- * Creates a Api Key
1178
- * @param payload - Object representation of the Api Key to be created
1179
- * @return Promise for the newly created Api Key
1180
- * @example ```javascript
1181
- * const contentful = require('contentful-management')
1182
- *
1183
- * const client = contentful.createClient({
1184
- * accessToken: '<content_management_api_key>'
1185
- * })
1186
- *
1187
- * client.getSpace('<space_id>')
1188
- * .then((space) => space.createApiKey({
1189
- * name: 'API Key name',
1190
- * environments:[
1191
- * {
1192
- * sys: {
1193
- * type: 'Link'
1194
- * linkType: 'Environment',
1195
- * id:'<environment_id>'
1196
- * }
1197
- * }
1198
- * ]
1199
- * }
1200
- * }))
1201
- * .then((apiKey) => console.log(apiKey))
1202
- * .catch(console.error)
1203
- * ```
1204
- */
1205
- createApiKey: function createApiKey(payload) {
1206
- const raw = this.toPlainObject();
1207
- return makeRequest({
1208
- entityType: 'ApiKey',
1209
- action: 'create',
1210
- params: {
1211
- spaceId: raw.sys.id
1212
- },
1213
- payload
1214
- }).then(data => wrapApiKey(makeRequest, data));
1215
- },
1216
- /**
1217
- * Creates a Api Key with a custom ID
1218
- * @param id - Api Key ID
1219
- * @param payload - Object representation of the Api Key to be created
1220
- * @return Promise for the newly created Api Key
1221
- * @example ```javascript
1222
- * const contentful = require('contentful-management')
1223
- *
1224
- * const client = contentful.createClient({
1225
- * accessToken: '<content_management_api_key>'
1226
- * })
1227
- *
1228
- * client.getSpace('<space_id>')
1229
- * .then((space) => space.createApiKeyWithId('<api-key-id>', {
1230
- * name: 'API Key name'
1231
- * environments:[
1232
- * {
1233
- * sys: {
1234
- * type: 'Link'
1235
- * linkType: 'Environment',
1236
- * id:'<environment_id>'
1237
- * }
1238
- * }
1239
- * ]
1240
- * }
1241
- * }))
1242
- * .then((apiKey) => console.log(apiKey))
1243
- * .catch(console.error)
1244
- * ```
1245
- */
1246
- createApiKeyWithId(id, payload) {
1247
- const raw = this.toPlainObject();
1248
- return makeRequest({
1249
- entityType: 'ApiKey',
1250
- action: 'createWithId',
1251
- params: {
1252
- spaceId: raw.sys.id,
1253
- apiKeyId: id
1254
- },
1255
- payload
1256
- }).then(data => wrapApiKey(makeRequest, data));
1257
- },
1258
- /**
1259
- * Creates an EnvironmentAlias with a custom ID
1260
- * @param environmentAliasId - EnvironmentAlias ID
1261
- * @param data - Object representation of the EnvironmentAlias to be created
1262
- * @return Promise for the newly created EnvironmentAlias
1263
- * @example ```javascript
1264
- * const contentful = require('contentful-management')
1265
- *
1266
- * const client = contentful.createClient({
1267
- * accessToken: '<content_management_api_key>'
1268
- * })
1269
- *
1270
- * client.getSpace('<space_id>')
1271
- * .then((space) => space.createEnvironmentAliasWithId('<environment-alias-id>', {
1272
- * environment: {
1273
- * sys: { type: 'Link', linkType: 'Environment', id: 'targetEnvironment' }
1274
- * }
1275
- * }))
1276
- * .then((environmentAlias) => console.log(environmentAlias))
1277
- * .catch(console.error)
1278
- * ```
1279
- */
1280
- createEnvironmentAliasWithId(environmentAliasId, data) {
1281
- const raw = this.toPlainObject();
1282
- return makeRequest({
1283
- entityType: 'EnvironmentAlias',
1284
- action: 'createWithId',
1285
- params: {
1286
- spaceId: raw.sys.id,
1287
- environmentAliasId
1288
- },
1289
- payload: data
1290
- }).then(response => wrapEnvironmentAlias(makeRequest, response));
1291
- },
1292
- /**
1293
- * Gets an Environment Alias
1294
- * @param Environment Alias ID
1295
- * @return Promise for an Environment Alias
1296
- * @example ```javascript
1297
- * const contentful = require('contentful-management')
1298
- *
1299
- * const client = contentful.createClient({
1300
- * accessToken: '<content_management_api_key>'
1301
- * })
1302
- *
1303
- * client.getSpace('<space_id>')
1304
- * .then((space) => space.getEnvironmentAlias('<alias-id>'))
1305
- * .then((alias) => console.log(alias))
1306
- * .catch(console.error)
1307
- * ```
1308
- */
1309
- getEnvironmentAlias(environmentAliasId) {
1310
- const raw = this.toPlainObject();
1311
- return makeRequest({
1312
- entityType: 'EnvironmentAlias',
1313
- action: 'get',
1314
- params: {
1315
- spaceId: raw.sys.id,
1316
- environmentAliasId
1317
- }
1318
- }).then(data => wrapEnvironmentAlias(makeRequest, data));
1319
- },
1320
- /**
1321
- * Gets a collection of Environment Aliases
1322
- * @return Promise for a collection of Environment Aliases
1323
- * @example ```javascript
1324
- * const contentful = require('contentful-management')
1325
- *
1326
- * const client = contentful.createClient({
1327
- * accessToken: '<content_management_api_key>'
1328
- * })
1329
- *
1330
- * client.getSpace('<space_id>')
1331
- * .then((space) => space.getEnvironmentAliases()
1332
- * .then((response) => console.log(response.items))
1333
- * .catch(console.error)
1334
- * ```
1335
- */
1336
- getEnvironmentAliases() {
1337
- const raw = this.toPlainObject();
1338
- return makeRequest({
1339
- entityType: 'EnvironmentAlias',
1340
- action: 'getMany',
1341
- params: {
1342
- spaceId: raw.sys.id
1343
- }
1344
- }).then(data => wrapEnvironmentAliasCollection(makeRequest, data));
1345
- },
1346
- /**
1347
- * Query for scheduled actions in space.
1348
- * @param query - Object with search parameters. The enviroment id field is mandatory. Check the <a href="https://www.contentful.com/developers/docs/references/content-management-api/#/reference/scheduled-actions/scheduled-actions-collection">REST API reference</a> for more details.
1349
- * @return Promise for the scheduled actions query
1350
- *
1351
- * @example ```javascript
1352
- * const contentful = require('contentful-management');
1353
- *
1354
- * const client = contentful.createClient({
1355
- * accessToken: '<content_management_api_key>'
1356
- * })
1357
- *
1358
- * client.getSpace('<space_id>')
1359
- * .then((space) => space.getScheduledActions({
1360
- * 'environment.sys.id': '<environment_id>',
1361
- * 'sys.status': 'scheduled'
1362
- * }))
1363
- * .then((scheduledActionCollection) => console.log(scheduledActionCollection.items))
1364
- * .catch(console.error)
1365
- * ```
1366
- */
1367
- getScheduledActions(query) {
1368
- const raw = this.toPlainObject();
1369
- return makeRequest({
1370
- entityType: 'ScheduledAction',
1371
- action: 'getMany',
1372
- params: {
1373
- spaceId: raw.sys.id,
1374
- query
1375
- }
1376
- }).then(response => wrapScheduledActionCollection(makeRequest, response));
1377
- },
1378
- /**
1379
- * Get a Scheduled Action in the current space by environment and ID.
1380
- *
1381
- * @throws if the Scheduled Action cannot be found or the user doesn't have permission to read schedules from the entity of the scheduled action itself.
1382
- * @returns Promise with the Scheduled Action
1383
- * @example ```javascript
1384
- * const contentful = require('contentful-management');
1385
- *
1386
- * const client = contentful.createClient({
1387
- * accessToken: '<content_management_api_key>'
1388
- * })
1389
- *
1390
- * client.getSpace('<space_id>')
1391
- * .then((space) => space.getScheduledAction({
1392
- * scheduledActionId: '<scheduled-action-id>',
1393
- * environmentId: '<environmentId>'
1394
- * }))
1395
- * .then((scheduledAction) => console.log(scheduledAction))
1396
- * .catch(console.error)
1397
- * ```
1398
- */
1399
- getScheduledAction({
1400
- scheduledActionId,
1401
- environmentId
1402
- }) {
1403
- const space = this.toPlainObject();
1404
- return makeRequest({
1405
- entityType: 'ScheduledAction',
1406
- action: 'get',
1407
- params: {
1408
- spaceId: space.sys.id,
1409
- environmentId,
1410
- scheduledActionId
1411
- }
1412
- }).then(scheduledAction => wrapScheduledAction(makeRequest, scheduledAction));
1413
- },
1414
- /**
1415
- * Creates a scheduled action
1416
- * @param data - Object representation of the scheduled action to be created
1417
- * @return Promise for the newly created scheduled actions
1418
- * @example ```javascript
1419
- * const contentful = require('contentful-management');
1420
- *
1421
- * const client = contentful.createClient({
1422
- * accessToken: '<content_management_api_key>'
1423
- * })
1424
- *
1425
- * client.getSpace('<space_id>')
1426
- * .then((space) => space.createScheduledAction({
1427
- * entity: {
1428
- * sys: {
1429
- * type: 'Link',
1430
- * linkType: 'Entry',
1431
- * id: '<entry_id>'
1432
- * }
1433
- * },
1434
- * environment: {
1435
- * sys: {
1436
- * type: 'Link',
1437
- * linkType: 'Environment',
1438
- * id: '<environment_id>'
1439
- * }
1440
- * },
1441
- * action: 'publish',
1442
- * scheduledFor: {
1443
- * datetime: <ISO_date_string>,
1444
- * timezone: 'Europe/Berlin'
1445
- * }
1446
- * }))
1447
- * .then((scheduledAction) => console.log(scheduledAction))
1448
- * .catch(console.error)
1449
- * ```
1450
- */
1451
- createScheduledAction(data) {
1452
- const raw = this.toPlainObject();
1453
- return makeRequest({
1454
- entityType: 'ScheduledAction',
1455
- action: 'create',
1456
- params: {
1457
- spaceId: raw.sys.id
1458
- },
1459
- payload: data
1460
- }).then(response => wrapScheduledAction(makeRequest, response));
1461
- },
1462
- /**
1463
- * Update a scheduled action
1464
- * @param {object} options
1465
- * @param options.scheduledActionId the id of the scheduled action to update
1466
- * @param options.version the sys.version of the scheduled action to be updated
1467
- * @param payload the scheduled actions object with updates, omitting sys object
1468
- * @returns Promise containing a wrapped scheduled action with helper methods
1469
- * @example ```javascript
1470
- * const contentful = require('contentful-management');
1471
- *
1472
- * const client = contentful.createClient({
1473
- * accessToken: '<content_management_api_key>'
1474
- * })
1475
- *
1476
- * client.getSpace('<space_id>')
1477
- * .then((space) => {
1478
- * return space.createScheduledAction({
1479
- * entity: {
1480
- * sys: {
1481
- * type: 'Link',
1482
- * linkType: 'Entry',
1483
- * id: '<entry_id>'
1484
- * }
1485
- * },
1486
- * environment: {
1487
- * sys: {
1488
- * type: 'Link',
1489
- * linkType: 'Environment',
1490
- * id: '<environment_id>'
1491
- * }
1492
- * },
1493
- * action: 'publish',
1494
- * scheduledFor: {
1495
- * datetime: <ISO_date_string>,
1496
- * timezone: 'Europe/Berlin'
1497
- * }
1498
- * })
1499
- * .then((scheduledAction) => {
1500
- * const { _sys, ...payload } = scheduledAction;
1501
- * return space.updateScheduledAction({
1502
- * ...payload,
1503
- * scheduledFor: {
1504
- * ...payload.scheduledFor,
1505
- * timezone: 'Europe/Paris'
1506
- * }
1507
- * })
1508
- * })
1509
- * .then((scheduledAction) => console.log(scheduledAction))
1510
- * .catch(console.error);
1511
- * ```
1512
- */
1513
- updateScheduledAction({
1514
- scheduledActionId,
1515
- payload,
1516
- version
1517
- }) {
1518
- const spaceProps = this.toPlainObject();
1519
- return makeRequest({
1520
- entityType: 'ScheduledAction',
1521
- action: 'update',
1522
- params: {
1523
- spaceId: spaceProps.sys.id,
1524
- version,
1525
- scheduledActionId
1526
- },
1527
- payload
1528
- }).then(response => wrapScheduledAction(makeRequest, response));
1529
- },
1530
- /**
1531
- * Cancels a Scheduled Action.
1532
- * Only cancels actions that have not yet executed.
1533
- *
1534
- * @param {object} options
1535
- * @param options.scheduledActionId the id of the scheduled action to be canceled
1536
- * @param options.environmentId the environment ID of the scheduled action to be canceled
1537
- * @throws if the Scheduled Action cannot be found or the user doesn't have permissions in the entity in the action.
1538
- * @returns Promise containing a wrapped Scheduled Action with helper methods
1539
- * @example ```javascript
1540
- * const contentful = require('contentful-management');
1541
- *
1542
- * const client = contentful.createClient({
1543
- * accessToken: '<content_management_api_key>'
1544
- * })
1545
- *
1546
- * // Given that an Scheduled Action is scheduled
1547
- * client.getSpace('<space_id>')
1548
- * .then((space) => space.deleteScheduledAction({
1549
- * environmentId: '<environment-id>',
1550
- * scheduledActionId: '<scheduled-action-id>'
1551
- * }))
1552
- * // The scheduled Action sys.status is now 'canceled'
1553
- * .then((scheduledAction) => console.log(scheduledAction))
1554
- * .catch(console.error);
1555
- * ```
1556
- */
1557
- deleteScheduledAction({
1558
- scheduledActionId,
1559
- environmentId
1560
- }) {
1561
- const spaceProps = this.toPlainObject();
1562
- return makeRequest({
1563
- entityType: 'ScheduledAction',
1564
- action: 'delete',
1565
- params: {
1566
- spaceId: spaceProps.sys.id,
1567
- environmentId,
1568
- scheduledActionId
1569
- }
1570
- }).then(response => wrapScheduledAction(makeRequest, response));
1571
- },
1572
- /**
1573
- * Gets a single AI Action.
1574
- * @param aiActionId - AI Action ID
1575
- * @return Promise for an AI Action
1576
- * @example
1577
- * ```javascript
1578
- * client.getSpace('<space_id>')
1579
- * .then((space) => space.getAiAction('<ai_action_id>'))
1580
- * .then((aiAction) => console.log(aiAction))
1581
- * .catch(console.error)
1582
- * ```
1583
- */
1584
- getAiAction(aiActionId) {
1585
- const raw = this.toPlainObject();
1586
- return makeRequest({
1587
- entityType: 'AiAction',
1588
- action: 'get',
1589
- params: {
1590
- spaceId: raw.sys.id,
1591
- aiActionId
1592
- }
1593
- }).then(data => wrapAiAction(makeRequest, data));
1594
- },
1595
- /**
1596
- * Gets a collection of AI Actions.
1597
- * @param query - Object with search parameters.
1598
- * @return Promise for a collection of AI Actions
1599
- * @example
1600
- * ```javascript
1601
- * client.getSpace('<space_id>')
1602
- * .then((space) => space.getAiActions({ limit: 10 }))
1603
- * .then((response) => console.log(response.items))
1604
- * .catch(console.error)
1605
- * ```
1606
- */
1607
- getAiActions(query = {}) {
1608
- const raw = this.toPlainObject();
1609
- return makeRequest({
1610
- entityType: 'AiAction',
1611
- action: 'getMany',
1612
- params: {
1613
- spaceId: raw.sys.id,
1614
- query
1615
- }
1616
- }).then(data => wrapAiActionCollection(makeRequest, data));
1617
- },
1618
- /**
1619
- * Creates an AI Action.
1620
- * @param data - Object representation of the AI Action to be created
1621
- * @return Promise for the newly created AI Action
1622
- * @example
1623
- * ```javascript
1624
- * client.getSpace('<space_id>')
1625
- * .then((space) => space.createAiAction({
1626
- * name: 'My AI Action',
1627
- * description: 'Description here',
1628
- * configuration: { modelType: 'model-x', modelTemperature: 0.7 },
1629
- * instruction: { template: 'Do something: {{var.input}}', variables: [], conditions: [] },
1630
- * testCases: []
1631
- * }))
1632
- * .then((aiAction) => console.log(aiAction))
1633
- * .catch(console.error)
1634
- * ```
1635
- */
1636
- createAiAction(data) {
1637
- const raw = this.toPlainObject();
1638
- return makeRequest({
1639
- entityType: 'AiAction',
1640
- action: 'create',
1641
- params: {
1642
- spaceId: raw.sys.id
1643
- },
1644
- payload: data
1645
- }).then(response => wrapAiAction(makeRequest, response));
1646
- },
1647
- /**
1648
- * Updates an AI Action.
1649
- * @param aiActionId - AI Action ID
1650
- * @param data - Object representation of the AI Action update
1651
- * @return Promise for the updated AI Action
1652
- * @example
1653
- * ```javascript
1654
- * client.getSpace('<space_id>')
1655
- * .then((space) => space.updateAiAction('<ai_action_id>', { name: 'New Name', ... }))
1656
- * .then((aiAction) => console.log(aiAction))
1657
- * .catch(console.error)
1658
- * ```
1659
- */
1660
- updateAiAction(aiActionId, data) {
1661
- var _data$sys$version;
1662
- const raw = this.toPlainObject();
1663
- return makeRequest({
1664
- entityType: 'AiAction',
1665
- action: 'update',
1666
- params: {
1667
- spaceId: raw.sys.id,
1668
- aiActionId
1669
- },
1670
- payload: data,
1671
- headers: {
1672
- 'X-Contentful-Version': (_data$sys$version = data.sys.version) !== null && _data$sys$version !== void 0 ? _data$sys$version : 0
1673
- }
1674
- }).then(response => wrapAiAction(makeRequest, response));
1675
- },
1676
- /**
1677
- * Publishes an AI Action.
1678
- * @param aiActionId - AI Action ID
1679
- * @param data - Object representation of the AI Action to be published
1680
- * @return Promise for the published AI Action
1681
- * @example
1682
- * ```javascript
1683
- * client.getSpace('<space_id>')
1684
- * .then((space) => space.publishAiAction('<ai_action_id>', { ... }))
1685
- * .then((aiAction) => console.log(aiAction))
1686
- * .catch(console.error)
1687
- * ```
1688
- */
1689
- publishAiAction(aiActionId, {
1690
- version
1691
- }) {
1692
- const raw = this.toPlainObject();
1693
- return makeRequest({
1694
- entityType: 'AiAction',
1695
- action: 'publish',
1696
- params: {
1697
- spaceId: raw.sys.id,
1698
- aiActionId,
1699
- version
1700
- }
1701
- }).then(response => wrapAiAction(makeRequest, response));
1702
- },
1703
- /**
1704
- * Unpublishes an AI Action.
1705
- * @param aiActionId - AI Action ID
1706
- * @return Promise for the unpublished AI Action
1707
- * @example
1708
- * ```javascript
1709
- * client.getSpace('<space_id>')
1710
- * .then((space) => space.unpublishAiAction('<ai_action_id>'))
1711
- * .then((aiAction) => console.log(aiAction))
1712
- * .catch(console.error)
1713
- * ```
1714
- */
1715
- unpublishAiAction(aiActionId) {
1716
- const raw = this.toPlainObject();
1717
- return makeRequest({
1718
- entityType: 'AiAction',
1719
- action: 'unpublish',
1720
- params: {
1721
- spaceId: raw.sys.id,
1722
- aiActionId
1723
- }
1724
- }).then(response => wrapAiAction(makeRequest, response));
1725
- },
1726
- /**
1727
- * Deletes an AI Action.
1728
- * @param aiActionId - AI Action ID
1729
- * @return Promise for deletion (void)
1730
- * @example
1731
- * ```javascript
1732
- * client.getSpace('<space_id>')
1733
- * .then((space) => space.deleteAiAction('<ai_action_id>'))
1734
- * .then(() => console.log('AI Action deleted'))
1735
- * .catch(console.error)
1736
- * ```
1737
- */
1738
- deleteAiAction(aiActionId) {
1739
- const raw = this.toPlainObject();
1740
- return makeRequest({
1741
- entityType: 'AiAction',
1742
- action: 'delete',
1743
- params: {
1744
- spaceId: raw.sys.id,
1745
- aiActionId
1746
- }
1747
- });
1748
- }
1749
- };
1750
- }