mongodb-atlas-api-client 2.30.0 → 3.0.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/.github/workflows/testcoverage.yml +46 -0
- package/README.md +80 -80
- package/package.json +6 -11
- package/src/alert.js +19 -16
- package/src/atlasSearch.js +43 -37
- package/src/atlasUser.js +31 -27
- package/src/cloudProviderAccess.js +26 -21
- package/src/cluster.js +49 -42
- package/src/customDbRole.js +31 -26
- package/src/dataLake.js +39 -37
- package/src/event.js +22 -20
- package/src/helper.js +11 -0
- package/src/httpClient.js +28 -0
- package/src/index.js +5 -6
- package/src/organization.js +41 -36
- package/src/project.js +46 -40
- package/src/projectAccesslist.js +31 -26
- package/src/projectWhitelist.js +31 -26
- package/src/user.js +31 -26
- package/test/alert.test.js +43 -0
- package/test/atlasSearch.test.js +91 -0
- package/test/dataLake.test.js +1 -2
- package/test/helper.test.js +38 -0
- package/.travis.yml +0 -6
package/src/dataLake.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class DataLake {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl, projectId) {
|
|
@@ -6,69 +8,69 @@ class DataLake {
|
|
|
6
8
|
this.projectId_ = projectId;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
async get(dataLakeName, options) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
async get(dataLakeName, options = {}) {
|
|
12
|
+
const queryString = getQueryStringFromOptions(options);
|
|
13
|
+
const httpOptions = options.httpOptions;
|
|
12
14
|
const response = (
|
|
13
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes/${dataLakeName}?${queryString}
|
|
14
|
-
)
|
|
15
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes/${dataLakeName}?${queryString}`, httpOptions)
|
|
16
|
+
);
|
|
15
17
|
return response;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
async getLogsStream(dataLakeName, options) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const response = (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
return response.body;
|
|
20
|
+
async getLogsStream(dataLakeName, options = {}) {
|
|
21
|
+
const queryString = getQueryStringFromOptions(options);
|
|
22
|
+
const httpOptions = options.httpOptions;
|
|
23
|
+
const response = await this.client_.fetchStream(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes/${dataLakeName}/queryLogs.gz?${queryString}`, {
|
|
24
|
+
"gzip": true,
|
|
25
|
+
...httpOptions
|
|
26
|
+
});
|
|
27
|
+
return response;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
async getAll(options) {
|
|
32
|
-
const
|
|
33
|
-
const
|
|
30
|
+
async getAll(options = {}) {
|
|
31
|
+
const queryString = getQueryStringFromOptions(options);
|
|
32
|
+
const httpOptions = options.httpOptions;
|
|
34
33
|
const response = (
|
|
35
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes?${queryString}
|
|
36
|
-
)
|
|
34
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes?${queryString}`, httpOptions)
|
|
35
|
+
);
|
|
37
36
|
return response;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
async delete(dataLakeName, options) {
|
|
41
|
-
const
|
|
42
|
-
const
|
|
39
|
+
async delete(dataLakeName, options = {}) {
|
|
40
|
+
const queryString = getQueryStringFromOptions(options);
|
|
41
|
+
const httpOptions = options.httpOptions;
|
|
43
42
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes/${dataLakeName}?${queryString}`, {
|
|
44
|
-
"method": "DELETE"
|
|
43
|
+
"method": "DELETE",
|
|
44
|
+
...httpOptions
|
|
45
45
|
});
|
|
46
46
|
return true;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
async update(dataLakeName, body, options) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
49
|
+
async update(dataLakeName, body, options = {}) {
|
|
50
|
+
const queryString = getQueryStringFromOptions(options);
|
|
51
|
+
const httpOptions = options.httpOptions;
|
|
52
52
|
const response = (
|
|
53
53
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes/${dataLakeName}?${queryString}`, {
|
|
54
54
|
"method": "PATCH",
|
|
55
|
-
"
|
|
56
|
-
"headers": {"Content-Type": "application/json"}
|
|
55
|
+
"data": body,
|
|
56
|
+
"headers": {"Content-Type": "application/json"},
|
|
57
|
+
...httpOptions
|
|
57
58
|
})
|
|
58
|
-
)
|
|
59
|
+
);
|
|
59
60
|
return response;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
async create(body, options) {
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
async create(body, options = {}) {
|
|
64
|
+
const queryString = getQueryStringFromOptions(options);
|
|
65
|
+
const httpOptions = options.httpOptions;
|
|
65
66
|
const response = (
|
|
66
67
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/dataLakes?${queryString}`, {
|
|
67
68
|
"method": "POST",
|
|
68
|
-
"
|
|
69
|
-
"headers": {"Content-Type": "application/json"}
|
|
69
|
+
"data": body,
|
|
70
|
+
"headers": {"Content-Type": "application/json"},
|
|
71
|
+
...httpOptions
|
|
70
72
|
})
|
|
71
|
-
)
|
|
73
|
+
);
|
|
72
74
|
return response;
|
|
73
75
|
}
|
|
74
76
|
}
|
package/src/event.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class Event {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl, projectId) {
|
|
@@ -6,39 +8,39 @@ class Event {
|
|
|
6
8
|
this.projectId_ = projectId;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
async get(eventId, options) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
async get(eventId, options = {}) {
|
|
12
|
+
const queryString = getQueryStringFromOptions(options);
|
|
13
|
+
const httpOptions = options.httpOptions;
|
|
12
14
|
const response = (
|
|
13
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/events/${eventId}?${queryString}
|
|
14
|
-
)
|
|
15
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/events/${eventId}?${queryString}`, httpOptions)
|
|
16
|
+
);
|
|
15
17
|
return response;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
async getAll(options) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
async getAll(options = {}) {
|
|
21
|
+
const queryString = getQueryStringFromOptions(options);
|
|
22
|
+
const httpOptions = options.httpOptions;
|
|
21
23
|
const response = (
|
|
22
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/events?${queryString}
|
|
23
|
-
)
|
|
24
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/events?${queryString}`, httpOptions)
|
|
25
|
+
);
|
|
24
26
|
return response;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
async getByOrganizationId(organizationId, eventId, options) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
29
|
+
async getByOrganizationId(organizationId, eventId, options = {}) {
|
|
30
|
+
const queryString = getQueryStringFromOptions(options);
|
|
31
|
+
const httpOptions = options.httpOptions;
|
|
30
32
|
const response = (
|
|
31
|
-
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/events/${eventId}?${queryString}
|
|
32
|
-
)
|
|
33
|
+
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/events/${eventId}?${queryString}`, httpOptions)
|
|
34
|
+
);
|
|
33
35
|
return response;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
async getAllByOrganizationId(organizationId, options) {
|
|
37
|
-
const
|
|
38
|
-
const
|
|
38
|
+
async getAllByOrganizationId(organizationId, options = {}) {
|
|
39
|
+
const queryString = getQueryStringFromOptions(options);
|
|
40
|
+
const httpOptions = options.httpOptions;
|
|
39
41
|
const response = (
|
|
40
|
-
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/events?${queryString}
|
|
41
|
-
)
|
|
42
|
+
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/events?${queryString}`, httpOptions)
|
|
43
|
+
);
|
|
42
44
|
return response;
|
|
43
45
|
}
|
|
44
46
|
|
package/src/helper.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function getQueryStringFromOptions(options = {}) {
|
|
2
|
+
/* eslint-disable no-unused-vars */
|
|
3
|
+
const {httpOptions, ...mongoQueryStringOptions} = options;
|
|
4
|
+
const urlparams = new URLSearchParams(mongoQueryStringOptions);
|
|
5
|
+
const queryString = urlparams.toString();
|
|
6
|
+
return queryString;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
getQueryStringFromOptions
|
|
11
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class HttpClient {
|
|
2
|
+
constructor(client, publicKey, privateKey) {
|
|
3
|
+
this.client_ = client;
|
|
4
|
+
this.digestAuth_ = `${publicKey}:${privateKey}`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
async fetch(url, options) {
|
|
8
|
+
const response = await this.client_.request(url, {
|
|
9
|
+
"digestAuth": this.digestAuth_,
|
|
10
|
+
"dataType": "json",
|
|
11
|
+
...options
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return response.data;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async fetchStream(url, options) {
|
|
18
|
+
const response = await this.client_.request(url, {
|
|
19
|
+
"digestAuth": this.digestAuth_,
|
|
20
|
+
"streaming": true,
|
|
21
|
+
...options
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return response.res;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = HttpClient;
|
package/src/index.js
CHANGED
|
@@ -11,7 +11,8 @@ const Alert = require("./alert");
|
|
|
11
11
|
const DataLake = require("./dataLake");
|
|
12
12
|
const CloudProviderAccess = require("./cloudProviderAccess");
|
|
13
13
|
const AtlasSearch = require("./atlasSearch");
|
|
14
|
-
const
|
|
14
|
+
const urllibClient = require("urllib");
|
|
15
|
+
const HttpClient = require("./httpClient");
|
|
15
16
|
|
|
16
17
|
function getFunctions(instance) {
|
|
17
18
|
const functions = {};
|
|
@@ -23,12 +24,10 @@ function getFunctions(instance) {
|
|
|
23
24
|
return functions;
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
|
|
26
28
|
function getMongodbAtlasApiClient(options) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
options.privateKey,
|
|
30
|
-
{}
|
|
31
|
-
);
|
|
29
|
+
|
|
30
|
+
const client = new HttpClient(urllibClient, options.publicKey, options.privateKey);
|
|
32
31
|
const user = new User(client, options.baseUrl, options.projectId);
|
|
33
32
|
const cluster = new Cluster(client, options.baseUrl, options.projectId);
|
|
34
33
|
const customDbRole = new CustomDbRole(client, options.baseUrl, options.projectId);
|
package/src/organization.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class Organization {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl) {
|
|
@@ -5,74 +7,77 @@ class Organization {
|
|
|
5
7
|
this.baseUrl_ = baseUrl;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
async getById(organizationId, options) {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
10
|
+
async getById(organizationId, options = {}) {
|
|
11
|
+
const queryString = getQueryStringFromOptions(options);
|
|
12
|
+
const httpOptions = options.httpOptions;
|
|
11
13
|
const response = (
|
|
12
|
-
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}?${queryString}
|
|
13
|
-
)
|
|
14
|
+
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}?${queryString}`, httpOptions)
|
|
15
|
+
);
|
|
14
16
|
return response;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
async getAllUsersForOrganization(organizationId, options) {
|
|
18
|
-
const
|
|
19
|
-
const
|
|
19
|
+
async getAllUsersForOrganization(organizationId, options = {}) {
|
|
20
|
+
const queryString = getQueryStringFromOptions(options);
|
|
21
|
+
const httpOptions = options.httpOptions;
|
|
20
22
|
const response = (
|
|
21
|
-
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/users?${queryString}
|
|
22
|
-
)
|
|
23
|
+
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/users?${queryString}`, httpOptions)
|
|
24
|
+
);
|
|
23
25
|
return response;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
async getAllProjectsForOrganization(organizationId, options) {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
28
|
+
async getAllProjectsForOrganization(organizationId, options = {}) {
|
|
29
|
+
const queryString = getQueryStringFromOptions(options);
|
|
30
|
+
const httpOptions = options.httpOptions;
|
|
29
31
|
const response = (
|
|
30
|
-
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/groups?${queryString}
|
|
31
|
-
)
|
|
32
|
+
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/groups?${queryString}`, httpOptions)
|
|
33
|
+
);
|
|
32
34
|
return response;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
async getAll(options) {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
37
|
+
async getAll(options = {}) {
|
|
38
|
+
const queryString = getQueryStringFromOptions(options);
|
|
39
|
+
const httpOptions = options.httpOptions;
|
|
38
40
|
const response = (
|
|
39
|
-
await this.client_.fetch(`${this.baseUrl_}/orgs?${queryString}
|
|
40
|
-
)
|
|
41
|
+
await this.client_.fetch(`${this.baseUrl_}/orgs?${queryString}`, httpOptions)
|
|
42
|
+
);
|
|
41
43
|
return response;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
async delete(organizationId, options) {
|
|
45
|
-
const
|
|
46
|
-
const
|
|
46
|
+
async delete(organizationId, options = {}) {
|
|
47
|
+
const queryString = getQueryStringFromOptions(options);
|
|
48
|
+
const httpOptions = options.httpOptions;
|
|
47
49
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}?${queryString}`, {
|
|
48
|
-
"method": "DELETE"
|
|
50
|
+
"method": "DELETE",
|
|
51
|
+
...httpOptions
|
|
49
52
|
});
|
|
50
53
|
return true;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
async rename(organizationId, body, options) {
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
+
async rename(organizationId, body, options = {}) {
|
|
57
|
+
const queryString = getQueryStringFromOptions(options);
|
|
58
|
+
const httpOptions = options.httpOptions;
|
|
56
59
|
const response = (
|
|
57
60
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}?${queryString}`, {
|
|
58
61
|
"method": "PATCH",
|
|
59
|
-
"
|
|
60
|
-
"headers": {"Content-Type": "application/json"}
|
|
62
|
+
"data": body,
|
|
63
|
+
"headers": {"Content-Type": "application/json"},
|
|
64
|
+
...httpOptions
|
|
61
65
|
})
|
|
62
|
-
)
|
|
66
|
+
);
|
|
63
67
|
return response;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
async invite(organizationId, body, options) {
|
|
67
|
-
const
|
|
68
|
-
const
|
|
70
|
+
async invite(organizationId, body, options = {}) {
|
|
71
|
+
const queryString = getQueryStringFromOptions(options);
|
|
72
|
+
const httpOptions = options.httpOptions;
|
|
69
73
|
const response = (
|
|
70
74
|
await this.client_.fetch(`${this.baseUrl_}/orgs/${organizationId}/invites?${queryString}`, {
|
|
71
75
|
"method": "POST",
|
|
72
|
-
"
|
|
73
|
-
"headers": {"Content-Type": "application/json"}
|
|
76
|
+
"data": body,
|
|
77
|
+
"headers": {"Content-Type": "application/json"},
|
|
78
|
+
...httpOptions
|
|
74
79
|
})
|
|
75
|
-
)
|
|
80
|
+
);
|
|
76
81
|
return response;
|
|
77
82
|
}
|
|
78
83
|
}
|
package/src/project.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class Project {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl) {
|
|
@@ -5,83 +7,87 @@ class Project {
|
|
|
5
7
|
this.baseUrl_ = baseUrl;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
async getById(projectId, options) {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
10
|
+
async getById(projectId, options = {}) {
|
|
11
|
+
const queryString = getQueryStringFromOptions(options);
|
|
12
|
+
const httpOptions = options.httpOptions;
|
|
11
13
|
const response = (
|
|
12
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}?${queryString}
|
|
13
|
-
)
|
|
14
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}?${queryString}`, httpOptions)
|
|
15
|
+
);
|
|
14
16
|
return response;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
async getByName(projectName, options) {
|
|
18
|
-
const
|
|
19
|
-
const
|
|
19
|
+
async getByName(projectName, options = {}) {
|
|
20
|
+
const queryString = getQueryStringFromOptions(options);
|
|
21
|
+
const httpOptions = options.httpOptions;
|
|
20
22
|
const response = (
|
|
21
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/byName/${projectName}?${queryString}
|
|
22
|
-
)
|
|
23
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/byName/${projectName}?${queryString}`, httpOptions)
|
|
24
|
+
);
|
|
23
25
|
return response;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
async getTeamsByProjectId(projectId, options) {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
28
|
+
async getTeamsByProjectId(projectId, options = {}) {
|
|
29
|
+
const queryString = getQueryStringFromOptions(options);
|
|
30
|
+
const httpOptions = options.httpOptions;
|
|
29
31
|
const response = (
|
|
30
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}/teams?${queryString}
|
|
31
|
-
)
|
|
32
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}/teams?${queryString}`, httpOptions)
|
|
33
|
+
);
|
|
32
34
|
return response;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
async getAll(options) {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
37
|
+
async getAll(options = {}) {
|
|
38
|
+
const queryString = getQueryStringFromOptions(options);
|
|
39
|
+
const httpOptions = options.httpOptions;
|
|
38
40
|
const response = (
|
|
39
|
-
await this.client_.fetch(`${this.baseUrl_}/groups?${queryString}
|
|
40
|
-
)
|
|
41
|
+
await this.client_.fetch(`${this.baseUrl_}/groups?${queryString}`, httpOptions)
|
|
42
|
+
);
|
|
41
43
|
return response;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
async delete(projectId, options) {
|
|
45
|
-
const
|
|
46
|
-
const
|
|
46
|
+
async delete(projectId, options = {}) {
|
|
47
|
+
const queryString = getQueryStringFromOptions(options);
|
|
48
|
+
const httpOptions = options.httpOptions;
|
|
47
49
|
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}?${queryString}`, {
|
|
48
|
-
"method": "DELETE"
|
|
50
|
+
"method": "DELETE",
|
|
51
|
+
...httpOptions
|
|
49
52
|
});
|
|
50
53
|
return true;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
async removeUserFromProject(projectId, userId, options) {
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
+
async removeUserFromProject(projectId, userId, options = {}) {
|
|
57
|
+
const queryString = getQueryStringFromOptions(options);
|
|
58
|
+
const httpOptions = options.httpOptions;
|
|
56
59
|
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}/users/${userId}?${queryString}`, {
|
|
57
|
-
"method": "DELETE"
|
|
60
|
+
"method": "DELETE",
|
|
61
|
+
...httpOptions
|
|
58
62
|
});
|
|
59
63
|
return true;
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
async assignTeams(projectId, body, options) {
|
|
63
|
-
const
|
|
64
|
-
const
|
|
66
|
+
async assignTeams(projectId, body, options = {}) {
|
|
67
|
+
const queryString = getQueryStringFromOptions(options);
|
|
68
|
+
const httpOptions = options.httpOptions;
|
|
65
69
|
const response = (
|
|
66
70
|
await this.client_.fetch(`${this.baseUrl_}/groups/${projectId}/teams?${queryString}`, {
|
|
67
71
|
"method": "POST",
|
|
68
|
-
"
|
|
69
|
-
"headers": {"Content-Type": "application/json"}
|
|
72
|
+
"data": body,
|
|
73
|
+
"headers": {"Content-Type": "application/json"},
|
|
74
|
+
...httpOptions
|
|
70
75
|
})
|
|
71
|
-
)
|
|
76
|
+
);
|
|
72
77
|
return response;
|
|
73
78
|
}
|
|
74
79
|
|
|
75
|
-
async create(body, options) {
|
|
76
|
-
const
|
|
77
|
-
const
|
|
80
|
+
async create(body, options = {}) {
|
|
81
|
+
const queryString = getQueryStringFromOptions(options);
|
|
82
|
+
const httpOptions = options.httpOptions;
|
|
78
83
|
const response = (
|
|
79
84
|
await this.client_.fetch(`${this.baseUrl_}/groups?${queryString}`, {
|
|
80
85
|
"method": "POST",
|
|
81
|
-
"
|
|
82
|
-
"headers": {"Content-Type": "application/json"}
|
|
86
|
+
"data": body,
|
|
87
|
+
"headers": {"Content-Type": "application/json"},
|
|
88
|
+
...httpOptions
|
|
83
89
|
})
|
|
84
|
-
)
|
|
90
|
+
);
|
|
85
91
|
return response;
|
|
86
92
|
}
|
|
87
93
|
}
|
package/src/projectAccesslist.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {getQueryStringFromOptions} = require("./helper");
|
|
2
|
+
|
|
1
3
|
class ProjectAccesslist {
|
|
2
4
|
|
|
3
5
|
constructor(client, baseUrl, projectId) {
|
|
@@ -6,56 +8,59 @@ class ProjectAccesslist {
|
|
|
6
8
|
this.projectId_ = projectId;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
async get(accesslistentry, options) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
async get(accesslistentry, options = {}) {
|
|
12
|
+
const queryString = getQueryStringFromOptions(options);
|
|
13
|
+
const httpOptions = options.httpOptions;
|
|
12
14
|
const response = (
|
|
13
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList/${accesslistentry}?${queryString}
|
|
14
|
-
)
|
|
15
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList/${accesslistentry}?${queryString}`, httpOptions)
|
|
16
|
+
);
|
|
15
17
|
return response;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
async getAll(options) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
async getAll(options = {}) {
|
|
21
|
+
const queryString = getQueryStringFromOptions(options);
|
|
22
|
+
const httpOptions = options.httpOptions;
|
|
21
23
|
const response = (
|
|
22
|
-
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList?${queryString}
|
|
23
|
-
)
|
|
24
|
+
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList?${queryString}`, httpOptions)
|
|
25
|
+
);
|
|
24
26
|
return response;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
async delete(accesslistentry, options) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
29
|
+
async delete(accesslistentry, options = {}) {
|
|
30
|
+
const queryString = getQueryStringFromOptions(options);
|
|
31
|
+
const httpOptions = options.httpOptions;
|
|
30
32
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList/${accesslistentry}?${queryString}`, {
|
|
31
|
-
"method": "DELETE"
|
|
33
|
+
"method": "DELETE",
|
|
34
|
+
...httpOptions
|
|
32
35
|
});
|
|
33
36
|
return true;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
async update(body, options) {
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
+
async update(body, options = {}) {
|
|
40
|
+
const queryString = getQueryStringFromOptions(options);
|
|
41
|
+
const httpOptions = options.httpOptions;
|
|
39
42
|
const response = (
|
|
40
43
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList?${queryString}`, {
|
|
41
44
|
"method": "POST",
|
|
42
|
-
"
|
|
43
|
-
"headers": {"Content-Type": "application/json"}
|
|
45
|
+
"data": body,
|
|
46
|
+
"headers": {"Content-Type": "application/json"},
|
|
47
|
+
...httpOptions
|
|
44
48
|
})
|
|
45
|
-
)
|
|
49
|
+
);
|
|
46
50
|
return response;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
async create(body, options) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
53
|
+
async create(body, options = {}) {
|
|
54
|
+
const queryString = getQueryStringFromOptions(options);
|
|
55
|
+
const httpOptions = options.httpOptions;
|
|
52
56
|
const response = (
|
|
53
57
|
await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/accessList?${queryString}`, {
|
|
54
58
|
"method": "POST",
|
|
55
|
-
"
|
|
56
|
-
"headers": {"Content-Type": "application/json"}
|
|
59
|
+
"data": body,
|
|
60
|
+
"headers": {"Content-Type": "application/json"},
|
|
61
|
+
...httpOptions
|
|
57
62
|
})
|
|
58
|
-
)
|
|
63
|
+
);
|
|
59
64
|
return response;
|
|
60
65
|
}
|
|
61
66
|
}
|