contentful-management 11.45.0-beta.1 → 11.45.0-beta.2

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 (586) hide show
  1. package/README.md +72 -47
  2. package/dist/contentful-management.browser.js +23147 -27455
  3. package/dist/contentful-management.browser.min.js +1 -2
  4. package/dist/contentful-management.cjs +36200 -0
  5. package/dist/{es-modules → esm}/adapters/REST/endpoints/access-token.js +20 -22
  6. package/dist/esm/adapters/REST/endpoints/api-key.js +41 -0
  7. package/dist/esm/adapters/REST/endpoints/app-access-token.js +7 -0
  8. package/dist/esm/adapters/REST/endpoints/app-action-call.js +61 -0
  9. package/dist/esm/adapters/REST/endpoints/app-action.js +35 -0
  10. package/dist/esm/adapters/REST/endpoints/app-bundle.js +34 -0
  11. package/dist/esm/adapters/REST/endpoints/app-definition.js +39 -0
  12. package/dist/esm/adapters/REST/endpoints/app-details.js +13 -0
  13. package/dist/esm/adapters/REST/endpoints/app-event-subscription.js +13 -0
  14. package/dist/esm/adapters/REST/endpoints/app-installation.js +35 -0
  15. package/dist/esm/adapters/REST/endpoints/app-key.js +16 -0
  16. package/dist/esm/adapters/REST/endpoints/app-signed-request.js +7 -0
  17. package/dist/esm/adapters/REST/endpoints/app-signing-secret.js +13 -0
  18. package/dist/esm/adapters/REST/endpoints/app-upload.js +24 -0
  19. package/dist/esm/adapters/REST/endpoints/asset-key.js +31 -0
  20. package/dist/esm/adapters/REST/endpoints/asset.js +170 -0
  21. package/dist/esm/adapters/REST/endpoints/bulk-action.js +16 -0
  22. package/dist/esm/adapters/REST/endpoints/comment.js +85 -0
  23. package/dist/esm/adapters/REST/endpoints/concept-scheme.js +40 -0
  24. package/dist/esm/adapters/REST/endpoints/concept.js +59 -0
  25. package/dist/esm/adapters/REST/endpoints/content-type.js +47 -0
  26. package/dist/esm/adapters/REST/endpoints/editor-interface.js +20 -0
  27. package/dist/esm/adapters/REST/endpoints/entry.js +90 -0
  28. package/dist/esm/adapters/REST/endpoints/environment-alias.js +38 -0
  29. package/dist/esm/adapters/REST/endpoints/environment-template-installation.js +20 -0
  30. package/dist/esm/adapters/REST/endpoints/environment-template.js +38 -0
  31. package/dist/esm/adapters/REST/endpoints/environment.js +40 -0
  32. package/dist/esm/adapters/REST/endpoints/extension.js +36 -0
  33. package/dist/esm/adapters/REST/endpoints/function-log.js +20 -0
  34. package/dist/esm/adapters/REST/endpoints/function.js +21 -0
  35. package/dist/esm/adapters/REST/endpoints/http.js +22 -0
  36. package/dist/esm/adapters/REST/endpoints/index.js +131 -0
  37. package/dist/esm/adapters/REST/endpoints/locale.js +31 -0
  38. package/dist/esm/adapters/REST/endpoints/organization-invitation.js +20 -0
  39. package/dist/esm/adapters/REST/endpoints/organization-membership.js +27 -0
  40. package/dist/esm/adapters/REST/endpoints/organization.js +25 -0
  41. package/dist/esm/adapters/REST/endpoints/personal-access-token.js +32 -0
  42. package/dist/esm/adapters/REST/endpoints/preview-api-key.js +12 -0
  43. package/dist/esm/adapters/REST/endpoints/raw.js +37 -0
  44. package/dist/esm/adapters/REST/endpoints/release-action.js +17 -0
  45. package/dist/esm/adapters/REST/endpoints/release.js +50 -0
  46. package/dist/esm/adapters/REST/endpoints/resource-provider.js +14 -0
  47. package/dist/esm/adapters/REST/endpoints/resource-type.js +24 -0
  48. package/dist/esm/adapters/REST/endpoints/resource.js +8 -0
  49. package/dist/esm/adapters/REST/endpoints/role.js +40 -0
  50. package/dist/esm/adapters/REST/endpoints/scheduled-action.js +38 -0
  51. package/dist/esm/adapters/REST/endpoints/snapshot.js +25 -0
  52. package/dist/esm/adapters/REST/endpoints/space-member.js +8 -0
  53. package/dist/esm/adapters/REST/endpoints/space-membership.js +51 -0
  54. package/dist/esm/adapters/REST/endpoints/space.js +27 -0
  55. package/dist/esm/adapters/REST/endpoints/tag.js +31 -0
  56. package/dist/esm/adapters/REST/endpoints/task.js +33 -0
  57. package/dist/esm/adapters/REST/endpoints/team-membership.js +28 -0
  58. package/dist/esm/adapters/REST/endpoints/team-space-membership.js +38 -0
  59. package/dist/esm/adapters/REST/endpoints/team.js +29 -0
  60. package/dist/esm/adapters/REST/endpoints/ui-config.js +19 -0
  61. package/dist/esm/adapters/REST/endpoints/upload-credentials.js +14 -0
  62. package/dist/esm/adapters/REST/endpoints/upload.js +38 -0
  63. package/dist/esm/adapters/REST/endpoints/usage.js +14 -0
  64. package/dist/esm/adapters/REST/endpoints/user-ui-config.js +19 -0
  65. package/dist/esm/adapters/REST/endpoints/user.js +21 -0
  66. package/dist/esm/adapters/REST/endpoints/utils.js +17 -0
  67. package/dist/esm/adapters/REST/endpoints/webhook.js +82 -0
  68. package/dist/esm/adapters/REST/endpoints/workflow-definition.js +35 -0
  69. package/dist/esm/adapters/REST/endpoints/workflow.js +42 -0
  70. package/dist/esm/adapters/REST/endpoints/workflows-changelog.js +9 -0
  71. package/dist/esm/adapters/REST/rest-adapter.js +40 -0
  72. package/dist/esm/common-types.js +6 -0
  73. package/dist/esm/common-utils.js +32 -0
  74. package/dist/esm/constants/editor-interface-defaults/controls-defaults.js +153 -0
  75. package/dist/esm/constants/editor-interface-defaults/editors-defaults.js +37 -0
  76. package/dist/esm/constants/editor-interface-defaults/index.js +12 -0
  77. package/dist/esm/constants/editor-interface-defaults/sidebar-defaults.js +68 -0
  78. package/dist/esm/constants/editor-interface-defaults/types.js +15 -0
  79. package/dist/esm/create-adapter.js +19 -0
  80. package/dist/esm/create-app-definition-api.js +252 -0
  81. package/dist/esm/create-contentful-api.js +512 -0
  82. package/dist/esm/create-entry-api.js +479 -0
  83. package/dist/esm/create-environment-api.js +2337 -0
  84. package/dist/esm/create-environment-template-api.js +268 -0
  85. package/dist/esm/create-organization-api.js +1134 -0
  86. package/dist/esm/create-space-api.js +1436 -0
  87. package/dist/esm/create-ui-config-api.js +53 -0
  88. package/dist/esm/create-user-ui-config-api.js +53 -0
  89. package/dist/{es-modules → esm}/enhance-with-methods.js +13 -11
  90. package/dist/esm/entities/access-token.js +33 -0
  91. package/dist/esm/entities/api-key.js +56 -0
  92. package/dist/esm/entities/app-access-token.js +15 -0
  93. package/dist/esm/entities/app-action-call.js +61 -0
  94. package/dist/esm/entities/app-action.js +45 -0
  95. package/dist/esm/entities/app-bundle.js +45 -0
  96. package/dist/esm/entities/app-definition.js +26 -0
  97. package/dist/esm/entities/app-details.js +37 -0
  98. package/dist/esm/entities/app-event-subscription.js +32 -0
  99. package/dist/esm/entities/app-installation.js +52 -0
  100. package/dist/esm/entities/app-key.js +41 -0
  101. package/dist/{es-modules → esm}/entities/app-signed-request.js +7 -4
  102. package/dist/esm/entities/app-signing-secret.js +32 -0
  103. package/dist/esm/entities/app-upload.js +44 -0
  104. package/dist/{es-modules → esm}/entities/asset-key.js +7 -4
  105. package/dist/esm/entities/asset.js +121 -0
  106. package/dist/esm/entities/bulk-action.js +58 -0
  107. package/dist/esm/entities/comment.js +57 -0
  108. package/dist/esm/entities/concept-scheme.js +1 -0
  109. package/dist/esm/entities/concept.js +1 -0
  110. package/dist/esm/entities/content-type.js +117 -0
  111. package/dist/esm/entities/editor-interface.js +47 -0
  112. package/dist/esm/entities/entry.js +24 -0
  113. package/dist/esm/entities/environment-alias.js +55 -0
  114. package/dist/esm/entities/environment-template-installation.js +20 -0
  115. package/dist/esm/entities/environment-template.js +15 -0
  116. package/dist/esm/entities/environment.js +31 -0
  117. package/dist/esm/entities/extension.js +51 -0
  118. package/dist/{es-modules → esm}/entities/function-log.js +9 -7
  119. package/dist/esm/entities/function.js +63 -0
  120. package/dist/esm/entities/index.js +123 -0
  121. package/dist/esm/entities/locale.js +54 -0
  122. package/dist/esm/entities/organization-invitation.js +15 -0
  123. package/dist/esm/entities/organization-membership.js +50 -0
  124. package/dist/esm/entities/organization.js +29 -0
  125. package/dist/esm/entities/personal-access-token.js +33 -0
  126. package/dist/esm/entities/preview-api-key.js +28 -0
  127. package/dist/esm/entities/release-action.js +52 -0
  128. package/dist/esm/entities/release.js +107 -0
  129. package/dist/esm/entities/resource-provider.js +137 -0
  130. package/dist/esm/entities/resource-type.js +94 -0
  131. package/dist/esm/entities/resource.js +10 -0
  132. package/dist/esm/entities/role.js +50 -0
  133. package/dist/esm/entities/scheduled-action.js +148 -0
  134. package/dist/esm/entities/snapshot.js +33 -0
  135. package/dist/esm/entities/space-member.js +20 -0
  136. package/dist/esm/entities/space-membership.js +50 -0
  137. package/dist/esm/entities/space.js +30 -0
  138. package/dist/esm/entities/tag.js +50 -0
  139. package/dist/esm/entities/task.js +51 -0
  140. package/dist/esm/entities/team-membership.js +51 -0
  141. package/dist/esm/entities/team-space-membership.js +50 -0
  142. package/dist/esm/entities/team.js +50 -0
  143. package/dist/esm/entities/ui-config.js +18 -0
  144. package/dist/esm/entities/upload.js +36 -0
  145. package/dist/esm/entities/usage.js +22 -0
  146. package/dist/esm/entities/user-ui-config.js +18 -0
  147. package/dist/esm/entities/user.js +25 -0
  148. package/dist/esm/entities/webhook.js +74 -0
  149. package/dist/esm/entities/workflow-definition.js +73 -0
  150. package/dist/esm/index.js +35 -0
  151. package/dist/esm/methods/action.js +49 -0
  152. package/dist/esm/methods/content-type.js +49 -0
  153. package/dist/esm/methods/utils.js +9 -0
  154. package/dist/esm/plain/as-iterator.js +30 -0
  155. package/dist/esm/plain/checks.js +10 -0
  156. package/dist/esm/plain/pagination-helper.js +54 -0
  157. package/dist/esm/plain/plain-client.js +496 -0
  158. package/dist/esm/plain/wrappers/wrap.js +24 -0
  159. package/dist/esm/upload-http-client.js +15 -0
  160. package/dist/stats-browser-min.html +4842 -0
  161. package/dist/{typings → types}/create-contentful-api.d.ts +1 -0
  162. package/dist/{typings → types}/create-environment-api.d.ts +2 -2
  163. package/dist/{typings → types}/create-ui-config-api.d.ts +1 -1
  164. package/dist/{typings → types}/create-user-ui-config-api.d.ts +1 -1
  165. package/dist/{typings → types}/entities/ui-config.d.ts +1 -1
  166. package/dist/{typings → types}/entities/user-ui-config.d.ts +1 -1
  167. package/dist/{typings/contentful-management.d.ts → types/index.d.ts} +1 -1
  168. package/dist/{typings → types}/plain/common-types.d.ts +3 -2
  169. package/package.json +52 -44
  170. package/dist/contentful-management.browser.js.map +0 -1
  171. package/dist/contentful-management.node.js +0 -31604
  172. package/dist/contentful-management.node.js.map +0 -1
  173. package/dist/contentful-management.node.min.js +0 -2
  174. package/dist/es-modules/adapters/REST/endpoints/api-key.js +0 -47
  175. package/dist/es-modules/adapters/REST/endpoints/app-access-token.js +0 -8
  176. package/dist/es-modules/adapters/REST/endpoints/app-action-call.js +0 -69
  177. package/dist/es-modules/adapters/REST/endpoints/app-action.js +0 -32
  178. package/dist/es-modules/adapters/REST/endpoints/app-bundle.js +0 -36
  179. package/dist/es-modules/adapters/REST/endpoints/app-definition.js +0 -45
  180. package/dist/es-modules/adapters/REST/endpoints/app-details.js +0 -10
  181. package/dist/es-modules/adapters/REST/endpoints/app-event-subscription.js +0 -10
  182. package/dist/es-modules/adapters/REST/endpoints/app-installation.js +0 -39
  183. package/dist/es-modules/adapters/REST/endpoints/app-key.js +0 -13
  184. package/dist/es-modules/adapters/REST/endpoints/app-signed-request.js +0 -4
  185. package/dist/es-modules/adapters/REST/endpoints/app-signing-secret.js +0 -10
  186. package/dist/es-modules/adapters/REST/endpoints/app-upload.js +0 -23
  187. package/dist/es-modules/adapters/REST/endpoints/asset-key.js +0 -33
  188. package/dist/es-modules/adapters/REST/endpoints/asset.js +0 -220
  189. package/dist/es-modules/adapters/REST/endpoints/bulk-action.js +0 -13
  190. package/dist/es-modules/adapters/REST/endpoints/comment.js +0 -101
  191. package/dist/es-modules/adapters/REST/endpoints/concept-scheme.js +0 -52
  192. package/dist/es-modules/adapters/REST/endpoints/concept.js +0 -85
  193. package/dist/es-modules/adapters/REST/endpoints/content-type.js +0 -61
  194. package/dist/es-modules/adapters/REST/endpoints/editor-interface.js +0 -24
  195. package/dist/es-modules/adapters/REST/endpoints/entry.js +0 -113
  196. package/dist/es-modules/adapters/REST/endpoints/environment-alias.js +0 -46
  197. package/dist/es-modules/adapters/REST/endpoints/environment-template-installation.js +0 -43
  198. package/dist/es-modules/adapters/REST/endpoints/environment-template.js +0 -88
  199. package/dist/es-modules/adapters/REST/endpoints/environment.js +0 -42
  200. package/dist/es-modules/adapters/REST/endpoints/extension.js +0 -44
  201. package/dist/es-modules/adapters/REST/endpoints/function-log.js +0 -22
  202. package/dist/es-modules/adapters/REST/endpoints/function.js +0 -20
  203. package/dist/es-modules/adapters/REST/endpoints/http.js +0 -39
  204. package/dist/es-modules/adapters/REST/endpoints/index.js +0 -128
  205. package/dist/es-modules/adapters/REST/endpoints/locale.js +0 -35
  206. package/dist/es-modules/adapters/REST/endpoints/organization-invitation.js +0 -22
  207. package/dist/es-modules/adapters/REST/endpoints/organization-membership.js +0 -35
  208. package/dist/es-modules/adapters/REST/endpoints/organization.js +0 -26
  209. package/dist/es-modules/adapters/REST/endpoints/personal-access-token.js +0 -33
  210. package/dist/es-modules/adapters/REST/endpoints/preview-api-key.js +0 -9
  211. package/dist/es-modules/adapters/REST/endpoints/raw.js +0 -42
  212. package/dist/es-modules/adapters/REST/endpoints/release-action.js +0 -21
  213. package/dist/es-modules/adapters/REST/endpoints/release.js +0 -58
  214. package/dist/es-modules/adapters/REST/endpoints/resource-provider.js +0 -13
  215. package/dist/es-modules/adapters/REST/endpoints/resource-type.js +0 -23
  216. package/dist/es-modules/adapters/REST/endpoints/resource.js +0 -5
  217. package/dist/es-modules/adapters/REST/endpoints/role.js +0 -44
  218. package/dist/es-modules/adapters/REST/endpoints/scheduled-action.js +0 -35
  219. package/dist/es-modules/adapters/REST/endpoints/snapshot.js +0 -22
  220. package/dist/es-modules/adapters/REST/endpoints/space-member.js +0 -5
  221. package/dist/es-modules/adapters/REST/endpoints/space-membership.js +0 -55
  222. package/dist/es-modules/adapters/REST/endpoints/space.js +0 -32
  223. package/dist/es-modules/adapters/REST/endpoints/tag.js +0 -46
  224. package/dist/es-modules/adapters/REST/endpoints/task.js +0 -47
  225. package/dist/es-modules/adapters/REST/endpoints/team-membership.js +0 -34
  226. package/dist/es-modules/adapters/REST/endpoints/team-space-membership.js +0 -45
  227. package/dist/es-modules/adapters/REST/endpoints/team.js +0 -35
  228. package/dist/es-modules/adapters/REST/endpoints/ui-config.js +0 -16
  229. package/dist/es-modules/adapters/REST/endpoints/upload-credentials.js +0 -11
  230. package/dist/es-modules/adapters/REST/endpoints/upload.js +0 -37
  231. package/dist/es-modules/adapters/REST/endpoints/usage.js +0 -11
  232. package/dist/es-modules/adapters/REST/endpoints/user-ui-config.js +0 -16
  233. package/dist/es-modules/adapters/REST/endpoints/user.js +0 -20
  234. package/dist/es-modules/adapters/REST/endpoints/utils.js +0 -28
  235. package/dist/es-modules/adapters/REST/endpoints/webhook.js +0 -93
  236. package/dist/es-modules/adapters/REST/endpoints/workflow-definition.js +0 -46
  237. package/dist/es-modules/adapters/REST/endpoints/workflow.js +0 -59
  238. package/dist/es-modules/adapters/REST/endpoints/workflows-changelog.js +0 -6
  239. package/dist/es-modules/adapters/REST/rest-adapter.js +0 -58
  240. package/dist/es-modules/adapters/REST/types.js +0 -1
  241. package/dist/es-modules/common-types.js +0 -54
  242. package/dist/es-modules/common-utils.js +0 -30
  243. package/dist/es-modules/constants/editor-interface-defaults/controls-defaults.js +0 -255
  244. package/dist/es-modules/constants/editor-interface-defaults/editors-defaults.js +0 -34
  245. package/dist/es-modules/constants/editor-interface-defaults/index.js +0 -9
  246. package/dist/es-modules/constants/editor-interface-defaults/sidebar-defaults.js +0 -57
  247. package/dist/es-modules/constants/editor-interface-defaults/types.js +0 -14
  248. package/dist/es-modules/contentful-management.js +0 -65
  249. package/dist/es-modules/create-adapter.js +0 -16
  250. package/dist/es-modules/create-app-definition-api.js +0 -263
  251. package/dist/es-modules/create-contentful-api.js +0 -576
  252. package/dist/es-modules/create-entry-api.js +0 -548
  253. package/dist/es-modules/create-environment-api.js +0 -2454
  254. package/dist/es-modules/create-environment-template-api.js +0 -316
  255. package/dist/es-modules/create-organization-api.js +0 -1306
  256. package/dist/es-modules/create-space-api.js +0 -1565
  257. package/dist/es-modules/create-ui-config-api.js +0 -60
  258. package/dist/es-modules/create-user-ui-config-api.js +0 -60
  259. package/dist/es-modules/entities/access-token.js +0 -38
  260. package/dist/es-modules/entities/api-key.js +0 -55
  261. package/dist/es-modules/entities/app-access-token.js +0 -12
  262. package/dist/es-modules/entities/app-action-call.js +0 -70
  263. package/dist/es-modules/entities/app-action.js +0 -44
  264. package/dist/es-modules/entities/app-bundle.js +0 -44
  265. package/dist/es-modules/entities/app-definition.js +0 -24
  266. package/dist/es-modules/entities/app-details.js +0 -35
  267. package/dist/es-modules/entities/app-event-subscription.js +0 -30
  268. package/dist/es-modules/entities/app-installation.js +0 -51
  269. package/dist/es-modules/entities/app-key.js +0 -40
  270. package/dist/es-modules/entities/app-signing-secret.js +0 -30
  271. package/dist/es-modules/entities/app-upload.js +0 -43
  272. package/dist/es-modules/entities/asset.js +0 -131
  273. package/dist/es-modules/entities/bulk-action.js +0 -61
  274. package/dist/es-modules/entities/comment.js +0 -77
  275. package/dist/es-modules/entities/concept-scheme.js +0 -1
  276. package/dist/es-modules/entities/concept.js +0 -1
  277. package/dist/es-modules/entities/content-type-fields.js +0 -1
  278. package/dist/es-modules/entities/content-type.js +0 -146
  279. package/dist/es-modules/entities/editor-interface.js +0 -46
  280. package/dist/es-modules/entities/entry.js +0 -22
  281. package/dist/es-modules/entities/environment-alias.js +0 -54
  282. package/dist/es-modules/entities/environment-template-installation.js +0 -17
  283. package/dist/es-modules/entities/environment-template.js +0 -12
  284. package/dist/es-modules/entities/environment.js +0 -29
  285. package/dist/es-modules/entities/extension.js +0 -50
  286. package/dist/es-modules/entities/field-type.js +0 -1
  287. package/dist/es-modules/entities/function.js +0 -61
  288. package/dist/es-modules/entities/index.js +0 -120
  289. package/dist/es-modules/entities/locale.js +0 -53
  290. package/dist/es-modules/entities/organization-invitation.js +0 -12
  291. package/dist/es-modules/entities/organization-membership.js +0 -49
  292. package/dist/es-modules/entities/organization.js +0 -32
  293. package/dist/es-modules/entities/personal-access-token.js +0 -38
  294. package/dist/es-modules/entities/preview-api-key.js +0 -27
  295. package/dist/es-modules/entities/release-action.js +0 -53
  296. package/dist/es-modules/entities/release.js +0 -105
  297. package/dist/es-modules/entities/resource-provider.js +0 -139
  298. package/dist/es-modules/entities/resource-type.js +0 -93
  299. package/dist/es-modules/entities/resource.js +0 -7
  300. package/dist/es-modules/entities/role.js +0 -49
  301. package/dist/es-modules/entities/scheduled-action.js +0 -155
  302. package/dist/es-modules/entities/snapshot.js +0 -31
  303. package/dist/es-modules/entities/space-member.js +0 -18
  304. package/dist/es-modules/entities/space-membership.js +0 -49
  305. package/dist/es-modules/entities/space.js +0 -28
  306. package/dist/es-modules/entities/tag.js +0 -56
  307. package/dist/es-modules/entities/task.js +0 -57
  308. package/dist/es-modules/entities/team-membership.js +0 -50
  309. package/dist/es-modules/entities/team-space-membership.js +0 -49
  310. package/dist/es-modules/entities/team.js +0 -49
  311. package/dist/es-modules/entities/ui-config.js +0 -15
  312. package/dist/es-modules/entities/upload-credential.js +0 -33
  313. package/dist/es-modules/entities/upload.js +0 -34
  314. package/dist/es-modules/entities/usage.js +0 -20
  315. package/dist/es-modules/entities/user-ui-config.js +0 -15
  316. package/dist/es-modules/entities/user.js +0 -23
  317. package/dist/es-modules/entities/utils.js +0 -1
  318. package/dist/es-modules/entities/webhook.js +0 -80
  319. package/dist/es-modules/entities/widget-parameters.js +0 -1
  320. package/dist/es-modules/entities/workflow-definition.js +0 -87
  321. package/dist/es-modules/entities/workflow.js +0 -76
  322. package/dist/es-modules/entities/workflows-changelog-entry.js +0 -24
  323. package/dist/es-modules/export-types.js +0 -3
  324. package/dist/es-modules/methods/action.js +0 -54
  325. package/dist/es-modules/methods/bulk-action.js +0 -15
  326. package/dist/es-modules/methods/content-type.js +0 -47
  327. package/dist/es-modules/methods/release-action.js +0 -17
  328. package/dist/es-modules/methods/utils.js +0 -7
  329. package/dist/es-modules/plain/as-iterator.js +0 -47
  330. package/dist/es-modules/plain/checks.js +0 -8
  331. package/dist/es-modules/plain/common-types.js +0 -1
  332. package/dist/es-modules/plain/entities/app-access-token.js +0 -1
  333. package/dist/es-modules/plain/entities/app-action-call.js +0 -1
  334. package/dist/es-modules/plain/entities/app-action.js +0 -1
  335. package/dist/es-modules/plain/entities/app-bundle.js +0 -1
  336. package/dist/es-modules/plain/entities/app-definition.js +0 -1
  337. package/dist/es-modules/plain/entities/app-details.js +0 -1
  338. package/dist/es-modules/plain/entities/app-event-subscription.js +0 -1
  339. package/dist/es-modules/plain/entities/app-installation.js +0 -1
  340. package/dist/es-modules/plain/entities/app-key.js +0 -1
  341. package/dist/es-modules/plain/entities/app-signed-request.js +0 -1
  342. package/dist/es-modules/plain/entities/app-signing-secret.js +0 -1
  343. package/dist/es-modules/plain/entities/app-upload.js +0 -1
  344. package/dist/es-modules/plain/entities/comment.js +0 -1
  345. package/dist/es-modules/plain/entities/concept-scheme.js +0 -1
  346. package/dist/es-modules/plain/entities/concept.js +0 -1
  347. package/dist/es-modules/plain/entities/editor-interface.js +0 -1
  348. package/dist/es-modules/plain/entities/environment-alias.js +0 -1
  349. package/dist/es-modules/plain/entities/environment.js +0 -1
  350. package/dist/es-modules/plain/entities/extension.js +0 -1
  351. package/dist/es-modules/plain/entities/function-log.js +0 -1
  352. package/dist/es-modules/plain/entities/function.js +0 -1
  353. package/dist/es-modules/plain/entities/locale.js +0 -1
  354. package/dist/es-modules/plain/entities/organization.js +0 -1
  355. package/dist/es-modules/plain/entities/resource-provider.js +0 -1
  356. package/dist/es-modules/plain/entities/resource-type.js +0 -1
  357. package/dist/es-modules/plain/entities/resource.js +0 -1
  358. package/dist/es-modules/plain/entities/role.js +0 -1
  359. package/dist/es-modules/plain/entities/space-member.js +0 -1
  360. package/dist/es-modules/plain/entities/space-membership.js +0 -1
  361. package/dist/es-modules/plain/entities/space.js +0 -1
  362. package/dist/es-modules/plain/entities/tag.js +0 -1
  363. package/dist/es-modules/plain/entities/task.js +0 -1
  364. package/dist/es-modules/plain/entities/team-membership.js +0 -1
  365. package/dist/es-modules/plain/entities/team-space-membership.js +0 -1
  366. package/dist/es-modules/plain/entities/team.js +0 -1
  367. package/dist/es-modules/plain/entities/ui-config.js +0 -1
  368. package/dist/es-modules/plain/entities/upload-credential.js +0 -1
  369. package/dist/es-modules/plain/entities/upload.js +0 -1
  370. package/dist/es-modules/plain/entities/usage.js +0 -1
  371. package/dist/es-modules/plain/entities/user-ui-config.js +0 -1
  372. package/dist/es-modules/plain/entities/user.js +0 -1
  373. package/dist/es-modules/plain/entities/webhook.js +0 -1
  374. package/dist/es-modules/plain/entities/workflow-definition.js +0 -1
  375. package/dist/es-modules/plain/entities/workflow.js +0 -1
  376. package/dist/es-modules/plain/entities/workflows-changelog.js +0 -1
  377. package/dist/es-modules/plain/pagination-helper.js +0 -76
  378. package/dist/es-modules/plain/plain-client.js +0 -524
  379. package/dist/es-modules/plain/wrappers/wrap.js +0 -46
  380. package/dist/es-modules/plain/wrappers/wrap.test-d.js +0 -15
  381. package/dist/es-modules/upload-http-client.js +0 -17
  382. /package/dist/{typings → types}/adapters/REST/endpoints/access-token.d.ts +0 -0
  383. /package/dist/{typings → types}/adapters/REST/endpoints/api-key.d.ts +0 -0
  384. /package/dist/{typings → types}/adapters/REST/endpoints/app-access-token.d.ts +0 -0
  385. /package/dist/{typings → types}/adapters/REST/endpoints/app-action-call.d.ts +0 -0
  386. /package/dist/{typings → types}/adapters/REST/endpoints/app-action.d.ts +0 -0
  387. /package/dist/{typings → types}/adapters/REST/endpoints/app-bundle.d.ts +0 -0
  388. /package/dist/{typings → types}/adapters/REST/endpoints/app-definition.d.ts +0 -0
  389. /package/dist/{typings → types}/adapters/REST/endpoints/app-details.d.ts +0 -0
  390. /package/dist/{typings → types}/adapters/REST/endpoints/app-event-subscription.d.ts +0 -0
  391. /package/dist/{typings → types}/adapters/REST/endpoints/app-installation.d.ts +0 -0
  392. /package/dist/{typings → types}/adapters/REST/endpoints/app-key.d.ts +0 -0
  393. /package/dist/{typings → types}/adapters/REST/endpoints/app-signed-request.d.ts +0 -0
  394. /package/dist/{typings → types}/adapters/REST/endpoints/app-signing-secret.d.ts +0 -0
  395. /package/dist/{typings → types}/adapters/REST/endpoints/app-upload.d.ts +0 -0
  396. /package/dist/{typings → types}/adapters/REST/endpoints/asset-key.d.ts +0 -0
  397. /package/dist/{typings → types}/adapters/REST/endpoints/asset.d.ts +0 -0
  398. /package/dist/{typings → types}/adapters/REST/endpoints/bulk-action.d.ts +0 -0
  399. /package/dist/{typings → types}/adapters/REST/endpoints/comment.d.ts +0 -0
  400. /package/dist/{typings → types}/adapters/REST/endpoints/concept-scheme.d.ts +0 -0
  401. /package/dist/{typings → types}/adapters/REST/endpoints/concept.d.ts +0 -0
  402. /package/dist/{typings → types}/adapters/REST/endpoints/content-type.d.ts +0 -0
  403. /package/dist/{typings → types}/adapters/REST/endpoints/editor-interface.d.ts +0 -0
  404. /package/dist/{typings → types}/adapters/REST/endpoints/entry.d.ts +0 -0
  405. /package/dist/{typings → types}/adapters/REST/endpoints/environment-alias.d.ts +0 -0
  406. /package/dist/{typings → types}/adapters/REST/endpoints/environment-template-installation.d.ts +0 -0
  407. /package/dist/{typings → types}/adapters/REST/endpoints/environment-template.d.ts +0 -0
  408. /package/dist/{typings → types}/adapters/REST/endpoints/environment.d.ts +0 -0
  409. /package/dist/{typings → types}/adapters/REST/endpoints/extension.d.ts +0 -0
  410. /package/dist/{typings → types}/adapters/REST/endpoints/function-log.d.ts +0 -0
  411. /package/dist/{typings → types}/adapters/REST/endpoints/function.d.ts +0 -0
  412. /package/dist/{typings → types}/adapters/REST/endpoints/http.d.ts +0 -0
  413. /package/dist/{typings → types}/adapters/REST/endpoints/index.d.ts +0 -0
  414. /package/dist/{typings → types}/adapters/REST/endpoints/locale.d.ts +0 -0
  415. /package/dist/{typings → types}/adapters/REST/endpoints/organization-invitation.d.ts +0 -0
  416. /package/dist/{typings → types}/adapters/REST/endpoints/organization-membership.d.ts +0 -0
  417. /package/dist/{typings → types}/adapters/REST/endpoints/organization.d.ts +0 -0
  418. /package/dist/{typings → types}/adapters/REST/endpoints/personal-access-token.d.ts +0 -0
  419. /package/dist/{typings → types}/adapters/REST/endpoints/preview-api-key.d.ts +0 -0
  420. /package/dist/{typings → types}/adapters/REST/endpoints/raw.d.ts +0 -0
  421. /package/dist/{typings → types}/adapters/REST/endpoints/release-action.d.ts +0 -0
  422. /package/dist/{typings → types}/adapters/REST/endpoints/release.d.ts +0 -0
  423. /package/dist/{typings → types}/adapters/REST/endpoints/resource-provider.d.ts +0 -0
  424. /package/dist/{typings → types}/adapters/REST/endpoints/resource-type.d.ts +0 -0
  425. /package/dist/{typings → types}/adapters/REST/endpoints/resource.d.ts +0 -0
  426. /package/dist/{typings → types}/adapters/REST/endpoints/role.d.ts +0 -0
  427. /package/dist/{typings → types}/adapters/REST/endpoints/scheduled-action.d.ts +0 -0
  428. /package/dist/{typings → types}/adapters/REST/endpoints/snapshot.d.ts +0 -0
  429. /package/dist/{typings → types}/adapters/REST/endpoints/space-member.d.ts +0 -0
  430. /package/dist/{typings → types}/adapters/REST/endpoints/space-membership.d.ts +0 -0
  431. /package/dist/{typings → types}/adapters/REST/endpoints/space.d.ts +0 -0
  432. /package/dist/{typings → types}/adapters/REST/endpoints/tag.d.ts +0 -0
  433. /package/dist/{typings → types}/adapters/REST/endpoints/task.d.ts +0 -0
  434. /package/dist/{typings → types}/adapters/REST/endpoints/team-membership.d.ts +0 -0
  435. /package/dist/{typings → types}/adapters/REST/endpoints/team-space-membership.d.ts +0 -0
  436. /package/dist/{typings → types}/adapters/REST/endpoints/team.d.ts +0 -0
  437. /package/dist/{typings → types}/adapters/REST/endpoints/ui-config.d.ts +0 -0
  438. /package/dist/{typings → types}/adapters/REST/endpoints/upload-credentials.d.ts +0 -0
  439. /package/dist/{typings → types}/adapters/REST/endpoints/upload.d.ts +0 -0
  440. /package/dist/{typings → types}/adapters/REST/endpoints/usage.d.ts +0 -0
  441. /package/dist/{typings → types}/adapters/REST/endpoints/user-ui-config.d.ts +0 -0
  442. /package/dist/{typings → types}/adapters/REST/endpoints/user.d.ts +0 -0
  443. /package/dist/{typings → types}/adapters/REST/endpoints/utils.d.ts +0 -0
  444. /package/dist/{typings → types}/adapters/REST/endpoints/webhook.d.ts +0 -0
  445. /package/dist/{typings → types}/adapters/REST/endpoints/workflow-definition.d.ts +0 -0
  446. /package/dist/{typings → types}/adapters/REST/endpoints/workflow.d.ts +0 -0
  447. /package/dist/{typings → types}/adapters/REST/endpoints/workflows-changelog.d.ts +0 -0
  448. /package/dist/{typings → types}/adapters/REST/rest-adapter.d.ts +0 -0
  449. /package/dist/{typings → types}/adapters/REST/types.d.ts +0 -0
  450. /package/dist/{typings → types}/common-types.d.ts +0 -0
  451. /package/dist/{typings → types}/common-utils.d.ts +0 -0
  452. /package/dist/{typings → types}/constants/editor-interface-defaults/controls-defaults.d.ts +0 -0
  453. /package/dist/{typings → types}/constants/editor-interface-defaults/editors-defaults.d.ts +0 -0
  454. /package/dist/{typings → types}/constants/editor-interface-defaults/index.d.ts +0 -0
  455. /package/dist/{typings → types}/constants/editor-interface-defaults/sidebar-defaults.d.ts +0 -0
  456. /package/dist/{typings → types}/constants/editor-interface-defaults/types.d.ts +0 -0
  457. /package/dist/{typings → types}/create-adapter.d.ts +0 -0
  458. /package/dist/{typings → types}/create-app-definition-api.d.ts +0 -0
  459. /package/dist/{typings → types}/create-entry-api.d.ts +0 -0
  460. /package/dist/{typings → types}/create-environment-template-api.d.ts +0 -0
  461. /package/dist/{typings → types}/create-organization-api.d.ts +0 -0
  462. /package/dist/{typings → types}/create-space-api.d.ts +0 -0
  463. /package/dist/{typings → types}/enhance-with-methods.d.ts +0 -0
  464. /package/dist/{typings → types}/entities/access-token.d.ts +0 -0
  465. /package/dist/{typings → types}/entities/api-key.d.ts +0 -0
  466. /package/dist/{typings → types}/entities/app-access-token.d.ts +0 -0
  467. /package/dist/{typings → types}/entities/app-action-call.d.ts +0 -0
  468. /package/dist/{typings → types}/entities/app-action.d.ts +0 -0
  469. /package/dist/{typings → types}/entities/app-bundle.d.ts +0 -0
  470. /package/dist/{typings → types}/entities/app-definition.d.ts +0 -0
  471. /package/dist/{typings → types}/entities/app-details.d.ts +0 -0
  472. /package/dist/{typings → types}/entities/app-event-subscription.d.ts +0 -0
  473. /package/dist/{typings → types}/entities/app-installation.d.ts +0 -0
  474. /package/dist/{typings → types}/entities/app-key.d.ts +0 -0
  475. /package/dist/{typings → types}/entities/app-signed-request.d.ts +0 -0
  476. /package/dist/{typings → types}/entities/app-signing-secret.d.ts +0 -0
  477. /package/dist/{typings → types}/entities/app-upload.d.ts +0 -0
  478. /package/dist/{typings → types}/entities/asset-key.d.ts +0 -0
  479. /package/dist/{typings → types}/entities/asset.d.ts +0 -0
  480. /package/dist/{typings → types}/entities/bulk-action.d.ts +0 -0
  481. /package/dist/{typings → types}/entities/comment.d.ts +0 -0
  482. /package/dist/{typings → types}/entities/concept-scheme.d.ts +0 -0
  483. /package/dist/{typings → types}/entities/concept.d.ts +0 -0
  484. /package/dist/{typings → types}/entities/content-type-fields.d.ts +0 -0
  485. /package/dist/{typings → types}/entities/content-type.d.ts +0 -0
  486. /package/dist/{typings → types}/entities/editor-interface.d.ts +0 -0
  487. /package/dist/{typings → types}/entities/entry.d.ts +0 -0
  488. /package/dist/{typings → types}/entities/environment-alias.d.ts +0 -0
  489. /package/dist/{typings → types}/entities/environment-template-installation.d.ts +0 -0
  490. /package/dist/{typings → types}/entities/environment-template.d.ts +0 -0
  491. /package/dist/{typings → types}/entities/environment.d.ts +0 -0
  492. /package/dist/{typings → types}/entities/extension.d.ts +0 -0
  493. /package/dist/{typings → types}/entities/field-type.d.ts +0 -0
  494. /package/dist/{typings → types}/entities/function-log.d.ts +0 -0
  495. /package/dist/{typings → types}/entities/function.d.ts +0 -0
  496. /package/dist/{typings → types}/entities/index.d.ts +0 -0
  497. /package/dist/{typings → types}/entities/locale.d.ts +0 -0
  498. /package/dist/{typings → types}/entities/organization-invitation.d.ts +0 -0
  499. /package/dist/{typings → types}/entities/organization-membership.d.ts +0 -0
  500. /package/dist/{typings → types}/entities/organization.d.ts +0 -0
  501. /package/dist/{typings → types}/entities/personal-access-token.d.ts +0 -0
  502. /package/dist/{typings → types}/entities/preview-api-key.d.ts +0 -0
  503. /package/dist/{typings → types}/entities/release-action.d.ts +0 -0
  504. /package/dist/{typings → types}/entities/release.d.ts +0 -0
  505. /package/dist/{typings → types}/entities/resource-provider.d.ts +0 -0
  506. /package/dist/{typings → types}/entities/resource-type.d.ts +0 -0
  507. /package/dist/{typings → types}/entities/resource.d.ts +0 -0
  508. /package/dist/{typings → types}/entities/role.d.ts +0 -0
  509. /package/dist/{typings → types}/entities/scheduled-action.d.ts +0 -0
  510. /package/dist/{typings → types}/entities/snapshot.d.ts +0 -0
  511. /package/dist/{typings → types}/entities/space-member.d.ts +0 -0
  512. /package/dist/{typings → types}/entities/space-membership.d.ts +0 -0
  513. /package/dist/{typings → types}/entities/space.d.ts +0 -0
  514. /package/dist/{typings → types}/entities/tag.d.ts +0 -0
  515. /package/dist/{typings → types}/entities/task.d.ts +0 -0
  516. /package/dist/{typings → types}/entities/team-membership.d.ts +0 -0
  517. /package/dist/{typings → types}/entities/team-space-membership.d.ts +0 -0
  518. /package/dist/{typings → types}/entities/team.d.ts +0 -0
  519. /package/dist/{typings → types}/entities/upload-credential.d.ts +0 -0
  520. /package/dist/{typings → types}/entities/upload.d.ts +0 -0
  521. /package/dist/{typings → types}/entities/usage.d.ts +0 -0
  522. /package/dist/{typings → types}/entities/user.d.ts +0 -0
  523. /package/dist/{typings → types}/entities/utils.d.ts +0 -0
  524. /package/dist/{typings → types}/entities/webhook.d.ts +0 -0
  525. /package/dist/{typings → types}/entities/widget-parameters.d.ts +0 -0
  526. /package/dist/{typings → types}/entities/workflow-definition.d.ts +0 -0
  527. /package/dist/{typings → types}/entities/workflow.d.ts +0 -0
  528. /package/dist/{typings → types}/entities/workflows-changelog-entry.d.ts +0 -0
  529. /package/dist/{typings → types}/export-types.d.ts +0 -0
  530. /package/dist/{typings → types}/methods/action.d.ts +0 -0
  531. /package/dist/{typings → types}/methods/bulk-action.d.ts +0 -0
  532. /package/dist/{typings → types}/methods/content-type.d.ts +0 -0
  533. /package/dist/{typings → types}/methods/release-action.d.ts +0 -0
  534. /package/dist/{typings → types}/methods/utils.d.ts +0 -0
  535. /package/dist/{typings → types}/plain/as-iterator.d.ts +0 -0
  536. /package/dist/{typings → types}/plain/checks.d.ts +0 -0
  537. /package/dist/{typings → types}/plain/entities/app-access-token.d.ts +0 -0
  538. /package/dist/{typings → types}/plain/entities/app-action-call.d.ts +0 -0
  539. /package/dist/{typings → types}/plain/entities/app-action.d.ts +0 -0
  540. /package/dist/{typings → types}/plain/entities/app-bundle.d.ts +0 -0
  541. /package/dist/{typings → types}/plain/entities/app-definition.d.ts +0 -0
  542. /package/dist/{typings → types}/plain/entities/app-details.d.ts +0 -0
  543. /package/dist/{typings → types}/plain/entities/app-event-subscription.d.ts +0 -0
  544. /package/dist/{typings → types}/plain/entities/app-installation.d.ts +0 -0
  545. /package/dist/{typings → types}/plain/entities/app-key.d.ts +0 -0
  546. /package/dist/{typings → types}/plain/entities/app-signed-request.d.ts +0 -0
  547. /package/dist/{typings → types}/plain/entities/app-signing-secret.d.ts +0 -0
  548. /package/dist/{typings → types}/plain/entities/app-upload.d.ts +0 -0
  549. /package/dist/{typings → types}/plain/entities/comment.d.ts +0 -0
  550. /package/dist/{typings → types}/plain/entities/concept-scheme.d.ts +0 -0
  551. /package/dist/{typings → types}/plain/entities/concept.d.ts +0 -0
  552. /package/dist/{typings → types}/plain/entities/editor-interface.d.ts +0 -0
  553. /package/dist/{typings → types}/plain/entities/environment-alias.d.ts +0 -0
  554. /package/dist/{typings → types}/plain/entities/environment.d.ts +0 -0
  555. /package/dist/{typings → types}/plain/entities/extension.d.ts +0 -0
  556. /package/dist/{typings → types}/plain/entities/function-log.d.ts +0 -0
  557. /package/dist/{typings → types}/plain/entities/function.d.ts +0 -0
  558. /package/dist/{typings → types}/plain/entities/locale.d.ts +0 -0
  559. /package/dist/{typings → types}/plain/entities/organization.d.ts +0 -0
  560. /package/dist/{typings → types}/plain/entities/resource-provider.d.ts +0 -0
  561. /package/dist/{typings → types}/plain/entities/resource-type.d.ts +0 -0
  562. /package/dist/{typings → types}/plain/entities/resource.d.ts +0 -0
  563. /package/dist/{typings → types}/plain/entities/role.d.ts +0 -0
  564. /package/dist/{typings → types}/plain/entities/space-member.d.ts +0 -0
  565. /package/dist/{typings → types}/plain/entities/space-membership.d.ts +0 -0
  566. /package/dist/{typings → types}/plain/entities/space.d.ts +0 -0
  567. /package/dist/{typings → types}/plain/entities/tag.d.ts +0 -0
  568. /package/dist/{typings → types}/plain/entities/task.d.ts +0 -0
  569. /package/dist/{typings → types}/plain/entities/team-membership.d.ts +0 -0
  570. /package/dist/{typings → types}/plain/entities/team-space-membership.d.ts +0 -0
  571. /package/dist/{typings → types}/plain/entities/team.d.ts +0 -0
  572. /package/dist/{typings → types}/plain/entities/ui-config.d.ts +0 -0
  573. /package/dist/{typings → types}/plain/entities/upload-credential.d.ts +0 -0
  574. /package/dist/{typings → types}/plain/entities/upload.d.ts +0 -0
  575. /package/dist/{typings → types}/plain/entities/usage.d.ts +0 -0
  576. /package/dist/{typings → types}/plain/entities/user-ui-config.d.ts +0 -0
  577. /package/dist/{typings → types}/plain/entities/user.d.ts +0 -0
  578. /package/dist/{typings → types}/plain/entities/webhook.d.ts +0 -0
  579. /package/dist/{typings → types}/plain/entities/workflow-definition.d.ts +0 -0
  580. /package/dist/{typings → types}/plain/entities/workflow.d.ts +0 -0
  581. /package/dist/{typings → types}/plain/entities/workflows-changelog.d.ts +0 -0
  582. /package/dist/{typings → types}/plain/pagination-helper.d.ts +0 -0
  583. /package/dist/{typings → types}/plain/plain-client.d.ts +0 -0
  584. /package/dist/{typings → types}/plain/wrappers/wrap.d.ts +0 -0
  585. /package/dist/{typings → types}/plain/wrappers/wrap.test-d.d.ts +0 -0
  586. /package/dist/{typings → types}/upload-http-client.d.ts +0 -0
