confluence.js 1.1.3 → 1.2.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 (151) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +1 -0
  3. package/out/api/content.d.ts +24 -52
  4. package/out/api/content.js +14 -0
  5. package/out/api/contentAttachments.d.ts +10 -6
  6. package/out/api/contentAttachments.js +12 -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 +1 -0
  12. package/out/api/contentWatches.d.ts +2 -2
  13. package/out/api/experimental.d.ts +16 -0
  14. package/out/api/experimental.js +34 -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/addPermissionToSpace.d.ts +5 -0
  48. package/out/api/parameters/addPermissionToSpace.js +2 -0
  49. package/out/api/parameters/addUserToGroup.d.ts +2 -1
  50. package/out/api/parameters/addUserToGroupByGroupId.d.ts +2 -1
  51. package/out/api/parameters/archivePages.d.ts +6 -0
  52. package/out/api/parameters/archivePages.js +2 -0
  53. package/out/api/parameters/checkContentPermission.d.ts +5 -0
  54. package/out/api/parameters/checkContentPermission.js +2 -0
  55. package/out/api/parameters/deleteRelationship.d.ts +38 -0
  56. package/out/api/parameters/deleteRelationship.js +2 -0
  57. package/out/api/parameters/downloadAttachment.d.ts +11 -0
  58. package/out/api/parameters/downloadAttachment.js +2 -0
  59. package/out/api/parameters/getContentProperties.d.ts +2 -0
  60. package/out/api/parameters/getDescendantsOfType.d.ts +101 -0
  61. package/out/api/parameters/getDescendantsOfType.js +89 -0
  62. package/out/api/parameters/getGroupByName.d.ts +4 -0
  63. package/out/api/parameters/getGroupByName.js +2 -0
  64. package/out/api/parameters/getGroups.d.ts +2 -0
  65. package/out/api/parameters/getTaskById.d.ts +4 -0
  66. package/out/api/parameters/getTaskById.js +2 -0
  67. package/out/api/parameters/getViewers.d.ts +6 -0
  68. package/out/api/parameters/getViewers.js +2 -0
  69. package/out/api/parameters/getViews.d.ts +6 -0
  70. package/out/api/parameters/getViews.js +2 -0
  71. package/out/api/parameters/index.d.ts +131 -116
  72. package/out/api/parameters/index.js +131 -116
  73. package/out/api/parameters/publishLegacyDraft.d.ts +3 -1
  74. package/out/api/parameters/publishSharedDraft.d.ts +3 -1
  75. package/out/api/parameters/searchByCQL.d.ts +34 -0
  76. package/out/api/parameters/searchByCQL.js +2 -0
  77. package/out/api/parameters/searchGroups.d.ts +8 -0
  78. package/out/api/parameters/searchGroups.js +2 -0
  79. package/out/api/parameters/searchUser.d.ts +20 -0
  80. package/out/api/parameters/searchUser.js +2 -0
  81. package/out/api/parameters/updateTaskById.d.ts +5 -0
  82. package/out/api/parameters/updateTaskById.js +2 -0
  83. package/out/api/relation.d.ts +12 -4
  84. package/out/api/relation.js +12 -2
  85. package/out/api/search.d.ts +12 -64
  86. package/out/api/search.js +19 -2
  87. package/out/api/settings.d.ts +2 -2
  88. package/out/api/settings.js +3 -0
  89. package/out/api/space.js +3 -0
  90. package/out/api/spacePermissions.d.ts +26 -2
  91. package/out/api/spacePermissions.js +20 -3
  92. package/out/api/spaceProperties.d.ts +4 -4
  93. package/out/api/spaceProperties.js +1 -0
  94. package/out/clients/baseClient.js +1 -1
  95. package/out/clients/confluenceClient.d.ts +2 -1
  96. package/out/clients/confluenceClient.js +1 -0
  97. package/package.json +6 -6
  98. package/src/api/content.ts +57 -52
  99. package/src/api/contentAttachments.ts +28 -6
  100. package/src/api/contentChildrenAndDescendants.ts +24 -28
  101. package/src/api/contentPermissions.ts +24 -7
  102. package/src/api/contentProperties.ts +1 -0
  103. package/src/api/contentWatches.ts +3 -3
  104. package/src/api/experimental.ts +44 -0
  105. package/src/api/group.ts +71 -19
  106. package/src/api/index.ts +1 -0
  107. package/src/api/inlineTasks.ts +52 -0
  108. package/src/api/models/getViewers.ts +6 -0
  109. package/src/api/models/getViews.ts +6 -0
  110. package/src/api/models/groupCreate.ts +4 -0
  111. package/src/api/models/horizontalHeaderLookAndFeel.ts +12 -0
  112. package/src/api/models/index.ts +13 -4
  113. package/src/api/models/lookAndFeel.ts +3 -0
  114. package/src/api/models/spacePermissionCreate.ts +34 -0
  115. package/src/api/models/spacePermissionCustomContent.ts +17 -0
  116. package/src/api/models/spacePermissionRequest.ts +42 -0
  117. package/src/api/models/spacePrivateCreate.ts +9 -0
  118. package/src/api/models/spacePropertyCreate.ts +4 -0
  119. package/src/api/models/spaceUpdate.ts +4 -0
  120. package/src/api/models/taskStatusUpdate.ts +3 -0
  121. package/src/api/models/topNavigationLookAndFeel.ts +8 -0
  122. package/src/api/parameters/addCustomContentPermissions.ts +6 -0
  123. package/src/api/parameters/addPermissionToSpace.ts +6 -0
  124. package/src/api/parameters/addUserToGroup.ts +3 -1
  125. package/src/api/parameters/addUserToGroupByGroupId.ts +3 -1
  126. package/src/api/parameters/archivePages.ts +6 -0
  127. package/src/api/parameters/checkContentPermission.ts +6 -0
  128. package/src/api/parameters/deleteRelationship.ts +38 -0
  129. package/src/api/parameters/downloadAttachment.ts +11 -0
  130. package/src/api/parameters/getContentProperties.ts +2 -0
  131. package/src/api/parameters/getDescendantsOfType.ts +102 -0
  132. package/src/api/parameters/getGroupByName.ts +4 -0
  133. package/src/api/parameters/getGroups.ts +2 -0
  134. package/src/api/parameters/getTaskById.ts +4 -0
  135. package/src/api/parameters/getViewers.ts +6 -0
  136. package/src/api/parameters/getViews.ts +6 -0
  137. package/src/api/parameters/index.ts +131 -116
  138. package/src/api/parameters/publishLegacyDraft.ts +4 -1
  139. package/src/api/parameters/publishSharedDraft.ts +4 -1
  140. package/src/api/parameters/searchByCQL.ts +34 -0
  141. package/src/api/parameters/searchGroups.ts +8 -0
  142. package/src/api/parameters/searchUser.ts +20 -0
  143. package/src/api/parameters/updateTaskById.ts +6 -0
  144. package/src/api/relation.ts +33 -8
  145. package/src/api/search.ts +53 -73
  146. package/src/api/settings.ts +6 -3
  147. package/src/api/space.ts +3 -0
  148. package/src/api/spacePermissions.ts +66 -8
  149. package/src/api/spaceProperties.ts +5 -4
  150. package/src/clients/baseClient.ts +2 -2
  151. package/src/clients/confluenceClient.ts +2 -0
