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