Skip to content

Commit 1daab81

Browse files
New endpoint (#2)
* new models * deps updates * dependencies updated * tests fixed, changelog added * telemetry info updated
1 parent 1ed3375 commit 1daab81

File tree

194 files changed

+4783
-3918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+4783
-3918
lines changed

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"plugins": [
3+
"prettier-plugin-jsdoc"
4+
]
5+
}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
### 1.0.1
4+
5+
- Minor internal improvements
6+
- New endpoint added
7+
8+
### 1.0.0
9+
10+
- Initial upload

package-lock.json

Lines changed: 498 additions & 590 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "confluence.js",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "confluence.js is a powerful Node.JS/Browser module that allows you to interact with the Confluence API very easily",
55
"main": "out/index.js",
66
"types": "out/index.d.ts",
@@ -10,6 +10,7 @@
1010
"test": "npm run test:unit && npm run test:system",
1111
"test:unit": "jest tests/unit",
1212
"test:system": "jest tests/system --setupFiles=./tests/setup.ts --runInBand",
13+
"prettier": "prettier --write src/**/*.ts",
1314
"doc": "typedoc --name Confluence.js --out docs ./src",
1415
"lint": "eslint src --ext .ts",
1516
"lint:fix": "npm run lint -- --fix"
@@ -32,25 +33,27 @@
3233
"license": "MIT",
3334
"homepage": "https://github.com/MrRefactoring/confluence.js#readme",
3435
"devDependencies": {
35-
"@types/express": "^4.17.11",
36-
"@types/jest": "^26.0.22",
36+
"@types/express": "^4.17.12",
37+
"@types/jest": "^26.0.23",
3738
"@types/oauth": "^0.9.1",
38-
"@typescript-eslint/eslint-plugin": "^4.22.0",
39-
"@typescript-eslint/parser": "^4.22.0",
40-
"dotenv": "^8.2.0",
41-
"eslint": "^7.24.0",
39+
"@typescript-eslint/eslint-plugin": "^4.25.0",
40+
"@typescript-eslint/parser": "^4.25.0",
41+
"dotenv": "^10.0.0",
42+
"eslint": "^7.27.0",
4243
"eslint-config-airbnb-typescript": "^12.3.1",
4344
"eslint-import-resolver-typescript": "^2.4.0",
44-
"eslint-plugin-import": "^2.22.1",
45-
"jest": "^26.6.3",
46-
"ts-jest": "^26.5.4",
47-
"typedoc": "^0.20.35",
45+
"eslint-plugin-import": "^2.23.3",
46+
"jest": "^26.0.23",
47+
"prettier": "^2.3.0",
48+
"prettier-plugin-jsdoc": "^0.3.22",
49+
"ts-jest": "^26.5.6",
50+
"typedoc": "^0.20.36",
4851
"typescript": "^4.2.4"
4952
},
5053
"dependencies": {
51-
"atlassian-jwt": "^1.0.3",
54+
"atlassian-jwt": "^2.0.0",
5255
"axios": "^0.21.1",
5356
"oauth": "^0.9.15",
54-
"telemetry.confluence.js": "*"
57+
"telemetry.confluence.js": "<2"
5558
}
5659
}

src/api/audit.ts

Lines changed: 115 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,35 @@ import { Callback } from '../callback';
55
import { RequestConfig } from '../requestConfig';
66