package/out/api/search.js CHANGED
@@ -7,6 +7,11 @@ class Search {
7
7
  this.client = client;
8
8
  }
9
9
  search(parameters, callback) {
10
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
11
+ return this.searchByCQL(parameters, callback);
12
+ });
13
+ }
14
+ searchByCQL(parameters, callback) {
10
15
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
11
16
  const config = {
12
17
  url: '/api/search',
@@ -15,14 +20,26 @@ class Search {
15
20
  cql: parameters.cql,
16
21
  cqlcontext: parameters.cqlcontext,
17
22
  cursor: parameters.cursor,
23
+ next: parameters.next,
24
+ prev: parameters.prev,
18
25
  limit: parameters.limit,
26
+ start: parameters.start,
19
27
  includeArchivedSpaces: parameters.includeArchivedSpaces,
28
+ excludeCurrentSpaces: parameters.excludeCurrentSpaces,
29
+ excerpt: parameters.excerpt,
30
+ sitePermissionTypeFilter: parameters.sitePermissionTypeFilter,
31
+ expand: parameters.expand,
20
32
  },
21
33
  };
22
- return this.client.sendRequest(config, callback, { methodName: 'search' });
34
+ return this.client.sendRequest(config, callback, { methodName: 'searchByCQL' });
23
35
  });
24
36
  }
25
37
  userSearch(parameters, callback) {
38
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
39
+ return this.searchUser(parameters, callback);
40
+ });
41
+ }
42
+ searchUser(parameters, callback) {
26
43
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
27
44
  const config = {
28
45
  url: '/api/search/user',
@@ -33,7 +50,7 @@ class Search {
33
50
  limit: parameters.limit,
34
51
  },
35
52
  };
36
- return this.client.sendRequest(config, callback, { methodName: 'search' });
53
+ return this.client.sendRequest(config, callback, { methodName: 'searchUser' });
37
54
  });
38
55
  }
39
56
  }
