confluence.js 1.4.1 → 1.5.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 +4 -0
- package/out/api/contentAttachments.d.ts +17 -176
- package/out/api/contentAttachments.js +46 -4
- package/out/api/contentAttachments.js.map +1 -1
- package/out/api/models/attachment.d.ts +30 -0
- package/out/api/models/attachment.js +3 -0
- package/out/api/models/attachment.js.map +1 -0
- package/out/api/models/attachmentContainer.d.ts +27 -0
- package/out/api/models/attachmentContainer.js +3 -0
- package/out/api/models/attachmentContainer.js.map +1 -0
- package/out/api/models/attachmentMetadata.d.ts +20 -0
- package/out/api/models/attachmentMetadata.js +3 -0
- package/out/api/models/attachmentMetadata.js.map +1 -0
- package/out/api/models/attachmentUpdate.d.ts +1 -0
- package/out/api/models/contentArray.d.ts +4 -4
- package/out/api/models/createdAttachment.d.ts +7 -0
- package/out/api/models/createdAttachment.js +3 -0
- package/out/api/models/createdAttachment.js.map +1 -0
- package/out/api/models/genericLinks.d.ts +11 -1
- package/out/api/models/index.d.ts +4 -0
- package/out/api/models/index.js +4 -0
- package/out/api/models/index.js.map +1 -1
- package/out/api/parameters/createAttachments.d.ts +13 -2
- package/out/api/parameters/createOrUpdateAttachments.d.ts +4 -2
- package/out/api/parameters/getAttachments.d.ts +1 -1
- package/out/api/parameters/getAttachments.js.map +1 -1
- package/out/api/parameters/updateAttachmentData.d.ts +4 -2
- package/out/api/parameters/updateAttachmentProperties.d.ts +45 -2
- package/out/clients/baseClient.js +3 -2
- package/out/clients/baseClient.js.map +1 -1
- package/out/config.d.ts +2 -0
- package/out/paramSerializer.js +1 -1
- package/out/paramSerializer.js.map +1 -1
- package/package.json +12 -10
- package/src/api/contentAttachments.ts +85 -197
- package/src/api/models/attachment.ts +31 -0
- package/src/api/models/attachmentContainer.ts +28 -0
- package/src/api/models/attachmentMetadata.ts +21 -0
- package/src/api/models/attachmentUpdate.ts +1 -0
- package/src/api/models/contentArray.ts +4 -4
- package/src/api/models/createdAttachment.ts +8 -0
- package/src/api/models/genericLinks.ts +12 -1
- package/src/api/models/index.ts +4 -0
- package/src/api/parameters/createAttachments.ts +12 -2
- package/src/api/parameters/createOrUpdateAttachments.ts +5 -2
- package/src/api/parameters/getAttachments.ts +71 -1
- package/src/api/parameters/updateAttachmentData.ts +5 -2
- package/src/api/parameters/updateAttachmentProperties.ts +59 -2
- package/src/clients/baseClient.ts +4 -2
- package/src/config.ts +2 -0
- package/src/paramSerializer.ts +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AttachmentMetadata } from './attachmentMetadata';
|
|
2
|
+
import { GenericLinks } from './genericLinks';
|
|
3
|
+
|
|
4
|
+
export interface Attachment {
|
|
5
|
+
id: string;
|
|
6
|
+
type: 'attachment' | string;
|
|
7
|
+
status: 'current' | string;
|
|
8
|
+
title: string;
|
|
9
|
+
macroRenderedOutput: any;
|
|
10
|
+
metadata: AttachmentMetadata;
|
|
11
|
+
extensions: {
|
|
12
|
+
mediaType: string;
|
|
13
|
+
fileSize: number;
|
|
14
|
+
comment: string;
|
|
15
|
+
mediaTypeDescription: string;
|
|
16
|
+
fileId: string;
|
|
17
|
+
};
|
|
18
|
+
_expandable: {
|
|
19
|
+
childTypes: string;
|
|
20
|
+
operations: string;
|
|
21
|
+
schedulePublishDate: string;
|
|
22
|
+
children: string;
|
|
23
|
+
restrictions: string;
|
|
24
|
+
history: string;
|
|
25
|
+
ancestors: string;
|
|
26
|
+
body: string;
|
|
27
|
+
descendants: string;
|
|
28
|
+
space: string;
|
|
29
|
+
};
|
|
30
|
+
_links: GenericLinks;
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GenericLinks } from './genericLinks';
|
|
2
|
+
|
|
3
|
+
export interface AttachmentContainer {
|
|
4
|
+
id: string;
|
|
5
|
+
type: 'page' | 'string';
|
|
6
|
+
status: 'current' | string;
|
|
7
|
+
title: string;
|
|
8
|
+
macroRenderedOutput: any;
|
|
9
|
+
extensions: {
|
|
10
|
+
position: number;
|
|
11
|
+
};
|
|
12
|
+
_expandable: {
|
|
13
|
+
container: string;
|
|
14
|
+
metadata: string;
|
|
15
|
+
restrictions: string;
|
|
16
|
+
history:string;
|
|
17
|
+
body: string;
|
|
18
|
+
version: string;
|
|
19
|
+
descendants: string;
|
|
20
|
+
space: string;
|
|
21
|
+
childTypes: string;
|
|
22
|
+
operations: string;
|
|
23
|
+
schedulePublishDate: string;
|
|
24
|
+
children: string;
|
|
25
|
+
ancestors: string;
|
|
26
|
+
};
|
|
27
|
+
_links: GenericLinks;
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GenericLinks } from './genericLinks';
|
|
2
|
+
|
|
3
|
+
export interface AttachmentMetadata {
|
|
4
|
+
comment: string;
|
|
5
|
+
mediaType: string;
|
|
6
|
+
labels: {
|
|
7
|
+
results: string[];
|
|
8
|
+
start: number;
|
|
9
|
+
limit: number;
|
|
10
|
+
size: number;
|
|
11
|
+
_links: GenericLinks;
|
|
12
|
+
};
|
|
13
|
+
_expandable: {
|
|
14
|
+
currentuser: string;
|
|
15
|
+
comments: string;
|
|
16
|
+
simple: string;
|
|
17
|
+
properties: string;
|
|
18
|
+
frontend: string;
|
|
19
|
+
likes: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Content } from './content';
|
|
2
2
|
import { GenericLinks } from './genericLinks';
|
|
3
3
|
|
|
4
|
-
export interface ContentArray {
|
|
5
|
-
results:
|
|
6
|
-
start
|
|
7
|
-
limit
|
|
4
|
+
export interface ContentArray<T = Content> {
|
|
5
|
+
results: T[];
|
|
6
|
+
start?: number;
|
|
7
|
+
limit?: number;
|
|
8
8
|
size: number;
|
|
9
9
|
_links: GenericLinks;
|
|
10
10
|
}
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
export type GenericLinks =
|
|
1
|
+
export type GenericLinks = {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
|
|
4
|
+
self: string;
|
|
5
|
+
next?: string;
|
|
6
|
+
tinyui?: string;
|
|
7
|
+
editui?: string;
|
|
8
|
+
webui?: string;
|
|
9
|
+
base?: string;
|
|
10
|
+
context?: string;
|
|
11
|
+
download?: string;
|
|
12
|
+
};
|
package/src/api/models/index.ts
CHANGED
|
@@ -4,11 +4,14 @@ export * from './accountIdEmailRecordArray';
|
|
|
4
4
|
export * from './addContentRestriction';
|
|
5
5
|
export * from './addContentRestrictionUpdateArray';
|
|
6
6
|
export * from './affectedObject';
|
|
7
|
+
export * from './attachmentContainer';
|
|
7
8
|
export * from './attachmentUpdate';
|
|
8
9
|
export * from './auditRecord';
|
|
9
10
|
export * from './auditRecordArray';
|
|
10
11
|
export * from './auditRecordCreate';
|
|
11
12
|
export * from './appDescriptor';
|
|
13
|
+
export * from './attachment';
|
|
14
|
+
export * from './attachmentMetadata';
|
|
12
15
|
export * from './blueprintTemplate';
|
|
13
16
|
export * from './blueprintTemplateArray';
|
|
14
17
|
export * from './breadcrumb';
|
|
@@ -60,6 +63,7 @@ export * from './copyPageRequest';
|
|
|
60
63
|
export * from './copyPageRequestDestination';
|
|
61
64
|
export * from './cQLPersonalDataConvertedQueries';
|
|
62
65
|
export * from './cQLPersonalDataMigrationRequest';
|
|
66
|
+
export * from './createdAttachment';
|
|
63
67
|
export * from './deletedSpace';
|
|
64
68
|
export * from './dynamicModulesErrorMessage';
|
|
65
69
|
export * from './embeddable';
|
|
@@ -2,7 +2,17 @@ export interface CreateAttachments {
|
|
|
2
2
|
/** The ID of the content to add the attachment to. */
|
|
3
3
|
id: string;
|
|
4
4
|
/** The status of the content that the attachment is being added to. */
|
|
5
|
-
status?: string;
|
|
5
|
+
status?: 'current' | 'draft' | string;
|
|
6
|
+
/** The attachments to be created. */
|
|
7
|
+
attachments: CreateAttachments.Attachment | CreateAttachments.Attachment[];
|
|
8
|
+
}
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
export namespace CreateAttachments {
|
|
11
|
+
export interface Attachment {
|
|
12
|
+
file: Buffer | ReadableStream | string | Blob | File | any;
|
|
13
|
+
filename: string;
|
|
14
|
+
minorEdit: boolean;
|
|
15
|
+
contentType?: string;
|
|
16
|
+
comment?: string;
|
|
17
|
+
}
|
|
8
18
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { CreateAttachments } from './createAttachments';
|
|
2
|
+
|
|
1
3
|
export interface CreateOrUpdateAttachments {
|
|
2
4
|
/** The ID of the content to add the attachment to. */
|
|
3
5
|
id: string;
|
|
4
6
|
/** The status of the content that the attachment is being added to. This should always be set to 'current'. */
|
|
5
|
-
status?: string;
|
|
7
|
+
status?: 'current' | 'draft' | string;
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
/** The attachments to be created or updated. */
|
|
10
|
+
attachments: CreateAttachments.Attachment | CreateAttachments.Attachment[];
|
|
8
11
|
}
|
|
@@ -2,7 +2,77 @@ export interface GetAttachments {
|
|
|
2
2
|
/** The ID of the content to be queried for its attachments. */
|
|
3
3
|
id: string;
|
|
4
4
|
/** A multi-value parameter indicating which properties of the content to expand. */
|
|
5
|
-
expand?:
|
|
5
|
+
expand?:
|
|
6
|
+
| 'childTypes.all'
|
|
7
|
+
| 'childTypes.attachment'
|
|
8
|
+
| 'childTypes.comment'
|
|
9
|
+
| 'childTypes.page'
|
|
10
|
+
| 'container'
|
|
11
|
+
| 'metadata'
|
|
12
|
+
| 'metadata.currentuser'
|
|
13
|
+
| 'metadata.properties'
|
|
14
|
+
| 'metadata.labels'
|
|
15
|
+
| 'metadata.frontend'
|
|
16
|
+
| 'operations'
|
|
17
|
+
| 'children.page'
|
|
18
|
+
| 'children.attachment'
|
|
19
|
+
| 'children.comment'
|
|
20
|
+
| 'restrictions.read.restrictions.user'
|
|
21
|
+
| 'restrictions.read.restrictions.group'
|
|
22
|
+
| 'restrictions.update.restrictions.user'
|
|
23
|
+
| 'restrictions.update.restrictions.group'
|
|
24
|
+
| 'history'
|
|
25
|
+
| 'history.lastUpdated'
|
|
26
|
+
| 'history.previousVersion'
|
|
27
|
+
| 'history.contributors'
|
|
28
|
+
| 'history.nextVersion'
|
|
29
|
+
| 'ancestors'
|
|
30
|
+
| 'body'
|
|
31
|
+
| 'version'
|
|
32
|
+
| 'descendants.page'
|
|
33
|
+
| 'descendants.attachment'
|
|
34
|
+
| 'descendants.comment'
|
|
35
|
+
| 'space'
|
|
36
|
+
| 'extensions.inlineProperties'
|
|
37
|
+
| 'extensions.resolution'
|
|
38
|
+
| (
|
|
39
|
+
| 'childTypes.all'
|
|
40
|
+
| 'childTypes.attachment'
|
|
41
|
+
| 'childTypes.comment'
|
|
42
|
+
| 'childTypes.page'
|
|
43
|
+
| 'container'
|
|
44
|
+
| 'metadata'
|
|
45
|
+
| 'metadata.currentuser'
|
|
46
|
+
| 'metadata.properties'
|
|
47
|
+
| 'metadata.labels'
|
|
48
|
+
| 'metadata.frontend'
|
|
49
|
+
| 'operations'
|
|
50
|
+
| 'children.page'
|
|
51
|
+
| 'children.attachment'
|
|
52
|
+
| 'children.comment'
|
|
53
|
+
| 'restrictions.read.restrictions.user'
|
|
54
|
+
| 'restrictions.read.restrictions.group'
|
|
55
|
+
| 'restrictions.update.restrictions.user'
|
|
56
|
+
| 'restrictions.update.restrictions.group'
|
|
57
|
+
| 'history'
|
|
58
|
+
| 'history.lastUpdated'
|
|
59
|
+
| 'history.previousVersion'
|
|
60
|
+
| 'history.contributors'
|
|
61
|
+
| 'history.nextVersion'
|
|
62
|
+
| 'ancestors'
|
|
63
|
+
| 'body'
|
|
64
|
+
| 'version'
|
|
65
|
+
| 'descendants.page'
|
|
66
|
+
| 'descendants.attachment'
|
|
67
|
+
| 'descendants.comment'
|
|
68
|
+
| 'space'
|
|
69
|
+
| 'extensions.inlineProperties'
|
|
70
|
+
| 'extensions.resolution'
|
|
71
|
+
)[]
|
|
72
|
+
| string
|
|
73
|
+
| string[]
|
|
74
|
+
| GetAttachments.Expand
|
|
75
|
+
| GetAttachments.Expand[];
|
|
6
76
|
/** The starting index of the returned attachments. */
|
|
7
77
|
start?: number;
|
|
8
78
|
/** The maximum number of attachments to return per page. Note, this may be restricted by fixed system limits. */
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateAttachments } from './createAttachments';
|
|
2
2
|
|
|
3
|
-
export interface UpdateAttachmentData
|
|
3
|
+
export interface UpdateAttachmentData {
|
|
4
4
|
/** The ID of the content that the attachment is attached to. */
|
|
5
5
|
id: string;
|
|
6
6
|
/** The ID of the attachment to update. */
|
|
7
7
|
attachmentId: string;
|
|
8
|
+
|
|
9
|
+
/** Attachment data to update. */
|
|
10
|
+
attachment: CreateAttachments.Attachment;
|
|
8
11
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AttachmentMetadata,
|
|
3
|
+
Container,
|
|
4
|
+
Content,
|
|
5
|
+
ContentChildren,
|
|
6
|
+
ContentChildType,
|
|
7
|
+
ContentHistory,
|
|
8
|
+
GenericLinks,
|
|
9
|
+
OperationCheckResult,
|
|
10
|
+
Space,
|
|
11
|
+
Version,
|
|
12
|
+
} from '../models';
|
|
2
13
|
|
|
3
14
|
export interface UpdateAttachmentProperties {
|
|
4
15
|
/** The ID of the content that the attachment is attached to. */
|
|
@@ -6,5 +17,51 @@ export interface UpdateAttachmentProperties {
|
|
|
6
17
|
/** The ID of the attachment to update. */
|
|
7
18
|
attachmentId: string;
|
|
8
19
|
|
|
9
|
-
|
|
20
|
+
/** @deprecated Use `update` property instead. */
|
|
21
|
+
body?: UpdateAttachmentProperties.Properties;
|
|
22
|
+
|
|
23
|
+
update?: UpdateAttachmentProperties.Properties;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export namespace UpdateAttachmentProperties {
|
|
27
|
+
export interface Properties {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
|
|
30
|
+
id: string;
|
|
31
|
+
type: 'page' | 'blogpost' | 'attachment' | 'content' | string;
|
|
32
|
+
status: 'current' | 'draft' | string;
|
|
33
|
+
title?: string;
|
|
34
|
+
space?: Space;
|
|
35
|
+
history?: ContentHistory;
|
|
36
|
+
version: Partial<Version>;
|
|
37
|
+
ancestors?: Content[];
|
|
38
|
+
operations?: OperationCheckResult[];
|
|
39
|
+
children?: ContentChildren;
|
|
40
|
+
childTypes?: ContentChildType;
|
|
41
|
+
descendants?: ContentChildren;
|
|
42
|
+
container?: Container;
|
|
43
|
+
body?: any;
|
|
44
|
+
restrictions?: any;
|
|
45
|
+
metadata?: Partial<AttachmentMetadata>;
|
|
46
|
+
macroRenderedOutput?: any;
|
|
47
|
+
extensions?: any;
|
|
48
|
+
_expandable?: {
|
|
49
|
+
'childTypes': string;
|
|
50
|
+
'container': string;
|
|
51
|
+
'metadata': string;
|
|
52
|
+
'operations': string;
|
|
53
|
+
'children': string;
|
|
54
|
+
'restrictions': string;
|
|
55
|
+
'history': string;
|
|
56
|
+
'ancestors': string;
|
|
57
|
+
'body': string;
|
|
58
|
+
'version': string;
|
|
59
|
+
'descendants': string;
|
|
60
|
+
'space': string;
|
|
61
|
+
'extensions': string;
|
|
62
|
+
'schedulePublishDate': string;
|
|
63
|
+
'macroRenderedOutput': string
|
|
64
|
+
};
|
|
65
|
+
_links?: GenericLinks;
|
|
66
|
+
}
|
|
10
67
|
}
|
|
@@ -116,6 +116,8 @@ export class BaseClient implements Client {
|
|
|
116
116
|
|
|
117
117
|
return responseHandler(response.data);
|
|
118
118
|
} catch (e: any) {
|
|
119
|
+
const err = this.config.newErrorHandling && e.isAxiosError ? e.response.data : e;
|
|
120
|
+
|
|
119
121
|
const callbackErrorHandler = callback && ((error: Config.Error) => callback(error));
|
|
120
122
|
const defaultErrorHandler = (error: Error) => {
|
|
121
123
|
throw error;
|
|
@@ -123,9 +125,9 @@ export class BaseClient implements Client {
|
|
|
123
125
|
|
|
124
126
|
const errorHandler = callbackErrorHandler ?? defaultErrorHandler;
|
|
125
127
|
|
|
126
|
-
this.config.middlewares?.onError?.(
|
|
128
|
+
this.config.middlewares?.onError?.(err);
|
|
127
129
|
|
|
128
|
-
return errorHandler(
|
|
130
|
+
return errorHandler(err);
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
}
|
package/src/config.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface Config {
|
|
|
13
13
|
* Adds `'X-Atlassian-Token': 'no-check'` to each request header
|
|
14
14
|
*/
|
|
15
15
|
noCheckAtlassianToken?: boolean;
|
|
16
|
+
/** Enable new API error handling. `false` by default. */
|
|
17
|
+
newErrorHandling?: boolean;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export namespace Config {
|
package/src/paramSerializer.ts
CHANGED