@@ -1,2454 +0,0 @@
1
- const _excluded = ["installationId"];
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
8
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
9
- import { createRequestConfig } from 'contentful-sdk-core';
10
- import entities from './entities';
11
- import { wrapReleaseAction, wrapReleaseActionCollection } from './entities/release-action';
12
- import { wrapRelease, wrapReleaseCollection } from './entities/release';
13
- import { wrapTag, wrapTagCollection } from './entities/tag';
14
- import { wrapUIConfig } from './entities/ui-config';
15
- import { wrapUserUIConfig } from './entities/user-ui-config';
16
- import { wrapEnvironmentTemplateInstallationCollection } from './entities/environment-template-installation';
17
- import { wrapFunctionCollection } from './entities/function';
18
- import { wrapFunctionLog, wrapFunctionLogCollection } from './entities/function-log';
19
-
20
- /**
21
- * @private
22
- */
23
-
24
- /**
25
- * Creates API object with methods to access the Environment API
26
- * @param {ContentfulEnvironmentAPI} makeRequest - function to make requests via an adapter
27
- * @return {ContentfulSpaceAPI}
28
- * @private
29
- */
30
- export default function createEnvironmentApi(makeRequest) {
31
- const {
32
- wrapEnvironment
33
- } = entities.environment;
34
- const {
35
- wrapContentType,
36
- wrapContentTypeCollection
37
- } = entities.contentType;
38
- const {
39
- wrapEntry,
40
- wrapEntryCollection
41
- } = entities.entry;
42
- const {
43
- wrapAsset,
44
- wrapAssetCollection
45
- } = entities.asset;
46
- const {
47
- wrapAssetKey
48
- } = entities.assetKey;
49
- const {
50
- wrapLocale,
51
- wrapLocaleCollection
52
- } = entities.locale;
53
- const {
54
- wrapSnapshotCollection
55
- } = entities.snapshot;
56
- const {
57
- wrapEditorInterface,
58
- wrapEditorInterfaceCollection
59
- } = entities.editorInterface;
60
- const {
61
- wrapUpload
62
- } = entities.upload;
63
- const {
64
- wrapExtension,
65
- wrapExtensionCollection
66
- } = entities.extension;
67
- const {
68
- wrapAppInstallation,
69
- wrapAppInstallationCollection
70
- } = entities.appInstallation;
71
- const {
72
- wrapAppSignedRequest
73
- } = entities.appSignedRequest;
74
- const {
75
- wrapAppActionCall
76
- } = entities.appActionCall;
77
- const {
78
- wrapBulkAction
79
- } = entities.bulkAction;
80
- const {
81
- wrapAppAccessToken
82
- } = entities.appAccessToken;
83
- const {
84
- wrapResourceTypesForEnvironmentCollection
85
- } = entities.resourceType;
86
- const {
87
- wrapResourceCollection
88
- } = entities.resource;
89
- return {
90
- /**
91
- * Deletes the environment
92
- * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
93
- * @example ```javascript
94
- * const contentful = require('contentful-management')
95
- *
96
- * const client = contentful.createClient({
97
- * accessToken: '<content_management_api_key>'
98
- * })
99
- *
100
- * client.getSpace('<space_id>')
101
- * .then((space) => space.getEnvironment('<environment-id>'))
102
- * .then((environment) => environment.delete())
103
- * .then(() => console.log('Environment deleted.'))
104
- * .catch(console.error)
105
- * ```
106
- */
107
- delete: function deleteEnvironment() {
108
- const raw = this.toPlainObject();
109
- return makeRequest({
110
- entityType: 'Environment',
111
- action: 'delete',
112
- params: {
113
- spaceId: raw.sys.space.sys.id,
114
- environmentId: raw.sys.id
115
- }
116
- }).then(() => {
117
- // noop
118
- });
119
- },
120
- /**
121
- * Updates the environment
122
- * @return Promise for the updated environment.
123
- * @example ```javascript
124
- * const contentful = require('contentful-management')
125
- *
126
- * const client = contentful.createClient({
127
- * accessToken: '<content_management_api_key>'
128
- * })
129
- *
130
- * client.getSpace('<space_id>')
131
- * .then((space) => space.getEnvironment('<environment-id>'))
132
- * .then((environment) => {
133
- * environment.name = 'New name'
134
- * return environment.update()
135
- * })
136
- * .then((environment) => console.log(`Environment ${environment.sys.id} renamed.`)
137
- * .catch(console.error)
138
- * ```
139
- */
140
- update: function updateEnvironment() {
141
- const raw = this.toPlainObject();
142
- return makeRequest({
143
- entityType: 'Environment',
144
- action: 'update',
145
- params: {
146
- spaceId: raw.sys.space.sys.id,
147
- environmentId: raw.sys.id
148
- },
149
- payload: raw
150
- }).then(data => wrapEnvironment(makeRequest, data));
151
- },
152
- /**
153
- * Creates SDK Entry object (locally) from entry data
154
- * @param entryData - Entry Data
155
- * @return Entry
156
- * @example ```javascript
157
- * environment.getEntry('entryId').then(entry => {
158
- *
159
- * // Build a plainObject in order to make it usable for React (saving in state or redux)
160
- * const plainObject = entry.toPlainObject();
161
- *
162
- * // The entry is being updated in some way as plainObject:
163
- * const updatedPlainObject = {
164
- * ...plainObject,
165
- * fields: {
166
- * ...plainObject.fields,
167
- * title: {
168
- * 'en-US': 'updatedTitle'
169
- * }
170
- * }
171
- * };
172
- *
173
- * // Rebuild an sdk object out of the updated plainObject:
174
- * const entryWithMethodsAgain = environment.getEntryFromData(updatedPlainObject);
175
- *
176
- * // Update with help of the sdk method:
177
- * entryWithMethodsAgain.update();
178
- *
179
- * });
180
- * ```
181
- **/
182
- getEntryFromData(entryData) {
183
- return wrapEntry(makeRequest, entryData);
184
- },
185
- /**
186
- * Creates SDK Asset object (locally) from entry data
187
- * @param assetData - Asset ID
188
- * @return Asset
189
- * @example ```javascript
190
- * environment.getAsset('asset_id').then(asset => {
191
- *
192
- * // Build a plainObject in order to make it usable for React (saving in state or redux)
193
- * const plainObject = asset.toPlainObject();
194
- *
195
- * // The asset is being updated in some way as plainObject:
196
- * const updatedPlainObject = {
197
- * ...plainObject,
198
- * fields: {
199
- * ...plainObject.fields,
200
- * title: {
201
- * 'en-US': 'updatedTitle'
202
- * }
203
- * }
204
- * };
205
- *
206
- * // Rebuild an sdk object out of the updated plainObject:
207
- * const assetWithMethodsAgain = environment.getAssetFromData(updatedPlainObject);
208
- *
209
- * // Update with help of the sdk method:
210
- * assetWithMethodsAgain.update();
211
- *
212
- * });
213
- * ```
214
- */
215
- getAssetFromData(assetData) {
216
- return wrapAsset(makeRequest, assetData);
217
- },
218
- /**
219
- *
220
- * @description Get a BulkAction by ID.
221
- * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/bulk-action
222
- * @param bulkActionId - ID of the BulkAction to fetch
223
- * @returns - Promise with the BulkAction
224
- *
225
- * @example ```javascript
226
- * const contentful = require('contentful-management')
227
- *
228
- * const client = contentful.createClient({
229
- * accessToken: '<content_management_api_key>'
230
- * })
231
- *
232
- * client.getSpace('<space_id>')
233
- * .then((space) => space.getEnvironment('<environment_id>'))
234
- * .then((environment) => environment.getBulkAction('<bulk_action_id>'))
235
- * .then((bulkAction) => console.log(bulkAction))
236
- * ```
237
- */
238
- getBulkAction(bulkActionId) {
239
- const raw = this.toPlainObject();
240
- return makeRequest({
241
- entityType: 'BulkAction',
242
- action: 'get',
243
- params: {
244
- spaceId: raw.sys.space.sys.id,
245
- environmentId: raw.sys.id,
246
- bulkActionId
247
- }
248
- }).then(data => wrapBulkAction(makeRequest, data));
249
- },
250
- /**
251
- * @description Creates a BulkAction that will attempt to publish all items contained in the payload.
252
- * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/publish-bulk-action
253
- * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction
254
- * @returns - Promise with the BulkAction
255
- *
256
- * @example
257
- *
258
- * ```javascript
259
- * const contentful = require('contentful-management')
260
- *
261
- * const client = contentful.createClient({
262
- * accessToken: '<content_management_api_key>'
263
- * })
264
- *
265
- * const payload = {
266
- * entities: {
267
- * sys: { type: 'Array' }
268
- * items: [
269
- * { sys: { type: 'Link', id: '<entry-id>', linkType: 'Entry', version: 2 } }
270
- * ]
271
- * }
272
- * }
273
- *
274
- * // Using Thenables
275
- * client.getSpace('<space_id>')
276
- * .then((space) => space.getEnvironment('<environment_id>'))
277
- * .then((environment) => environment.createPublishBulkAction(payload))
278
- * .then((bulkAction) => console.log(bulkAction.waitProcessing()))
279
- * .catch(console.error)
280
- *
281
- * // Using async/await
282
- * try {
283
- * const space = await client.getSpace('<space_id>')
284
- * const environment = await space.getEnvironment('<environment_id>')
285
- * const bulkActionInProgress = await environment.createPublishBulkAction(payload)
286
- *
287
- * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
288
- * const bulkActionCompleted = await bulkActionInProgress.waitProcessing()
289
- * console.log(bulkActionCompleted)
290
- * } catch (error) {
291
- * console.log(error)
292
- * }
293
- * ```
294
- */
295
- createPublishBulkAction(payload) {
296
- const raw = this.toPlainObject();
297
- return makeRequest({
298
- entityType: 'BulkAction',
299
- action: 'publish',
300
- params: {
301
- spaceId: raw.sys.space.sys.id,
302
- environmentId: raw.sys.id
303
- },
304
- payload
305
- }).then(data => wrapBulkAction(makeRequest, data));
306
- },
307
- /**
308
- * @description Creates a BulkAction that will attempt to validate all items contained in the payload.
309
- * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/validate-bulk-action
310
- * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction
311
- * @returns - Promise with the BulkAction
312
- *
313
- * @example
314
- *
315
- * ```javascript
316
- * const contentful = require('contentful-management')
317
- *
318
- * const client = contentful.createClient({
319
- * accessToken: '<content_management_api_key>'
320
- * })
321
- *
322
- * const payload = {
323
- * action: 'publish',
324
- * entities: {
325
- * sys: { type: 'Array' }
326
- * items: [
327
- * { sys: { type: 'Link', id: '<entry-id>', linkType: 'Entry' } }
328
- * ]
329
- * }
330
- * }
331
- *
332
- * // Using Thenables
333
- * client.getSpace('<space_id>')
334
- * .then((space) => space.getEnvironment('<environment_id>'))
335
- * .then((environment) => environment.createValidateBulkAction(payload))
336
- * .then((bulkAction) => console.log(bulkAction.waitProcessing()))
337
- * .catch(console.error)
338
- *
339
- * // Using async/await
340
- * try {
341
- * const space = await client.getSpace('<space_id>')
342
- * const environment = await space.getEnvironment('<environment_id>')
343
- * const bulkActionInProgress = await environment.createValidateBulkAction(payload)
344
- *
345
- * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
346
- * const bulkActionCompleted = await bulkActionInProgress.waitProcessing()
347
- * console.log(bulkActionCompleted)
348
- * } catch (error) {
349
- * console.log(error)
350
- * }
351
- * ```
352
- */
353
- createValidateBulkAction(payload) {
354
- const raw = this.toPlainObject();
355
- return makeRequest({
356
- entityType: 'BulkAction',
357
- action: 'validate',
358
- params: {
359
- spaceId: raw.sys.space.sys.id,
360
- environmentId: raw.sys.id
361
- },
362
- payload
363
- }).then(data => wrapBulkAction(makeRequest, data));
364
- },
365
- /**
366
- * @description Creates a BulkAction that will attempt to unpublish all items contained in the payload.
367
- * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/unpublish-bulk-action
368
- * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction
369
- * @returns - Promise with the BulkAction
370
- *
371
- * @example
372
- *
373
- * ```javascript
374
- * const contentful = require('contentful-management')
375
- *
376
- * const client = contentful.createClient({
377
- * accessToken: '<content_management_api_key>'
378
- * })
379
- *
380
- * const payload = {
381
- * entities: {
382
- * sys: { type: 'Array' }
383
- * items: [
384
- * { sys: { type: 'Link', id: 'entry-id', linkType: 'Entry' } }
385
- * ]
386
- * }
387
- * }
388
- *
389
- * // Using Thenables
390
- * client.getSpace('<space_id>')
391
- * .then((space) => space.getEnvironment('<environment_id>'))
392
- * .then((environment) => environment.createUnpublishBulkAction(payload))
393
- * .then((bulkAction) => console.log(bulkAction.waitProcessing()))
394
- * .catch(console.error)
395
- *
396
- * // Using async/await
397
- * try {
398
- * const space = await clientgetSpace('<space_id>')
399
- * const environment = await space.getEnvironment('<environment_id>')
400
- * const bulkActionInProgress = await environment.createUnpublishBulkAction(payload)
401
- *
402
- * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
403
- * const bulkActionCompleted = await bulkActionInProgress.waitProcessing()
404
- * console.log(bulkActionCompleted)
405
- * } catch (error) {
406
- * console.log(error)
407
- * }
408
- * ```
409
- */
410
- createUnpublishBulkAction(payload) {
411
- const raw = this.toPlainObject();
412
- return makeRequest({
413
- entityType: 'BulkAction',
414
- action: 'unpublish',
415
- params: {
416
- spaceId: raw.sys.space.sys.id,
417
- environmentId: raw.sys.id
418
- },
419
- payload
420
- }).then(data => wrapBulkAction(makeRequest, data));
421
- },
422
- /**
423
- * Gets a Content Type
424
- * @param contentTypeId - Content Type ID
425
- * @return Promise for a Content Type
426
- * @example ```javascript
427
- * const contentful = require('contentful-management')
428
- *
429
- * const client = contentful.createClient({
430
- * accessToken: '<content_management_api_key>'
431
- * })
432
- *
433
- * client.getSpace('<space_id>')
434
- * .then((space) => space.getEnvironment('<environment-id>'))
435
- * .then((environment) => environment.getContentType('<content_type_id>'))
436
- * .then((contentType) => console.log(contentType))
437
- * .catch(console.error)
438
- * ```
439
- */
440
- getContentType(contentTypeId) {
441
- const raw = this.toPlainObject();
442
- return makeRequest({
443
- entityType: 'ContentType',
444
- action: 'get',
445
- params: {
446
- spaceId: raw.sys.space.sys.id,
447
- environmentId: raw.sys.id,
448
- contentTypeId
449
- }
450
- }).then(data => wrapContentType(makeRequest, data));
451
- },
452
- /**
453
- * Gets a collection of Content Types
454
- * @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.
455
- * @return Promise for a collection of Content Types
456
- * @example ```javascript
457
- * const contentful = require('contentful-management')
458
- *
459
- * const client = contentful.createClient({
460
- * accessToken: '<content_management_api_key>'
461
- * })
462
- *
463
- * client.getSpace('<space_id>')
464
- * .then((space) => space.getEnvironment('<environment-id>'))
465
- * .then((environment) => environment.getContentTypes())
466
- * .then((response) => console.log(response.items))
467
- * .catch(console.error)
468
- * ```
469
- */
470
- getContentTypes(query = {}) {
471
- const raw = this.toPlainObject();
472
- return makeRequest({
473
- entityType: 'ContentType',
474
- action: 'getMany',
475
- params: {
476
- spaceId: raw.sys.space.sys.id,
477
- environmentId: raw.sys.id,
478
- query: createRequestConfig({
479
- query
480
- }).params
481
- }
482
- }).then(data => wrapContentTypeCollection(makeRequest, data));
483
- },
484
- /**
485
- * Creates a Content Type
486
- * @param data - Object representation of the Content Type to be created
487
- * @return Promise for the newly created Content Type
488
- * @example ```javascript
489
- * const contentful = require('contentful-management')
490
- *
491
- * const client = contentful.createClient({
492
- * accessToken: '<content_management_api_key>'
493
- * })
494
- *
495
- * client.getSpace('<space_id>')
496
- * .then((space) => space.getEnvironment('<environment-id>'))
497
- * .then((environment) => environment.createContentType({
498
- * name: 'Blog Post',
499
- * fields: [
500
- * {
501
- * id: 'title',
502
- * name: 'Title',
503
- * required: true,
504
- * localized: false,
505
- * type: 'Text'
506
- * }
507
- * ]
508
- * }))
509
- * .then((contentType) => console.log(contentType))
510
- * .catch(console.error)
511
- * ```
512
- */
513
- createContentType(data) {
514
- const raw = this.toPlainObject();
515
- return makeRequest({
516
- entityType: 'ContentType',
517
- action: 'create',
518
- params: {
519
- spaceId: raw.sys.space.sys.id,
520
- environmentId: raw.sys.id
521
- },
522
- payload: data
523
- }).then(response => wrapContentType(makeRequest, response));
524
- },
525
- /**
526
- * Creates a Content Type with a custom ID
527
- * @param contentTypeId - Content Type ID
528
- * @param data - Object representation of the Content Type to be created
529
- * @return Promise for the newly created Content Type
530
- * @example ```javascript
531
- * const contentful = require('contentful-management')
532
- *
533
- * const client = contentful.createClient({
534
- * accessToken: '<content_management_api_key>'
535
- * })
536
- *
537
- * client.getSpace('<space_id>')
538
- * .then((space) => space.getEnvironment('<environment-id>'))
539
- * .then((environment) => environment.createContentTypeWithId('<content-type-id>', {
540
- * name: 'Blog Post',
541
- * fields: [
542
- * {
543
- * id: 'title',
544
- * name: 'Title',
545
- * required: true,
546
- * localized: false,
547
- * type: 'Text'
548
- * }
549
- * ]
550
- * }))
551
- * .then((contentType) => console.log(contentType))
552
- * .catch(console.error)
553
- * ```
554
- */
555
- createContentTypeWithId(contentTypeId, data) {
556
- const raw = this.toPlainObject();
557
- return makeRequest({
558
- entityType: 'ContentType',
559
- action: 'createWithId',
560
- params: {
561
- spaceId: raw.sys.space.sys.id,
562
- environmentId: raw.sys.id,
563
- contentTypeId
564
- },
565
- payload: data
566
- }).then(response => wrapContentType(makeRequest, response));
567
- },
568
- /**
569
- * Gets an EditorInterface for a ContentType
570
- * @param contentTypeId - Content Type ID
571
- * @return Promise for an EditorInterface
572
- * @example ```javascript
573
- * const contentful = require('contentful-management')
574
- *
575
- * const client = contentful.createClient({
576
- * accessToken: '<content_management_api_key>'
577
- * })
578
- *
579
- * client.getSpace('<space_id>')
580
- * .then((space) => space.getEnvironment('<environment-id>'))
581
- * .then((environment) => environment.getEditorInterfaceForContentType('<content_type_id>'))
582
- * .then((EditorInterface) => console.log(EditorInterface))
583
- * .catch(console.error)
584
- * ```
585
- */
586
- getEditorInterfaceForContentType(contentTypeId) {
587
- const raw = this.toPlainObject();
588
- return makeRequest({
589
- entityType: 'EditorInterface',
590
- action: 'get',
591
- params: {
592
- spaceId: raw.sys.space.sys.id,
593
- environmentId: raw.sys.id,
594
- contentTypeId
595
- }
596
- }).then(response => wrapEditorInterface(makeRequest, response));
597
- },
598
- /**
599
- * Gets all EditorInterfaces
600
- * @return Promise for a collection of EditorInterface
601
- * @example ```javascript
602
- * const contentful = require('contentful-management')
603
- *
604
- * const client = contentful.createClient({
605
- * accessToken: '<content_management_api_key>'
606
- * })
607
- *
608
- * client.getSpace('<space_id>')
609
- * .then((space) => space.getEnvironment('<environment-id>'))
610
- * .then((environment) => environment.getEditorInterfaces())
611
- * .then((response) => console.log(response.items))
612
- * .catch(console.error)
613
- * ```
614
- */
615
- getEditorInterfaces() {
616
- const raw = this.toPlainObject();
617
- return makeRequest({
618
- entityType: 'EditorInterface',
619
- action: 'getMany',
620
- params: {
621
- spaceId: raw.sys.space.sys.id,
622
- environmentId: raw.sys.id
623
- }
624
- }).then(response => wrapEditorInterfaceCollection(makeRequest, response));
625
- },
626
- /**
627
- * Gets an Entry
628
- * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
629
- * from your entry in the backend
630
- * @param id - Entry ID
631
- * @param query - Object with search parameters. In this method it's only useful for `locale`.
632
- * @return Promise for an Entry
633
- * @example ```javascript
634
- * const contentful = require('contentful-management')
635
- *
636
- * const client = contentful.createClient({
637
- * accessToken: '<content_management_api_key>'
638
- * })
639
- *
640
- * client.getSpace('<space_id>')
641
- * .then((space) => space.getEnvironment('<environment-id>'))
642
- * .then((environment) => environment.getEntry('<entry-id>'))
643
- * .then((entry) => console.log(entry))
644
- * .catch(console.error)
645
- * ```
646
- */
647
- getEntry(id, query = {}) {
648
- const raw = this.toPlainObject();
649
- return makeRequest({
650
- entityType: 'Entry',
651
- action: 'get',
652
- params: {
653
- spaceId: raw.sys.space.sys.id,
654
- environmentId: raw.sys.id,
655
- entryId: id,
656
- query: createRequestConfig({
657
- query: query
658
- }).params
659
- }
660
- }).then(data => wrapEntry(makeRequest, data));
661
- },
662
- /**
663
- * Deletes an Entry of this environment
664
- * @param id - Entry ID
665
- * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
666
- * @example ```javascript
667
- * const contentful = require('contentful-management')
668
- *
669
- * const client = contentful.createClient({
670
- * accessToken: '<content_management_api_key>'
671
- * })
672
- *
673
- * client.getSpace('<space_id>')
674
- * .then((space) => space.getEnvironment('<environment-id>'))
675
- * .then((environment) => environment.deleteEntry("4bmLXiuviAZH3jkj5DLRWE"))
676
- * .then(() => console.log('Entry deleted.'))
677
- * .catch(console.error)
678
- * ```
679
- */
680
- deleteEntry(id) {
681
- const raw = this.toPlainObject();
682
- return makeRequest({
683
- entityType: 'Entry',
684
- action: 'delete',
685
- params: {
686
- spaceId: raw.sys.space.sys.id,
687
- environmentId: raw.sys.id,
688
- entryId: id
689
- }
690
- }).then(() => {
691
- // noop
692
- });
693
- },
694
- /**
695
- * Gets a collection of Entries
696
- * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
697
- * from your entry in the backend
698
- * @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.
699
- * @return Promise for a collection of Entries
700
- * @example ```javascript
701
- * const contentful = require('contentful-management')
702
- *
703
- * const client = contentful.createClient({
704
- * accessToken: '<content_management_api_key>'
705
- * })
706
- *
707
- * client.getSpace('<space_id>')
708
- * .then((space) => space.getEnvironment('<environment-id>'))
709
- * .then((environment) => environment.getEntries({'content_type': 'foo'})) // you can add more queries as 'key': 'value'
710
- * .then((response) => console.log(response.items))
711
- * .catch(console.error)
712
- * ```
713
- */
714
- getEntries(query = {}) {
715
- const raw = this.toPlainObject();
716
- return makeRequest({
717
- entityType: 'Entry',
718
- action: 'getMany',
719
- params: {
720
- spaceId: raw.sys.space.sys.id,
721
- environmentId: raw.sys.id,
722
- query: createRequestConfig({
723
- query: query
724
- }).params
725
- }
726
- }).then(data => wrapEntryCollection(makeRequest, data));
727
- },
728
- /**
729
- * Gets a collection of published Entries
730
- * @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.
731
- * @return Promise for a collection of published Entries
732
- * @example ```javascript
733
- * const contentful = require('contentful-management')
734
- *
735
- * const client = contentful.createClient({
736
- * accessToken: '<content_management_api_key>'
737
- * })
738
- *
739
- * client.getSpace('<space_id>')
740
- * .then((space) => space.getEnvironment('<environment-id>'))
741
- * .then((environment) => environment.getPublishedEntries({'content_type': 'foo'})) // you can add more queries as 'key': 'value'
742
- * .then((response) => console.log(response.items))
743
- * .catch(console.error)
744
- * ```
745
- */
746
- getPublishedEntries(query = {}) {
747
- const raw = this.toPlainObject();
748
- return makeRequest({
749
- entityType: 'Entry',
750
- action: 'getPublished',
751
- params: {
752
- spaceId: raw.sys.space.sys.id,
753
- environmentId: raw.sys.id,
754
- query: createRequestConfig({
755
- query: query
756
- }).params
757
- }
758
- }).then(data => wrapEntryCollection(makeRequest, data));
759
- },
760
- /**
761
- * Creates a Entry
762
- * @param contentTypeId - The Content Type ID of the newly created Entry
763
- * @param data - Object representation of the Entry to be created
764
- * @return Promise for the newly created Entry
765
- * @example ```javascript
766
- * const contentful = require('contentful-management')
767
- *
768
- * const client = contentful.createClient({
769
- * accessToken: '<content_management_api_key>'
770
- * })
771
- *
772
- * client.getSpace('<space_id>')
773
- * .then((space) => space.getEnvironment('<environment-id>'))
774
- * .then((environment) => environment.createEntry('<content_type_id>', {
775
- * fields: {
776
- * title: {
777
- * 'en-US': 'Entry title'
778
- * }
779
- * }
780
- * }))
781
- * .then((entry) => console.log(entry))
782
- * .catch(console.error)
783
- * ```
784
- */
785
- createEntry(contentTypeId, data) {
786
- const raw = this.toPlainObject();
787
- return makeRequest({
788
- entityType: 'Entry',
789
- action: 'create',
790
- params: {
791
- spaceId: raw.sys.space.sys.id,
792
- environmentId: raw.sys.id,
793
- contentTypeId: contentTypeId
794
- },
795
- payload: data
796
- }).then(response => wrapEntry(makeRequest, response));
797
- },
798
- /**
799
- * Creates a Entry with a custom ID
800
- * @param contentTypeId - The Content Type of the newly created Entry
801
- * @param id - Entry ID
802
- * @param data - Object representation of the Entry to be created
803
- * @return Promise for the newly created Entry
804
- * @example ```javascript
805
- * const contentful = require('contentful-management')
806
- *
807
- * const client = contentful.createClient({
808
- * accessToken: '<content_management_api_key>'
809
- * })
810
- *
811
- * // Create entry
812
- * client.getSpace('<space_id>')
813
- * .then((space) => space.getEnvironment('<environment-id>'))
814
- * .then((environment) => environment.createEntryWithId('<content_type_id>', '<entry_id>', {
815
- * fields: {
816
- * title: {
817
- * 'en-US': 'Entry title'
818
- * }
819
- * }
820
- * }))
821
- * .then((entry) => console.log(entry))
822
- * .catch(console.error)
823
- * ```
824
- */
825
- createEntryWithId(contentTypeId, id, data) {
826
- const raw = this.toPlainObject();
827
- return makeRequest({
828
- entityType: 'Entry',
829
- action: 'createWithId',
830
- params: {
831
- spaceId: raw.sys.space.sys.id,
832
- environmentId: raw.sys.id,
833
- entryId: id,
834
- contentTypeId: contentTypeId
835
- },
836
- payload: data
837
- }).then(response => wrapEntry(makeRequest, response));
838
- },
839
- /**
840
- * Get entry references
841
- * @param entryId - Entry ID
842
- * @param {Object} options.include - Level of the entry descendants from 1 up to 10 maximum
843
- * @returns Promise of Entry references
844
- * @example ```javascript
845
- * const contentful = require('contentful-management');
846
- *
847
- * const client = contentful.createClient({
848
- * accessToken: '<contentful_management_api_key>
849
- * })
850
- *
851
- * // Get entry references
852
- * client.getSpace('<space_id>')
853
- * .then((space) => space.getEnvironment('<environment_id>'))
854
- * .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
855
- * .then((entry) => console.log(entry.includes))
856
- * // or
857
- * .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({include: number}))
858
- * .catch(console.error)
859
- * ```
860
- */
861
- getEntryReferences(entryId, options) {
862
- const raw = this.toPlainObject();
863
- return makeRequest({
864
- entityType: 'Entry',
865
- action: 'references',
866
- params: {
867
- spaceId: raw.sys.space.sys.id,
868
- environmentId: raw.sys.id,
869
- entryId: entryId,
870
- include: options === null || options === void 0 ? void 0 : options.include
871
- }
872
- }).then(response => wrapEntryCollection(makeRequest, response));
873
- },
874
- /**
875
- * Gets an Asset
876
- * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
877
- * from your entry in the backend
878
- * @param id - Asset ID
879
- * @param query - Object with search parameters. In this method it's only useful for `locale`.
880
- * @return Promise for an Asset
881
- * @example ```javascript
882
- * const contentful = require('contentful-management')
883
- *
884
- * const client = contentful.createClient({
885
- * accessToken: '<content_management_api_key>'
886
- * })
887
- *
888
- * client.getSpace('<space_id>')
889
- * .then((space) => space.getEnvironment('<environment-id>'))
890
- * .then((environment) => environment.getAsset('<asset_id>'))
891
- * .then((asset) => console.log(asset))
892
- * .catch(console.error)
893
- * ```
894
- */
895
- getAsset(id, query = {}) {
896
- const raw = this.toPlainObject();
897
- return makeRequest({
898
- entityType: 'Asset',
899
- action: 'get',
900
- params: {
901
- spaceId: raw.sys.space.sys.id,
902
- environmentId: raw.sys.id,
903
- assetId: id,
904
- query: createRequestConfig({
905
- query: query
906
- }).params
907
- }
908
- }).then(data => wrapAsset(makeRequest, data));
909
- },
910
- /**
911
- * Gets a collection of Assets
912
- * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
913
- * from your entry in the backend
914
- * @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.
915
- * @return Promise for a collection of Assets
916
- * @example ```javascript
917
- * const contentful = require('contentful-management')
918
- *
919
- * const client = contentful.createClient({
920
- * accessToken: '<content_management_api_key>'
921
- * })
922
- *
923
- * client.getSpace('<space_id>')
924
- * .then((space) => space.getEnvironment('<environment-id>'))
925
- * .then((environment) => environment.getAssets())
926
- * .then((response) => console.log(response.items))
927
- * .catch(console.error)
928
- * ```
929
- */
930
- getAssets(query = {}) {
931
- const raw = this.toPlainObject();
932
- return makeRequest({
933
- entityType: 'Asset',
934
- action: 'getMany',
935
- params: {
936
- spaceId: raw.sys.space.sys.id,
937
- environmentId: raw.sys.id,
938
- query: createRequestConfig({
939
- query: query
940
- }).params
941
- }
942
- }).then(data => wrapAssetCollection(makeRequest, data));
943
- },
944
- /**
945
- * Gets a collection of published Assets
946
- * @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.
947
- * @return Promise for a collection of published Assets
948
- * @example ```javascript
949
- * const contentful = require('contentful-management')
950
- *
951
- * const client = contentful.createClient({
952
- * accessToken: '<content_management_api_key>'
953
- * })
954
- *
955
- * client.getSpace('<space_id>')
956
- * .then((space) => space.getEnvironment('<environment-id>'))
957
- * .then((environment) => environment.getPublishedAssets())
958
- * .then((response) => console.log(response.items))
959
- * .catch(console.error)
960
- * ```
961
- */
962
- getPublishedAssets(query = {}) {
963
- const raw = this.toPlainObject();
964
- return makeRequest({
965
- entityType: 'Asset',
966
- action: 'getPublished',
967
- params: {
968
- spaceId: raw.sys.space.sys.id,
969
- environmentId: raw.sys.id,
970
- query: createRequestConfig({
971
- query: query
972
- }).params
973
- }
974
- }).then(data => wrapAssetCollection(makeRequest, data));
975
- },
976
- /**
977
- * Creates a Asset. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
978
- * @param data - Object representation of the Asset to be created. Note that the field object should have an upload property on asset creation, which will be removed and replaced with an url property when processing is finished.
979
- * @return Promise for the newly created Asset
980
- * @example ```javascript
981
- * const client = contentful.createClient({
982
- * accessToken: '<content_management_api_key>'
983
- * })
984
- *
985
- * // Create asset
986
- * client.getSpace('<space_id>')
987
- * .then((space) => space.getEnvironment('<environment-id>'))
988
- * .then((environment) => environment.createAsset({
989
- * fields: {
990
- * title: {
991
- * 'en-US': 'Playsam Streamliner'
992
- * },
993
- * file: {
994
- * 'en-US': {
995
- * contentType: 'image/jpeg',
996
- * fileName: 'example.jpeg',
997
- * upload: 'https://example.com/example.jpg'
998
- * }
999
- * }
1000
- * }
1001
- * }))
1002
- * .then((asset) => asset.processForLocale("en-US")) // OR asset.processForAllLocales()
1003
- * .then((asset) => console.log(asset))
1004
- * .catch(console.error)
1005
- * ```
1006
- */
1007
- createAsset(data) {
1008
- const raw = this.toPlainObject();
1009
- return makeRequest({
1010
- entityType: 'Asset',
1011
- action: 'create',
1012
- params: {
1013
- spaceId: raw.sys.space.sys.id,
1014
- environmentId: raw.sys.id
1015
- },
1016
- payload: data
1017
- }).then(response => wrapAsset(makeRequest, response));
1018
- },
1019
- /**
1020
- * Creates a Asset with a custom ID. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
1021
- * @param id - Asset ID
1022
- * @param data - Object representation of the Asset to be created. Note that the field object should have an upload property on asset creation, which will be removed and replaced with an url property when processing is finished.
1023
- * @return Promise for the newly created Asset
1024
- * @example ```javascript
1025
- * const client = contentful.createClient({
1026
- * accessToken: '<content_management_api_key>'
1027
- * })
1028
- *
1029
- * // Create asset
1030
- * client.getSpace('<space_id>')
1031
- * .then((space) => space.getEnvironment('<environment-id>'))
1032
- * .then((environment) => environment.createAssetWithId('<asset_id>', {
1033
- * title: {
1034
- * 'en-US': 'Playsam Streamliner'
1035
- * },
1036
- * file: {
1037
- * 'en-US': {
1038
- * contentType: 'image/jpeg',
1039
- * fileName: 'example.jpeg',
1040
- * upload: 'https://example.com/example.jpg'
1041
- * }
1042
- * }
1043
- * }))
1044
- * .then((asset) => asset.process())
1045
- * .then((asset) => console.log(asset))
1046
- * .catch(console.error)
1047
- * ```
1048
- */
1049
- createAssetWithId(id, data) {
1050
- const raw = this.toPlainObject();
1051
- return makeRequest({
1052
- entityType: 'Asset',
1053
- action: 'createWithId',
1054
- params: {
1055
- spaceId: raw.sys.space.sys.id,
1056
- environmentId: raw.sys.id,
1057
- assetId: id
1058
- },
1059
- payload: data
1060
- }).then(response => wrapAsset(makeRequest, response));
1061
- },
1062
- /**
1063
- * Creates a Asset based on files. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
1064
- * @param data - Object representation of the Asset to be created. Note that the field object should have an uploadFrom property on asset creation, which will be removed and replaced with an url property when processing is finished.
1065
- * @param data.fields.file.[LOCALE].file - Can be a string, an ArrayBuffer or a Stream.
1066
- * @return Promise for the newly created Asset
1067
- * @example ```javascript
1068
- * const client = contentful.createClient({
1069
- * accessToken: '<content_management_api_key>'
1070
- * })
1071
- *
1072
- * client.getSpace('<space_id>')
1073
- * .then((space) => space.getEnvironment('<environment-id>'))
1074
- * .then((environment) => environment.createAssetFromFiles({
1075
- * fields: {
1076
- * file: {
1077
- * 'en-US': {
1078
- * contentType: 'image/jpeg',
1079
- * fileName: 'filename_english.jpg',
1080
- * file: createReadStream('path/to/filename_english.jpg')
1081
- * },
1082
- * 'de-DE': {
1083
- * contentType: 'image/svg+xml',
1084
- * fileName: 'filename_german.svg',
1085
- * file: '<svg><path fill="red" d="M50 50h150v50H50z"/></svg>'
1086
- * }
1087
- * }
1088
- * }
1089
- * }))
1090
- * .then((asset) => console.log(asset))
1091
- * .catch(console.error)
1092
- * ```
1093
- */
1094
- createAssetFromFiles(data, options) {
1095
- const raw = this.toPlainObject();
1096
- return makeRequest({
1097
- entityType: 'Asset',
1098
- action: 'createFromFiles',
1099
- params: {
1100
- spaceId: raw.sys.space.sys.id,
1101
- environmentId: raw.sys.id,
1102
- uploadTimeout: options === null || options === void 0 ? void 0 : options.uploadTimeout
1103
- },
1104
- payload: data
1105
- }).then(response => wrapAsset(makeRequest, response));
1106
- },
1107
- /**
1108
- * Creates an asset key for signing asset URLs (Embargoed Assets)
1109
- * @param data Object with request payload
1110
- * @param data.expiresAt number a UNIX timestamp in the future (but not more than 48 hours from time of calling)
1111
- * @return Promise for the newly created AssetKey
1112
- * @example ```javascript
1113
- * const client = contentful.createClient({
1114
- * accessToken: '<content_management_api_key>'
1115
- * })
1116
- *
1117
- * // Create assetKey
1118
- * now = () => Math.floor(Date.now() / 1000)
1119
- * const withExpiryIn1Hour = () => now() + 1 * 60 * 60
1120
- * client.getSpace('<space_id>')
1121
- * .then((space) => space.getEnvironment('<environment-id>'))
1122
- * .then((environment) => environment.createAssetKey({ expiresAt: withExpiryIn1Hour() }))
1123
- * .then((policy, secret) => console.log({ policy, secret }))
1124
- * .catch(console.error)
1125
- * ```
1126
- */
1127
- createAssetKey(payload) {
1128
- const raw = this.toPlainObject();
1129
- return makeRequest({
1130
- entityType: 'AssetKey',
1131
- action: 'create',
1132
- params: {
1133
- spaceId: raw.sys.space.sys.id,
1134
- environmentId: raw.sys.id
1135
- },
1136
- payload
1137
- }).then(data => wrapAssetKey(makeRequest, data));
1138
- },
1139
- /**
1140
- * Gets an Upload
1141
- * @param id - Upload ID
1142
- * @return Promise for an Upload
1143
- * @example ```javascript
1144
- * const client = contentful.createClient({
1145
- * accessToken: '<content_management_api_key>'
1146
- * })
1147
- * const uploadStream = createReadStream('path/to/filename_english.jpg')
1148
- *
1149
- * client.getSpace('<space_id>')
1150
- * .then((space) => space.getEnvironment('<environment-id>'))
1151
- * .then((environment) => environment.getUpload('<upload-id>')
1152
- * .then((upload) => console.log(upload))
1153
- * .catch(console.error)
1154
- */
1155
- getUpload(id) {
1156
- const raw = this.toPlainObject();
1157
- return makeRequest({
1158
- entityType: 'Upload',
1159
- action: 'get',
1160
- params: {
1161
- spaceId: raw.sys.space.sys.id,
1162
- environmentId: raw.sys.id,
1163
- uploadId: id
1164
- }
1165
- }).then(data => wrapUpload(makeRequest, data));
1166
- },
1167
- /**
1168
- * Creates a Upload.
1169
- * @param data - Object with file information.
1170
- * @param data.file - Actual file content. Can be a string, an ArrayBuffer or a Stream.
1171
- * @return Upload object containing information about the uploaded file.
1172
- * @example ```javascript
1173
- * const client = contentful.createClient({
1174
- * accessToken: '<content_management_api_key>'
1175
- * })
1176
- * const uploadStream = createReadStream('path/to/filename_english.jpg')
1177
- *
1178
- * client.getSpace('<space_id>')
1179
- * .then((space) => space.getEnvironment('<environment-id>'))
1180
- * .then((environment) => environment.createUpload({file: uploadStream})
1181
- * .then((upload) => console.log(upload))
1182
- * .catch(console.error)
1183
- * ```
1184
- */
1185
- createUpload: function createUpload(data) {
1186
- const raw = this.toPlainObject();
1187
- return makeRequest({
1188
- entityType: 'Upload',
1189
- action: 'create',
1190
- params: {
1191
- spaceId: raw.sys.space.sys.id,
1192
- environmentId: raw.sys.id
1193
- },
1194
- payload: data
1195
- }).then(data => wrapUpload(makeRequest, data));
1196
- },
1197
- /**
1198
- * Gets a Locale
1199
- * @param localeId - Locale ID
1200
- * @return Promise for an Locale
1201
- * @example ```javascript
1202
- * const contentful = require('contentful-management')
1203
- *
1204
- * const client = contentful.createClient({
1205
- * accessToken: '<content_management_api_key>'
1206
- * })
1207
- *
1208
- * client.getSpace('<space_id>')
1209
- * .then((space) => space.getEnvironment('<environment-id>'))
1210
- * .then((environment) => environment.getLocale('<locale_id>'))
1211
- * .then((locale) => console.log(locale))
1212
- * .catch(console.error)
1213
- * ```
1214
- */
1215
- getLocale(localeId) {
1216
- const raw = this.toPlainObject();
1217
- return makeRequest({
1218
- entityType: 'Locale',
1219
- action: 'get',
1220
- params: {
1221
- spaceId: raw.sys.space.sys.id,
1222
- environmentId: raw.sys.id,
1223
- localeId
1224
- }
1225
- }).then(data => wrapLocale(makeRequest, data));
1226
- },
1227
- /**
1228
- * Gets a collection of Locales
1229
- * @return Promise for a collection of Locales
1230
- * @example ```javascript
1231
- * const contentful = require('contentful-management')
1232
- *
1233
- * const client = contentful.createClient({
1234
- * accessToken: '<content_management_api_key>'
1235
- * })
1236
- *
1237
- * client.getSpace('<space_id>')
1238
- * .then((space) => space.getEnvironment('<environment-id>'))
1239
- * .then((environment) => environment.getLocales())
1240
- * .then((response) => console.log(response.items))
1241
- * .catch(console.error)
1242
- * ```
1243
- */
1244
- getLocales(query = {}) {
1245
- const raw = this.toPlainObject();
1246
- return makeRequest({
1247
- entityType: 'Locale',
1248
- action: 'getMany',
1249
- params: {
1250
- spaceId: raw.sys.space.sys.id,
1251
- environmentId: raw.sys.id,
1252
- query: createRequestConfig({
1253
- query
1254
- }).params
1255
- }
1256
- }).then(data => wrapLocaleCollection(makeRequest, data));
1257
- },
1258
- /**
1259
- * Creates a Locale
1260
- * @param data - Object representation of the Locale to be created
1261
- * @return Promise for the newly created Locale
1262
- * @example ```javascript
1263
- * const contentful = require('contentful-management')
1264
- *
1265
- * const client = contentful.createClient({
1266
- * accessToken: '<content_management_api_key>'
1267
- * })
1268
- *
1269
- * // Create locale
1270
- * client.getSpace('<space_id>')
1271
- * .then((space) => space.getEnvironment('<environment-id>'))
1272
- * .then((environment) => environment.createLocale({
1273
- * name: 'German (Austria)',
1274
- * code: 'de-AT',
1275
- * fallbackCode: 'de-DE',
1276
- * optional: true
1277
- * }))
1278
- * .then((locale) => console.log(locale))
1279
- * .catch(console.error)
1280
- * ```
1281
- */
1282
- createLocale(data) {
1283
- const raw = this.toPlainObject();
1284
- return makeRequest({
1285
- entityType: 'Locale',
1286
- action: 'create',
1287
- params: {
1288
- spaceId: raw.sys.space.sys.id,
1289
- environmentId: raw.sys.id
1290
- },
1291
- payload: data
1292
- }).then(response => wrapLocale(makeRequest, response));
1293
- },
1294
- /**
1295
- * Gets an UI Extension
1296
- * @param id - Extension ID
1297
- * @return Promise for an UI Extension
1298
- * @example ```javascript
1299
- * const contentful = require('contentful-management')
1300
- *
1301
- * const client = contentful.createClient({
1302
- * accessToken: '<content_management_api_key>'
1303
- * })
1304
- *
1305
- * client.getSpace('<space_id>')
1306
- * .then((space) => space.getEnvironment('<environment-id>'))
1307
- * .then((environment) => environment.getUiExtension('<extension-id>'))
1308
- * .then((extension) => console.log(extension))
1309
- * .catch(console.error)
1310
- * ```
1311
- */
1312
- getUiExtension(id) {
1313
- const raw = this.toPlainObject();
1314
- return makeRequest({
1315
- entityType: 'Extension',
1316
- action: 'get',
1317
- params: {
1318
- spaceId: raw.sys.space.sys.id,
1319
- environmentId: raw.sys.id,
1320
- extensionId: id
1321
- }
1322
- }).then(data => wrapExtension(makeRequest, data));
1323
- },
1324
- /**
1325
- * Gets a collection of UI Extension
1326
- * @return Promise for a collection of UI Extensions
1327
- * @example ```javascript
1328
- * const contentful = require('contentful-management')
1329
- *
1330
- * const client = contentful.createClient({
1331
- * accessToken: '<content_management_api_key>'
1332
- * })
1333
- *
1334
- * client.getSpace('<space_id>')
1335
- * .then((space) => space.getEnvironment('<environment-id>'))
1336
- * .then((environment) => environment.getUiExtensions()
1337
- * .then((response) => console.log(response.items))
1338
- * .catch(console.error)
1339
- * ```
1340
- */
1341
- getUiExtensions() {
1342
- const raw = this.toPlainObject();
1343
- return makeRequest({
1344
- entityType: 'Extension',
1345
- action: 'getMany',
1346
- params: {
1347
- spaceId: raw.sys.space.sys.id,
1348
- environmentId: raw.sys.id
1349
- }
1350
- }).then(response => wrapExtensionCollection(makeRequest, response));
1351
- },
1352
- /**
1353
- * Creates a UI Extension
1354
- * @param data - Object representation of the UI Extension to be created
1355
- * @return Promise for the newly created UI Extension
1356
- * @example ```javascript
1357
- * const contentful = require('contentful-management')
1358
- *
1359
- * const client = contentful.createClient({
1360
- * accessToken: '<content_management_api_key>'
1361
- * })
1362
- *
1363
- * client.getSpace('<space_id>')
1364
- * .then((space) => space.getEnvironment('<environment-id>'))
1365
- * .then((environment) => environment.createUiExtension({
1366
- * extension: {
1367
- * name: 'My awesome extension',
1368
- * src: 'https://example.com/my',
1369
- * fieldTypes: [
1370
- * {
1371
- * type: 'Symbol'
1372
- * },
1373
- * {
1374
- * type: 'Text'
1375
- * }
1376
- * ],
1377
- * sidebar: false
1378
- * }
1379
- * }))
1380
- * .then((extension) => console.log(extension))
1381
- * .catch(console.error)
1382
- * ```
1383
- */
1384
- createUiExtension(data) {
1385
- const raw = this.toPlainObject();
1386
- return makeRequest({
1387
- entityType: 'Extension',
1388
- action: 'create',
1389
- params: {
1390
- spaceId: raw.sys.space.sys.id,
1391
- environmentId: raw.sys.id
1392
- },
1393
- payload: data
1394
- }).then(response => wrapExtension(makeRequest, response));
1395
- },
1396
- /**
1397
- * Creates a UI Extension with a custom ID
1398
- * @param id - Extension ID
1399
- * @param data - Object representation of the UI Extension to be created
1400
- * @return Promise for the newly created UI Extension
1401
- * @example ```javascript
1402
- * const contentful = require('contentful-management')
1403
- *
1404
- * const client = contentful.createClient({
1405
- * accessToken: '<content_management_api_key>'
1406
- * })
1407
- *
1408
- * client.getSpace('<space_id>')
1409
- * .then((space) => space.getEnvironment('<environment-id>'))
1410
- * .then((environment) => environment.createUiExtensionWithId('<extension_id>', {
1411
- * extension: {
1412
- * name: 'My awesome extension',
1413
- * src: 'https://example.com/my',
1414
- * fieldTypes: [
1415
- * {
1416
- * type: 'Symbol'
1417
- * },
1418
- * {
1419
- * type: 'Text'
1420
- * }
1421
- * ],
1422
- * sidebar: false
1423
- * }
1424
- * }))
1425
- * .then((extension) => console.log(extension))
1426
- * .catch(console.error)
1427
- * ```
1428
- */
1429
- createUiExtensionWithId(id, data) {
1430
- const raw = this.toPlainObject();
1431
- return makeRequest({
1432
- entityType: 'Extension',
1433
- action: 'createWithId',
1434
- params: {
1435
- spaceId: raw.sys.space.sys.id,
1436
- environmentId: raw.sys.id,
1437
- extensionId: id
1438
- },
1439
- payload: data
1440
- }).then(response => wrapExtension(makeRequest, response));
1441
- },
1442
- /**
1443
- * Creates an App Installation
1444
- * @param appDefinitionId - AppDefinition ID
1445
- * @param data - AppInstallation data
1446
- * @param options.acceptAllTerms - Flag for accepting Apps' Marketplace EULA, Terms, and Privacy policy (need to pass `{acceptAllTerms: true}` to install a marketplace app)
1447
- * @return Promise for an App Installation
1448
- * @example ```javascript
1449
- * const contentful = require('contentful-management')
1450
- *
1451
- * const client = contentful.createClient({
1452
- * accessToken: '<content_management_api_key>'
1453
- * })
1454
- *
1455
- * client.getSpace('<space_id>')
1456
- * .then((space) => space.getEnvironment('<environment-id>'))
1457
- * .then((environment) => environment.createAppInstallation('<app_definition_id>', {
1458
- * parameters: {
1459
- * someParameter: someValue
1460
- * }
1461
- * })
1462
- * .then((appInstallation) => console.log(appInstallation))
1463
- * .catch(console.error)
1464
- * ```
1465
- */
1466
- createAppInstallation(appDefinitionId, data, {
1467
- acceptAllTerms
1468
- } = {}) {
1469
- const raw = this.toPlainObject();
1470
- return makeRequest({
1471
- entityType: 'AppInstallation',
1472
- action: 'upsert',
1473
- params: {
1474
- spaceId: raw.sys.space.sys.id,
1475
- environmentId: raw.sys.id,
1476
- appDefinitionId,
1477
- acceptAllTerms
1478
- },
1479
- payload: data
1480
- }).then(payload => wrapAppInstallation(makeRequest, payload));
1481
- },
1482
- /**
1483
- * Gets an App Installation
1484
- * @param id - AppDefintion ID
1485
- * @return Promise for an App Installation
1486
- * @example ```javascript
1487
- * const contentful = require('contentful-management')
1488
- *
1489
- * const client = contentful.createClient({
1490
- * accessToken: '<content_management_api_key>'
1491
- * })
1492
- *
1493
- * client.getSpace('<space_id>')
1494
- * .then((space) => space.getEnvironment('<environment-id>'))
1495
- * .then((environment) => environment.getAppInstallation('<app-definition-id>'))
1496
- * .then((appInstallation) => console.log(appInstallation))
1497
- * .catch(console.error)
1498
- * ```
1499
- */
1500
- getAppInstallation(id) {
1501
- const raw = this.toPlainObject();
1502
- return makeRequest({
1503
- entityType: 'AppInstallation',
1504
- action: 'get',
1505
- params: {
1506
- spaceId: raw.sys.space.sys.id,
1507
- environmentId: raw.sys.id,
1508
- appDefinitionId: id
1509
- }
1510
- }).then(data => wrapAppInstallation(makeRequest, data));
1511
- },
1512
- /**
1513
- * Gets a collection of App Installation
1514
- * @return Promise for a collection of App Installations
1515
- * @example ```javascript
1516
- * const contentful = require('contentful-management')
1517
- *
1518
- * const client = contentful.createClient({
1519
- * accessToken: '<content_management_api_key>'
1520
- * })
1521
- *
1522
- * client.getSpace('<space_id>')
1523
- * .then((space) => space.getEnvironment('<environment-id>'))
1524
- * .then((environment) => environment.getAppInstallations()
1525
- * .then((response) => console.log(response.items))
1526
- * .catch(console.error)
1527
- * ```
1528
- */
1529
- getAppInstallations() {
1530
- const raw = this.toPlainObject();
1531
- return makeRequest({
1532
- entityType: 'AppInstallation',
1533
- action: 'getMany',
1534
- params: {
1535
- spaceId: raw.sys.space.sys.id,
1536
- environmentId: raw.sys.id
1537
- }
1538
- }).then(data => wrapAppInstallationCollection(makeRequest, data));
1539
- },
1540
- /**
1541
- * Creates an app action call
1542
- * @param appDefinitionId - AppDefinition ID
1543
- * @param appActionId - action ID
1544
- * @param data - App Action Call data
1545
- * @return Promise for an App Action Call
1546
- * @example ```javascript
1547
- * const contentful = require('contentful-management')
1548
- *
1549
- * const client = contentful.createClient({
1550
- * accessToken: '<content_management_api_key>'
1551
- * })
1552
- *
1553
- * const data = {
1554
- * headers: {
1555
- * 'x-my-header': 'some-value'
1556
- * },
1557
- * body: {
1558
- * 'some-body-value': true
1559
- * }
1560
- * }
1561
- *
1562
- * client.getSpace('<space_id>')
1563
- * .then((space) => space.getEnvironment('<environment-id>'))
1564
- * .then((environment) => environment.createAppActionCall('<app_definition_id>', '<action_id>', data)
1565
- * .then((appActionCall) => console.log(appActionCall))
1566
- * .catch(console.error)
1567
- * ```
1568
- */
1569
- createAppActionCall(appDefinitionId, appActionId, data) {
1570
- const raw = this.toPlainObject();
1571
- return makeRequest({
1572
- entityType: 'AppActionCall',
1573
- action: 'create',
1574
- params: {
1575
- spaceId: raw.sys.space.sys.id,
1576
- environmentId: raw.sys.id,
1577
- appDefinitionId,
1578
- appActionId
1579
- },
1580
- payload: data
1581
- }).then(payload => wrapAppActionCall(makeRequest, payload));
1582
- },
1583
- /**
1584
- * Creates an app signed request
1585
- * @param appDefinitionId - AppDefinition ID
1586
- * @param data - SignedRequest data
1587
- * @return Promise for a Signed Request
1588
- * @example ```javascript
1589
- * const contentful = require('contentful-management')
1590
- *
1591
- * const client = contentful.createClient({
1592
- * accessToken: '<content_management_api_key>'
1593
- * })
1594
- *
1595
- * const data = {
1596
- * method: 'POST',
1597
- * path: '/request_path',
1598
- * body: '{ "key": "data" }',
1599
- * headers: {
1600
- * 'x-my-header': 'some-value'
1601
- * },
1602
- * }
1603
- *
1604
- * client.getSpace('<space_id>')
1605
- * .then((space) => space.getEnvironment('<environment-id>'))
1606
- * .then((environment) => environment.createAppSignedRequest('<app_definition_id>', data)
1607
- * .then((signedRequest) => console.log(signedRequest))
1608
- * .catch(console.error)
1609
- * ```
1610
- */
1611
- createAppSignedRequest(appDefinitionId, data) {
1612
- const raw = this.toPlainObject();
1613
- return makeRequest({
1614
- entityType: 'AppSignedRequest',
1615
- action: 'create',
1616
- params: {
1617
- spaceId: raw.sys.space.sys.id,
1618
- environmentId: raw.sys.id,
1619
- appDefinitionId
1620
- },
1621
- payload: data
1622
- }).then(payload => wrapAppSignedRequest(makeRequest, payload));
1623
- },
1624
- /**
1625
- * Creates an app access token
1626
- * @param appDefinitionId - AppDefinition ID
1627
- * @param data - Json Web Token
1628
- * @return Promise for an app access token
1629
- * @example ```javascript
1630
- * const contentful = require('contentful-management')
1631
- * const { sign } = require('jsonwebtoken')
1632
- *
1633
- * const signOptions = { algorithm: 'RS256', issuer: '<app_definition_id>', expiresIn: '10m' }
1634
- *
1635
- * const client = contentful.createClient({
1636
- * accessToken: '<content_management_api_key>'
1637
- * })
1638
- *
1639
- * const data = {
1640
- * jwt: sign({}, '<private_key>', signOptions)
1641
- * }
1642
- *
1643
- * client.getSpace('<space_id>')
1644
- * .then((space) => space.getEnvironment('<environment-id>'))
1645
- * .then((environment) => environment.createAppAccessToken('<app_definition_id>', data)
1646
- * .then((appAccessToken) => console.log(appAccessToken))
1647
- * .catch(console.error)
1648
- * ```
1649
- */
1650
- createAppAccessToken(appDefinitionId, data) {
1651
- const raw = this.toPlainObject();
1652
- return makeRequest({
1653
- entityType: 'AppAccessToken',
1654
- action: 'create',
1655
- params: {
1656
- spaceId: raw.sys.space.sys.id,
1657
- environmentId: raw.sys.id,
1658
- appDefinitionId
1659
- },
1660
- payload: data
1661
- }).then(payload => wrapAppAccessToken(makeRequest, payload));
1662
- },
1663
- /**
1664
- * Gets a collection of Functions for a given environment
1665
- * @param appInstallationId
1666
- * @param {import('../common-types').AcceptsQueryOptions} query - optional query parameter for filtering functions by action
1667
- * @return Promise containing wrapped collection of Functions in an environment
1668
- * @example ```javascript
1669
- * const contentful = require('contentful-management')
1670
- *
1671
- * const client = contentful.createClient({
1672
- * accessToken: '<content_management_api_key>'
1673
- * })
1674
- *
1675
- * client
1676
- * .getSpace('<space-id>')
1677
- * .then((space) => space.getEnvironment('<environment-id>'))
1678
- * .then((environment) => environment.getFunctionsForEnvironment('<app-installation-id>', { 'accepts[all]': '<action>' }))
1679
- * .then((functions) => console.log(functions.items))
1680
- * .catch(console.error)
1681
- * ```
1682
- */
1683
- getFunctionsForEnvironment(appInstallationId, query) {
1684
- const raw = this.toPlainObject();
1685
- return makeRequest({
1686
- entityType: 'Function',
1687
- action: 'getManyForEnvironment',
1688
- params: {
1689
- spaceId: raw.sys.space.sys.id,
1690
- environmentId: raw.sys.id,
1691
- appInstallationId,
1692
- query
1693
- }
1694
- }).then(data => wrapFunctionCollection(makeRequest, data));
1695
- },
1696
- /**
1697
- * Gets a collection of FunctionLogs for a given app installation id and FunctionId
1698
- * @param appInstallationId
1699
- * @param functionId
1700
- * @param {import('../common-types').CursorBasedParams} query - optional query parameter for pagination (limit, nextPage, prevPage)
1701
- * @return Promise containing wrapped collection of FunctionLogs
1702
- * * @example ```javascript
1703
- * const contentful = require('contentful-management')
1704
- *
1705
- * const client = contentful.createClient({
1706
- * accessToken: '<content_management_api_key>'
1707
- * })
1708
- *
1709
- * client
1710
- * .getSpace('<space-id>')
1711
- * .then((space) => space.getEnvironment('<environment-id>'))
1712
- * .then((environment) =>
1713
- * environment.getFunctionLogs(
1714
- * '<app-installation-id>',
1715
- * '<function-id>',
1716
- * { limit: 10 },
1717
- * )
1718
- * )
1719
- * .then((functionLogs) => console.log(functionLog.items))
1720
- * .catch(console.error)
1721
- * ```
1722
- */
1723
- getFunctionLogs(appInstallationId, functionId, query) {
1724
- const raw = this.toPlainObject();
1725
- return makeRequest({
1726
- entityType: 'FunctionLog',
1727
- action: 'getMany',
1728
- params: {
1729
- spaceId: raw.sys.space.sys.id,
1730
- environmentId: raw.sys.id,
1731
- appInstallationId,
1732
- functionId,
1733
- query: query ? createRequestConfig({
1734
- query
1735
- }).params : undefined
1736
- }
1737
- }).then(data => wrapFunctionLogCollection(makeRequest, data));
1738
- },
1739
- /**
1740
- * Gets a FunctionLog by appInstallationId, functionId and logId
1741
- * @param appInstallationId
1742
- * @param functionId
1743
- * @param logId
1744
- * @return Promise containing a wrapped FunctionLog
1745
- * @example ```javascript
1746
- * const contentful = require('contentful-management')
1747
- *
1748
- * const client = contentful.createClient({
1749
- * accessToken: '<content_management_api_key>'
1750
- * })
1751
- *
1752
- * client
1753
- * .getSpace(<space-id>)
1754
- * .then((space) => space.getEnvironment('<environment-id>'))
1755
- * .then((environment) =>
1756
- * environment.getFunctionLog(
1757
- * '<app-installation-id>',
1758
- * '<function-id>',
1759
- * '<log-id>'
1760
- * )
1761
- * )
1762
- * .then((functionLog) => console.log(functionLog))
1763
- * .catch(console.error)
1764
- * ```
1765
- */
1766
- getFunctionLog(appInstallationId, functionId, logId) {
1767
- const raw = this.toPlainObject();
1768
- return makeRequest({
1769
- entityType: 'FunctionLog',
1770
- action: 'get',
1771
- params: {
1772
- spaceId: raw.sys.space.sys.id,
1773
- environmentId: raw.sys.id,
1774
- appInstallationId,
1775
- functionId,
1776
- logId
1777
- }
1778
- }).then(data => wrapFunctionLog(makeRequest, data));
1779
- },
1780
- /**
1781
- * Gets all snapshots of an entry
1782
- * @func getEntrySnapshots
1783
- * @param entryId - Entry ID
1784
- * @param query - query additional query paramaters
1785
- * @return Promise for a collection of Entry Snapshots
1786
- * @example ```javascript
1787
- * const contentful = require('contentful-management')
1788
- *
1789
- * const client = contentful.createClient({
1790
- * accessToken: '<content_management_api_key>'
1791
- * })
1792
- *
1793
- * client.getSpace('<space_id>')
1794
- * .then((space) => space.getEnvironment('<environment-id>'))
1795
- * .then((environment) => environment.getEntrySnapshots('<entry_id>'))
1796
- * .then((snapshots) => console.log(snapshots.items))
1797
- * .catch(console.error)
1798
- * ```
1799
- */
1800
- getEntrySnapshots(entryId, query = {}) {
1801
- const raw = this.toPlainObject();
1802
- return makeRequest({
1803
- entityType: 'Snapshot',
1804
- action: 'getManyForEntry',
1805
- params: {
1806
- spaceId: raw.sys.space.sys.id,
1807
- environmentId: raw.sys.id,
1808
- entryId,
1809
- query
1810
- }
1811
- }).then(data => wrapSnapshotCollection(makeRequest, data));
1812
- },
1813
- /**
1814
- * Gets all snapshots of a contentType
1815
- * @func getContentTypeSnapshots
1816
- * @param contentTypeId - Content Type ID
1817
- * @param query - query additional query paramaters
1818
- * @return Promise for a collection of Content Type Snapshots
1819
- * @example ```javascript
1820
- * const contentful = require('contentful-management')
1821
- *
1822
- * const client = contentful.createClient({
1823
- * accessToken: '<content_management_api_key>'
1824
- * })
1825
- *
1826
- * client.getSpace('<space_id>')
1827
- * .then((space) => space.getEnvironment('<environment-id>'))
1828
- * .then((environment) => environment.getContentTypeSnapshots('<contentTypeId>'))
1829
- * .then((snapshots) => console.log(snapshots.items))
1830
- * .catch(console.error)
1831
- * ```
1832
- */
1833
- getContentTypeSnapshots(contentTypeId, query = {}) {
1834
- const raw = this.toPlainObject();
1835
- return makeRequest({
1836
- entityType: 'Snapshot',
1837
- action: 'getManyForContentType',
1838
- params: {
1839
- spaceId: raw.sys.space.sys.id,
1840
- environmentId: raw.sys.id,
1841
- contentTypeId,
1842
- query
1843
- }
1844
- }).then(data => wrapSnapshotCollection(makeRequest, data));
1845
- },
1846
- createTag(id, name, visibility) {
1847
- const raw = this.toPlainObject();
1848
- return makeRequest({
1849
- entityType: 'Tag',
1850
- action: 'createWithId',
1851
- params: {
1852
- spaceId: raw.sys.space.sys.id,
1853
- environmentId: raw.sys.id,
1854
- tagId: id
1855
- },
1856
- payload: {
1857
- name,
1858
- sys: {
1859
- visibility: visibility !== null && visibility !== void 0 ? visibility : 'private'
1860
- }
1861
- }
1862
- }).then(data => wrapTag(makeRequest, data));
1863
- },
1864
- getTags(query = {}) {
1865
- const raw = this.toPlainObject();
1866
- return makeRequest({
1867
- entityType: 'Tag',
1868
- action: 'getMany',
1869
- params: {
1870
- spaceId: raw.sys.space.sys.id,
1871
- environmentId: raw.sys.id,
1872
- query: createRequestConfig({
1873
- query
1874
- }).params
1875
- }
1876
- }).then(data => wrapTagCollection(makeRequest, data));
1877
- },
1878
- getTag(id) {
1879
- const raw = this.toPlainObject();
1880
- return makeRequest({
1881
- entityType: 'Tag',
1882
- action: 'get',
1883
- params: {
1884
- spaceId: raw.sys.space.sys.id,
1885
- environmentId: raw.sys.id,
1886
- tagId: id
1887
- }
1888
- }).then(data => wrapTag(makeRequest, data));
1889
- },
1890
- /**
1891
- * Retrieves a Release by ID
1892
- * @param releaseId
1893
- * @returns Promise containing a wrapped Release
1894
- * @example ```javascript
1895
- * const contentful = require('contentful-management')
1896
- *
1897
- * const client = contentful.createClient({
1898
- * accessToken: '<content_management_api_key>'
1899
- * })
1900
- *
1901
- * client.getSpace('<space_id>')
1902
- * .then((space) => space.getEnvironment('<environment-id>'))
1903
- * .then((environment) => environment.getRelease('<release_id>'))
1904
- * .then((release) => console.log(release))
1905
- * .catch(console.error)
1906
- * ```
1907
- */
1908
- getRelease(releaseId) {
1909
- const raw = this.toPlainObject();
1910
- return makeRequest({
1911
- entityType: 'Release',
1912
- action: 'get',
1913
- params: {
1914
- spaceId: raw.sys.space.sys.id,
1915
- environmentId: raw.sys.id,
1916
- releaseId
1917
- }
1918
- }).then(data => wrapRelease(makeRequest, data));
1919
- },
1920
- /**
1921
- * Gets a Collection of Releases,
1922
- * @param {ReleaseQueryOptions} query filtering options for the collection result
1923
- * @returns Promise containing a wrapped Release Collection
1924
- * @example ```javascript
1925
- * const contentful = require('contentful-management')
1926
- *
1927
- * const client = contentful.createClient({
1928
- * accessToken: '<content_management_api_key>'
1929
- * })
1930
- *
1931
- * client.getSpace('<space_id>')
1932
- * .then((space) => space.getEnvironment('<environment-id>'))
1933
- * .then((environment) => environment.getReleases({ 'entities.sys.id[in]': '<asset_id>,<entry_id>' }))
1934
- * .then((releases) => console.log(releases))
1935
- * .catch(console.error)
1936
- * ```
1937
- */
1938
- getReleases(query) {
1939
- const raw = this.toPlainObject();
1940
- return makeRequest({
1941
- entityType: 'Release',
1942
- action: 'query',
1943
- params: {
1944
- spaceId: raw.sys.space.sys.id,
1945
- environmentId: raw.sys.id,
1946
- query
1947
- }
1948
- }).then(data => wrapReleaseCollection(makeRequest, data));
1949
- },
1950
- /**
1951
- * Creates a new Release with the entities and title in the payload
1952
- * @param payload Object containing the payload in order to create a Release
1953
- * @returns Promise containing a wrapped Release, that has other helper methods within.
1954
- * @example ```javascript
1955
- * const contentful = require('contentful-management')
1956
- *
1957
- * const client = contentful.createClient({
1958
- * accessToken: '<content_management_api_key>'
1959
- * })
1960
- *
1961
- * const payload = {
1962
- * title: 'My Release',
1963
- * entities: {
1964
- * sys: { type: 'Array' },
1965
- * items: [
1966
- * { sys: { linkType: 'Entry', type: 'Link', id: '<entry_id>' } }
1967
- * ]
1968
- * }
1969
- * }
1970
- *
1971
- * client.getSpace('<space_id>')
1972
- * .then((space) => space.getEnvironment('<environment-id>'))
1973
- * .then((environment) => environment.createRelease(payload))
1974
- * .then((release) => console.log(release))
1975
- * .catch(console.error)
1976
- * ```
1977
- */
1978
- createRelease(payload) {
1979
- const raw = this.toPlainObject();
1980
- return makeRequest({
1981
- entityType: 'Release',
1982
- action: 'create',
1983
- params: {
1984
- spaceId: raw.sys.space.sys.id,
1985
- environmentId: raw.sys.id
1986
- },
1987
- payload
1988
- }).then(data => wrapRelease(makeRequest, data));
1989
- },
1990
- /**
1991
- * Updates a Release and replaces all the properties.
1992
- * @param {object} options,
1993
- * @param options.releaseId the ID of the release
1994
- * @param options.payload the payload to be updated in the Release
1995
- * @param options.version Release sys.version that to be updated
1996
- * @returns Promise containing a wrapped Release, that has helper methods within.
1997
- *
1998
- * @example ```javascript
1999
- * const contentful = require('contentful-management')
2000
- *
2001
- * const client = contentful.createClient({
2002
- * accessToken: '<content_management_api_key>'
2003
- * })
2004
- *
2005
- *
2006
- * const payload = {
2007
- * title: "Updated Release title",
2008
- * entities: {
2009
- * sys: { type: 'Array' },
2010
- * items: [
2011
- * { sys: { linkType: 'Entry', type: 'Link', id: '<entry_id>' } }
2012
- * ]
2013
- * }
2014
- * }
2015
- *
2016
- * client.getSpace('<space_id>')
2017
- * .then((space) => space.getEnvironment('<environment-id>'))
2018
- * .then((environment) => environment.updateRelease({ releaseId: '<release_id>', version: 1, payload } ))
2019
- * .then((release) => console.log(release))
2020
- * .catch(console.error)
2021
- * ```
2022
- */
2023
- updateRelease({
2024
- releaseId,
2025
- payload,
2026
- version
2027
- }) {
2028
- const raw = this.toPlainObject();
2029
- return makeRequest({
2030
- entityType: 'Release',
2031
- action: 'update',
2032
- params: {
2033
- spaceId: raw.sys.space.sys.id,
2034
- environmentId: raw.sys.id,
2035
- releaseId,
2036
- version
2037
- },
2038
- payload
2039
- }).then(data => wrapRelease(makeRequest, data));
2040
- },
2041
- /**
2042
- * Deletes a Release by ID - does not delete any entities.
2043
- * @param releaseId the ID of the release
2044
- *
2045
- * @returns Promise containing a wrapped Release, that has helper methods within.
2046
- * @example ```javascript
2047
- * const contentful = require('contentful-management')
2048
- *
2049
- * const client = contentful.createClient({
2050
- * accessToken: '<content_management_api_key>'
2051
- * })
2052
- *
2053
- * client.getSpace('<space_id>')
2054
- * .then((space) => space.getEnvironment('<environment-id>'))
2055
- * .then((environment) => environment.deleteRelease('<release_id>')
2056
- * .catch(console.error)
2057
- * ```
2058
- */
2059
- deleteRelease(releaseId) {
2060
- const raw = this.toPlainObject();
2061
- return makeRequest({
2062
- entityType: 'Release',
2063
- action: 'delete',
2064
- params: {
2065
- spaceId: raw.sys.space.sys.id,
2066
- environmentId: raw.sys.id,
2067
- releaseId
2068
- }
2069
- });
2070
- },
2071
- /**
2072
- * Publishes all Entities contained in a Release.
2073
- * @param options.releaseId the ID of the release
2074
- * @param options.version the version of the release that is to be published
2075
- * @returns Promise containing a wrapped Release, that has helper methods within.
2076
- *
2077
- * @example ```javascript
2078
- * const contentful = require('contentful-management')
2079
- *
2080
- * const client = contentful.createClient({
2081
- * accessToken: '<content_management_api_key>'
2082
- * })
2083
- *
2084
- * client.getSpace('<space_id>')
2085
- * .then((space) => space.getEnvironment('<environment-id>'))
2086
- * .then((environment) => environment.publishRelease({ releaseId: '<release_id>', version: 1 }))
2087
- * .catch(console.error)
2088
- * ```
2089
- */
2090
- publishRelease({
2091
- releaseId,
2092
- version
2093
- }) {
2094
- const raw = this.toPlainObject();
2095
- return makeRequest({
2096
- entityType: 'Release',
2097
- action: 'publish',
2098
- params: {
2099
- spaceId: raw.sys.space.sys.id,
2100
- environmentId: raw.sys.id,
2101
- releaseId,
2102
- version
2103
- }
2104
- }).then(data => wrapReleaseAction(makeRequest, data));
2105
- },
2106
- /**
2107
- * Unpublishes all Entities contained in a Release.
2108
- * @param options.releaseId the ID of the release
2109
- * @param options.version the version of the release that is to be published
2110
- * @returns Promise containing a wrapped Release, that has helper methods within.
2111
- *
2112
- * @example ```javascript
2113
- * const contentful = require('contentful-management')
2114
- *
2115
- * const client = contentful.createClient({
2116
- * accessToken: '<content_management_api_key>'
2117
- * })
2118
- *
2119
- * client.getSpace('<space_id>')
2120
- * .then((space) => space.getEnvironment('<environment-id>'))
2121
- * .then((environment) => environment.unpublishRelease({ releaseId: '<release_id>', version: 1 }))
2122
- * .catch(console.error)
2123
- * ```
2124
- */
2125
- unpublishRelease({
2126
- releaseId,
2127
- version
2128
- }) {
2129
- const raw = this.toPlainObject();
2130
- return makeRequest({
2131
- entityType: 'Release',
2132
- action: 'unpublish',
2133
- params: {
2134
- spaceId: raw.sys.space.sys.id,
2135
- environmentId: raw.sys.id,
2136
- releaseId,
2137
- version
2138
- }
2139
- }).then(data => wrapReleaseAction(makeRequest, data));
2140
- },
2141
- /**
2142
- * Validates all Entities contained in a Release against an action (publish or unpublish)
2143
- * @param options.releaseId the ID of the release
2144
- * @param options.payload (optional) the type of action to be validated against
2145
- *
2146
- * @returns Promise containing a wrapped Release, that has helper methods within.
2147
- *
2148
- * @example ```javascript
2149
- * const contentful = require('contentful-management')
2150
- *
2151
- * const client = contentful.createClient({
2152
- * accessToken: '<content_management_api_key>'
2153
- * })
2154
- *
2155
- * client.getSpace('<space_id>')
2156
- * .then((space) => space.getEnvironment('<environment-id>'))
2157
- * .then((environment) => environment.validateRelease({ releaseId: '<release_id>', payload: { action: 'unpublish' } }))
2158
- * .catch(console.error)
2159
- * ```
2160
- */
2161
- validateRelease({
2162
- releaseId,
2163
- payload
2164
- }) {
2165
- const raw = this.toPlainObject();
2166
- return makeRequest({
2167
- entityType: 'Release',
2168
- action: 'validate',
2169
- params: {
2170
- spaceId: raw.sys.space.sys.id,
2171
- environmentId: raw.sys.id,
2172
- releaseId
2173
- },
2174
- payload
2175
- }).then(data => wrapReleaseAction(makeRequest, data));
2176
- },
2177
- /**
2178
- * Archives a Release and prevents new operations (publishing, unpublishing adding new entities etc).
2179
- * @param options.releaseId the ID of the release
2180
- * @param options.version the version of the release that is to be archived
2181
- * @returns Promise containing a wrapped Release, that has helper methods within.
2182
- *
2183
- * @example ```javascript
2184
- * const contentful = require('contentful-management')
2185
- *
2186
- * const client = contentful.createClient({
2187
- * accessToken: '<content_management_api_key>'
2188
- * })
2189
- *
2190
- * client.getSpace('<space_id>')
2191
- * .then((space) => space.getEnvironment('<environment-id>'))
2192
- * .then((environment) => environment.archiveRelease({ releaseId: '<release_id>', version: 1 }))
2193
- * .catch(console.error)
2194
- * ```
2195
- */
2196
- archiveRelease({
2197
- releaseId,
2198
- version
2199
- }) {
2200
- const raw = this.toPlainObject();
2201
- return makeRequest({
2202
- entityType: 'Release',
2203
- action: 'archive',
2204
- params: {
2205
- spaceId: raw.sys.space.sys.id,
2206
- environmentId: raw.sys.id,
2207
- releaseId,
2208
- version
2209
- }
2210
- }).then(data => wrapRelease(makeRequest, data));
2211
- },
2212
- /**
2213
- * Unarchives a previously archived Release - this enables the release to be published, unpublished etc.
2214
- * @param options.releaseId the ID of the release
2215
- * @param options.version the version of the release that is to be unarchived
2216
- * @returns Promise containing a wrapped Release, that has helper methods within.
2217
- *
2218
- * @example ```javascript
2219
- * const contentful = require('contentful-management')
2220
- *
2221
- * const client = contentful.createClient({
2222
- * accessToken: '<content_management_api_key>'
2223
- * })
2224
- *
2225
- * client.getSpace('<space_id>')
2226
- * .then((space) => space.getEnvironment('<environment-id>'))
2227
- * .then((environment) => environment.unarchiveRelease({ releaseId: '<release_id>', version: 1 }))
2228
- * .catch(console.error)
2229
- * ```
2230
- */
2231
- unarchiveRelease({
2232
- releaseId,
2233
- version
2234
- }) {
2235
- const raw = this.toPlainObject();
2236
- return makeRequest({
2237
- entityType: 'Release',
2238
- action: 'unarchive',
2239
- params: {
2240
- spaceId: raw.sys.space.sys.id,
2241
- environmentId: raw.sys.id,
2242
- releaseId,
2243
- version
2244
- }
2245
- }).then(data => wrapRelease(makeRequest, data));
2246
- },
2247
- /**
2248
- * Retrieves a ReleaseAction by ID
2249
- * @param params.releaseId The ID of a Release
2250
- * @param params.actionId The ID of a Release Action
2251
- * @returns Promise containing a wrapped ReleaseAction
2252
- * @example ```javascript
2253
- * const contentful = require('contentful-management')
2254
- *
2255
- * const client = contentful.createClient({
2256
- * accessToken: '<content_management_api_key>'
2257
- * })
2258
- *
2259
- * client.getSpace('<space_id>')
2260
- * .then((space) => space.getEnvironment('<environment-id>'))
2261
- * .then((environment) => environment.getReleaseAction({ releaseId: '<release_id>', actionId: '<action_id>' }))
2262
- * .then((releaseAction) => console.log(releaseAction))
2263
- * .catch(console.error)
2264
- * ```
2265
- */
2266
- getReleaseAction({
2267
- actionId,
2268
- releaseId
2269
- }) {
2270
- const raw = this.toPlainObject();
2271
- return makeRequest({
2272
- entityType: 'ReleaseAction',
2273
- action: 'get',
2274
- params: {
2275
- actionId,
2276
- spaceId: raw.sys.space.sys.id,
2277
- environmentId: raw.sys.id,
2278
- releaseId
2279
- }
2280
- }).then(data => wrapReleaseAction(makeRequest, data));
2281
- },
2282
- /**
2283
- * Gets a Collection of ReleaseActions
2284
- * @param {string} params.releaseId ID of the Release to fetch the actions from
2285
- * @param {ReleaseQueryOptions} params.query filtering options for the collection result
2286
- * @returns Promise containing a wrapped ReleaseAction Collection
2287
- *
2288
- * @example ```javascript
2289
- * const contentful = require('contentful-management')
2290
- *
2291
- * const client = contentful.createClient({
2292
- * accessToken: '<content_management_api_key>'
2293
- * })
2294
- *
2295
- * client.getSpace('<space_id>')
2296
- * .then((space) => space.getEnvironment('<environment-id>'))
2297
- * .then((environment) => environment.getReleaseActions({ query: { 'sys.id[in]': '<id_1>,<id_2>', 'sys.release.sys.id[in]': '<id1>,<id2>' } }))
2298
- * .then((releaseActions) => console.log(releaseActions))
2299
- * .catch(console.error)
2300
- * ```
2301
- */
2302
- getReleaseActions({
2303
- query
2304
- }) {
2305
- const raw = this.toPlainObject();
2306
- return makeRequest({
2307
- entityType: 'ReleaseAction',
2308
- action: 'getMany',
2309
- params: {
2310
- spaceId: raw.sys.space.sys.id,
2311
- environmentId: raw.sys.id,
2312
- query
2313
- }
2314
- }).then(data => wrapReleaseActionCollection(makeRequest, data));
2315
- },
2316
- async getUIConfig() {
2317
- const raw = this.toPlainObject();
2318
- const data = await makeRequest({
2319
- entityType: 'UIConfig',
2320
- action: 'get',
2321
- params: {
2322
- spaceId: raw.sys.space.sys.id,
2323
- environmentId: raw.sys.id
2324
- }
2325
- });
2326
- return wrapUIConfig(makeRequest, data);
2327
- },
2328
- async getUserUIConfig() {
2329
- const raw = this.toPlainObject();
2330
- const data = await makeRequest({
2331
- entityType: 'UserUIConfig',
2332
- action: 'get',
2333
- params: {
2334
- spaceId: raw.sys.space.sys.id,
2335
- environmentId: raw.sys.id
2336
- }
2337
- });
2338
- return wrapUserUIConfig(makeRequest, data);
2339
- },
2340
- /**
2341
- * Gets a collection of all environment template installations in the environment for a given template
2342
- * @param environmentTemplateId - Environment template ID to return installations for
2343
- * @param [options.installationId] - Installation ID to filter for a specific installation
2344
- * @return Promise for a collection of EnvironmentTemplateInstallations
2345
- * ```javascript
2346
- * const contentful = require('contentful-management')
2347
- *
2348
- * const client = contentful.createClient({
2349
- * accessToken: '<content_management_api_key>'
2350
- * })
2351
- *
2352
- * client.getSpace('<space_id>')
2353
- * .then((space) => space.getEnvironment('<environment_id>'))
2354
- * .then((environment) => environment.getEnvironmentTemplateInstallations('<environment_template_id>'))
2355
- * .then((installations) => console.log(installations.items))
2356
- * .catch(console.error)
2357
- * ```
2358
- */
2359
- async getEnvironmentTemplateInstallations(environmentTemplateId, _ref = {}) {
2360
- let {
2361
- installationId
2362
- } = _ref,
2363
- query = _objectWithoutProperties(_ref, _excluded);
2364
- const raw = this.toPlainObject();
2365
- return makeRequest({
2366
- entityType: 'EnvironmentTemplateInstallation',
2367
- action: 'getForEnvironment',
2368
- params: _objectSpread(_objectSpread({
2369
- environmentTemplateId
2370
- }, installationId && {
2371
- installationId
2372
- }), {}, {
2373
- query: _objectSpread({}, createRequestConfig({
2374
- query
2375
- }).params),
2376
- spaceId: raw.sys.space.sys.id,
2377
- environmentId: raw.sys.id
2378
- })
2379
- }).then(data => wrapEnvironmentTemplateInstallationCollection(makeRequest, data));
2380
- },
2381
- /**
2382
- * Gets a collection of all resource types based on native external references app installations in the environment
2383
- * @param query - BasicCursorPaginationOptions
2384
- * @return Promise for a collection of ResourceTypes
2385
- * ```javascript
2386
- * const contentful = require('contentful-management')
2387
- *
2388
- * const client = contentful.createClient({
2389
- * accessToken: '<content_management_api_key>'
2390
- * })
2391
- *
2392
- * client.getSpace('<space_id>')
2393
- * .then((space) => space.getEnvironment('<environment_id>'))
2394
- * .then((environment) => environment.getResourceTypes({limit: 10}))
2395
- * .then((installations) => console.log(installations.items))
2396
- * .catch(console.error)
2397
- * ```
2398
- */
2399
- async getResourceTypes(query) {
2400
- const raw = this.toPlainObject();
2401
- return makeRequest({
2402
- entityType: 'ResourceType',
2403
- action: 'getForEnvironment',
2404
- params: {
2405
- query,
2406
- spaceId: raw.sys.space.sys.id,
2407
- environmentId: raw.sys.id
2408
- }
2409
- }).then(data => wrapResourceTypesForEnvironmentCollection(makeRequest, data));
2410
- },
2411
- /**
2412
- * Gets a collection of all resources for a given resource type based on native external references app installations in the environment
2413
- * @param resourceTypeId - Id of the resourceType to get its resources
2414
- * @param query - Either LookupQuery options with 'sys.urn[in]' param or a Search query with 'query' param, in both cases you can add pagination options
2415
- * @return Promise for a collection of Resources for a given resourceTypeId
2416
- * ```javascript
2417
- * const contentful = require('contentful-management')
2418
- *
2419
- * const client = contentful.createClient({
2420
- * accessToken: '<content_management_api_key>'
2421
- * })
2422
- *
2423
- * // Search Query
2424
- * client.getSpace('<space_id>')
2425
- * .then((space) => space.getEnvironment('<environment_id>'))
2426
- * // <search_query> is a string you want to search for in the external resources
2427
- * .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {query: '<search_query>', limit: 10}))
2428
- * .then((installations) => console.log(installations.items))
2429
- * .catch(console.error)
2430
- *
2431
- * // Lookup query
2432
- *
2433
- * client.getSpace('<space_id>')
2434
- * .then((space) => space.getEnvironment('<environment_id>'))
2435
- * .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {'sys.urn[in]': '<resource_urn1>,<resource_urn2>', limit: 10}))
2436
- * .then((installations) => console.log(installations.items))
2437
- * .catch(console.error)
2438
- * ```
2439
- */
2440
- async getResourcesForResourceType(resourceTypeId, query) {
2441
- const raw = this.toPlainObject();
2442
- return makeRequest({
2443
- entityType: 'Resource',
2444
- action: 'getMany',
2445
- params: {
2446
- query,
2447
- spaceId: raw.sys.space.sys.id,
2448
- environmentId: raw.sys.id,
2449
- resourceTypeId
2450
- }
2451
- }).then(data => wrapResourceCollection(makeRequest, data));
2452
- }
2453
- };
2454
- }