@@ -48,7 +48,7 @@ export declare class Settings {
48
48
  *
49
49
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
50
50
  */
51
- updateLookAndFeelSettings<T = Models.LookAndFeelUpdated>(parameters: Parameters.UpdateLookAndFeelSettings | undefined, callback: Callback<T>): Promise<void>;
51
+ updateLookAndFeelSettings<T = Models.LookAndFeel>(parameters: Parameters.UpdateLookAndFeelSettings | undefined, callback: Callback<T>): Promise<void>;
52
52
  /**
53
53
  * Updates the look and feel settings for the site or for a single space. If custom settings exist, they are updated.
54
54
  * If no custom settings exist, then a set of custom settings is created.
@@ -58,7 +58,7 @@ export declare class Settings {
58
58
  *
59
59
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
60
60
  */
61
- updateLookAndFeelSettings<T = Models.LookAndFeelUpdated>(parameters?: Parameters.UpdateLookAndFeelSettings, callback?: never): Promise<T>;
61
+ updateLookAndFeelSettings<T = Models.LookAndFeel>(parameters?: Parameters.UpdateLookAndFeelSettings, callback?: never): Promise<T>;
62
62
  /**
63
63
  * Resets the custom look and feel settings for the site or a single space. This changes the values of the custom
64
64
  * settings to be the same as the default settings. It does not change which settings (default or custom) are
@@ -44,8 +44,11 @@ class Settings {
44
44
  links: parameters === null || parameters === void 0 ? void 0 : parameters.links,
45
45
  menus: parameters === null || parameters === void 0 ? void 0 : parameters.menus,
46
46
  header: parameters === null || parameters === void 0 ? void 0 : parameters.header,
47
+ horizontalHeader: parameters === null || parameters === void 0 ? void 0 : parameters.horizontalHeader,
47
48
  content: parameters === null || parameters === void 0 ? void 0 : parameters.content,
48
49
  bordersAndDividers: parameters === null || parameters === void 0 ? void 0 : parameters.bordersAndDividers,
50
+ spaceReference: parameters === null || parameters === void 0 ? void 0 : parameters.spaceReference,
51
+ _links: parameters === null || parameters === void 0 ? void 0 : parameters.links,
49
52
  },
50
53
  };
51
54
  return this.client.sendRequest(config, callback, { methodName: 'updateLookAndFeelSettings' });
package/out/api/space.js CHANGED
@@ -50,6 +50,7 @@ class Space {
50
50
  key: parameters === null || parameters === void 0 ? void 0 : parameters.key,
51
51
  name: parameters === null || parameters === void 0 ? void 0 : parameters.name,
52
52
  description: parameters === null || parameters === void 0 ? void 0 : parameters.description,
53
+ permissions: parameters === null || parameters === void 0 ? void 0 : parameters.permissions,
53
54
  },
54
55
  };
55
56
  return this.client.sendRequest(config, callback, { methodName: 'createPrivateSpace' });
@@ -73,6 +74,8 @@ class Space {
73
74
  name: parameters.name,
74
75
  description: parameters.description,
75
76
  homepage: parameters.homepage,
77
+ type: parameters.type,
78
+ status: parameters.status,
76
79
  },
77
80
  };
78
81
  return this.client.sendRequest(config, callback, { methodName: 'updateSpace' });
@@ -5,6 +5,10 @@ import { Callback } from '../callback';
5
5
  export declare class SpacePermissions {
6
6
  private client;
7
7
  constructor(client: Client);
8
+ /** @deprecated Will be removed in the next major version. Use `addPermissionToSpace` instead. */
9
+ addPermission<T = Models.SpacePermissionV2>(parameters: Parameters.AddPermission, callback: Callback<T>): Promise<void>;
10
+ /** @deprecated Will be removed in the next major version. Use `addPermissionToSpace` instead. */
11
+ addPermission<T = Models.SpacePermissionV2>(parameters: Parameters.AddPermission, callback?: never): Promise<T>;
8
12
  /**
9
13
  * Adds new permission to space.
10
14
  *
@@ -14,7 +18,7 @@ export declare class SpacePermissions {
14
18
  *
15
19
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
16
20
  */
17
- addPermission<T = Models.SpacePermissionV2>(parameters: Parameters.AddPermission, callback: Callback<T>): Promise<void>;
21
+ addPermissionToSpace<T = Models.SpacePermissionV2>(parameters: Parameters.AddPermissionToSpace, callback: Callback<T>): Promise<void>;
18
22
  /**
19
23
  * Adds new permission to space.
20
24
  *
@@ -24,7 +28,27 @@ export declare class SpacePermissions {
24
28
  *
25
29
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
26
30
  */
27
- addPermission<T = Models.SpacePermissionV2>(parameters: Parameters.AddPermission, callback?: never): Promise<T>;
31
+ addPermissionToSpace<T = Models.SpacePermissionV2>(parameters: Parameters.AddPermissionToSpace, callback?: never): Promise<T>;
32
+ /**
33
+ * Adds new custom content permission to space.
34
+ *
35
+ * If the permission to be added is a group permission, the group can be identified by its group name or group id.
36
+ *
37
+ * Note: Only apps can access this REST resource and only make changes to the respective app permissions.
38
+ *
39
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
40
+ */
41
+ addCustomContentPermissions<T = unknown>(parameters: Parameters.AddCustomContentPermissions, callback: Callback<T>): Promise<void>;
42
+ /**
43
+ * Adds new custom content permission to space.
44
+ *
45
+ * If the permission to be added is a group permission, the group can be identified by its group name or group id.
46
+ *
47
+ * Note: Only apps can access this REST resource and only make changes to the respective app permissions.
48
+ *
49
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.
50
+ */
51
+ addCustomContentPermissions<T = unknown>(parameters: Parameters.AddCustomContentPermissions, callback?: never): Promise<T>;
28
52
  /**
29
53
  * Removes a space permission. Note that removing Read Space permission for a user or group will remove all the space
30
54
  * permissions for that user or group.
@@ -7,18 +7,35 @@ class SpacePermissions {
7
7
  this.client = client;
8
8
  }
9
9
  addPermission(parameters, callback) {
10
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
11
+ return this.addPermissionToSpace(parameters, callback);
12
+ });
13
+ }
14
+ addPermissionToSpace(parameters, callback) {
10
15
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
11
16
  const config = {
12
17
  url: `/api/space/${parameters.spaceKey}/permission`,
13
18
  method: 'POST',
14
19
  data: {
15
- id: parameters.id,
16
20
  subject: parameters.subject,
17
21
  operation: parameters.operation,
18
- _links: parameters._links,
22
+ _links: parameters.links,
23
+ },
24
+ };
25
+ return this.client.sendRequest(config, callback, { methodName: 'addPermissionToSpace' });
26
+ });
27
+ }
28
+ addCustomContentPermissions(parameters, callback) {
29
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
30
+ const config = {
31
+ url: `/api/space/${parameters.spaceKey}/permission/custom-content`,
32
+ method: 'POST',
33
+ data: {
34
+ subject: parameters.subject,
35
+ operations: parameters.operations,
19
36
  },
20
37
  };
21
- return this.client.sendRequest(config, callback, { methodName: 'addPermission' });
38
+ return this.client.sendRequest(config, callback, { methodName: 'addCustomContentPermissions' });
22
39
  });
23
40
  }
24
41
  removePermission(parameters, callback) {
@@ -42,15 +42,15 @@ export declare class SpaceProperties {
42
42
  */
43
43
  getSpaceProperty<T = Models.SpaceProperty>(parameters: Parameters.GetSpaceProperty, callback?: never): Promise<T>;
44
44
  /**
45
- * Creates a new space property. This is the same as `POST /api/space/{spaceKey}/property` but the key for the
46
- * property is passed as a path parameter, rather than in the request body.
45
+ * Creates a new space property. This is the same as `POST /wiki/rest/api/space/{spaceKey}/property` but the key for
46
+ * the property is passed as a path parameter, rather than in the request body.
47
47
  *
48
48
  * **[Permissions required](https://confluence.atlassian.com/x/_AozKw)**: ‘Admin’ permission for the space.
49
49
  */
50
50
  createSpacePropertyForKey<T = Models.SpaceProperty>(parameters: Parameters.CreateSpacePropertyForKey, callback: Callback<T>): Promise<void>;
51
51
  /**
52
- * Creates a new space property. This is the same as `POST /api/space/{spaceKey}/property` but the key for the
53
- * property is passed as a path parameter, rather than in the request body.
52
+ * Creates a new space property. This is the same as `POST /wiki/rest/api/space/{spaceKey}/property` but the key for
53
+ * the property is passed as a path parameter, rather than in the request body.
54
54
  *
55
55
  * **[Permissions required](https://confluence.atlassian.com/x/_AozKw)**: ‘Admin’ permission for the space.
56
56
  */
@@ -28,6 +28,7 @@ class SpaceProperties {
28
28
  data: {
29
29
  key: parameters.key,
30
30
  value: parameters.value,
31
+ space: parameters.space,
31
32
  },
32
33
  };
33
34
  return this.client.sendRequest(config, callback, { methodName: 'createSpaceProperty' });
@@ -64,7 +64,7 @@ class BaseClient {
64
64
  var _a, _b, _c, _d, _e, _f, _g, _h;
65
65
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
66
66
  const startDateTime = new Date();
67
- const telemetry = Object.assign({ authentication: this.authenticationType, baseRequestConfigUsed: !!this.config.baseRequestConfig, bodyExists: !!requestConfig.data, callbackUsed: !!callback, headersExists: !!requestConfig.headers, libVersion: '1.1.3', libVersionHash: '6d8c23a768aec9eefc52917e68aa3926', methodName: (telemetryData === null || telemetryData === void 0 ? void 0 : telemetryData.methodName) || 'sendRequest', onErrorMiddlewareUsed: !!((_a = this.config.middlewares) === null || _a === void 0 ? void 0 : _a.onError), onResponseMiddlewareUsed: !!((_b = this.config.middlewares) === null || _b === void 0 ? void 0 : _b.onResponse), queryExists: !!requestConfig.params, requestEndTime: new Date(), requestStartTime: startDateTime, requestStatusCode: 0, noCheckAtlassianToken: !!this.config.noCheckAtlassianToken }, telemetryData);
67
+ const telemetry = Object.assign({ authentication: this.authenticationType, baseRequestConfigUsed: !!this.config.baseRequestConfig, bodyExists: !!requestConfig.data, callbackUsed: !!callback, headersExists: !!requestConfig.headers, libVersion: '1.2.0', libVersionHash: '0ba4439ee9a46d9d9f14c60f88f45f87', methodName: (telemetryData === null || telemetryData === void 0 ? void 0 : telemetryData.methodName) || 'sendRequest', onErrorMiddlewareUsed: !!((_a = this.config.middlewares) === null || _a === void 0 ? void 0 : _a.onError), onResponseMiddlewareUsed: !!((_b = this.config.middlewares) === null || _b === void 0 ? void 0 : _b.onResponse), queryExists: !!requestConfig.params, requestEndTime: new Date(), requestStartTime: startDateTime, requestStatusCode: 0, noCheckAtlassianToken: !!this.config.noCheckAtlassianToken }, telemetryData);
68
68
  try {
69
69
  const modifiedRequestConfig = Object.assign(Object.assign({}, requestConfig), { headers: this.removeUndefinedProperties(Object.assign({ Authorization: yield authenticationService_1.AuthenticationService.getAuthenticationToken(this.config.authentication, {
70
70
  baseURL: this.config.host,
@@ -1,5 +1,5 @@
1
1
  import { BaseClient } from './baseClient';
2
- import { Audit, Content, ContentAttachments, ContentBody, ContentChildrenAndDescendants, ContentComments, ContentLabels, ContentMacroBody, ContentPermissions, ContentProperties, ContentRestrictions, ContentVersions, ContentWatches, DynamicModules, Group, InlineTasks, LabelInfo, LongRunningTask, Relation, Search, Settings, Space, SpacePermissions, SpaceProperties, SpaceSettings, Template, Themes, Users } from '../api';
2
+ import { Audit, Content, ContentAttachments, ContentBody, ContentChildrenAndDescendants, ContentComments, ContentLabels, ContentMacroBody, ContentPermissions, ContentProperties, ContentRestrictions, ContentVersions, ContentWatches, DynamicModules, Experimental, Group, InlineTasks, LabelInfo, LongRunningTask, Relation, Search, Settings, Space, SpacePermissions, SpaceProperties, SpaceSettings, Template, Themes, Users } from '../api';
3
3
  export declare class ConfluenceClient extends BaseClient {
4
4
  audit: Audit;
5
5
  content: Content;
@@ -15,6 +15,7 @@ export declare class ConfluenceClient extends BaseClient {
15
15
  contentVersions: ContentVersions;
16
16
  contentWatches: ContentWatches;
17
17
  dynamicModules: DynamicModules;
18
+ experimental: Experimental;
18
19
  group: Group;
19
20
  inlineTasks: InlineTasks;
20
21
  labelInfo: LabelInfo;
@@ -20,6 +20,7 @@ class ConfluenceClient extends baseClient_1.BaseClient {
20
20
  this.contentVersions = new api_1.ContentVersions(this);
21
21
  this.contentWatches = new api_1.ContentWatches(this);
22
22
  this.dynamicModules = new api_1.DynamicModules(this);
23
+ this.experimental = new api_1.Experimental(this);
23
24
  this.group = new api_1.Group(this);
24
25
  this.inlineTasks = new api_1.InlineTasks(this);
25
26
  this.labelInfo = new api_1.LabelInfo(this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "confluence.js",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "confluence.js is a powerful Node.JS/Browser module that allows you to interact with the Confluence API very easily",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",
@@ -36,9 +36,9 @@
36
36
  "@types/express": "^4.17.13",
37
37
  "@types/jest": "^26.0.24",
38
38
  "@types/oauth": "^0.9.1",
39
- "@types/sinon": "^10.0.2",
40
- "@typescript-eslint/eslint-plugin": "^4.31.1",
41
- "@typescript-eslint/parser": "^4.31.1",
39
+ "@types/sinon": "^10.0.4",
40
+ "@typescript-eslint/eslint-plugin": "^4.32.0",
41
+ "@typescript-eslint/parser": "^4.32.0",
42
42
  "dotenv": "^10.0.0",
43
43
  "eslint": "^7.32.0",
44
44
  "eslint-config-airbnb": "^18.2.1",
@@ -46,11 +46,11 @@
46
46
  "eslint-import-resolver-typescript": "^2.5.0",
47
47
  "eslint-plugin-import": "^2.24.2",
48
48
  "jest": "^26.6.3",
49
- "prettier": "^2.4.0",
49
+ "prettier": "^2.4.1",
50
50
  "prettier-plugin-jsdoc": "^0.3.24",
51
51
  "sinon": "^11.1.2",
52
52
  "ts-jest": "^26.5.6",
53
- "typedoc": "^0.22.3",
53
+ "typedoc": "^0.22.4",
54
54
  "typescript": "^4.4.3"
55
55
  },
56
56
  "dependencies": {
@@ -102,6 +102,45 @@ export class Content {
102
102
  return this.client.sendRequest(config, callback, { methodName: 'createContent' });
103
103
  }
104
104
 
105
+ /**
106
+ * Archives a list of pages. The pages to be archived are specified as a list of content IDs. This API accepts the
107
+ * archival request and returns a task ID. The archival process happens asynchronously. Use the /longtask/<taskId>
108
+ * REST API to get the copy task status.
109
+ *
110
+ * Each content ID needs to resolve to page objects that are not already in an archived state. The content IDs need
111
+ * not belong to the same space.
112
+ *
113
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Archive' permission for each of the pages
114
+ * in the corresponding space it belongs to.
115
+ */
116
+ async archivePages<T = unknown>(
117
+ parameters: Parameters.ArchivePages,
118
+ callback: Callback<T>
119
+ ): Promise<void>;
120
+ /**
121
+ * Archives a list of pages. The pages to be archived are specified as a list of content IDs. This API accepts the
122
+ * archival request and returns a task ID. The archival process happens asynchronously. Use the /longtask/<taskId>
123
+ * REST API to get the copy task status.
124
+ *
125
+ * Each content ID needs to resolve to page objects that are not already in an archived state. The content IDs need
126
+ * not belong to the same space.
127
+ *
128
+ * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Archive' permission for each of the pages
129
+ * in the corresponding space it belongs to.
130
+ */
131
+ async archivePages<T = unknown>(parameters: Parameters.ArchivePages, callback?: never): Promise<T>;
132
+ async archivePages<T = unknown>(parameters: Parameters.ArchivePages, callback?: Callback<T>): Promise<void | T> {
133
+ const config: RequestConfig = {
134
+ url: '/api/content/archive',
135
+ method: 'POST',
136
+ data: {
137
+ pages: parameters.pages,
138
+ },
139
+ };
140
+
141
+ return this.client.sendRequest(config, callback, { methodName: 'archivePages' });
142
+ }
143
+
105
144
  /**
106
145
  * Publishes a legacy draft of a page created from a blueprint. Legacy drafts will eventually be removed in favor of
107
146
  * shared drafts. For now, this method works the same as [Publish shared draft](#api-content-blueprint-instance-draftId-put).
@@ -135,6 +174,15 @@ export class Content {
135
174
  params: {
136
175
  status: parameters.status,
137
176
  },
177
+ data: {
178
+ ...parameters,
179
+ version: parameters.version,
180
+ title: parameters.title,
181
+ type: parameters.type,
182
+ status: parameters.bodyStatus,
183
+ space: parameters.space,
184
+ ancestors: parameters.ancestors,
185
+ },
138
186
  };
139
187
 
140
188
  return this.client.sendRequest(config, callback, { methodName: 'publishLegacyDraft' });
@@ -171,6 +219,15 @@ export class Content {
171
219
  params: {
172
220
  status: parameters.status,
173
221
  },
222
+ data: {
223
+ ...parameters,
224
+ version: parameters.version,
225
+ title: parameters.title,
226
+ type: parameters.type,
227
+ status: parameters.bodyStatus,
228
+ space: parameters.space,
229
+ ancestors: parameters.ancestors,
230
+ },
174
231
  };
175
232
 
176
233
  return this.client.sendRequest(config, callback, { methodName: 'publishSharedDraft' });
@@ -180,32 +237,6 @@ export class Content {
180
237
  * Returns the list of content that matches a Confluence Query Language (CQL) query. For information on CQL, see:
181
238
  * [Advanced searching using CQL](https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/).
182
239
  *
183
- * Example initial call:
184
- * ```
185
- * https://your-domain.atlassian.net/wiki/rest/api/content/search?cql=type=page&limit=25
186
- * ```
187
- *
188
- * Example response:
189
- * ```
190
- * {
191
- * "results": [
192
- * { ... },
193
- * { ... },
194
- * ...
195
- * { ... }
196
- * ],
197
- * "limit": 25,
198
- * "size": 25,
199
- * ...
200
- * "_links": {
201
- * "base": "<url>",
202
- * "context": "<url>",
203
- * "next": "/rest/api/content/search?cql=type=page&limit=25&cursor=raNDoMsTRiNg",
204
- * "self": "<url>"
205
- * }
206
- * }
207
- * ```
208
- *
209
240
  * When additional results are available, returns `next` and `prev` URLs to retrieve them in subsequent calls. The
210
241
  * URLs each contain a cursor that points to the appropriate set of results. Use `limit` to specify the number of
211
242
  * results returned in each call. Example subsequent call (taken from example response):
@@ -225,32 +256,6 @@ export class Content {
225
256
  * Returns the list of content that matches a Confluence Query Language (CQL) query. For information on CQL, see:
226
257
  * [Advanced searching using CQL](https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/).
227
258
  *
228
- * Example initial call:
229
- * ```
230
- * https://your-domain.atlassian.net/wiki/rest/api/content/search?cql=type=page&limit=25
231
- * ```
232
- *
233
- * Example response:
234
- * ```
235
- * {
236
- * "results": [
237
- * { ... },
238
- * { ... },
239
- * ...
240
- * { ... }
241
- * ],
242
- * "limit": 25,
243
- * "size": 25,
244
- * ...
245
- * "_links": {
246
- * "base": "<url>",
247
- * "context": "<url>",
248
- * "next": "/rest/api/content/search?cql=type=page&limit=25&cursor=raNDoMsTRiNg",
249
- * "self": "<url>"
250
- * }
251
- * }
252
- * ```
253
- *
254
259
  * When additional results are available, returns `next` and `prev` URLs to retrieve them in subsequent calls. The
255
260
  * URLs each contain a cursor that points to the appropriate set of results. Use `limit` to specify the number of
256
261
  * results returned in each call. Example subsequent call (taken from example response):
@@ -56,7 +56,7 @@ export class ContentAttachments {
56
56
  *
57
57
  * The media type 'multipart/form-data' is defined in [RFC 7578](https://www.ietf.org/rfc/rfc7578.txt). Most client
58
58
  * libraries have classes that make it easier to implement multipart posts, like the
59
- * [MultipartEntityBuilder](http://hc.apache.org/httpcomponents-client-5.0.x/current/httpclient5/apidocs/) Java class
59
+ * [MultipartEntityBuilder](https://hc.apache.org/httpcomponents-client-5.1.x/current/httpclient5/apidocs/) Java class
60
60
  * provided by Apache HTTP Components.
61
61
  *
62
62
  * Note, according to [RFC 7578](https://tools.ietf.org/html/rfc7578#section-4.5), in the case where the form data is
@@ -92,7 +92,7 @@ export class ContentAttachments {
92
92
  *
93
93
  * The media type 'multipart/form-data' is defined in [RFC 7578](https://www.ietf.org/rfc/rfc7578.txt). Most client
94
94
  * libraries have classes that make it easier to implement multipart posts, like the
95
- * [MultipartEntityBuilder](http://hc.apache.org/httpcomponents-client-5.0.x/current/httpclient5/apidocs/) Java class
95
+ * [MultipartEntityBuilder](https://hc.apache.org/httpcomponents-client-5.1.x/current/httpclient5/apidocs/) Java class
96
96
  * provided by Apache HTTP Components.
97
97
  *
98
98
  * Note, according to [RFC 7578](https://tools.ietf.org/html/rfc7578#section-4.5), in the case where the form data is
@@ -148,7 +148,7 @@ export class ContentAttachments {
148
148
  *
149
149
  * The media type 'multipart/form-data' is defined in [RFC 7578](https://www.ietf.org/rfc/rfc7578.txt). Most client
150
150
  * libraries have classes that make it easier to implement multipart posts, like the
151
- * [MultipartEntityBuilder](http://hc.apache.org/httpcomponents-client-5.0.x/current/httpclient5/apidocs/) Java class
151
+ * [MultipartEntityBuilder](https://hc.apache.org/httpcomponents-client-5.1.x/current/httpclient5/apidocs/) Java class
152
152
  * provided by Apache HTTP Components.
153
153
  *
154
154
  * Note, according to [RFC 7578](https://tools.ietf.org/html/rfc7578#section-4.5), in the case where the form data is
@@ -185,7 +185,7 @@ export class ContentAttachments {
185
185
  *
186
186
  * The media type 'multipart/form-data' is defined in [RFC 7578](https://www.ietf.org/rfc/rfc7578.txt). Most client
187
187
  * libraries have classes that make it easier to implement multipart posts, like the
188
- * [MultipartEntityBuilder](http://hc.apache.org/httpcomponents-client-5.0.x/current/httpclient5/apidocs/) Java class
188
+ * [MultipartEntityBuilder](https://hc.apache.org/httpcomponents-client-5.1.x/current/httpclient5/apidocs/) Java class
189
189
  * provided by Apache HTTP Components.
190
190
  *
191
191
  * Note, according to [RFC 7578](https://tools.ietf.org/html/rfc7578#section-4.5), in the case where the form data is
@@ -277,7 +277,7 @@ export class ContentAttachments {
277
277
  *
278
278
  * The media type 'multipart/form-data' is defined in [RFC 7578](https://www.ietf.org/rfc/rfc7578.txt). Most client
279
279
  * libraries have classes that make it easier to implement multipart posts, like the
280
- * [MultipartEntityBuilder](http://hc.apache.org/httpcomponents-client-5.0.x/current/httpclient5/apidocs/) Java class
280
+ * [MultipartEntityBuilder](https://hc.apache.org/httpcomponents-client-5.1.x/current/httpclient5/apidocs/) Java class
281
281
  * provided by Apache HTTP Components.
282
282
  *
283
283
  * Note, according to [RFC 7578](https://tools.ietf.org/html/rfc7578#section-4.5), in the case where the form data is
@@ -316,7 +316,7 @@ export class ContentAttachments {
316
316
  *
317
317
  * The media type 'multipart/form-data' is defined in [RFC 7578](https://www.ietf.org/rfc/rfc7578.txt). Most client
318
318
  * libraries have classes that make it easier to implement multipart posts, like the
319
- * [MultipartEntityBuilder](http://hc.apache.org/httpcomponents-client-5.0.x/current/httpclient5/apidocs/) Java class
319
+ * [MultipartEntityBuilder](https://hc.apache.org/httpcomponents-client-5.1.x/current/httpclient5/apidocs/) Java class
320
320
  * provided by Apache HTTP Components.
321
321
  *
322
322
  * Note, according to [RFC 7578](https://tools.ietf.org/html/rfc7578#section-4.5), in the case where the form data is
@@ -360,4 +360,26 @@ export class ContentAttachments {
360
360
 
361
361
  return this.client.sendRequest(config, callback, { methodName: 'updateAttachmentData' });
362
362
  }
363
+
364
+ /** Redirects the client to a URL that serves an attachment's binary data. */
365
+ async downloadAttachment<T = unknown>(
366
+ parameters: Parameters.DownloadAttachment,
367
+ callback: Callback<T>
368
+ ): Promise<void>;
369
+ /** Redirects the client to a URL that serves an attachment's binary data. */
370
+ async downloadAttachment<T = unknown>(parameters: Parameters.DownloadAttachment, callback?: never): Promise<T>;
371
+ async downloadAttachment<T = unknown>(
372
+ parameters: Parameters.DownloadAttachment,
373
+ callback?: Callback<T>,
374
+ ): Promise<void | T> {
375
+ const config: RequestConfig = {
376
+ url: `/api/content/${parameters.id}/child/attachment/${parameters.attachmentId}/download`,
377
+ method: 'GET',
378
+ params: {
379
+ version: parameters.version,
380
+ },
381
+ };
382
+
383
+ return this.client.sendRequest(config, callback, { methodName: 'downloadAttachment' });
384
+ }
363
385
  }
@@ -218,6 +218,23 @@ export class ContentChildrenAndDescendants {
218
218
  return this.client.sendRequest(config, callback, { methodName: 'getContentDescendants' });
219
219
  }
220
220
 
221
+ /** @deprecated This API will be removed in the next major version. Use `getDescendantsOfType` method instead. */
222
+ async descendantsOfType<T = Models.ContentArray>(
223
+ parameters: Parameters.DescendantsOfType,
224
+ callback: Callback<T>
225
+ ): Promise<void>;
226
+ /** @deprecated This API will be removed in the next major version. Use `getDescendantsOfType` method instead. */
227
+ async descendantsOfType<T = Models.ContentArray>(
228
+ parameters: Parameters.DescendantsOfType,
229
+ callback?: never
230
+ ): Promise<T>;
231
+ async descendantsOfType<T = Models.ContentArray>(
232
+ parameters: Parameters.DescendantsOfType,
233
+ callback?: Callback<T>,
234
+ ): Promise<void | T> {
235
+ return this.getDescendantsOfType(parameters, callback!);
236
+ }
237
+
221
238
  /**
222
239
  * Returns all descendants of a given type, for a piece of content. This is similar to [Get content children by
223
240
  * type](#api-content-id-child-type-get), except that this method returns child pages at all levels, rather than just
@@ -235,8 +252,8 @@ export class ContentChildrenAndDescendants {
235
252
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space, and
236
253
  * permission to view the content if it is a page.
237
254
  */
238
- async descendantsOfType<T = Models.ContentArray>(
239
- parameters: Parameters.DescendantsOfType,
255
+ async getDescendantsOfType<T = Models.ContentArray>(
256
+ parameters: Parameters.GetDescendantsOfType,
240
257
  callback: Callback<T>
241
258
  ): Promise<void>;
242
259
  /**
@@ -256,12 +273,12 @@ export class ContentChildrenAndDescendants {
256
273
  * **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space, and
257
274
  * permission to view the content if it is a page.
258
275
  */
259
- async descendantsOfType<T = Models.ContentArray>(
260
- parameters: Parameters.DescendantsOfType,
276
+ async getDescendantsOfType<T = Models.ContentArray>(
277
+ parameters: Parameters.GetDescendantsOfType,
261
278
  callback?: never
262
279
  ): Promise<T>;
263
- async descendantsOfType<T = Models.ContentArray>(
264
- parameters: Parameters.DescendantsOfType,
280
+ async getDescendantsOfType<T = Models.ContentArray>(
281
+ parameters: Parameters.GetDescendantsOfType,
265
282
  callback?: Callback<T>,
266
283
  ): Promise<void | T> {
267
284
  const config: RequestConfig = {
@@ -271,6 +288,7 @@ export class ContentChildrenAndDescendants {
271
288
  depth: parameters.depth,
272
289
  start: parameters.start,
273
290
  limit: parameters.limit,
291
+ expand: parameters.expand,
274
292
  },
275
293
  };
276
294
 
@@ -283,17 +301,6 @@ export class ContentChildrenAndDescendants {
283
301
  * copied page is defined using the destinationPageId in the request body. The titleOptions object defines the rules
284
302
  * of renaming page titles during the copy; for example, search and replace can be used in conjunction to rewrite the
285
303
  * copied page titles.
286
- *
287
- * Response example:
288
- * <pre>
289
- * {
290
- * "id" : "1180606",
291
- * "links" : {
292
- * "status" : "/rest/api/longtask/1180606"
293
- * }
294
- * }
295
- * </pre>
296
- * Use the /longtask/<taskId> REST API to get the copy task status.
297
304
  */
298
305
  async copyPageHierarchy<T = unknown>(parameters: Parameters.CopyPageHierarchy, callback: Callback<T>): Promise<void>;
299
306
  /**
@@ -302,17 +309,6 @@ export class ContentChildrenAndDescendants {
302
309
  * copied page is defined using the destinationPageId in the request body. The titleOptions object defines the rules
303
310
  * of renaming page titles during the copy; for example, search and replace can be used in conjunction to rewrite the
304
311
  * copied page titles.
305
- *
306
- * Response example:
307
- * <pre>
308
- * {
309
- * "id" : "1180606",
310
- * "links" : {
311
- * "status" : "/rest/api/longtask/1180606"
312
- * }
313
- * }
314
- * </pre>
315
- * Use the /longtask/<taskId> REST API to get the copy task status.
316
312
  */
317
313
  async copyPageHierarchy<T = unknown>(parameters: Parameters.CopyPageHierarchy, callback?: never): Promise<T>;
318
314
  async copyPageHierarchy<T = unknown>(