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.
- package/CHANGELOG.md +49 -0
- package/README.md +1 -57
- package/out/api/content.d.ts +24 -52
- package/out/api/content.js +15 -0
- package/out/api/contentAttachments.d.ts +10 -6
- package/out/api/contentAttachments.js +13 -0
- package/out/api/contentChildrenAndDescendants.d.ts +6 -24
- package/out/api/contentChildrenAndDescendants.js +6 -0
- package/out/api/contentPermissions.d.ts +6 -2
- package/out/api/contentPermissions.js +6 -1
- package/out/api/contentProperties.js +2 -0
- package/out/api/contentWatches.d.ts +2 -2
- package/out/api/experimental.d.ts +52 -0
- package/out/api/experimental.js +70 -0
- package/out/api/group.d.ts +30 -10
- package/out/api/group.js +31 -2
- package/out/api/index.d.ts +1 -0
- package/out/api/index.js +1 -0
- package/out/api/inlineTasks.d.ts +28 -0
- package/out/api/inlineTasks.js +21 -0
- package/out/api/models/getViewers.d.ts +6 -0
- package/out/api/models/getViewers.js +2 -0
- package/out/api/models/getViews.d.ts +6 -0
- package/out/api/models/getViews.js +2 -0
- package/out/api/models/groupCreate.d.ts +4 -0
- package/out/api/models/groupCreate.js +2 -0
- package/out/api/models/horizontalHeaderLookAndFeel.d.ts +11 -0
- package/out/api/models/horizontalHeaderLookAndFeel.js +2 -0
- package/out/api/models/index.d.ts +13 -4
- package/out/api/models/index.js +13 -4
- package/out/api/models/lookAndFeel.d.ts +3 -0
- package/out/api/models/spacePermissionCreate.d.ts +33 -0
- package/out/api/models/spacePermissionCreate.js +2 -0
- package/out/api/models/spacePermissionCustomContent.d.ts +16 -0
- package/out/api/models/spacePermissionCustomContent.js +2 -0
- package/out/api/models/spacePermissionRequest.d.ts +41 -0
- package/out/api/models/spacePermissionRequest.js +2 -0
- package/out/api/models/spacePrivateCreate.d.ts +9 -0
- package/out/api/models/spacePropertyCreate.d.ts +4 -0
- package/out/api/models/spaceUpdate.d.ts +4 -0
- package/out/api/models/taskStatusUpdate.d.ts +3 -0
- package/out/api/models/taskStatusUpdate.js +2 -0
- package/out/api/models/topNavigationLookAndFeel.d.ts +8 -0
- package/out/api/models/topNavigationLookAndFeel.js +2 -0
- package/out/api/parameters/addCustomContentPermissions.d.ts +5 -0
- package/out/api/parameters/addCustomContentPermissions.js +2 -0
- package/out/api/parameters/addLabelsToSpace.d.ts +4 -0
- package/out/api/parameters/addLabelsToSpace.js +2 -0
- package/out/api/parameters/addPermissionToSpace.d.ts +5 -0
- package/out/api/parameters/addPermissionToSpace.js +2 -0
- package/out/api/parameters/addUserToGroup.d.ts +2 -1
- package/out/api/parameters/addUserToGroupByGroupId.d.ts +2 -1
- package/out/api/parameters/archivePages.d.ts +6 -0
- package/out/api/parameters/archivePages.js +2 -0
- package/out/api/parameters/checkContentPermission.d.ts +5 -0
- package/out/api/parameters/checkContentPermission.js +2 -0
- package/out/api/parameters/deleteLabelFromSpace.d.ts +8 -0
- package/out/api/parameters/deleteLabelFromSpace.js +2 -0
- package/out/api/parameters/deleteRelationship.d.ts +38 -0
- package/out/api/parameters/deleteRelationship.js +2 -0
- package/out/api/parameters/downloadAttachment.d.ts +11 -0
- package/out/api/parameters/downloadAttachment.js +2 -0
- package/out/api/parameters/getBulkUserLookup.d.ts +0 -6
- package/out/api/parameters/getContentById.d.ts +85 -1
- package/out/api/parameters/getContentById.js +87 -0
- package/out/api/parameters/getContentChildren.d.ts +1 -0
- package/out/api/parameters/getContentProperties.d.ts +2 -0
- package/out/api/parameters/getContentProperty.d.ts +12 -0
- package/out/api/parameters/getContentVersions.d.ts +1 -1
- package/out/api/parameters/getCurrentUser.d.ts +1 -6
- package/out/api/parameters/getDescendantsOfType.d.ts +101 -0
- package/out/api/parameters/getDescendantsOfType.js +89 -0
- package/out/api/parameters/getGroupByName.d.ts +4 -0
- package/out/api/parameters/getGroupByName.js +2 -0
- package/out/api/parameters/getGroups.d.ts +2 -0
- package/out/api/parameters/getHistoryForContent.d.ts +1 -1
- package/out/api/parameters/getLabelsForSpace.d.ts +18 -0
- package/out/api/parameters/getLabelsForSpace.js +2 -0
- package/out/api/parameters/getTaskById.d.ts +4 -0
- package/out/api/parameters/getTaskById.js +2 -0
- package/out/api/parameters/getViewers.d.ts +6 -0
- package/out/api/parameters/getViewers.js +2 -0
- package/out/api/parameters/getViews.d.ts +6 -0
- package/out/api/parameters/getViews.js +2 -0
- package/out/api/parameters/index.d.ts +134 -116
- package/out/api/parameters/index.js +134 -116
- package/out/api/parameters/publishLegacyDraft.d.ts +3 -1
- package/out/api/parameters/publishSharedDraft.d.ts +3 -1
- package/out/api/parameters/restoreContentVersion.d.ts +1 -1
- package/out/api/parameters/searchByCQL.d.ts +34 -0
- package/out/api/parameters/searchByCQL.js +2 -0
- package/out/api/parameters/searchGroups.d.ts +8 -0
- package/out/api/parameters/searchGroups.js +2 -0
- package/out/api/parameters/searchUser.d.ts +27 -0
- package/out/api/parameters/searchUser.js +2 -0
- package/out/api/parameters/updateTaskById.d.ts +5 -0
- package/out/api/parameters/updateTaskById.js +2 -0
- package/out/api/relation.d.ts +12 -4
- package/out/api/relation.js +12 -2
- package/out/api/search.d.ts +12 -64
- package/out/api/search.js +19 -2
- package/out/api/settings.d.ts +2 -2
- package/out/api/settings.js +3 -0
- package/out/api/space.js +5 -1
- package/out/api/spacePermissions.d.ts +26 -2
- package/out/api/spacePermissions.js +20 -3
- package/out/api/spaceProperties.d.ts +4 -4
- package/out/api/spaceProperties.js +1 -0
- package/out/api/template.d.ts +24 -16
- package/out/clients/baseClient.d.ts +2 -5
- package/out/clients/baseClient.js +4 -30
- package/out/clients/client.d.ts +2 -3
- package/out/clients/confluenceClient.d.ts +2 -1
- package/out/clients/confluenceClient.js +1 -0
- package/out/config.d.ts +3 -2
- package/out/index.d.ts +1 -0
- package/out/index.js +2 -1
- package/package.json +24 -24
- package/src/api/content.ts +58 -52
- package/src/api/contentAttachments.ts +29 -6
- package/src/api/contentChildrenAndDescendants.ts +24 -28
- package/src/api/contentPermissions.ts +24 -7
- package/src/api/contentProperties.ts +2 -0
- package/src/api/contentWatches.ts +3 -3
- package/src/api/experimental.ts +137 -0
- package/src/api/group.ts +71 -19
- package/src/api/index.ts +1 -0
- package/src/api/inlineTasks.ts +52 -0
- package/src/api/models/getViewers.ts +6 -0
- package/src/api/models/getViews.ts +6 -0
- package/src/api/models/groupCreate.ts +4 -0
- package/src/api/models/horizontalHeaderLookAndFeel.ts +12 -0
- package/src/api/models/index.ts +13 -4
- package/src/api/models/lookAndFeel.ts +3 -0
- package/src/api/models/spacePermissionCreate.ts +34 -0
- package/src/api/models/spacePermissionCustomContent.ts +17 -0
- package/src/api/models/spacePermissionRequest.ts +42 -0
- package/src/api/models/spacePrivateCreate.ts +9 -0
- package/src/api/models/spacePropertyCreate.ts +4 -0
- package/src/api/models/spaceUpdate.ts +4 -0
- package/src/api/models/taskStatusUpdate.ts +3 -0
- package/src/api/models/topNavigationLookAndFeel.ts +8 -0
- package/src/api/parameters/addCustomContentPermissions.ts +6 -0
- package/src/api/parameters/addLabelsToSpace.ts +4 -0
- package/src/api/parameters/addPermissionToSpace.ts +6 -0
- package/src/api/parameters/addUserToGroup.ts +3 -1
- package/src/api/parameters/addUserToGroupByGroupId.ts +3 -1
- package/src/api/parameters/archivePages.ts +6 -0
- package/src/api/parameters/checkContentPermission.ts +6 -0
- package/src/api/parameters/deleteLabelFromSpace.ts +8 -0
- package/src/api/parameters/deleteRelationship.ts +38 -0
- package/src/api/parameters/downloadAttachment.ts +11 -0
- package/src/api/parameters/getBulkUserLookup.ts +0 -6
- package/src/api/parameters/getContentById.ts +86 -1
- package/src/api/parameters/getContentChildren.ts +1 -0
- package/src/api/parameters/getContentProperties.ts +2 -0
- package/src/api/parameters/getContentProperty.ts +12 -0
- package/src/api/parameters/getContentVersions.ts +1 -1
- package/src/api/parameters/getCurrentUser.ts +1 -6
- package/src/api/parameters/getDescendantsOfType.ts +102 -0
- package/src/api/parameters/getGroupByName.ts +4 -0
- package/src/api/parameters/getGroups.ts +2 -0
- package/src/api/parameters/getHistoryForContent.ts +1 -1
- package/src/api/parameters/getLabelsForSpace.ts +18 -0
- package/src/api/parameters/getTaskById.ts +4 -0
- package/src/api/parameters/getViewers.ts +6 -0
- package/src/api/parameters/getViews.ts +6 -0
- package/src/api/parameters/index.ts +134 -116
- package/src/api/parameters/publishLegacyDraft.ts +4 -1
- package/src/api/parameters/publishSharedDraft.ts +4 -1
- package/src/api/parameters/restoreContentVersion.ts +1 -1
- package/src/api/parameters/searchByCQL.ts +34 -0
- package/src/api/parameters/searchGroups.ts +8 -0
- package/src/api/parameters/searchUser.ts +27 -0
- package/src/api/parameters/updateTaskById.ts +6 -0
- package/src/api/relation.ts +33 -8
- package/src/api/search.ts +53 -73
- package/src/api/settings.ts +6 -3
- package/src/api/space.ts +4 -1
- package/src/api/spacePermissions.ts +66 -8
- package/src/api/spaceProperties.ts +5 -4
- package/src/api/template.ts +24 -16
- package/src/clients/baseClient.ts +4 -60
- package/src/clients/client.ts +2 -3
- package/src/clients/confluenceClient.ts +2 -0
- package/src/config.ts +3 -2
- package/src/index.ts +1 -0
- package/tsconfig.json +2 -1
package/out/api/template.d.ts
CHANGED
|
@@ -22,15 +22,15 @@ export declare class Template {
|
|
|
22
22
|
/**
|
|
23
23
|
* Updates a content template. Note, blueprint templates cannot be updated via the REST API.
|
|
24
24
|
*
|
|
25
|
-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to
|
|
26
|
-
* space template or 'Confluence Administrator' global permission to
|
|
25
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to update a
|
|
26
|
+
* space template or 'Confluence Administrator' global permission to update a global template.
|
|
27
27
|
*/
|
|
28
28
|
updateContentTemplate<T = Models.ContentTemplate>(parameters: Parameters.UpdateContentTemplate | undefined, callback: Callback<T>): Promise<void>;
|
|
29
29
|
/**
|
|
30
30
|
* Updates a content template. Note, blueprint templates cannot be updated via the REST API.
|
|
31
31
|
*
|
|
32
|
-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to
|
|
33
|
-
* space template or 'Confluence Administrator' global permission to
|
|
32
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to update a
|
|
33
|
+
* space template or 'Confluence Administrator' global permission to update a global template.
|
|
34
34
|
*/
|
|
35
35
|
updateContentTemplate<T = Models.ContentTemplate>(parameters?: Parameters.UpdateContentTemplate, callback?: never): Promise<T>;
|
|
36
36
|
/**
|
|
@@ -40,8 +40,9 @@ export declare class Template {
|
|
|
40
40
|
* Note, all global blueprints are inherited by each space. Space blueprints can be customised without affecting the
|
|
41
41
|
* global blueprints.
|
|
42
42
|
*
|
|
43
|
-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
|
|
44
|
-
* ('Can use' global permission)
|
|
43
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
|
|
44
|
+
* blueprints for the space and permission to access the Confluence site ('Can use' global permission) to view global
|
|
45
|
+
* blueprints.
|
|
45
46
|
*/
|
|
46
47
|
getBlueprintTemplates<T = Models.BlueprintTemplateArray>(parameters: Parameters.GetBlueprintTemplates | undefined, callback: Callback<T>): Promise<void>;
|
|
47
48
|
/**
|
|
@@ -51,38 +52,39 @@ export declare class Template {
|
|
|
51
52
|
* Note, all global blueprints are inherited by each space. Space blueprints can be customised without affecting the
|
|
52
53
|
* global blueprints.
|
|
53
54
|
*
|
|
54
|
-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
|
|
55
|
-
* ('Can use' global permission)
|
|
55
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
|
|
56
|
+
* blueprints for the space and permission to access the Confluence site ('Can use' global permission) to view global
|
|
57
|
+
* blueprints.
|
|
56
58
|
*/
|
|
57
59
|
getBlueprintTemplates<T = Models.BlueprintTemplateArray>(parameters?: Parameters.GetBlueprintTemplates, callback?: never): Promise<T>;
|
|
58
60
|
/**
|
|
59
61
|
* Returns all content templates. Use this method to retrieve all global content templates or all content templates in a space.
|
|
60
62
|
*
|
|
61
|
-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: '
|
|
62
|
-
* space templates and
|
|
63
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
|
|
64
|
+
* space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
|
|
63
65
|
*/
|
|
64
66
|
getContentTemplates<T = Models.ContentTemplateArray>(parameters: Parameters.GetContentTemplates | undefined, callback: Callback<T>): Promise<void>;
|
|
65
67
|
/**
|
|
66
68
|
* Returns all content templates. Use this method to retrieve all global content templates or all content templates in a space.
|
|
67
69
|
*
|
|
68
|
-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: '
|
|
69
|
-
* space templates and
|
|
70
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
|
|
71
|
+
* space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
|
|
70
72
|
*/
|
|
71
73
|
getContentTemplates<T = Models.ContentTemplateArray>(parameters?: Parameters.GetContentTemplates, callback?: never): Promise<T>;
|
|
72
74
|
/**
|
|
73
75
|
* Returns a content template. This includes information about template, like the name, the space or blueprint that
|
|
74
76
|
* the template is in, the body of the template, and more.
|
|
75
77
|
*
|
|
76
|
-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: '
|
|
77
|
-
* space templates and
|
|
78
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
|
|
79
|
+
* space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
|
|
78
80
|
*/
|
|
79
81
|
getContentTemplate<T = Models.ContentTemplate>(parameters: Parameters.GetContentTemplate, callback: Callback<T>): Promise<void>;
|
|
80
82
|
/**
|
|
81
83
|
* Returns a content template. This includes information about template, like the name, the space or blueprint that
|
|
82
84
|
* the template is in, the body of the template, and more.
|
|
83
85
|
*
|
|
84
|
-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: '
|
|
85
|
-
* space templates and
|
|
86
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' permission for the space to view
|
|
87
|
+
* space templates and permission to access the Confluence site ('Can use' global permission) to view global templates.
|
|
86
88
|
*/
|
|
87
89
|
getContentTemplate<T = Models.ContentTemplate>(parameters: Parameters.GetContentTemplate, callback?: never): Promise<T>;
|
|
88
90
|
/**
|
|
@@ -94,6 +96,9 @@ export declare class Template {
|
|
|
94
96
|
* - If the template is a modified global-level blueprint template, it reverts to the default global-level blueprint template.
|
|
95
97
|
*
|
|
96
98
|
* Note, unmodified blueprint templates cannot be deleted.
|
|
99
|
+
*
|
|
100
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to delete a
|
|
101
|
+
* space template or 'Confluence Administrator' global permission to delete a global template.
|
|
97
102
|
*/
|
|
98
103
|
removeTemplate<T = void>(parameters: Parameters.RemoveTemplate, callback: Callback<T>): Promise<void>;
|
|
99
104
|
/**
|
|
@@ -105,6 +110,9 @@ export declare class Template {
|
|
|
105
110
|
* - If the template is a modified global-level blueprint template, it reverts to the default global-level blueprint template.
|
|
106
111
|
*
|
|
107
112
|
* Note, unmodified blueprint templates cannot be deleted.
|
|
113
|
+
*
|
|
114
|
+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space to delete a
|
|
115
|
+
* space template or 'Confluence Administrator' global permission to delete a global template.
|
|
108
116
|
*/
|
|
109
117
|
removeTemplate<T = void>(parameters: Parameters.RemoveTemplate, callback?: never): Promise<T>;
|
|
110
118
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Telemetry } from 'telemetry.confluence.js';
|
|
2
1
|
import type { Client } from './client';
|
|
3
2
|
import type { Callback } from '../callback';
|
|
4
3
|
import type { Config } from '../config';
|
|
@@ -6,14 +5,12 @@ import type { RequestConfig } from '../requestConfig';
|
|
|
6
5
|
export declare class BaseClient implements Client {
|
|
7
6
|
#private;
|
|
8
7
|
protected readonly config: Config;
|
|
9
|
-
private telemetryClient;
|
|
10
8
|
protected urlSuffix: string;
|
|
11
9
|
constructor(config: Config);
|
|
12
10
|
protected paramSerializer(parameters: Record<string, any>): string;
|
|
13
11
|
protected encode(value: string): string;
|
|
14
12
|
protected removeUndefinedProperties(obj: Record<string, any>): Record<string, any>;
|
|
15
13
|
private get instance();
|
|
16
|
-
sendRequest<T>(requestConfig: RequestConfig, callback: never, telemetryData?:
|
|
17
|
-
sendRequest<T>(requestConfig: RequestConfig, callback: Callback<T>, telemetryData?:
|
|
18
|
-
private get authenticationType();
|
|
14
|
+
sendRequest<T>(requestConfig: RequestConfig, callback: never, telemetryData?: any): Promise<T>;
|
|
15
|
+
sendRequest<T>(requestConfig: RequestConfig, callback: Callback<T>, telemetryData?: any): Promise<void>;
|
|
19
16
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.BaseClient = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const axios_1 = require("axios");
|
|
7
|
-
const telemetry_confluence_js_1 = require("telemetry.confluence.js");
|
|
8
7
|
const authenticationService_1 = require("../services/authenticationService");
|
|
9
8
|
const ATLASSIAN_TOKEN_CHECK_FLAG = 'X-Atlassian-Token';
|
|
10
9
|
const ATLASSIAN_TOKEN_CHECK_NOCHECK_VALUE = 'no-check';
|
|
@@ -13,7 +12,6 @@ class BaseClient {
|
|
|
13
12
|
this.config = config;
|
|
14
13
|
_BaseClient_instance.set(this, void 0);
|
|
15
14
|
this.urlSuffix = '/wiki/rest/';
|
|
16
|
-
this.telemetryClient = new telemetry_confluence_js_1.TelemetryClient(config.telemetry);
|
|
17
15
|
}
|
|
18
16
|
paramSerializer(parameters) {
|
|
19
17
|
const parts = [];
|
|
@@ -60,11 +58,9 @@ class BaseClient {
|
|
|
60
58
|
(0, tslib_1.__classPrivateFieldSet)(this, _BaseClient_instance, axios_1.default.create(Object.assign(Object.assign({ paramsSerializer: this.paramSerializer.bind(this) }, this.config.baseRequestConfig), { baseURL: `${this.config.host}${this.urlSuffix}`, headers: this.removeUndefinedProperties(Object.assign({ [ATLASSIAN_TOKEN_CHECK_FLAG]: this.config.noCheckAtlassianToken ? ATLASSIAN_TOKEN_CHECK_NOCHECK_VALUE : undefined }, (_a = this.config.baseRequestConfig) === null || _a === void 0 ? void 0 : _a.headers)) })), "f");
|
|
61
59
|
return (0, tslib_1.__classPrivateFieldGet)(this, _BaseClient_instance, "f");
|
|
62
60
|
}
|
|
63
|
-
sendRequest(requestConfig, callback
|
|
64
|
-
var _a, _b, _c, _d
|
|
61
|
+
sendRequest(requestConfig, callback) {
|
|
62
|
+
var _a, _b, _c, _d;
|
|
65
63
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
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);
|
|
68
64
|
try {
|
|
69
65
|
const modifiedRequestConfig = Object.assign(Object.assign({}, requestConfig), { headers: this.removeUndefinedProperties(Object.assign({ Authorization: yield authenticationService_1.AuthenticationService.getAuthenticationToken(this.config.authentication, {
|
|
70
66
|
baseURL: this.config.host,
|
|
@@ -75,8 +71,7 @@ class BaseClient {
|
|
|
75
71
|
const callbackResponseHandler = callback && ((data) => callback(null, data));
|
|
76
72
|
const defaultResponseHandler = (data) => data;
|
|
77
73
|
const responseHandler = callbackResponseHandler !== null && callbackResponseHandler !== void 0 ? callbackResponseHandler : defaultResponseHandler;
|
|
78
|
-
(
|
|
79
|
-
telemetry.requestStatusCode = response.status;
|
|
74
|
+
(_b = (_a = this.config.middlewares) === null || _a === void 0 ? void 0 : _a.onResponse) === null || _b === void 0 ? void 0 : _b.call(_a, response.data);
|
|
80
75
|
return responseHandler(response.data);
|
|
81
76
|
}
|
|
82
77
|
catch (e) {
|
|
@@ -85,32 +80,11 @@ class BaseClient {
|
|
|
85
80
|
throw error;
|
|
86
81
|
};
|
|
87
82
|
const errorHandler = callbackErrorHandler !== null && callbackErrorHandler !== void 0 ? callbackErrorHandler : defaultErrorHandler;
|
|
88
|
-
(
|
|
89
|
-
telemetry.requestStatusCode = e.isAxiosError ? (_h = (_g = e.response) === null || _g === void 0 ? void 0 : _g.status) !== null && _h !== void 0 ? _h : 0 : 418;
|
|
83
|
+
(_d = (_c = this.config.middlewares) === null || _c === void 0 ? void 0 : _c.onError) === null || _d === void 0 ? void 0 : _d.call(_c, e);
|
|
90
84
|
return errorHandler(e);
|
|
91
85
|
}
|
|
92
|
-
finally {
|
|
93
|
-
telemetry.requestEndTime = new Date();
|
|
94
|
-
this.telemetryClient.sendTelemetry(telemetry);
|
|
95
|
-
}
|
|
96
86
|
});
|
|
97
87
|
}
|
|
98
|
-
get authenticationType() {
|
|
99
|
-
const { authentication } = this.config;
|
|
100
|
-
if (!authentication) {
|
|
101
|
-
return telemetry_confluence_js_1.Authentication.None;
|
|
102
|
-
}
|
|
103
|
-
if (authentication.basic) {
|
|
104
|
-
return telemetry_confluence_js_1.Authentication.Basic;
|
|
105
|
-
}
|
|
106
|
-
if (authentication.oauth2) {
|
|
107
|
-
return telemetry_confluence_js_1.Authentication.OAuth2;
|
|
108
|
-
}
|
|
109
|
-
if (authentication.jwt) {
|
|
110
|
-
return telemetry_confluence_js_1.Authentication.JWT;
|
|
111
|
-
}
|
|
112
|
-
return telemetry_confluence_js_1.Authentication.NA;
|
|
113
|
-
}
|
|
114
88
|
}
|
|
115
89
|
exports.BaseClient = BaseClient;
|
|
116
90
|
_BaseClient_instance = new WeakMap();
|
package/out/clients/client.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { Telemetry } from 'telemetry.confluence.js';
|
|
2
1
|
import type { Callback } from '../callback';
|
|
3
2
|
import type { RequestConfig } from '../requestConfig';
|
|
4
3
|
export interface Client {
|
|
5
|
-
sendRequest<T>(requestConfig: RequestConfig, callback?: never, telemetryData?:
|
|
6
|
-
sendRequest<T>(requestConfig: RequestConfig, callback?: Callback<T>, telemetryData?:
|
|
4
|
+
sendRequest<T>(requestConfig: RequestConfig, callback?: never, telemetryData?: any): Promise<T>;
|
|
5
|
+
sendRequest<T>(requestConfig: RequestConfig, callback?: Callback<T>, telemetryData?: any): Promise<void>;
|
|
7
6
|
}
|
|
@@ -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/out/config.d.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
|
export interface Config {
|
|
@@ -7,6 +6,7 @@ export interface Config {
|
|
|
7
6
|
baseRequestConfig?: Config.BaseRequestConfig;
|
|
8
7
|
authentication?: Config.Authentication;
|
|
9
8
|
middlewares?: Config.Middlewares;
|
|
9
|
+
/** @deprecated Disabled. Will be removed in the next major version. */
|
|
10
10
|
telemetry?: Config.Telemetry;
|
|
11
11
|
/**
|
|
12
12
|
* Adds `'X-Atlassian-Token': 'no-check'` to each request header
|
|
@@ -16,7 +16,8 @@ export interface Config {
|
|
|
16
16
|
export declare namespace Config {
|
|
17
17
|
type BaseRequestConfig = RequestConfig;
|
|
18
18
|
type Error = AxiosError;
|
|
19
|
-
|
|
19
|
+
/** @deprecated Disabled. Will be removed in the next major version. */
|
|
20
|
+
type Telemetry = boolean | any;
|
|
20
21
|
type Authentication = UtilityTypes.XOR<{
|
|
21
22
|
jwt: Authentication.JWT;
|
|
22
23
|
}, UtilityTypes.XOR<{
|
package/out/index.d.ts
CHANGED
package/out/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Parameters = exports.Models = exports.Api = void 0;
|
|
3
|
+
exports.Parameters = exports.Models = exports.Server = exports.Api = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
(0, tslib_1.__exportStar)(require("./clients"), exports);
|
|
6
6
|
(0, tslib_1.__exportStar)(require("./config"), exports);
|
|
7
7
|
(0, tslib_1.__exportStar)(require("./requestConfig"), exports);
|
|
8
8
|
(0, tslib_1.__exportStar)(require("./callback"), exports);
|
|
9
9
|
exports.Api = require("./api");
|
|
10
|
+
exports.Server = require("./server");
|
|
10
11
|
exports.Models = require("./api/models");
|
|
11
12
|
exports.Parameters = require("./api/parameters");
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "confluence.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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
|
+
"author": "Vladislav Tupikin <mrrefactoring@yandex.ru>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://mrrefactoring.github.io/confluence.js",
|
|
8
|
+
"repository": "https://github.com/MrRefactoring/confluence.js.git",
|
|
5
9
|
"main": "out/index.js",
|
|
6
10
|
"types": "out/index.d.ts",
|
|
7
11
|
"scripts": {
|
|
8
12
|
"build": "tsc",
|
|
9
13
|
"prepublishOnly": "npm run build && npm run test && npm run lint",
|
|
10
14
|
"test": "npm run test:unit && npm run test:e2e",
|
|
11
|
-
"test:unit": "jest tests/unit",
|
|
15
|
+
"test:unit": "jest tests/unit --verbose",
|
|
12
16
|
"test:e2e": "jest tests/e2e --setupFiles=./tests/setup.ts --runInBand",
|
|
13
17
|
"prettier": "prettier --write src/**/*.ts",
|
|
14
|
-
"doc": "typedoc --name Confluence.js --out docs ./src",
|
|
18
|
+
"doc": "typedoc --name \"Confluence.js - Cloud and Server API library\" --out docs ./src/index.ts --plugin typedoc-plugin-extras --footerDate --footerTime --footerTypedocVersion --favicon https://svgshare.com/i/bVi.svg",
|
|
15
19
|
"lint": "eslint src --ext .ts",
|
|
16
20
|
"lint:fix": "npm run lint -- --fix"
|
|
17
21
|
},
|
|
@@ -19,7 +23,6 @@
|
|
|
19
23
|
"preset": "ts-jest",
|
|
20
24
|
"testEnvironment": "node"
|
|
21
25
|
},
|
|
22
|
-
"repository": "https://github.com/MrRefactoring/confluence.js.git",
|
|
23
26
|
"keywords": [
|
|
24
27
|
"confluence",
|
|
25
28
|
"api",
|
|
@@ -29,35 +32,32 @@
|
|
|
29
32
|
"wiki",
|
|
30
33
|
"atlassian"
|
|
31
34
|
],
|
|
32
|
-
"author": "Vladislav Tupikin <mrrefactoring@yandex.ru>",
|
|
33
|
-
"license": "MIT",
|
|
34
|
-
"homepage": "https://github.com/MrRefactoring/confluence.js#readme",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/express": "^4.17.13",
|
|
37
|
-
"@types/jest": "^
|
|
37
|
+
"@types/jest": "^27.0.3",
|
|
38
38
|
"@types/oauth": "^0.9.1",
|
|
39
|
-
"@types/sinon": "^10.0.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
41
|
-
"@typescript-eslint/parser": "^
|
|
39
|
+
"@types/sinon": "^10.0.6",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
41
|
+
"@typescript-eslint/parser": "^5.6.0",
|
|
42
42
|
"dotenv": "^10.0.0",
|
|
43
|
-
"eslint": "^
|
|
44
|
-
"eslint-config-airbnb": "^
|
|
45
|
-
"eslint-config-airbnb-typescript": "^
|
|
43
|
+
"eslint": "^8.4.1",
|
|
44
|
+
"eslint-config-airbnb": "^19.0.2",
|
|
45
|
+
"eslint-config-airbnb-typescript": "^16.1.0",
|
|
46
46
|
"eslint-import-resolver-typescript": "^2.5.0",
|
|
47
|
-
"eslint-plugin-import": "^2.
|
|
48
|
-
"jest": "^
|
|
49
|
-
"prettier": "^2.
|
|
50
|
-
"prettier-plugin-jsdoc": "^0.3.
|
|
51
|
-
"sinon": "^
|
|
52
|
-
"ts-jest": "^
|
|
53
|
-
"typedoc": "^0.22.
|
|
54
|
-
"
|
|
47
|
+
"eslint-plugin-import": "^2.25.3",
|
|
48
|
+
"jest": "^27.4.3",
|
|
49
|
+
"prettier": "^2.5.1",
|
|
50
|
+
"prettier-plugin-jsdoc": "^0.3.30",
|
|
51
|
+
"sinon": "^12.0.1",
|
|
52
|
+
"ts-jest": "^27.1.1",
|
|
53
|
+
"typedoc": "^0.22.10",
|
|
54
|
+
"typedoc-plugin-extras": "^2.2.1",
|
|
55
|
+
"typescript": "^4.5.2"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
58
|
"atlassian-jwt": "^2.0.2",
|
|
58
|
-
"axios": "^0.
|
|
59
|
+
"axios": "^0.24.0",
|
|
59
60
|
"oauth": "^0.9.15",
|
|
60
|
-
"telemetry.confluence.js": "<2",
|
|
61
61
|
"tslib": "^2.3.1"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/api/content.ts
CHANGED
|
@@ -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):
|
|
@@ -314,6 +319,7 @@ export class Content {
|
|
|
314
319
|
version: parameters.version,
|
|
315
320
|
embeddedContentRender: parameters.embeddedContentRender,
|
|
316
321
|
trigger: parameters.trigger,
|
|
322
|
+
expand: parameters.expand,
|
|
317
323
|
},
|
|
318
324
|
};
|
|
319
325
|
|
|
@@ -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](
|
|
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](
|
|
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](
|
|
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](
|
|
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](
|
|
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](
|
|
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,27 @@ 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 = ArrayBuffer>(
|
|
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 = ArrayBuffer>(parameters: Parameters.DownloadAttachment, callback?: never): Promise<T>;
|
|
371
|
+
async downloadAttachment<T = ArrayBuffer>(
|
|
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
|
+
responseType: 'arraybuffer',
|
|
379
|
+
params: {
|
|
380
|
+
version: parameters.version,
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
return this.client.sendRequest(config, callback, { methodName: 'downloadAttachment' });
|
|
385
|
+
}
|
|
363
386
|
}
|