confluence.js 1.1.3 → 1.3.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 (188) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +1 -57
  3. package/out/api/content.d.ts +24 -52
  4. package/out/api/content.js +15 -0
  5. package/out/api/contentAttachments.d.ts +10 -6
  6. package/out/api/contentAttachments.js +13 -0
  7. package/out/api/contentChildrenAndDescendants.d.ts +6 -24
  8. package/out/api/contentChildrenAndDescendants.js +6 -0
  9. package/out/api/contentPermissions.d.ts +6 -2
  10. package/out/api/contentPermissions.js +6 -1
  11. package/out/api/contentProperties.js +2 -0
  12. package/out/api/contentWatches.d.ts +2 -2
  13. package/out/api/experimental.d.ts +52 -0
  14. package/out/api/experimental.js +70 -0
  15. package/out/api/group.d.ts +30 -10
  16. package/out/api/group.js +31 -2
  17. package/out/api/index.d.ts +1 -0
  18. package/out/api/index.js +1 -0
  19. package/out/api/inlineTasks.d.ts +28 -0
  20. package/out/api/inlineTasks.js +21 -0
  21. package/out/api/models/getViewers.d.ts +6 -0
  22. package/out/api/models/getViewers.js +2 -0
  23. package/out/api/models/getViews.d.ts +6 -0
  24. package/out/api/models/getViews.js +2 -0
  25. package/out/api/models/groupCreate.d.ts +4 -0
  26. package/out/api/models/groupCreate.js +2 -0
  27. package/out/api/models/horizontalHeaderLookAndFeel.d.ts +11 -0
  28. package/out/api/models/horizontalHeaderLookAndFeel.js +2 -0
  29. package/out/api/models/index.d.ts +13 -4
  30. package/out/api/models/index.js +13 -4
  31. package/out/api/models/lookAndFeel.d.ts +3 -0
  32. package/out/api/models/spacePermissionCreate.d.ts +33 -0
  33. package/out/api/models/spacePermissionCreate.js +2 -0
  34. package/out/api/models/spacePermissionCustomContent.d.ts +16 -0
  35. package/out/api/models/spacePermissionCustomContent.js +2 -0
  36. package/out/api/models/spacePermissionRequest.d.ts +41 -0
  37. package/out/api/models/spacePermissionRequest.js +2 -0
  38. package/out/api/models/spacePrivateCreate.d.ts +9 -0
  39. package/out/api/models/spacePropertyCreate.d.ts +4 -0
  40. package/out/api/models/spaceUpdate.d.ts +4 -0
  41. package/out/api/models/taskStatusUpdate.d.ts +3 -0
  42. package/out/api/models/taskStatusUpdate.js +2 -0
  43. package/out/api/models/topNavigationLookAndFeel.d.ts +8 -0
  44. package/out/api/models/topNavigationLookAndFeel.js +2 -0
  45. package/out/api/parameters/addCustomContentPermissions.d.ts +5 -0
  46. package/out/api/parameters/addCustomContentPermissions.js +2 -0
  47. package/out/api/parameters/addLabelsToSpace.d.ts +4 -0
  48. package/out/api/parameters/addLabelsToSpace.js +2 -0
  49. package/out/api/parameters/addPermissionToSpace.d.ts +5 -0
  50. package/out/api/parameters/addPermissionToSpace.js +2 -0
  51. package/out/api/parameters/addUserToGroup.d.ts +2 -1
  52. package/out/api/parameters/addUserToGroupByGroupId.d.ts +2 -1
  53. package/out/api/parameters/archivePages.d.ts +6 -0
  54. package/out/api/parameters/archivePages.js +2 -0
  55. package/out/api/parameters/checkContentPermission.d.ts +5 -0
  56. package/out/api/parameters/checkContentPermission.js +2 -0
  57. package/out/api/parameters/deleteLabelFromSpace.d.ts +8 -0
  58. package/out/api/parameters/deleteLabelFromSpace.js +2 -0
  59. package/out/api/parameters/deleteRelationship.d.ts +38 -0
  60. package/out/api/parameters/deleteRelationship.js +2 -0
  61. package/out/api/parameters/downloadAttachment.d.ts +11 -0
  62. package/out/api/parameters/downloadAttachment.js +2 -0
  63. package/out/api/parameters/getBulkUserLookup.d.ts +0 -6
  64. package/out/api/parameters/getContentById.d.ts +85 -1
  65. package/out/api/parameters/getContentById.js +87 -0
  66. package/out/api/parameters/getContentChildren.d.ts +1 -0
  67. package/out/api/parameters/getContentProperties.d.ts +2 -0
  68. package/out/api/parameters/getContentProperty.d.ts +12 -0
  69. package/out/api/parameters/getContentVersions.d.ts +1 -1
  70. package/out/api/parameters/getCurrentUser.d.ts +1 -6
  71. package/out/api/parameters/getDescendantsOfType.d.ts +101 -0
  72. package/out/api/parameters/getDescendantsOfType.js +89 -0
  73. package/out/api/parameters/getGroupByName.d.ts +4 -0
  74. package/out/api/parameters/getGroupByName.js +2 -0
  75. package/out/api/parameters/getGroups.d.ts +2 -0
  76. package/out/api/parameters/getHistoryForContent.d.ts +1 -1
  77. package/out/api/parameters/getLabelsForSpace.d.ts +18 -0
  78. package/out/api/parameters/getLabelsForSpace.js +2 -0
  79. package/out/api/parameters/getTaskById.d.ts +4 -0
  80. package/out/api/parameters/getTaskById.js +2 -0
  81. package/out/api/parameters/getViewers.d.ts +6 -0
  82. package/out/api/parameters/getViewers.js +2 -0
  83. package/out/api/parameters/getViews.d.ts +6 -0
  84. package/out/api/parameters/getViews.js +2 -0
  85. package/out/api/parameters/index.d.ts +134 -116
  86. package/out/api/parameters/index.js +134 -116
  87. package/out/api/parameters/publishLegacyDraft.d.ts +3 -1
  88. package/out/api/parameters/publishSharedDraft.d.ts +3 -1
  89. package/out/api/parameters/restoreContentVersion.d.ts +1 -1
  90. package/out/api/parameters/searchByCQL.d.ts +34 -0
  91. package/out/api/parameters/searchByCQL.js +2 -0
  92. package/out/api/parameters/searchGroups.d.ts +8 -0
  93. package/out/api/parameters/searchGroups.js +2 -0
  94. package/out/api/parameters/searchUser.d.ts +27 -0
  95. package/out/api/parameters/searchUser.js +2 -0
  96. package/out/api/parameters/updateTaskById.d.ts +5 -0
  97. package/out/api/parameters/updateTaskById.js +2 -0
  98. package/out/api/relation.d.ts +12 -4
  99. package/out/api/relation.js +12 -2
  100. package/out/api/search.d.ts +12 -64
  101. package/out/api/search.js +19 -2
  102. package/out/api/settings.d.ts +2 -2
  103. package/out/api/settings.js +3 -0
  104. package/out/api/space.js +5 -1
  105. package/out/api/spacePermissions.d.ts +26 -2
  106. package/out/api/spacePermissions.js +20 -3
  107. package/out/api/spaceProperties.d.ts +4 -4
  108. package/out/api/spaceProperties.js +1 -0
  109. package/out/api/template.d.ts +24 -16
  110. package/out/clients/baseClient.d.ts +2 -5
  111. package/out/clients/baseClient.js +4 -30
  112. package/out/clients/client.d.ts +2 -3
  113. package/out/clients/confluenceClient.d.ts +2 -1
  114. package/out/clients/confluenceClient.js +1 -0
  115. package/out/config.d.ts +3 -2
  116. package/out/index.d.ts +1 -0
  117. package/out/index.js +2 -1
  118. package/package.json +24 -24
  119. package/src/api/content.ts +58 -52
  120. package/src/api/contentAttachments.ts +29 -6
  121. package/src/api/contentChildrenAndDescendants.ts +24 -28
  122. package/src/api/contentPermissions.ts +24 -7
  123. package/src/api/contentProperties.ts +2 -0
  124. package/src/api/contentWatches.ts +3 -3
  125. package/src/api/experimental.ts +137 -0
  126. package/src/api/group.ts +71 -19
  127. package/src/api/index.ts +1 -0
  128. package/src/api/inlineTasks.ts +52 -0
  129. package/src/api/models/getViewers.ts +6 -0
  130. package/src/api/models/getViews.ts +6 -0
  131. package/src/api/models/groupCreate.ts +4 -0
  132. package/src/api/models/horizontalHeaderLookAndFeel.ts +12 -0
  133. package/src/api/models/index.ts +13 -4
  134. package/src/api/models/lookAndFeel.ts +3 -0
  135. package/src/api/models/spacePermissionCreate.ts +34 -0
  136. package/src/api/models/spacePermissionCustomContent.ts +17 -0
  137. package/src/api/models/spacePermissionRequest.ts +42 -0
  138. package/src/api/models/spacePrivateCreate.ts +9 -0
  139. package/src/api/models/spacePropertyCreate.ts +4 -0
  140. package/src/api/models/spaceUpdate.ts +4 -0
  141. package/src/api/models/taskStatusUpdate.ts +3 -0
  142. package/src/api/models/topNavigationLookAndFeel.ts +8 -0
  143. package/src/api/parameters/addCustomContentPermissions.ts +6 -0
  144. package/src/api/parameters/addLabelsToSpace.ts +4 -0
  145. package/src/api/parameters/addPermissionToSpace.ts +6 -0
  146. package/src/api/parameters/addUserToGroup.ts +3 -1
  147. package/src/api/parameters/addUserToGroupByGroupId.ts +3 -1
  148. package/src/api/parameters/archivePages.ts +6 -0
  149. package/src/api/parameters/checkContentPermission.ts +6 -0
  150. package/src/api/parameters/deleteLabelFromSpace.ts +8 -0
  151. package/src/api/parameters/deleteRelationship.ts +38 -0
  152. package/src/api/parameters/downloadAttachment.ts +11 -0
  153. package/src/api/parameters/getBulkUserLookup.ts +0 -6
  154. package/src/api/parameters/getContentById.ts +86 -1
  155. package/src/api/parameters/getContentChildren.ts +1 -0
  156. package/src/api/parameters/getContentProperties.ts +2 -0
  157. package/src/api/parameters/getContentProperty.ts +12 -0
  158. package/src/api/parameters/getContentVersions.ts +1 -1
  159. package/src/api/parameters/getCurrentUser.ts +1 -6
  160. package/src/api/parameters/getDescendantsOfType.ts +102 -0
  161. package/src/api/parameters/getGroupByName.ts +4 -0
  162. package/src/api/parameters/getGroups.ts +2 -0
  163. package/src/api/parameters/getHistoryForContent.ts +1 -1
  164. package/src/api/parameters/getLabelsForSpace.ts +18 -0
  165. package/src/api/parameters/getTaskById.ts +4 -0
  166. package/src/api/parameters/getViewers.ts +6 -0
  167. package/src/api/parameters/getViews.ts +6 -0
  168. package/src/api/parameters/index.ts +134 -116
  169. package/src/api/parameters/publishLegacyDraft.ts +4 -1
  170. package/src/api/parameters/publishSharedDraft.ts +4 -1
  171. package/src/api/parameters/restoreContentVersion.ts +1 -1
  172. package/src/api/parameters/searchByCQL.ts +34 -0
  173. package/src/api/parameters/searchGroups.ts +8 -0
  174. package/src/api/parameters/searchUser.ts +27 -0
  175. package/src/api/parameters/updateTaskById.ts +6 -0
  176. package/src/api/relation.ts +33 -8
  177. package/src/api/search.ts +53 -73
  178. package/src/api/settings.ts +6 -3
  179. package/src/api/space.ts +4 -1
  180. package/src/api/spacePermissions.ts +66 -8
  181. package/src/api/spaceProperties.ts +5 -4
  182. package/src/api/template.ts +24 -16
  183. package/src/clients/baseClient.ts +4 -60
  184. package/src/clients/client.ts +2 -3
  185. package/src/clients/confluenceClient.ts +2 -0
  186. package/src/config.ts +3 -2
  187. package/src/index.ts +1 -0
  188. package/tsconfig.json +2 -1
