confluence.js 1.5.1 → 1.6.0

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 (163) hide show
  1. package/CHANGELOG.md +22 -3
  2. package/README.md +1 -0
  3. package/out/api/audit.d.ts +24 -12
  4. package/out/api/audit.js.map +1 -1
  5. package/out/api/content.d.ts +18 -12
  6. package/out/api/content.js.map +1 -1
  7. package/out/api/contentAttachments.d.ts +14 -8
  8. package/out/api/contentAttachments.js.map +1 -1
  9. package/out/api/contentBody.d.ts +52 -0
  10. package/out/api/contentBody.js +27 -3
  11. package/out/api/contentBody.js.map +1 -1
  12. package/out/api/contentChildrenAndDescendants.js +2 -1
  13. package/out/api/contentChildrenAndDescendants.js.map +1 -1
  14. package/out/api/contentContentState.d.ts +30 -28
  15. package/out/api/contentContentState.js +2 -0
  16. package/out/api/contentContentState.js.map +1 -1
  17. package/out/api/contentMacroBody.d.ts +72 -2
  18. package/out/api/contentMacroBody.js +29 -0
  19. package/out/api/contentMacroBody.js.map +1 -1
  20. package/out/api/contentRestrictions.d.ts +16 -8
  21. package/out/api/contentRestrictions.js.map +1 -1
  22. package/out/api/contentStates.d.ts +120 -0
  23. package/out/api/contentStates.js +88 -0
  24. package/out/api/contentStates.js.map +1 -0
  25. package/out/api/contentWatches.d.ts +16 -8
  26. package/out/api/contentWatches.js.map +1 -1
  27. package/out/api/dynamicModules.js +1 -0
  28. package/out/api/dynamicModules.js.map +1 -1
  29. package/out/api/experimental.d.ts +2 -2
  30. package/out/api/index.d.ts +1 -0
  31. package/out/api/index.js +1 -0
  32. package/out/api/index.js.map +1 -1
  33. package/out/api/models/asyncContentBody.d.ts +30 -0
  34. package/out/api/models/asyncContentBody.js +3 -0
  35. package/out/api/models/asyncContentBody.js.map +1 -0
  36. package/out/api/models/asyncId.d.ts +3 -0
  37. package/out/api/models/asyncId.js +3 -0
  38. package/out/api/models/asyncId.js.map +1 -0
  39. package/out/api/models/contentBodyCreate.d.ts +1 -0
  40. package/out/api/models/contentStateResponse.d.ts +7 -0
  41. package/out/api/models/contentStateResponse.js +3 -0
  42. package/out/api/models/contentStateResponse.js.map +1 -0
  43. package/out/api/models/contentStateRestInput.d.ts +11 -0
  44. package/out/api/models/contentStateRestInput.js +3 -0
  45. package/out/api/models/contentStateRestInput.js.map +1 -0
  46. package/out/api/models/index.d.ts +16 -12
  47. package/out/api/models/index.js +16 -12
  48. package/out/api/models/index.js.map +1 -1
  49. package/out/api/parameters/asyncConvertContentBodyRequest.d.ts +38 -0
  50. package/out/api/parameters/asyncConvertContentBodyRequest.js +3 -0
  51. package/out/api/parameters/asyncConvertContentBodyRequest.js.map +1 -0
  52. package/out/api/parameters/asyncConvertContentBodyResponse.d.ts +4 -0
  53. package/out/api/parameters/asyncConvertContentBodyResponse.js +3 -0
  54. package/out/api/parameters/asyncConvertContentBodyResponse.js.map +1 -0
  55. package/out/api/parameters/convertContentBody.d.ts +16 -2
  56. package/out/api/parameters/getAndAsyncConvertMacroBodyByMacroId.d.ts +46 -0
  57. package/out/api/parameters/getAndAsyncConvertMacroBodyByMacroId.js +3 -0
  58. package/out/api/parameters/getAndAsyncConvertMacroBodyByMacroId.js.map +1 -0
  59. package/out/api/parameters/getAndConvertMacroBodyByMacroId.d.ts +34 -0
  60. package/out/api/parameters/getAndConvertMacroBodyByMacroId.js +3 -0
  61. package/out/api/parameters/getAndConvertMacroBodyByMacroId.js.map +1 -0
  62. package/out/api/parameters/getAvailableContentStates.d.ts +4 -2
  63. package/out/api/parameters/getContentState.d.ts +8 -4
  64. package/out/api/parameters/getSpaceContentStates.d.ts +4 -0
  65. package/out/api/parameters/getSpaceContentStates.js +3 -0
  66. package/out/api/parameters/getSpaceContentStates.js.map +1 -0
  67. package/out/api/parameters/getUser.d.ts +6 -4
  68. package/out/api/parameters/index.d.ts +5 -0
  69. package/out/api/parameters/index.js +5 -0
  70. package/out/api/parameters/index.js.map +1 -1
  71. package/out/api/parameters/movePage.d.ts +9 -5
  72. package/out/api/parameters/removeContentState.d.ts +5 -1
  73. package/out/api/parameters/setContentState.d.ts +11 -5
  74. package/out/api/relation.d.ts +8 -4
  75. package/out/api/relation.js.map +1 -1
  76. package/out/api/settings.d.ts +6 -4
  77. package/out/api/settings.js.map +1 -1
  78. package/out/api/space.d.ts +6 -4
  79. package/out/api/space.js.map +1 -1
  80. package/out/api/spaceProperties.d.ts +4 -4
  81. package/out/api/template.d.ts +16 -8
  82. package/out/api/template.js.map +1 -1
  83. package/out/clients/baseClient.js +3 -1
  84. package/out/clients/baseClient.js.map +1 -1
  85. package/out/clients/confluenceClient.d.ts +2 -1
  86. package/out/clients/confluenceClient.js +1 -0
  87. package/out/clients/confluenceClient.js.map +1 -1
  88. package/out/clients/serverClient.js.map +1 -1
  89. package/out/server/audit.js +6 -6
  90. package/out/server/audit.js.map +1 -1
  91. package/out/server/content.d.ts +34 -262
  92. package/out/server/content.js +40 -32
  93. package/out/server/content.js.map +1 -1
  94. package/out/server/contentBody.d.ts +2 -12
  95. package/out/server/contentBody.js +2 -1
  96. package/out/server/contentBody.js.map +1 -1
  97. package/out/server/group.js +3 -3
  98. package/out/server/group.js.map +1 -1
  99. package/out/server/longTask.js +2 -2
  100. package/out/server/longTask.js.map +1 -1
  101. package/out/server/parameters/convertContentBody.d.ts +16 -0
  102. package/out/server/parameters/updateAttachmentData.d.ts +8 -2
  103. package/out/server/search.d.ts +2 -22
  104. package/out/server/search.js +1 -1
  105. package/out/server/search.js.map +1 -1
  106. package/out/server/space.d.ts +12 -94
  107. package/out/server/space.js +14 -14
  108. package/out/server/space.js.map +1 -1
  109. package/out/server/user.d.ts +8 -152
  110. package/out/server/user.js +10 -10
  111. package/out/server/user.js.map +1 -1
  112. package/package.json +10 -10
  113. package/src/api/audit.ts +24 -12
  114. package/src/api/content.ts +23 -17
  115. package/src/api/contentAttachments.ts +19 -13
  116. package/src/api/contentBody.ts +102 -0
  117. package/src/api/contentChildrenAndDescendants.ts +3 -1
  118. package/src/api/contentContentState.ts +30 -28
  119. package/src/api/contentMacroBody.ts +119 -2
  120. package/src/api/contentRestrictions.ts +16 -8
  121. package/src/api/contentStates.ts +252 -0
  122. package/src/api/contentWatches.ts +16 -8
  123. package/src/api/dynamicModules.ts +1 -0
  124. package/src/api/experimental.ts +2 -2
  125. package/src/api/index.ts +1 -0
  126. package/src/api/models/asyncContentBody.ts +31 -0
  127. package/src/api/models/asyncId.ts +3 -0
  128. package/src/api/models/contentBodyCreate.ts +1 -0
  129. package/src/api/models/contentStateResponse.ts +8 -0
  130. package/src/api/models/contentStateRestInput.ts +11 -0
  131. package/src/api/models/index.ts +16 -12
  132. package/src/api/parameters/asyncConvertContentBodyRequest.ts +81 -0
  133. package/src/api/parameters/asyncConvertContentBodyResponse.ts +4 -0
  134. package/src/api/parameters/convertContentBody.ts +39 -2
  135. package/src/api/parameters/getAndAsyncConvertMacroBodyByMacroId.ts +88 -0
  136. package/src/api/parameters/getAndConvertMacroBodyByMacroId.ts +104 -0
  137. package/src/api/parameters/getAvailableContentStates.ts +5 -2
  138. package/src/api/parameters/getContentState.ts +9 -4
  139. package/src/api/parameters/getSpaceContentStates.ts +4 -0
  140. package/src/api/parameters/getUser.ts +14 -4
  141. package/src/api/parameters/index.ts +5 -0
  142. package/src/api/parameters/movePage.ts +9 -5
  143. package/src/api/parameters/removeContentState.ts +6 -1
  144. package/src/api/parameters/setContentState.ts +13 -5
  145. package/src/api/relation.ts +8 -4
  146. package/src/api/settings.ts +6 -4
  147. package/src/api/space.ts +7 -5
  148. package/src/api/spaceProperties.ts +4 -4
  149. package/src/api/template.ts +16 -8
  150. package/src/clients/baseClient.ts +5 -10
  151. package/src/clients/client.ts +1 -5
  152. package/src/clients/confluenceClient.ts +2 -0
  153. package/src/clients/serverClient.ts +1 -10
  154. package/src/server/audit.ts +6 -6
  155. package/src/server/content.ts +78 -295
  156. package/src/server/contentBody.ts +4 -13
  157. package/src/server/group.ts +3 -3
  158. package/src/server/longTask.ts +2 -2
  159. package/src/server/parameters/convertContentBody.ts +37 -0
  160. package/src/server/parameters/updateAttachmentData.ts +7 -3
  161. package/src/server/search.ts +3 -23
  162. package/src/server/space.ts +26 -108
  163. package/src/server/user.ts +18 -162