77
export class Audit {
8-
constructor(private client: Client) { }
8+
constructor(private client: Client) {}
99

1010
/**
11-
* Returns all records in the audit log, optionally for a certain date range.
12-
* This contains information about events like space exports, group membership
13-
* changes, app installations, etc. For more information, see
14-
* [Audit log](https://confluence.atlassian.com/confcloud/audit-log-802164269.html)
15-
* in the Confluence administrator's guide.
11+
* Returns all records in the audit log, optionally for a certain date range. This contains information about events
12+
* like space exports, group membership changes, app installations, etc. For more information, see [Audit
13+
* log](https://confluence.atlassian.com/confcloud/audit-log-802164269.html) in the Confluence administrator's guide.
1614
*
17-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
18-
* 'Confluence Administrator' global permission. */
19-
async getAuditRecords<T = Models.AuditRecordArray>(parameters: Parameters.GetAuditRecords | undefined, callback: Callback<T>): Promise<void>;
15+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
16+
*/
17+
async getAuditRecords<T = Models.AuditRecordArray>(
18+
parameters: Parameters.GetAuditRecords | undefined,
19+
callback: Callback<T>
20+
): Promise<void>;
2021
/**
21-
* Returns all records in the audit log, optionally for a certain date range.
22-
* This contains information about events like space exports, group membership
23-
* changes, app installations, etc. For more information, see
24-
* [Audit log](https://confluence.atlassian.com/confcloud/audit-log-802164269.html)
25-
* in the Confluence administrator's guide.
22+
* Returns all records in the audit log, optionally for a certain date range. This contains information about events
23+
* like space exports, group membership changes, app installations, etc. For more information, see [Audit
24+
* log](https://confluence.atlassian.com/confcloud/audit-log-802164269.html) in the Confluence administrator's guide.
2625
*
27-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
28-
* 'Confluence Administrator' global permission. */
29-
async getAuditRecords<T = Models.AuditRecordArray>(parameters?: Parameters.GetAuditRecords, callback?: never): Promise<T>;
30-
async getAuditRecords<T = Models.AuditRecordArray>(parameters?: Parameters.GetAuditRecords, callback?: Callback<T>): Promise<void | T> {
31-
const config = {
26+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
27+
*/
28+
async getAuditRecords<T = Models.AuditRecordArray>(
29+
parameters?: Parameters.GetAuditRecords,
30+
callback?: never
31+
): Promise<T>;
32+
async getAuditRecords<T = Models.AuditRecordArray>(
33+
parameters?: Parameters.GetAuditRecords,
34+
callback?: Callback<T>,
35+
): Promise<void | T> {
36+
const config: RequestConfig = {
3237
url: '/api/audit',
3338
method: 'GET',
3439
params: {
@@ -38,25 +43,34 @@ export class Audit {
3843
start: parameters?.start,
3944
limit: parameters?.limit,
4045
},
41-
} as RequestConfig;
46+
};
4247

4348
return this.client.sendRequest(config, callback, { methodName: 'getAuditRecords' });
4449
}
4550

4651
/**
4752
* Creates a record in the audit log.
4853
*
49-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
50-
* 'Confluence Administrator' global permission. */
51-
async createAuditRecord<T = Models.AuditRecord>(parameters: Parameters.CreateAuditRecord | undefined, callback: Callback<T>): Promise<void>;
54+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
55+
*/
56+
async createAuditRecord<T = Models.AuditRecord>(
57+
parameters: Parameters.CreateAuditRecord | undefined,
58+
callback: Callback<T>
59+
): Promise<void>;
5260
/**
5361
* Creates a record in the audit log.
5462
*
55-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
56-
* 'Confluence Administrator' global permission. */
57-
async createAuditRecord<T = Models.AuditRecord>(parameters?: Parameters.CreateAuditRecord, callback?: never): Promise<T>;
58-
async createAuditRecord<T = Models.AuditRecord>(parameters?: Parameters.CreateAuditRecord, callback?: Callback<T>): Promise<void | T> {
59-
const config = {
63+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
64+
*/
65+
async createAuditRecord<T = Models.AuditRecord>(
66+
parameters?: Parameters.CreateAuditRecord,
67+
callback?: never
68+
): Promise<T>;
69+
async createAuditRecord<T = Models.AuditRecord>(
70+
parameters?: Parameters.CreateAuditRecord,
71+
callback?: Callback<T>,
72+
): Promise<void | T> {
73+
const config: RequestConfig = {
6074
url: '/api/audit',
6175
method: 'POST',
6276
data: {
@@ -71,25 +85,31 @@ export class Audit {
7185
changedValues: parameters?.changedValues,
7286
associatedObjects: parameters?.associatedObjects,
7387
},
74-
} as RequestConfig;
88+
};
7589

7690
return this.client.sendRequest(config, callback, { methodName: 'createAuditRecord' });
7791
}
7892

7993
/**
8094
* Exports audit records as a CSV file or ZIP file.
8195
*
82-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
83-
* 'Confluence Administrator' global permission. */
84-
async exportAuditRecords<T = unknown>(parameters: Parameters.ExportAuditRecords | undefined, callback: Callback<T>): Promise<void>;
96+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
97+
*/
98+
async exportAuditRecords<T = unknown>(
99+
parameters: Parameters.ExportAuditRecords | undefined,
100+
callback: Callback<T>
101+
): Promise<void>;
85102
/**
86103
* Exports audit records as a CSV file or ZIP file.
87104
*
88-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
89-
* 'Confluence Administrator' global permission. */
105+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
106+
*/
90107
async exportAuditRecords<T = unknown>(parameters?: Parameters.ExportAuditRecords, callback?: never): Promise<T>;
91-
async exportAuditRecords<T = unknown>(parameters?: Parameters.ExportAuditRecords, callback?: Callback<T>): Promise<void | T> {
92-
const config = {
108+
async exportAuditRecords<T = unknown>(
109+
parameters?: Parameters.ExportAuditRecords,
110+
callback?: Callback<T>,
111+
): Promise<void | T> {
112+
const config: RequestConfig = {
93113
url: '/api/audit/export',
94114
method: 'GET',
95115
params: {
@@ -98,89 +118,101 @@ export class Audit {
98118
searchString: parameters?.searchString,
99119
format: parameters?.format,
100120
},
101-
} as RequestConfig;
121+
};
102122

103123
return this.client.sendRequest(config, callback, { methodName: 'exportAuditRecords' });
104124
}
105125

106126
/**
107-
* Returns the retention period for records in the audit log. The retention
108-
* period is how long an audit record is kept for, from creation date until
109-
* it is deleted.
127+
* Returns the retention period for records in the audit log. The retention period is how long an audit record is kept
128+
* for, from creation date until it is deleted.
110129
*
111-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
112-
* 'Confluence Administrator' global permission. */
130+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
131+
*/
113132
async getRetentionPeriod<T = Models.RetentionPeriod>(callback: Callback<T>): Promise<void>;
114133
/**
115-
* Returns the retention period for records in the audit log. The retention
116-
* period is how long an audit record is kept for, from creation date until
117-
* it is deleted.
134+
* Returns the retention period for records in the audit log. The retention period is how long an audit record is kept
135+
* for, from creation date until it is deleted.
118136
*
119-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
120-
* 'Confluence Administrator' global permission. */
137+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
138+
*/
121139
async getRetentionPeriod<T = Models.RetentionPeriod>(callback?: never): Promise<T>;
122140
async getRetentionPeriod<T = Models.RetentionPeriod>(callback?: Callback<T>): Promise<void | T> {
123-
const config = {
141+
const config: RequestConfig = {
124142
url: '/api/audit/retention',
125143
method: 'GET',
126-
} as RequestConfig;
144+
};
127145

128146
return this.client.sendRequest(config, callback, { methodName: 'getRetentionPeriod' });
129147
}
130148

131149
/**
132-
* Sets the retention period for records in the audit log. The retention period
133-
* can be set to a maximum of 20 years.
150+
* Sets the retention period for records in the audit log. The retention period can be set to a maximum of 20 years.
134151
*
135-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
136-
* 'Confluence Administrator' global permission. */
137-
async setRetentionPeriod<T = Models.RetentionPeriod>(parameters: Parameters.SetRetentionPeriod | undefined, callback: Callback<T>): Promise<void>;
152+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
153+
*/
154+
async setRetentionPeriod<T = Models.RetentionPeriod>(
155+
parameters: Parameters.SetRetentionPeriod | undefined,
156+
callback: Callback<T>
157+
): Promise<void>;
138158
/**
139-
* Sets the retention period for records in the audit log. The retention period
140-
* can be set to a maximum of 20 years.
159+
* Sets the retention period for records in the audit log. The retention period can be set to a maximum of 20 years.
141160
*
142-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
143-
* 'Confluence Administrator' global permission. */
144-
async setRetentionPeriod<T = Models.RetentionPeriod>(parameters?: Parameters.SetRetentionPeriod, callback?: never): Promise<T>;
145-
async setRetentionPeriod<T = Models.RetentionPeriod>(parameters?: Parameters.SetRetentionPeriod, callback?: Callback<T>): Promise<void | T> {
146-
const config = {
161+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
162+
*/
163+
async setRetentionPeriod<T = Models.RetentionPeriod>(
164+
parameters?: Parameters.SetRetentionPeriod,
165+
callback?: never
166+
): Promise<T>;
167+
async setRetentionPeriod<T = Models.RetentionPeriod>(
168+
parameters?: Parameters.SetRetentionPeriod,
169+
callback?: Callback<T>,
170+
): Promise<void | T> {
171+
const config: RequestConfig = {
147172
url: '/api/audit/retention',
148173
method: 'PUT',
149174
data: {
150175
number: parameters?.number,
151176
units: parameters?.units,
152177
},
153-
} as RequestConfig;
178+
};
154179

155180
return this.client.sendRequest(config, callback, { methodName: 'setRetentionPeriod' });
156181
}
157182

158183
/**
159-
* Returns records from the audit log, for a time period back from the current
160-
* date. For example, you can use this method to get the last 3 months of records.
184+
* Returns records from the audit log, for a time period back from the current date. For example, you can use this
185+
* method to get the last 3 months of records.
161186
*
162-
* This contains information about events like space exports, group membership
163-
* changes, app installations, etc. For more information, see
164-
* [Audit log](https://confluence.atlassian.com/confcloud/audit-log-802164269.html)
165-
* in the Confluence administrator's guide.
187+
* This contains information about events like space exports, group membership changes, app installations, etc. For
188+
* more information, see [Audit log](https://confluence.atlassian.com/confcloud/audit-log-802164269.html) in the
189+
* Confluence administrator's guide.
166190
*
167-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
168-
* 'Confluence Administrator' global permission. */
169-
async getAuditRecordsForTimePeriod<T = Models.AuditRecordArray>(parameters: Parameters.GetAuditRecordsForTimePeriod | undefined, callback: Callback<T>): Promise<void>;
191+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
192+
*/
193+
async getAuditRecordsForTimePeriod<T = Models.AuditRecordArray>(
194+
parameters: Parameters.GetAuditRecordsForTimePeriod | undefined,
195+
callback: Callback<T>
196+
): Promise<void>;
170197
/**
171-
* Returns records from the audit log, for a time period back from the current
172-
* date. For example, you can use this method to get the last 3 months of records.
198+
* Returns records from the audit log, for a time period back from the current date. For example, you can use this
199+
* method to get the last 3 months of records.
173200
*
174-
* This contains information about events like space exports, group membership
175-
* changes, app installations, etc. For more information, see
176-
* [Audit log](https://confluence.atlassian.com/confcloud/audit-log-802164269.html)
177-
* in the Confluence administrator's guide.
201+
* This contains information about events like space exports, group membership changes, app installations, etc. For
202+
* more information, see [Audit log](https://confluence.atlassian.com/confcloud/audit-log-802164269.html) in the
203+
* Confluence administrator's guide.
178204
*
179-
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
180-
* 'Confluence Administrator' global permission. */
181-
async getAuditRecordsForTimePeriod<T = Models.AuditRecordArray>(parameters?: Parameters.GetAuditRecordsForTimePeriod, callback?: never): Promise<T>;
182-
async getAuditRecordsForTimePeriod<T = Models.AuditRecordArray>(parameters?: Parameters.GetAuditRecordsForTimePeriod, callback?: Callback<T>): Promise<void | T> {
183-
const config = {
205+
* **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.
206+
*/
207+
async getAuditRecordsForTimePeriod<T = Models.AuditRecordArray>(
208+
parameters?: Parameters.GetAuditRecordsForTimePeriod,
209+
callback?: never
210+
): Promise<T>;
211+
async getAuditRecordsForTimePeriod<T = Models.AuditRecordArray>(
212+
parameters?: Parameters.GetAuditRecordsForTimePeriod,
213+
callback?: Callback<T>,
214+
): Promise<void | T> {
215+
const config: RequestConfig = {
184216
url: '/api/audit/since',
185217
method: 'GET',
186218
params: {
@@ -190,7 +222,7 @@ export class Audit {
190222
start: parameters?.start,
191223
limit: parameters?.limit,
192224
},
193-
} as RequestConfig;
225+
};
194226

195227
return this.client.sendRequest(config, callback, { methodName: 'getAuditRecordsForTimePeriod' });
196228
}

0 commit comments

Comments
 (0)