package/src/api/search.ts CHANGED
@@ -7,95 +7,52 @@ import { RequestConfig } from '../requestConfig';
7
7
  export class Search {
8
8
  constructor(private client: Client) {}
9
9
 
10
+ /** @deprecated Will be removed in the next major version. Use `searchByCQL` instead. */
11
+ async search<T = Models.SearchPageResponseSearchResult>(
12
+ parameters: Parameters.Search,
13
+ callback: Callback<T>
14
+ ): Promise<void>;
15
+ /** @deprecated Will be removed in the next major version. Use `searchByCQL` instead. */
16
+ async search<T = Models.SearchPageResponseSearchResult>(parameters: Parameters.Search, callback?: never): Promise<T>;
17
+ async search<T = Models.SearchPageResponseSearchResult>(
18
+ parameters: Parameters.Search,
19
+ callback?: Callback<T>,
20
+ ): Promise<void | T> {
21
+ return this.searchByCQL(parameters, callback!);
22
+ }
23
+
10
24
  /**
11
25
  * Searches for content using the [Confluence Query Language
12
26
  * (CQL)](https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/)
13
27
  *
14
- * Example initial call:
15
- *
16
- * https://your-domain.atlassian.net/wiki/rest/api/search?cql=type=page&limit=25
17
- *
18
- * Example response:
19
- *
20
- * {
21
- * "results": [
22
- * { ... },
23
- * { ... },
24
- * ...
25
- * { ... }
26
- * ],
27
- * "limit": 25,
28
- * "size": 25,
29
- * ...
30
- * "_links": {
31
- * "base": "<url>",
32
- * "context": "<url>",
33
- * "next": "/rest/api/search?cql=type=page&limit=25&cursor=raNDoMsTRiNg",
34
- * "self": "<url>"
35
- * }
36
- * }
37
- *
38
28
  * When additional results are available, returns `next` and `prev` URLs to retrieve them in subsequent calls. The
39
29
  * URLs each contain a cursor that points to the appropriate set of results. Use `limit` to specify the number of
40
30
  * results returned in each call.
41
31
  *
42
- * Example subsequent call (taken from example response):
43
- *
44
- * https://your-domain.atlassian.net/wiki/rest/api/search?cql=type=page&limit=25&cursor=raNDoMsTRiNg
45
- *
46
- * The response to this will have a `prev` URL similar to the `next` in the example response.
47
- *
48
32
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the entities. Note, only
49
33
  * entities that the user has permission to view will be returned.
50
34
  */
51
- async search<T = Models.SearchPageResponseSearchResult>(
52
- parameters: Parameters.Search,
35
+ async searchByCQL<T = Models.SearchPageResponseSearchResult>(
36
+ parameters: Parameters.SearchByCQL,
53
37
  callback: Callback<T>
54
38
  ): Promise<void>;
55
39
  /**
56
40
  * Searches for content using the [Confluence Query Language
57
41
  * (CQL)](https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/)
58
42
  *
59
- * Example initial call:
60
- *
61
- * https://your-domain.atlassian.net/wiki/rest/api/search?cql=type=page&limit=25
62
- *
63
- * Example response:
64
- *
65
- * {
66
- * "results": [
67
- * { ... },
68
- * { ... },
69
- * ...
70
- * { ... }
71
- * ],
72
- * "limit": 25,
73
- * "size": 25,
74
- * ...
75
- * "_links": {
76
- * "base": "<url>",
77
- * "context": "<url>",
78
- * "next": "/rest/api/search?cql=type=page&limit=25&cursor=raNDoMsTRiNg",
79
- * "self": "<url>"
80
- * }
81
- * }
82
- *
83
43
  * When additional results are available, returns `next` and `prev` URLs to retrieve them in subsequent calls. The
84
44
  * URLs each contain a cursor that points to the appropriate set of results. Use `limit` to specify the number of
85
45
  * results returned in each call.
86
46
  *
87
- * Example subsequent call (taken from example response):
88
- *
89
- * https://your-domain.atlassian.net/wiki/rest/api/search?cql=type=page&limit=25&cursor=raNDoMsTRiNg
90
- *
91
- * The response to this will have a `prev` URL similar to the `next` in the example response.
92
- *
93
47
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to view the entities. Note, only
94
48
  * entities that the user has permission to view will be returned.
95
49
  */
96
- async search<T = Models.SearchPageResponseSearchResult>(parameters: Parameters.Search, callback?: never): Promise<T>;
97
- async search<T = Models.SearchPageResponseSearchResult>(
98
- parameters: Parameters.Search,
50
+ async searchByCQL<T = Models.SearchPageResponseSearchResult>(
51
+ parameters: Parameters.SearchByCQL,
52
+ callback?: never
53
+ ): Promise<T>;
54
+ async searchByCQL<T = Models.SearchPageResponseSearchResult>(
55
+ parameters: Parameters.SearchByCQL,
99
56
  callback?: Callback<T>,
100
57
  ): Promise<void | T> {
101
58
  const config: RequestConfig = {
@@ -105,14 +62,37 @@ export class Search {
105
62
  cql: parameters.cql,
106
63
  cqlcontext: parameters.cqlcontext,
107
64
  cursor: parameters.cursor,
65
+ next: parameters.next,
66
+ prev: parameters.prev,
108
67
  limit: parameters.limit,
68
+ start: parameters.start,
109
69
  includeArchivedSpaces: parameters.includeArchivedSpaces,
70
+ excludeCurrentSpaces: parameters.excludeCurrentSpaces,
71
+ excerpt: parameters.excerpt,
72
+ sitePermissionTypeFilter: parameters.sitePermissionTypeFilter,
73
+ expand: parameters.expand,
110
74
  },
111
75
  };
112
76
 
113
- return this.client.sendRequest(config, callback, { methodName: 'search' });
77
+ return this.client.sendRequest(config, callback, { methodName: 'searchByCQL' });
114
78
  }
115
79
 
80
+ /** @deprecated Will be removed in the next major version. Use `searchUser` instead. */
81
+ async userSearch<T = Models.SearchPageResponseSearchResult>(
82
+ parameters: Parameters.UserSearch,
83
+ callback: Callback<T>
84
+ ): Promise<void>;
85
+ /** @deprecated Will be removed in the next major version. Use `searchUser` instead. */
86
+ async userSearch<T = Models.SearchPageResponseSearchResult>(
87
+ parameters: Parameters.UserSearch,
88
+ callback?: never
89
+ ): Promise<T>;
90
+ async userSearch<T = Models.SearchPageResponseSearchResult>(
91
+ parameters: Parameters.UserSearch,
92
+ callback?: Callback<T>,
93
+ ): Promise<void | T> {
94
+ return this.searchUser(parameters, callback!);
95
+ }
116
96
  /**
117
97
  * Searches for users using user-specific queries from the [Confluence Query Language
118
98
  * (CQL)](https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/).
@@ -120,8 +100,8 @@ export class Search {
120
100
  * Note that some user fields may be set to null depending on the user's privacy settings. These are: email,
121
101
  * profilePicture, and displayName.
122
102
  */
123
- async userSearch<T = Models.SearchPageResponseSearchResult>(
124
- parameters: Parameters.UserSearch,
103
+ async searchUser<T = Models.SearchPageResponseSearchResult>(
104
+ parameters: Parameters.SearchUser,
125
105
  callback: Callback<T>
126
106
  ): Promise<void>;
127
107
  /**
@@ -131,12 +111,12 @@ export class Search {
131
111
  * Note that some user fields may be set to null depending on the user's privacy settings. These are: email,
132
112
  * profilePicture, and displayName.
133
113
  */
134
- async userSearch<T = Models.SearchPageResponseSearchResult>(
135
- parameters: Parameters.UserSearch,
114
+ async searchUser<T = Models.SearchPageResponseSearchResult>(
115
+ parameters: Parameters.SearchUser,
136
116
  callback?: never
137
117
  ): Promise<T>;
138
- async userSearch<T = Models.SearchPageResponseSearchResult>(
139
- parameters: Parameters.UserSearch,
118
+ async searchUser<T = Models.SearchPageResponseSearchResult>(
119
+ parameters: Parameters.SearchUser,
140
120
  callback?: Callback<T>,
141
121
  ): Promise<void | T> {
142
122
  const config: RequestConfig = {
@@ -149,6 +129,6 @@ export class Search {
149
129
  },
150
130
  };
151
131
 
152
- return this.client.sendRequest(config, callback, { methodName: 'search' });
132
+ return this.client.sendRequest(config, callback, { methodName: 'searchUser' });
153
133
  }
154
134
  }
@@ -93,7 +93,7 @@ export class Settings {
93
93
  *
94
94
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
95
95
  */
96
- async updateLookAndFeelSettings<T = Models.LookAndFeelUpdated>(
96
+ async updateLookAndFeelSettings<T = Models.LookAndFeel>(
97
97
  parameters: Parameters.UpdateLookAndFeelSettings | undefined,
98
98
  callback: Callback<T>
99
99
  ): Promise<void>;
@@ -106,11 +106,11 @@ export class Settings {
106
106
  *
107
107
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
108
108
  */
109
- async updateLookAndFeelSettings<T = Models.LookAndFeelUpdated>(
109
+ async updateLookAndFeelSettings<T = Models.LookAndFeel>(
110
110
  parameters?: Parameters.UpdateLookAndFeelSettings,
111
111
  callback?: never
112
112
  ): Promise<T>;
113
- async updateLookAndFeelSettings<T = Models.LookAndFeelUpdated>(
113
+ async updateLookAndFeelSettings<T = Models.LookAndFeel>(
114
114
  parameters?: Parameters.UpdateLookAndFeelSettings,
115
115
  callback?: Callback<T>,
116
116
  ): Promise<void | T> {
@@ -125,8 +125,11 @@ export class Settings {
125
125
  links: parameters?.links,
126
126
  menus: parameters?.menus,
127
127
  header: parameters?.header,
128
+ horizontalHeader: parameters?.horizontalHeader,
128
129
  content: parameters?.content,
129
130
  bordersAndDividers: parameters?.bordersAndDividers,
131
+ spaceReference: parameters?.spaceReference,
132
+ _links: parameters?.links,
130
133
  },
131
134
  };
132
135
 
package/src/api/space.ts CHANGED
@@ -31,7 +31,7 @@ export class Space {
31
31
  url: '/api/space',
32
32
  method: 'GET',
33
33
  params: {
34
- spaceKey: parameters?.spaceKey,
34
+ spaceKey: parameters?.spaceKey?.map((key, index) => index ? `&spaceKey=${key}` : key),
35
35
  spaceId: parameters?.spaceId,
36
36
  type: parameters?.type,
37
37
  status: parameters?.status,
@@ -106,6 +106,7 @@ export class Space {
106
106
  key: parameters?.key,
107
107
  name: parameters?.name,
108
108
  description: parameters?.description,
109
+ permissions: parameters?.permissions,
109
110
  },
110
111
  };
111
112
 
@@ -159,6 +160,8 @@ export class Space {
159
160
  name: parameters.name,
160
161
  description: parameters.description,
161
162
  homepage: parameters.homepage,
163
+ type: parameters.type,
164
+ status: parameters.status,
162
165
  },
163
166
  };
164
167
 
@@ -7,6 +7,20 @@ import { RequestConfig } from '../requestConfig';
7
7
  export class SpacePermissions {
8
8
  constructor(private client: Client) {}
9
9
 
10
+ /** @deprecated Will be removed in the next major version. Use `addPermissionToSpace` instead. */
11
+ async addPermission<T = Models.SpacePermissionV2>(
12
+ parameters: Parameters.AddPermission,
13
+ callback: Callback<T>
14
+ ): Promise<void>;
15
+ /** @deprecated Will be removed in the next major version. Use `addPermissionToSpace` instead. */
16
+ async addPermission<T = Models.SpacePermissionV2>(parameters: Parameters.AddPermission, callback?: never): Promise<T>;
17
+ async addPermission<T = Models.SpacePermissionV2>(
18
+ parameters: Parameters.AddPermission,
19
+ callback?: Callback<T>,
20
+ ): Promise<void | T> {
21
+ return this.addPermissionToSpace(parameters, callback!);
22
+ }
23
+
10
24
  /**
11
25
  * Adds new permission to space.
12
26
  *
@@ -16,8 +30,8 @@ export class SpacePermissions {
16
30
  *
17
31
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
18
32
  */
19
- async addPermission<T = Models.SpacePermissionV2>(
20
- parameters: Parameters.AddPermission,
33
+ async addPermissionToSpace<T = Models.SpacePermissionV2>(
34
+ parameters: Parameters.AddPermissionToSpace,
21
35
  callback: Callback<T>
22
36
  ): Promise<void>;
23
37
  /**
@@ -29,23 +43,67 @@ export class SpacePermissions {
29
43
  *
30
44
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
31
45
  */
32
- async addPermission<T = Models.SpacePermissionV2>(parameters: Parameters.AddPermission, callback?: never): Promise<T>;
33
- async addPermission<T = Models.SpacePermissionV2>(
34
- parameters: Parameters.AddPermission,
46
+ async addPermissionToSpace<T = Models.SpacePermissionV2>(
47
+ parameters: Parameters.AddPermissionToSpace,
48
+ callback?: never
49
+ ): Promise<T>;
50
+ async addPermissionToSpace<T = Models.SpacePermissionV2>(
51
+ parameters: Parameters.AddPermissionToSpace,
35
52
  callback?: Callback<T>,
36
53
  ): Promise<void | T> {
37
54
  const config: RequestConfig = {
38
55
  url: `/api/space/${parameters.spaceKey}/permission`,
39
56
  method: 'POST',
40
57
  data: {
41
- id: parameters.id,
42
58
  subject: parameters.subject,
43
59
  operation: parameters.operation,
44
- _links: parameters._links,
60
+ _links: parameters.links,
61
+ },
62
+ };
63
+
64
+ return this.client.sendRequest(config, callback, { methodName: 'addPermissionToSpace' });
65
+ }
66
+
67
+ /**
68
+ * Adds new custom content permission to space.
69
+ *
70
+ * If the permission to be added is a group permission, the group can be identified by its group name or group id.
71
+ *
72
+ * Note: Only apps can access this REST resource and only make changes to the respective app permissions.
73
+ *
74
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
75
+ */
76
+ async addCustomContentPermissions<T = unknown>(
77
+ parameters: Parameters.AddCustomContentPermissions,
78
+ callback: Callback<T>
79
+ ): Promise<void>;
80
+ /**
81
+ * Adds new custom content permission to space.
82
+ *
83
+ * If the permission to be added is a group permission, the group can be identified by its group name or group id.
84
+ *
85
+ * Note: Only apps can access this REST resource and only make changes to the respective app permissions.
86
+ *
87
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
88
+ */
89
+ async addCustomContentPermissions<T = unknown>(
90
+ parameters: Parameters.AddCustomContentPermissions,
91
+ callback?: never
92
+ ): Promise<T>;
93
+ async addCustomContentPermissions<T = unknown>(
94
+ parameters: Parameters.AddCustomContentPermissions,
95
+ callback?: Callback<T>,
96
+ ): Promise<void | T> {
97
+ const config: RequestConfig = {
98
+ url: `/api/space/${parameters.spaceKey}/permission/custom-content`,
99
+ method: 'POST',
100
+ data: {
101
+ subject: parameters.subject,
102
+ operations: parameters.operations,
45
103
  },
46
104
  };
47
105
 
48
- return this.client.sendRequest(config, callback, { methodName: 'addPermission' });
106
+ return this.client.sendRequest(config, callback, { methodName: 'addCustomContentPermissions' });
49
107
  }
50
108
 
51
109
  /**
@@ -70,6 +70,7 @@ export class SpaceProperties {
70
70
  data: {
71
71
  key: parameters.key,
72
72
  value: parameters.value,
73
+ space: parameters.space,
73
74
  },
74
75
  };
75
76
 
@@ -110,8 +111,8 @@ export class SpaceProperties {
110
111
  }
111
112
 
112
113
  /**
113
- * Creates a new space property. This is the same as `POST /api/space/{spaceKey}/property` but the key for the
114
- * property is passed as a path parameter, rather than in the request body.
114
+ * Creates a new space property. This is the same as `POST /wiki/rest/api/space/{spaceKey}/property` but the key for
115
+ * the property is passed as a path parameter, rather than in the request body.
115
116
  *
116
117
  * **[Permissions required](https://confluence.atlassian.com/x/_AozKw)**: ‘Admin’ permission for the space.
117
118
  */
@@ -120,8 +121,8 @@ export class SpaceProperties {
120
121
  callback: Callback<T>
121
122
  ): Promise<void>;
122
123
  /**
123
- * Creates a new space property. This is the same as `POST /api/space/{spaceKey}/property` but the key for the
124
- * property is passed as a path parameter, rather than in the request body.
124
+ * Creates a new space property. This is the same as `POST /wiki/rest/api/space/{spaceKey}/property` but the key for
125
+ * the property is passed as a path parameter, rather than in the request body.
125
126
  *
126
127
  * **[Permissions required](https://confluence.atlassian.com/x/_AozKw)**: ‘Admin’ permission for the space.
127
128
  */
@@ -50,8 +50,8 @@ export class Template {
50
50
  /**
51
51
  * Updates a content template. Note, blueprint templates cannot be updated via the REST API.
52
52
  *
53
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to create a
54
- * space template or 'Confluence Administrator' global permission to create a global template.
53
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to update a
54
+ * space template or 'Confluence Administrator' global permission to update a global template.
55
55
  */
56
56
  async updateContentTemplate<T = Models.ContentTemplate>(
57
57
  parameters: Parameters.UpdateContentTemplate | undefined,
@@ -60,8 +60,8 @@ export class Template {
60
60
  /**
61
61
  * Updates a content template. Note, blueprint templates cannot be updated via the REST API.
62
62
  *
63
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to create a
64
- * space template or 'Confluence Administrator' global permission to create a global template.
63
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to update a
64
+ * space template or 'Confluence Administrator' global permission to update a global template.
65
65
  */
66
66
  async updateContentTemplate<T = Models.ContentTemplate>(
67
67
  parameters?: Parameters.UpdateContentTemplate,
@@ -95,8 +95,9 @@ export class Template {
95
95
  * Note, all global blueprints are inherited by each space. Space blueprints can be customised without affecting the
96
96
  * global blueprints.
97
97
  *
98
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to access the Confluence site
99
- * ('Can use' global permission).
98
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
99
+ * blueprints for the space and permission to access the Confluence site ('Can use' global permission) to view global
100
+ * blueprints.
100
101
  */
101
102
  async getBlueprintTemplates<T = Models.BlueprintTemplateArray>(
102
103
  parameters: Parameters.GetBlueprintTemplates | undefined,
@@ -109,8 +110,9 @@ export class Template {
109
110
  * Note, all global blueprints are inherited by each space. Space blueprints can be customised without affecting the
110
111
  * global blueprints.
111
112
  *
112
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to access the Confluence site
113
- * ('Can use' global permission).
113
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
114
+ * blueprints for the space and permission to access the Confluence site ('Can use' global permission) to view global
115
+ * blueprints.
114
116
  */
115
117
  async getBlueprintTemplates<T = Models.BlueprintTemplateArray>(
116
118
  parameters?: Parameters.GetBlueprintTemplates,
@@ -137,8 +139,8 @@ export class Template {
137
139
  /**
138
140
  * Returns all content templates. Use this method to retrieve all global content templates or all content templates in a space.
139
141
  *
140
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to view
141
- * space templates and 'Confluence Administrator' global permission to view global templates.
142
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
143
+ * space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
142
144
  */
143
145
  async getContentTemplates<T = Models.ContentTemplateArray>(
144
146
  parameters: Parameters.GetContentTemplates | undefined,
@@ -147,8 +149,8 @@ export class Template {
147
149
  /**
148
150
  * Returns all content templates. Use this method to retrieve all global content templates or all content templates in a space.
149
151
  *
150
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to view
151
- * space templates and 'Confluence Administrator' global permission to view global templates.
152
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
153
+ * space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
152
154
  */
153
155
  async getContentTemplates<T = Models.ContentTemplateArray>(
154
156
  parameters?: Parameters.GetContentTemplates,
@@ -176,8 +178,8 @@ export class Template {
176
178
  * Returns a content template. This includes information about template, like the name, the space or blueprint that
177
179
  * the template is in, the body of the template, and more.
178
180
  *
179
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to view
180
- * space templates and 'Confluence Administrator' global permission to view global templates.
181
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
182
+ * space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
181
183
  */
182
184
  async getContentTemplate<T = Models.ContentTemplate>(
183
185
  parameters: Parameters.GetContentTemplate,
@@ -187,8 +189,8 @@ export class Template {
187
189
  * Returns a content template. This includes information about template, like the name, the space or blueprint that
188
190
  * the template is in, the body of the template, and more.
189
191
  *
190
- * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to view
191
- * space templates and 'Confluence Administrator' global permission to view global templates.
192
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
193
+ * space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
192
194
  */
193
195
  async getContentTemplate<T = Models.ContentTemplate>(
194
196
  parameters: Parameters.GetContentTemplate,
@@ -215,6 +217,9 @@ export class Template {
215
217
  * - If the template is a modified global-level blueprint template, it reverts to the default global-level blueprint template.
216
218
  *
217
219
  * Note, unmodified blueprint templates cannot be deleted.
220
+ *
221
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to delete a
222
+ * space template or 'Confluence Administrator' global permission to delete a global template.
218
223
  */
219
224
  async removeTemplate<T = void>(parameters: Parameters.RemoveTemplate, callback: Callback<T>): Promise<void>;
220
225
  /**
@@ -226,6 +231,9 @@ export class Template {
226
231
  * - If the template is a modified global-level blueprint template, it reverts to the default global-level blueprint template.
227
232
  *
228
233
  * Note, unmodified blueprint templates cannot be deleted.
234
+ *
235
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to delete a
236
+ * space template or 'Confluence Administrator' global permission to delete a global template.
229
237
  */
230
238
  async removeTemplate<T = void>(parameters: Parameters.RemoveTemplate, callback?: never): Promise<T>;
231
239
  async removeTemplate<T = void>(parameters: Parameters.RemoveTemplate, callback?: Callback<T>): Promise<void | T> {
@@ -1,5 +1,4 @@
1
1
  import axios, { AxiosInstance } from 'axios';
2
- import { Authentication, Telemetry, TelemetryClient } from 'telemetry.confluence.js';
3
2
  import type { Client } from './client';
4
3
  import type { Callback } from '../callback';
5
4
  import type { Config } from '../config';
@@ -11,13 +10,10 @@ const ATLASSIAN_TOKEN_CHECK_NOCHECK_VALUE = 'no-check';
11
10
 
12
11
  export class BaseClient implements Client {
13
12
  #instance: AxiosInstance | undefined;
14
- private telemetryClient: TelemetryClient;
15
13
 
16
14
  protected urlSuffix = '/wiki/rest/';
17
15
 
18
- constructor(protected readonly config: Config) {
19
- this.telemetryClient = new TelemetryClient(config.telemetry);
20
- }
16
+ constructor(protected readonly config: Config) {}
21
17
 
22
18
  protected paramSerializer(parameters: Record<string, any>): string {
23
19
  const parts: string[] = [];
@@ -82,38 +78,16 @@ export class BaseClient implements Client {
82
78
  return this.#instance;
83
79
  }
84
80
 
85
- async sendRequest<T>(requestConfig: RequestConfig, callback: never, telemetryData?: Partial<Telemetry>): Promise<T>;
81
+ async sendRequest<T>(requestConfig: RequestConfig, callback: never, telemetryData?: any): Promise<T>;
86
82
  async sendRequest<T>(
87
83
  requestConfig: RequestConfig,
88
84
  callback: Callback<T>,
89
- telemetryData?: Partial<Telemetry>
85
+ telemetryData?: any,
90
86
  ): Promise<void>;
91
87
  async sendRequest<T>(
92
88
  requestConfig: RequestConfig,
93
89
  callback: Callback<T> | never,
94
- telemetryData?: Partial<Telemetry>,
95
90
  ): Promise<void | T> {
96
- const startDateTime = new Date();
97
-
98
- const telemetry: Telemetry = {
99
- authentication: this.authenticationType,
100
- baseRequestConfigUsed: !!this.config.baseRequestConfig,
101
- bodyExists: !!requestConfig.data,
102
- callbackUsed: !!callback,
103
- headersExists: !!requestConfig.headers,
104
- libVersion: '1.1.3',
105
- libVersionHash: '6d8c23a768aec9eefc52917e68aa3926',
106
- methodName: telemetryData?.methodName || 'sendRequest',
107
- onErrorMiddlewareUsed: !!this.config.middlewares?.onError,
108
- onResponseMiddlewareUsed: !!this.config.middlewares?.onResponse,
109
- queryExists: !!requestConfig.params,
110
- requestEndTime: new Date(),
111
- requestStartTime: startDateTime,
112
- requestStatusCode: 0,
113
- noCheckAtlassianToken: !!this.config.noCheckAtlassianToken,
114
- ...telemetryData,
115
- };
116
-
117
91
  try {
118
92
  const modifiedRequestConfig = {
119
93
  ...requestConfig,
@@ -127,7 +101,7 @@ export class BaseClient implements Client {
127
101
  }),
128
102
  };
129
103
 
130
- const response = await this.instance.request(modifiedRequestConfig);
104
+ const response = await this.instance.request<T>(modifiedRequestConfig);
131
105
 
132
106
  const callbackResponseHandler = callback && ((data: T): void => callback(null, data));
133
107
  const defaultResponseHandler = (data: T): T => data;
@@ -136,8 +110,6 @@ export class BaseClient implements Client {
136
110
 
137
111
  this.config.middlewares?.onResponse?.(response.data);
138
112
 
139
- telemetry.requestStatusCode = response.status;
140
-
141
113
  return responseHandler(response.data);
142
114
  } catch (e: any) {
143
115
  const callbackErrorHandler = callback && ((error: Config.Error) => callback(error));
@@ -149,35 +121,7 @@ export class BaseClient implements Client {
149
121
 
150
122
  this.config.middlewares?.onError?.(e);
151
123
 
152
- telemetry.requestStatusCode = e.isAxiosError ? e.response?.status ?? 0 : 418;
153
-
154
124
  return errorHandler(e);
155
- } finally {
156
- telemetry.requestEndTime = new Date();
157
-
158
- this.telemetryClient.sendTelemetry(telemetry);
159
- }
160
- }
161
-
162
- private get authenticationType(): Authentication {
163
- const { authentication } = this.config;
164
-
165
- if (!authentication) {
166
- return Authentication.None;
167
- }
168
-
169
- if (authentication.basic) {
170
- return Authentication.Basic;
171
- }
172
-
173
- if (authentication.oauth2) {
174
- return Authentication.OAuth2;
175
- }
176
-
177
- if (authentication.jwt) {
178
- return Authentication.JWT;
179
125
  }
180
-
181
- return Authentication.NA;
182
126
  }
183
127
  }
@@ -1,12 +1,11 @@
1
- import type { Telemetry } from 'telemetry.confluence.js';
2
1
  import type { Callback } from '../callback';
3
2
  import type { RequestConfig } from '../requestConfig';
4
3
 
5
4
  export interface Client {
6
- sendRequest<T>(requestConfig: RequestConfig, callback?: never, telemetryData?: Partial<Telemetry>): Promise<T>;
5
+ sendRequest<T>(requestConfig: RequestConfig, callback?: never, telemetryData?: any): Promise<T>;
7
6
  sendRequest<T>(
8
7
  requestConfig: RequestConfig,
9
8
  callback?: Callback<T>,
10
- telemetryData?: Partial<Telemetry>
9
+ telemetryData?: any,
11
10
  ): Promise<void>;
12
11
  }
@@ -14,6 +14,7 @@ import {
14
14
  ContentVersions,
15
15
  ContentWatches,
16
16
  DynamicModules,
17
+ Experimental,
17
18
  Group,
18
19
  InlineTasks,
19
20
  LabelInfo,
@@ -45,6 +46,7 @@ export class ConfluenceClient extends BaseClient {
45
46
  contentVersions = new ContentVersions(this);
46
47
  contentWatches = new ContentWatches(this);
47
48
  dynamicModules = new DynamicModules(this);
49
+ experimental = new Experimental(this);
48
50
  group = new Group(this);
49
51
  inlineTasks = new InlineTasks(this);
50
52
  labelInfo = new LabelInfo(this);
package/src/config.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { AxiosError } from 'axios';
2
- import type { TelemetryConfig } from 'telemetry.confluence.js';
3
2
  import type { RequestConfig } from './requestConfig';
4
3
  import type { UtilityTypes } from './utilityTypes';
5
4
 
@@ -8,6 +7,7 @@ export interface Config {
8
7
  baseRequestConfig?: Config.BaseRequestConfig;
9
8
  authentication?: Config.Authentication;
10
9
  middlewares?: Config.Middlewares;
10
+ /** @deprecated Disabled. Will be removed in the next major version. */
11
11
  telemetry?: Config.Telemetry;
12
12
  /**
13
13
  * Adds `'X-Atlassian-Token': 'no-check'` to each request header
@@ -18,7 +18,8 @@ export interface Config {
18
18
  export namespace Config {
19
19
  export type BaseRequestConfig = RequestConfig;
20
20
  export type Error = AxiosError;
21
- export type Telemetry = boolean | TelemetryConfig;
21
+ /** @deprecated Disabled. Will be removed in the next major version. */
22
+ export type Telemetry = boolean | any;
22
23
 
23
24
  export type Authentication = UtilityTypes.XOR<{
24
25
  jwt: Authentication.JWT;