@@ -20,7 +20,8 @@ export class ContentMacroBody {
20
20
  * macro ID is found. This check will eventually become redundant, as macro IDs are generated for pages and
21
21
  * transparently propagate out to all instances.
22
22
  *
23
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content that the macro is in.
23
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content that the
24
+ * macro is in.
24
25
  */
25
26
  async getMacroBodyByMacroId<T = Models.MacroInstance>(
26
27
  parameters: Parameters.GetMacroBodyByMacroId,
@@ -39,7 +40,8 @@ export class ContentMacroBody {
39
40
  * macro ID is found. This check will eventually become redundant, as macro IDs are generated for pages and
40
41
  * transparently propagate out to all instances.
41
42
  *
42
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content that the macro is in.
43
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content that the
44
+ * macro is in.
43
45
  */
44
46
  async getMacroBodyByMacroId<T = Models.MacroInstance>(
45
47
  parameters: Parameters.GetMacroBodyByMacroId,
@@ -56,4 +58,119 @@ export class ContentMacroBody {
56
58
 
57
59
  return this.client.sendRequest(config, callback);
58
60
  }
61
+
62
+ /**
63
+ * Returns the body of a macro in format specified in path, for the given macro ID. This includes information like the
64
+ * name of the macro, the body of the macro, and any macro parameters.
65
+ *
66
+ * About the macro ID: When a macro is created in a new version of content, Confluence will generate a random ID for
67
+ * it, unless an ID is specified (by an app). The macro ID will look similar to this:
68
+ * '50884bd9-0cb8-41d5-98be-f80943c14f96'. The ID is then persisted as new versions of content are created, and is
69
+ * only modified by Confluence if there are conflicting IDs.
70
+ *
71
+ * Note, to preserve backwards compatibility this resource will also match on the hash of the macro body, even if a
72
+ * macro ID is found. This check will eventually become redundant, as macro IDs are generated for pages and
73
+ * transparently propagate out to all instances.
74
+ *
75
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content that the
76
+ * macro is in.
77
+ */
78
+ async getAndConvertMacroBodyByMacroId<T = Models.ContentBody>(
79
+ parameters: Parameters.GetAndConvertMacroBodyByMacroId,
80
+ callback: Callback<T>
81
+ ): Promise<void>;
82
+ /**
83
+ * Returns the body of a macro in format specified in path, for the given macro ID. This includes information like the
84
+ * name of the macro, the body of the macro, and any macro parameters.
85
+ *
86
+ * About the macro ID: When a macro is created in a new version of content, Confluence will generate a random ID for
87
+ * it, unless an ID is specified (by an app). The macro ID will look similar to this:
88
+ * '50884bd9-0cb8-41d5-98be-f80943c14f96'. The ID is then persisted as new versions of content are created, and is
89
+ * only modified by Confluence if there are conflicting IDs.
90
+ *
91
+ * Note, to preserve backwards compatibility this resource will also match on the hash of the macro body, even if a
92
+ * macro ID is found. This check will eventually become redundant, as macro IDs are generated for pages and
93
+ * transparently propagate out to all instances.
94
+ *
95
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content that the
96
+ * macro is in.
97
+ */
98
+ async getAndConvertMacroBodyByMacroId<T = Models.ContentBody>(
99
+ parameters: Parameters.GetAndConvertMacroBodyByMacroId,
100
+ callback?: never
101
+ ): Promise<T>;
102
+ async getAndConvertMacroBodyByMacroId<T = Models.ContentBody>(
103
+ parameters: Parameters.GetAndConvertMacroBodyByMacroId,
104
+ callback?: Callback<T>,
105
+ ): Promise<void | T> {
106
+ const config: RequestConfig = {
107
+ url: `/api/content/${parameters.id}/history/${parameters.version}/macro/id/${parameters.macroId}/convert/${parameters.to}`,
108
+ method: 'GET',
109
+ params: {
110
+ spaceKeyContext: parameters.spaceKeyContext,
111
+ embeddedContentRender: parameters.embeddedContentRender,
112
+ expand: parameters.expand,
113
+ },
114
+ };
115
+
116
+ return this.client.sendRequest(config, callback);
117
+ }
118
+
119
+ /**
120
+ * Returns Async Id of the conversion task which will convert the macro into a content body of the desired format. The
121
+ * result will be available for 5 minutes after completion of the conversion.
122
+ *
123
+ * About the macro ID: When a macro is created in a new version of content, Confluence will generate a random ID for
124
+ * it, unless an ID is specified (by an app). The macro ID will look similar to this:
125
+ * '884bd9-0cb8-41d5-98be-f80943c14f96'. The ID is then persisted as new versions of content are created, and is only
126
+ * modified by Confluence if there are conflicting IDs.
127
+ *
128
+ * Note, to preserve backwards compatibility this resource will also match on the hash of the macro body, even if a
129
+ * macro ID is found. This check will eventually become redundant, as macro IDs are generated for pages and
130
+ * transparently propagate out to all instances.
131
+ *
132
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content that the
133
+ * macro is in.
134
+ */
135
+ async getAndAsyncConvertMacroBodyByMacroId<T = Models.AsyncId>(
136
+ parameters: Parameters.GetAndAsyncConvertMacroBodyByMacroId,
137
+ callback: Callback<T>
138
+ ): Promise<void>;
139
+ /**
140
+ * Returns Async Id of the conversion task which will convert the macro into a content body of the desired format. The
141
+ * result will be available for 5 minutes after completion of the conversion.
142
+ *
143
+ * About the macro ID: When a macro is created in a new version of content, Confluence will generate a random ID for
144
+ * it, unless an ID is specified (by an app). The macro ID will look similar to this:
145
+ * '884bd9-0cb8-41d5-98be-f80943c14f96'. The ID is then persisted as new versions of content are created, and is only
146
+ * modified by Confluence if there are conflicting IDs.
147
+ *
148
+ * Note, to preserve backwards compatibility this resource will also match on the hash of the macro body, even if a
149
+ * macro ID is found. This check will eventually become redundant, as macro IDs are generated for pages and
150
+ * transparently propagate out to all instances.
151
+ *
152
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content that the
153
+ * macro is in.
154
+ */
155
+ async getAndAsyncConvertMacroBodyByMacroId<T = Models.AsyncId>(
156
+ parameters: Parameters.GetAndAsyncConvertMacroBodyByMacroId,
157
+ callback?: never
158
+ ): Promise<T>;
159
+ async getAndAsyncConvertMacroBodyByMacroId<T = Models.AsyncId>(
160
+ parameters: Parameters.GetAndAsyncConvertMacroBodyByMacroId,
161
+ callback?: Callback<T>,
162
+ ): Promise<void | T> {
163
+ const config: RequestConfig = {
164
+ url: `/api/content/${parameters.id}/history/${parameters.version}/macro/id/${parameters.macroId}/convert/async/${parameters.to}`,
165
+ method: 'GET',
166
+ params: {
167
+ allowCache: parameters.allowCache,
168
+ spaceKeyContext: parameters.spaceKeyContext,
169
+ embeddedContentRender: parameters.embeddedContentRender,
170
+ expand: parameters.expand,
171
+ },
172
+ };
173
+
174
+ return this.client.sendRequest(config, callback);
175
+ }
59
176
  }
@@ -262,7 +262,8 @@ export class ContentRestrictions {
262
262
  }
263
263
 
264
264
  /**
265
- * Adds a group to a content restriction. That is, grant read or update permission to the group for a piece of content.
265
+ * Adds a group to a content restriction. That is, grant read or update permission to the group for a piece of
266
+ * content.
266
267
  *
267
268
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
268
269
  */
@@ -271,7 +272,8 @@ export class ContentRestrictions {
271
272
  callback: Callback<T>
272
273
  ): Promise<void>;
273
274
  /**
274
- * Adds a group to a content restriction. That is, grant read or update permission to the group for a piece of content.
275
+ * Adds a group to a content restriction. That is, grant read or update permission to the group for a piece of
276
+ * content.
275
277
  *
276
278
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
277
279
  */
@@ -292,13 +294,15 @@ export class ContentRestrictions {
292
294
  }
293
295
 
294
296
  /**
295
- * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of content.
297
+ * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of
298
+ * content.
296
299
  *
297
300
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
298
301
  */
299
302
  async removeGroupByName<T = unknown>(parameters: Parameters.RemoveGroupByName, callback: Callback<T>): Promise<void>;
300
303
  /**
301
- * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of content.
304
+ * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of
305
+ * content.
302
306
  *
303
307
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
304
308
  */
@@ -392,13 +396,15 @@ export class ContentRestrictions {
392
396
  }
393
397
 
394
398
  /**
395
- * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of content.
399
+ * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of
400
+ * content.
396
401
  *
397
402
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
398
403
  */
399
404
  async removeGroupById<T = unknown>(parameters: Parameters.RemoveGroupById, callback: Callback<T>): Promise<void>;
400
405
  /**
401
- * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of content.
406
+ * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of
407
+ * content.
402
408
  *
403
409
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
404
410
  */
@@ -502,7 +508,8 @@ export class ContentRestrictions {
502
508
  }
503
509
 
504
510
  /**
505
- * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of content.
511
+ * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of
512
+ * content.
506
513
  *
507
514
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
508
515
  */
@@ -511,7 +518,8 @@ export class ContentRestrictions {
511
518
  callback: Callback<T>
512
519
  ): Promise<void>;
513
520
  /**
514
- * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of content.
521
+ * Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of
522
+ * content.
515
523
  *
516
524
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
517
525
  */
@@ -0,0 +1,252 @@
1
+ import * as Models from './models';
2
+ import * as Parameters from './parameters';
3
+ import { Callback } from '../callback';
4
+ import { Client } from '../clients';
5
+ import { RequestConfig } from '../requestConfig';
6
+
7
+ export class ContentStates {
8
+ constructor(private client: Client) {}
9
+
10
+ /**
11
+ * Gets the current content state of the draft or current version of content. To specify the draft version, set the
12
+ * parameter status to draft, otherwise archived or current will get the relevant published state.
13
+ *
14
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content.
15
+ */
16
+ async getContentState<T = Models.ContentStateResponse>(
17
+ parameters: Parameters.GetContentState,
18
+ callback: Callback<T>
19
+ ): Promise<void>;
20
+ /**
21
+ * Gets the current content state of the draft or current version of content. To specify the draft version, set the
22
+ * parameter status to draft, otherwise archived or current will get the relevant published state.
23
+ *
24
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the content.
25
+ */
26
+ async getContentState<T = Models.ContentStateResponse>(
27
+ parameters: Parameters.GetContentState,
28
+ callback?: never
29
+ ): Promise<T>;
30
+ async getContentState<T = Models.ContentStateResponse>(
31
+ parameters: Parameters.GetContentState,
32
+ callback?: Callback<T>,
33
+ ): Promise<void | T> {
34
+ const config: RequestConfig = {
35
+ url: `/api/content/${parameters.id}/state`,
36
+ method: 'GET',
37
+ params: {
38
+ status: parameters.status,
39
+ },
40
+ };
41
+
42
+ return this.client.sendRequest(config, callback);
43
+ }
44
+
45
+ /**
46
+ * Sets the content state of the content specified and creates a new version (publishes the content without changing
47
+ * the body) of the content with the new state.
48
+ *
49
+ * You may pass in either an id of a state, or the name and color of a desired new state. If all 3 are passed in, id
50
+ * will be used. If the name and color passed in already exist under the current user's existing custom states, the
51
+ * existing state will be reused. If custom states are disabled in the space of the content (which can be determined
52
+ * by getting the content state space settings of the content's space) then this set will fail.
53
+ *
54
+ * You may not remove a content state via this PUT request. You must use the DELETE method. A specified state is
55
+ * required in the body of this request.
56
+ *
57
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
58
+ */
59
+ async setContentState<T = Models.ContentStateResponse>(
60
+ parameters: Parameters.SetContentState,
61
+ callback: Callback<T>
62
+ ): Promise<void>;
63
+ /**
64
+ * Sets the content state of the content specified and creates a new version (publishes the content without changing
65
+ * the body) of the content with the new state.
66
+ *
67
+ * You may pass in either an id of a state, or the name and color of a desired new state. If all 3 are passed in, id
68
+ * will be used. If the name and color passed in already exist under the current user's existing custom states, the
69
+ * existing state will be reused. If custom states are disabled in the space of the content (which can be determined
70
+ * by getting the content state space settings of the content's space) then this set will fail.
71
+ *
72
+ * You may not remove a content state via this PUT request. You must use the DELETE method. A specified state is
73
+ * required in the body of this request.
74
+ *
75
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
76
+ */
77
+ async setContentState<T = Models.ContentStateResponse>(
78
+ parameters: Parameters.SetContentState,
79
+ callback?: never
80
+ ): Promise<T>;
81
+ async setContentState<T = Models.ContentStateResponse>(
82
+ parameters: Parameters.SetContentState,
83
+ callback?: Callback<T>,
84
+ ): Promise<void | T> {
85
+ const config: RequestConfig = {
86
+ url: `/api/content/${parameters.id}/state`,
87
+ method: 'PUT',
88
+ params: {
89
+ status: parameters.status,
90
+ },
91
+ data: {
92
+ name: parameters.name,
93
+ color: parameters.color,
94
+ id: parameters.stateId,
95
+ },
96
+ };
97
+
98
+ return this.client.sendRequest(config, callback);
99
+ }
100
+
101
+ /**
102
+ * Removes the content state of the content specified and creates a new version (publishes the content without
103
+ * changing the body) of the content with the new status.
104
+ *
105
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
106
+ */
107
+ async removeContentState<T = Models.ContentStateResponse>(
108
+ parameters: Parameters.RemoveContentState,
109
+ callback: Callback<T>
110
+ ): Promise<void>;
111
+ /**
112
+ * Removes the content state of the content specified and creates a new version (publishes the content without
113
+ * changing the body) of the content with the new status.
114
+ *
115
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
116
+ */
117
+ async removeContentState<T = Models.ContentStateResponse>(
118
+ parameters: Parameters.RemoveContentState,
119
+ callback?: never
120
+ ): Promise<T>;
121
+ async removeContentState<T = Models.ContentStateResponse>(
122
+ parameters: Parameters.RemoveContentState,
123
+ callback?: Callback<T>,
124
+ ): Promise<void | T> {
125
+ const config: RequestConfig = {
126
+ url: `/api/content/${parameters.id}/state`,
127
+ method: 'DELETE',
128
+ params: {
129
+ status: parameters.status,
130
+ },
131
+ };
132
+
133
+ return this.client.sendRequest(config, callback);
134
+ }
135
+
136
+ /**
137
+ * Gets content states that are available for the content to be set as. Will return all enabled Space Content States.
138
+ * Will only return most the 3 most recently published custom content states to match UI editor list. To get all
139
+ * custom content states, use the /content-states endpoint.
140
+ *
141
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
142
+ */
143
+ async getAvailableContentStates<T = Models.AvailableContentStates>(
144
+ parameters: Parameters.GetAvailableContentStates,
145
+ callback: Callback<T>
146
+ ): Promise<void>;
147
+ /**
148
+ * Gets content states that are available for the content to be set as. Will return all enabled Space Content States.
149
+ * Will only return most the 3 most recently published custom content states to match UI editor list. To get all
150
+ * custom content states, use the /content-states endpoint.
151
+ *
152
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.
153
+ */
154
+ async getAvailableContentStates<T = Models.AvailableContentStates>(
155
+ parameters: Parameters.GetAvailableContentStates,
156
+ callback?: never
157
+ ): Promise<T>;
158
+ async getAvailableContentStates<T = Models.AvailableContentStates>(
159
+ parameters: Parameters.GetAvailableContentStates,
160
+ callback?: Callback<T>,
161
+ ): Promise<void | T> {
162
+ const config: RequestConfig = {
163
+ url: `/api/content/${parameters.id}/state/available`,
164
+ method: 'GET',
165
+ };
166
+
167
+ return this.client.sendRequest(config, callback);
168
+ }
169
+
170
+ /**
171
+ * Get custom content states that authenticated user has created.
172
+ *
173
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required** Must have user authentication.
174
+ */
175
+ async getCustomContentStates<T = Models.ContentState[]>(callback: Callback<T>): Promise<void>;
176
+ /**
177
+ * Get custom content states that authenticated user has created.
178
+ *
179
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required** Must have user authentication.
180
+ */
181
+ async getCustomContentStates<T = Models.ContentState[]>(callback?: never): Promise<T>;
182
+ async getCustomContentStates<T = Models.ContentState[]>(callback?: Callback<T>): Promise<void | T> {
183
+ const config: RequestConfig = {
184
+ url: '/api/content-states',
185
+ method: 'GET',
186
+ };
187
+
188
+ return this.client.sendRequest(config, callback);
189
+ }
190
+
191
+ /**
192
+ * Get content states that are suggested in the space.
193
+ *
194
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Space view permission
195
+ */
196
+ async getSpaceContentStates<T = Models.ContentState[]>(
197
+ parameters: Parameters.GetSpaceContentStates,
198
+ callback: Callback<T>
199
+ ): Promise<void>;
200
+ /**
201
+ * Get content states that are suggested in the space.
202
+ *
203
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Space view permission
204
+ */
205
+ async getSpaceContentStates<T = Models.ContentState[]>(
206
+ parameters: Parameters.GetSpaceContentStates,
207
+ callback?: never
208
+ ): Promise<T>;
209
+ async getSpaceContentStates<T = Models.ContentState[]>(
210
+ parameters: Parameters.GetSpaceContentStates,
211
+ callback?: Callback<T>,
212
+ ): Promise<void | T> {
213
+ const config: RequestConfig = {
214
+ url: `/api/space/${parameters.spaceKey}/state`,
215
+ method: 'GET',
216
+ };
217
+
218
+ return this.client.sendRequest(config, callback);
219
+ }
220
+
221
+ /**
222
+ * Get object describing whether content states are allowed at all, if custom content states or space content states
223
+ * are restricted, and a list of space content states allowed for the space if they are not restricted.
224
+ *
225
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Space admin permission
226
+ */
227
+ async getContentStateSettings<T = Models.ContentStateSettings>(
228
+ parameters: Parameters.GetContentStateSettings,
229
+ callback: Callback<T>
230
+ ): Promise<void>;
231
+ /**
232
+ * Get object describing whether content states are allowed at all, if custom content states or space content states
233
+ * are restricted, and a list of space content states allowed for the space if they are not restricted.
234
+ *
235
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Space admin permission
236
+ */
237
+ async getContentStateSettings<T = Models.ContentStateSettings>(
238
+ parameters: Parameters.GetContentStateSettings,
239
+ callback?: never
240
+ ): Promise<T>;
241
+ async getContentStateSettings<T = Models.ContentStateSettings>(
242
+ parameters: Parameters.GetContentStateSettings,
243
+ callback?: Callback<T>,
244
+ ): Promise<void | T> {
245
+ const config: RequestConfig = {
246
+ url: `/api/space/${parameters.spaceKey}/state/settings`,
247
+ method: 'GET',
248
+ };
249
+
250
+ return this.client.sendRequest(config, callback);
251
+ }
252
+ }
@@ -8,7 +8,8 @@ export class ContentWatches {
8
8
  constructor(private client: Client) {}
9
9
 
10
10
  /**
11
- * Returns the watches for a page. A user that watches a page will receive receive notifications when the page is updated.
11
+ * Returns the watches for a page. A user that watches a page will receive receive notifications when the page is
12
+ * updated.
12
13
  *
13
14
  * If you want to manage watches for a page, use the following `user` methods:
14
15
  *
@@ -24,7 +25,8 @@ export class ContentWatches {
24
25
  callback: Callback<T>
25
26
  ): Promise<void>;
26
27
  /**
27
- * Returns the watches for a page. A user that watches a page will receive receive notifications when the page is updated.
28
+ * Returns the watches for a page. A user that watches a page will receive receive notifications when the page is
29
+ * updated.
28
30
  *
29
31
  * If you want to manage watches for a page, use the following `user` methods:
30
32
  *
@@ -180,7 +182,8 @@ export class ContentWatches {
180
182
  * - Specify a user via a query parameter: Use the `accountId` to identify the user.
181
183
  * - Do not specify a user: The currently logged-in user will be used.
182
184
  *
183
- * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF protection.
185
+ * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF
186
+ * protection.
184
187
  *
185
188
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission
186
189
  * if specifying a user, otherwise permission to access the Confluence site ('Can use' global permission).
@@ -192,7 +195,8 @@ export class ContentWatches {
192
195
  * - Specify a user via a query parameter: Use the `accountId` to identify the user.
193
196
  * - Do not specify a user: The currently logged-in user will be used.
194
197
  *
195
- * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF protection.
198
+ * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF
199
+ * protection.
196
200
  *
197
201
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission
198
202
  * if specifying a user, otherwise permission to access the Confluence site ('Can use' global permission).
@@ -304,7 +308,8 @@ export class ContentWatches {
304
308
  * - Specify a user via a query parameter: Use the `accountId` to identify the user.
305
309
  * - Do not specify a user: The currently logged-in user will be used.
306
310
  *
307
- * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF protection.
311
+ * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF
312
+ * protection.
308
313
  *
309
314
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission
310
315
  * if specifying a user, otherwise permission to access the Confluence site ('Can use' global permission).
@@ -316,7 +321,8 @@ export class ContentWatches {
316
321
  * - Specify a user via a query parameter: Use the `accountId` to identify the user.
317
322
  * - Do not specify a user: The currently logged-in user will be used.
318
323
  *
319
- * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF protection.
324
+ * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF
325
+ * protection.
320
326
  *
321
327
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission
322
328
  * if specifying a user, otherwise permission to access the Confluence site ('Can use' global permission).
@@ -422,7 +428,8 @@ export class ContentWatches {
422
428
  * - Specify a user via a query parameter: Use the `accountId` to identify the user.
423
429
  * - Do not specify a user: The currently logged-in user will be used.
424
430
  *
425
- * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF protection.
431
+ * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF
432
+ * protection.
426
433
  *
427
434
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission
428
435
  * if specifying a user, otherwise permission to access the Confluence site ('Can use' global permission).
@@ -434,7 +441,8 @@ export class ContentWatches {
434
441
  * - Specify a user via a query parameter: Use the `accountId` to identify the user.
435
442
  * - Do not specify a user: The currently logged-in user will be used.
436
443
  *
437
- * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF protection.
444
+ * Note, you must add the `X-Atlassian-Token: no-check` header when making a request, as this operation has XSRF
445
+ * protection.
438
446
  *
439
447
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission
440
448
  * if specifying a user, otherwise permission to access the Confluence site ('Can use' global permission).
@@ -51,6 +51,7 @@ export class DynamicModules {
51
51
  const config: RequestConfig = {
52
52
  url: '/atlassian-connect/1/app/module/dynamic',
53
53
  method: 'POST',
54
+ data: parameters,
54
55
  };
55
56
 
56
57
  return this.client.sendRequest(config, callback);
@@ -319,9 +319,9 @@ export class Experimental {
319
319
  return this.client.sendRequest(config, callback);
320
320
  }
321
321
 
322
- /** Get the total number of distinct viewers a piece of content has. */
322
+ /** @deprecated Get the total number of distinct viewers a piece of content has. */
323
323
  async getViewers<T = Models.GetViewers>(parameters: Parameters.GetViewers, callback: Callback<T>): Promise<void>;
324
- /** Get the total number of distinct viewers a piece of content has. */
324
+ /** @deprecated Get the total number of distinct viewers a piece of content has. */
325
325
  async getViewers<T = Models.GetViewers>(parameters: Parameters.GetViewers, callback?: never): Promise<T>;
326
326
  async getViewers<T = Models.GetViewers>(
327
327
  parameters: Parameters.GetViewers,
package/src/api/index.ts CHANGED
@@ -11,6 +11,7 @@ export * from './contentMacroBody';
11
11
  export * from './contentPermissions';
12
12
  export * from './contentProperties';
13
13
  export * from './contentRestrictions';
14
+ export * from './contentStates';
14
15
  export * from './contentVersions';
15
16
  export * from './contentWatches';
16
17
  export * from './dynamicModules';
@@ -0,0 +1,31 @@
1
+ import { EmbeddedContent } from './embeddedContent';
2
+ import { GenericLinks } from './genericLinks';
3
+ import { WebResourceDependencies } from './webResourceDependencies';
4
+
5
+ export interface AsyncContentBody {
6
+ value?: string;
7
+ representation?: string;
8
+ renderTaskId?: string;
9
+ error?: string;
10
+ /**
11
+ * Rerunning is reserved for when the job is working, but there is a previous run's value in the cache. You may
12
+ * choose to continue polling, or use the cached value.
13
+ */
14
+ status?: string;
15
+ embeddedContent?: EmbeddedContent[];
16
+ webresource?: WebResourceDependencies;
17
+ mediaToken?: {
18
+ collectionIds?: string[];
19
+ contentId?: string;
20
+ expiryDateTime?: string;
21
+ fileIds?: string[];
22
+ token?: string;
23
+ };
24
+ Expandable?: {
25
+ content?: string;
26
+ embeddedContent?: string;
27
+ webresource?: string;
28
+ mediaToken?: string;
29
+ };
30
+ Links?: GenericLinks;
31
+ }
@@ -0,0 +1,3 @@
1
+ export interface AsyncId {
2
+ asyncId: string;
3
+ }
@@ -4,4 +4,5 @@ export interface ContentBodyCreate {
4
4
  value: string;
5
5
  /** The content format type. Set the value of this property to the name of the format being used, e.g. 'storage'. */
6
6
  representation: string;
7
+ additionalProperties?: any;
7
8
  }
@@ -0,0 +1,8 @@
1
+ import { ContentState } from './contentState';
2
+
3
+ export interface ContentStateResponse {
4
+ /** Null or content state */
5
+ contentState?: ContentState;
6
+ /** Timestamp of last publish event where content state changed */
7
+ lastUpdated?: string;
8
+ }
@@ -0,0 +1,11 @@
1
+ export interface ContentStateRestInput {
2
+ /** Name of content state. Maximum 20 characters. */
3
+ name?: string;
4
+ /**
5
+ * Color of state. Must be in 6 digit hex form (#FFFFFF). The default colors offered in the UI are: #ff7452 (red),
6
+ * #2684ff (blue), #ffc400 (yellow), #57d9a3 (green), and #8777d9 (purple)
7
+ */
8
+ color?: string;
9
+ /** Id of state. This can be 0,1, or 2 if you wish to specify a default space state. */
10
+ stateId?: string;
11
+ }