mongodb-atlas-api-client 2.32.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "name": "mongodb-atlas-api-client",
3
- "version": "2.32.0",
3
+ "version": "3.2.0",
4
4
  "description": "A mongodb atlas api client for nodejs.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
- "cover": "istanbul cover ./node_modules/@hapi/lab/bin/lab ./test --leaks",
8
7
  "pretest": "npm run depcheck && eslint --cache \"src/**/*.js\" \"test/**/*.js\"",
9
- "depcheck": "depcheck --ignores node-fetch",
10
- "coveralls": "cat ./coverage/lcov.info | node ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
11
- "test": "./node_modules/@hapi/lab/bin/lab ./test/ -v -S --assert @hapi/code --threshold 100 -p 1",
8
+ "depcheck": "depcheck",
9
+ "test": "./node_modules/@hapi/lab/bin/lab -I @@any-promise/REGISTRATION ./test/ -v -S --assert @hapi/code --threshold 100 -p 1 -o test-results/result.json -r json -r console -o stdout",
12
10
  "lint": "./node_modules/.bin/eslint ./src --fix",
13
- "travis": "npm run test",
14
11
  "premajor": "npm run test",
15
12
  "major": "npm version major -m \"published to npm as v%s\" && git push --follow-tags && npm publish",
16
13
  "preminor": "npm run test",
@@ -41,14 +38,12 @@
41
38
  "devDependencies": {
42
39
  "@hapi/code": "^8.0.2",
43
40
  "@hapi/lab": "^24.3.2",
44
- "coveralls": "^3.1.1",
45
41
  "depcheck": "^1.4.2",
46
42
  "eslint": "^7.32.0",
47
- "istanbul": "^0.4.5",
48
- "nock": "^13.1.3"
43
+ "nock": "^13.1.3",
44
+ "sinon": "^14.0.0"
49
45
  },
50
46
  "dependencies": {
51
- "digest-fetch": "^1.1.6",
52
- "node-fetch": "^2.6.5"
47
+ "urllib": "^2.38.0"
53
48
  }
54
49
  }
package/src/alert.js CHANGED
@@ -1,3 +1,5 @@
1
+ const {getQueryStringFromOptions} = require("./helper");
2
+
1
3
  class Alert {
2
4
 
3
5
  constructor(client, baseUrl, projectId) {
@@ -6,34 +8,35 @@ class Alert {
6
8
  this.projectId_ = projectId;
7
9
  }
8
10
 
9
- async getAll(options) {
10
- const urlparams = new URLSearchParams(options);
11
- const queryString = urlparams.toString();
11
+ async getAll(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_}/alerts?${queryString}`)
14
- ).json();
15
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts?${queryString}`, httpOptions)
16
+ );
15
17
  return response;
16
18
  }
17
19
 
18
- async get(alertId, options) {
19
- const urlparams = new URLSearchParams(options);
20
- const queryString = urlparams.toString();
20
+ async get(alertId, 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_}/alerts/${alertId}?${queryString}`)
23
- ).json();
24
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts/${alertId}?${queryString}`, httpOptions)
25
+ );
24
26
  return response;
25
27
  }
26
28
 
27
- async acknowledge(alertId, body, options) {
28
- const urlparams = new URLSearchParams(options);
29
- const queryString = urlparams.toString();
29
+ async acknowledge(alertId, body, options = {}) {
30
+ const queryString = getQueryStringFromOptions(options);
31
+ const httpOptions = options.httpOptions;
30
32
  const response = (
31
33
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/alerts/${alertId}?${queryString}`, {
32
34
  "method": "PATCH",
33
- "body": JSON.stringify(body),
34
- "headers": {"Content-Type": "application/json"}
35
+ "data": body,
36
+ "headers": {"Content-Type": "application/json"},
37
+ ...httpOptions
35
38
  })
36
- ).json();
39
+ );
37
40
  return response;
38
41
  }
39
42
  }
@@ -1,3 +1,5 @@
1
+ const {getQueryStringFromOptions} = require("./helper");
2
+
1
3
  class AtlasSearch {
2
4
 
3
5
  constructor(client, baseUrl, projectId) {
@@ -6,78 +8,82 @@ class AtlasSearch {
6
8
  this.projectId_ = projectId;
7
9
  }
8
10
 
9
- async get(clusterName, indexId, options) {
10
- const urlparams = new URLSearchParams(options);
11
- const queryString = urlparams.toString();
11
+ async get(clusterName, indexId, 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_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`)
14
- ).json();
15
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`, httpOptions)
16
+ );
15
17
  return response;
16
18
  }
17
19
 
18
- async getAllAnalyzers(clusterName, options) {
19
- const urlparams = new URLSearchParams(options);
20
- const queryString = urlparams.toString();
20
+ async getAllAnalyzers(clusterName, 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_}/clusters/${clusterName}/fts/analyzers?${queryString}`)
23
- ).json();
24
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/analyzers?${queryString}`, httpOptions)
25
+ );
24
26
  return response;
25
27
  }
26
28
 
27
- async upsertAnalyzer(clusterName, body, options) {
28
- const urlparams = new URLSearchParams(options);
29
- const queryString = urlparams.toString();
29
+ async upsertAnalyzer(clusterName, body, options = {}) {
30
+ const queryString = getQueryStringFromOptions(options);
31
+ const httpOptions = options.httpOptions;
30
32
  const response = (
31
33
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/analyzers?${queryString}`, {
32
34
  "method": "PUT",
33
- "body": JSON.stringify(body),
34
- "headers": {"Content-Type": "application/json"}
35
+ "data": body,
36
+ "headers": {"Content-Type": "application/json"},
37
+ ...httpOptions
35
38
  })
36
- ).json();
39
+ );
37
40
  return response;
38
41
  }
39
42
 
40
- async getAll(clusterName, databaseName, collectionName, options) {
41
- const urlparams = new URLSearchParams(options);
42
- const queryString = urlparams.toString();
43
+ async getAll(clusterName, databaseName, collectionName, options = {}) {
44
+ const queryString = getQueryStringFromOptions(options);
45
+ const httpOptions = options.httpOptions;
43
46
  const response = (
44
- await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${databaseName}/${collectionName}?${queryString}`)
45
- ).json();
47
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${databaseName}/${collectionName}?${queryString}`, httpOptions)
48
+ );
46
49
  return response;
47
50
  }
48
51
 
49
- async delete(clusterName, indexId, options) {
50
- const urlparams = new URLSearchParams(options);
51
- const queryString = urlparams.toString();
52
+ async delete(clusterName, indexId, options = {}) {
53
+ const queryString = getQueryStringFromOptions(options);
54
+ const httpOptions = options.httpOptions;
52
55
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`, {
53
- "method": "DELETE"
56
+ "method": "DELETE",
57
+ ...httpOptions
54
58
  });
55
59
  return true;
56
60
  }
57
61
 
58
- async update(clusterName, indexId, body, options) {
59
- const urlparams = new URLSearchParams(options);
60
- const queryString = urlparams.toString();
62
+ async update(clusterName, indexId, body, options = {}) {
63
+ const queryString = getQueryStringFromOptions(options);
64
+ const httpOptions = options.httpOptions;
61
65
  const response = (
62
66
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes/${indexId}?${queryString}`, {
63
67
  "method": "PATCH",
64
- "body": JSON.stringify(body),
65
- "headers": {"Content-Type": "application/json"}
68
+ "data": body,
69
+ "headers": {"Content-Type": "application/json"},
70
+ ...httpOptions
66
71
  })
67
- ).json();
72
+ );
68
73
  return response;
69
74
  }
70
75
 
71
- async create(clusterName, body, options) {
72
- const urlparams = new URLSearchParams(options);
73
- const queryString = urlparams.toString();
76
+ async create(clusterName, body, options = {}) {
77
+ const queryString = getQueryStringFromOptions(options);
78
+ const httpOptions = options.httpOptions;
74
79
  const response = (
75
80
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clusterName}/fts/indexes?${queryString}`, {
76
81
  "method": "POST",
77
- "body": JSON.stringify(body),
78
- "headers": {"Content-Type": "application/json"}
82
+ "data": body,
83
+ "headers": {"Content-Type": "application/json"},
84
+ ...httpOptions
79
85
  })
80
- ).json();
86
+ );
81
87
  return response;
82
88
  }
83
89
  }
package/src/atlasUser.js CHANGED
@@ -1,3 +1,5 @@
1
+ const {getQueryStringFromOptions} = require("./helper");
2
+
1
3
  class AtlasUser {
2
4
 
3
5
  constructor(client, baseUrl, projectId) {
@@ -6,57 +8,58 @@ class AtlasUser {
6
8
  this.projectId_ = projectId;
7
9
  }
8
10
 
9
- async getByName(username, options) {
10
- const urlparams = new URLSearchParams(options);
11
- const queryString = urlparams.toString();
11
+ async getByName(username, options = {}) {
12
+ const queryString = getQueryStringFromOptions(options);
13
+ const httpOptions = options.httpOptions;
12
14
  const response = (
13
- await this.client_.fetch(`${this.baseUrl_}/users/byName/${username}?${queryString}`)
14
- ).json();
15
+ await this.client_.fetch(`${this.baseUrl_}/users/byName/${username}?${queryString}`, httpOptions)
16
+ );
15
17
  return response;
16
18
  }
17
19
 
18
- async getById(userId, options) {
19
- const urlparams = new URLSearchParams(options);
20
- const queryString = urlparams.toString();
20
+ async getById(userId, options = {}) {
21
+ const queryString = getQueryStringFromOptions(options);
22
+ const httpOptions = options.httpOptions;
21
23
  const response = (
22
- await this.client_.fetch(`${this.baseUrl_}/users/${userId}?${queryString}`)
23
- ).json();
24
+ await this.client_.fetch(`${this.baseUrl_}/users/${userId}?${queryString}`, httpOptions)
25
+ );
24
26
  return response;
25
27
  }
26
28
 
27
- async getAll(options) {
28
- const urlparams = new URLSearchParams(options);
29
- const queryString = urlparams.toString();
29
+ async getAll(options = {}) {
30
+ const queryString = getQueryStringFromOptions(options);
31
+ const httpOptions = options.httpOptions;
30
32
  const response = (
31
- await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/users?${queryString}`)
32
- ).json();
33
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/users?${queryString}`, httpOptions)
34
+ );
33
35
  return response;
34
36
  }
35
37
 
36
-
37
- async update(userId, body, options) {
38
- const urlparams = new URLSearchParams(options);
39
- const queryString = urlparams.toString();
38
+ async update(userId, body, options = {}) {
39
+ const queryString = getQueryStringFromOptions(options);
40
+ const httpOptions = options.httpOptions;
40
41
  const response = (
41
42
  await this.client_.fetch(`${this.baseUrl_}/users/${userId}?${queryString}`, {
42
43
  "method": "PATCH",
43
- "body": JSON.stringify(body),
44
- "headers": {"Content-Type": "application/json"}
44
+ "data": body,
45
+ "headers": {"Content-Type": "application/json"},
46
+ ...httpOptions
45
47
  })
46
- ).json();
48
+ );
47
49
  return response;
48
50
  }
49
51
 
50
- async create(body, options) {
51
- const urlparams = new URLSearchParams(options);
52
- const queryString = urlparams.toString();
52
+ async create(body, options = {}) {
53
+ const queryString = getQueryStringFromOptions(options);
54
+ const httpOptions = options.httpOptions;
53
55
  const response = (
54
56
  await this.client_.fetch(`${this.baseUrl_}/users?${queryString}`, {
55
57
  "method": "POST",
56
- "body": JSON.stringify(body),
57
- "headers": {"Content-Type": "application/json"}
58
+ "data": body,
59
+ "headers": {"Content-Type": "application/json"},
60
+ ...httpOptions
58
61
  })
59
- ).json();
62
+ );
60
63
  return response;
61
64
  }
62
65
  }
@@ -1,3 +1,5 @@
1
+ const {getQueryStringFromOptions} = require("./helper");
2
+
1
3
  class CloudProviderAccess {
2
4
 
3
5
  constructor(client, baseUrl, projectId) {
@@ -6,47 +8,50 @@ class CloudProviderAccess {
6
8
  this.projectId_ = projectId;
7
9
  }
8
10
 
9
- async getAll(options) {
10
- const urlparams = new URLSearchParams(options);
11
- const queryString = urlparams.toString();
11
+ async getAll(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_}/cloudProviderAccess?${queryString}`)
14
- ).json();
15
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess?${queryString}`, httpOptions)
16
+ );
15
17
  return response;
16
18
  }
17
19
 
18
- async delete(cloudProvider, roleId, options) {
19
- const urlparams = new URLSearchParams(options);
20
- const queryString = urlparams.toString();
20
+ async delete(cloudProvider, roleId, options = {}) {
21
+ const queryString = getQueryStringFromOptions(options);
22
+ const httpOptions = options.httpOptions;
21
23
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess/${cloudProvider}/${roleId}?${queryString}`, {
22
- "method": "DELETE"
24
+ "method": "DELETE",
25
+ ...httpOptions
23
26
  });
24
27
  return true;
25
28
  }
26
29
 
27
- async update(roleId, body, options) {
28
- const urlparams = new URLSearchParams(options);
29
- const queryString = urlparams.toString();
30
+ async update(roleId, body, options = {}) {
31
+ const queryString = getQueryStringFromOptions(options);
32
+ const httpOptions = options.httpOptions;
30
33
  const response = (
31
34
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess/${roleId}?${queryString}`, {
32
35
  "method": "PATCH",
33
- "body": JSON.stringify(body),
34
- "headers": {"Content-Type": "application/json"}
36
+ "data": body,
37
+ "headers": {"Content-Type": "application/json"},
38
+ ...httpOptions
35
39
  })
36
- ).json();
40
+ );
37
41
  return response;
38
42
  }
39
43
 
40
- async create(body, options) {
41
- const urlparams = new URLSearchParams(options);
42
- const queryString = urlparams.toString();
44
+ async create(body, options = {}) {
45
+ const queryString = getQueryStringFromOptions(options);
46
+ const httpOptions = options.httpOptions;
43
47
  const response = (
44
48
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/cloudProviderAccess?${queryString}`, {
45
49
  "method": "POST",
46
- "body": JSON.stringify(body),
47
- "headers": {"Content-Type": "application/json"}
50
+ "data": body,
51
+ "headers": {"Content-Type": "application/json"},
52
+ ...httpOptions
48
53
  })
49
- ).json();
54
+ );
50
55
  return response;
51
56
  }
52
57
  }
package/src/cluster.js CHANGED
@@ -1,3 +1,5 @@
1
+ const {getQueryStringFromOptions} = require("./helper");
2
+
1
3
  class Cluster {
2
4
 
3
5
  constructor(client, baseUrl, projectId) {
@@ -6,89 +8,94 @@ class Cluster {
6
8
  this.projectId_ = projectId;
7
9
  }
8
10
 
9
- async get(clustername, options) {
10
- const urlparams = new URLSearchParams(options);
11
- const queryString = urlparams.toString();
11
+ async get(clustername, 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_}/clusters/${clustername}?${queryString}`)
14
- ).json();
15
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}`, httpOptions)
16
+ );
15
17
  return response;
16
18
  }
17
19
 
18
- async getAdvanceConfiguration(clustername, options) {
19
- const urlparams = new URLSearchParams(options);
20
- const queryString = urlparams.toString();
20
+ async getAdvanceConfiguration(clustername, 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_}/clusters/${clustername}/processArgs?${queryString}`)
23
- ).json();
24
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/processArgs?${queryString}`, httpOptions)
25
+ );
24
26
  return response;
25
27
  }
26
28
 
27
- async getAll(options) {
28
- const urlparams = new URLSearchParams(options);
29
- const queryString = urlparams.toString();
29
+ async getAll(options = {}) {
30
+ const queryString = getQueryStringFromOptions(options);
31
+ const httpOptions = options.httpOptions;
30
32
  const response = (
31
- await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters?${queryString}`)
32
- ).json();
33
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters?${queryString}`, httpOptions)
34
+ );
33
35
  return response;
34
36
  }
35
37
 
36
- async delete(clustername, options) {
37
- const urlparams = new URLSearchParams(options);
38
- const queryString = urlparams.toString();
38
+ async delete(clustername, options = {}) {
39
+ const queryString = getQueryStringFromOptions(options);
40
+ const httpOptions = options.httpOptions;
39
41
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}`, {
40
- "method": "DELETE"
42
+ "method": "DELETE",
43
+ ...httpOptions
41
44
  });
42
45
  return true;
43
46
  }
44
47
 
45
- async update(clustername, body, options) {
46
- const urlparams = new URLSearchParams(options);
47
- const queryString = urlparams.toString();
48
+ async update(clustername, body, options = {}) {
49
+ const queryString = getQueryStringFromOptions(options);
50
+ const httpOptions = options.httpOptions;
48
51
  const response = (
49
52
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}?${queryString}`, {
50
53
  "method": "PATCH",
51
- "body": JSON.stringify(body),
52
- "headers": {"Content-Type": "application/json"}
54
+ "data": body,
55
+ "headers": {"Content-Type": "application/json"},
56
+ ...httpOptions
53
57
  })
54
- ).json();
58
+ );
55
59
  return response;
56
60
  }
57
61
 
58
- async updateAdvanceConfiguration(clustername, body, options) {
59
- const urlparams = new URLSearchParams(options);
60
- const queryString = urlparams.toString();
62
+ async updateAdvanceConfiguration(clustername, body, options = {}) {
63
+ const queryString = getQueryStringFromOptions(options);
64
+ const httpOptions = options.httpOptions;
61
65
  const response = (
62
66
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/processArgs?${queryString}`, {
63
67
  "method": "PATCH",
64
- "body": JSON.stringify(body),
65
- "headers": {"Content-Type": "application/json"}
68
+ "data": body,
69
+ "headers": {"Content-Type": "application/json"},
70
+ ...httpOptions
66
71
  })
67
- ).json();
72
+ );
68
73
  return response;
69
74
  }
70
75
 
71
- async testPrimaryFailOver(clustername, options) {
72
- const urlparams = new URLSearchParams(options);
73
- const queryString = urlparams.toString();
76
+ async testPrimaryFailOver(clustername, options = {}) {
77
+ const queryString = getQueryStringFromOptions(options);
78
+ const httpOptions = options.httpOptions;
74
79
  const response = (
75
80
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters/${clustername}/restartPrimaries?${queryString}`, {
76
- "method": "POST"
81
+ "method": "POST",
82
+ ...httpOptions
77
83
  })
78
- ).json();
84
+ );
79
85
  return response;
80
86
  }
81
87
 
82
- async create(body, options) {
83
- const urlparams = new URLSearchParams(options);
84
- const queryString = urlparams.toString();
88
+ async create(body, options = {}) {
89
+ const queryString = getQueryStringFromOptions(options);
90
+ const httpOptions = options.httpOptions;
85
91
  const response = (
86
92
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/clusters?${queryString}`, {
87
93
  "method": "POST",
88
- "body": JSON.stringify(body),
89
- "headers": {"Content-Type": "application/json"}
94
+ "data": body,
95
+ "headers": {"Content-Type": "application/json"},
96
+ ...httpOptions
90
97
  })
91
- ).json();
98
+ );
92
99
  return response;
93
100
  }
94
101
  }
@@ -1,3 +1,5 @@
1
+ const {getQueryStringFromOptions} = require("./helper");
2
+
1
3
  class CustomDbRole {
2
4
 
3
5
  constructor(client, baseUrl, projectId) {
@@ -6,56 +8,59 @@ class CustomDbRole {
6
8
  this.projectId_ = projectId;
7
9
  }
8
10
 
9
- async get(rolename, options) {
10
- const urlparams = new URLSearchParams(options);
11
- const queryString = urlparams.toString();
11
+ async get(rolename, 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_}/customDBRoles/roles/${rolename}?${queryString}`)
14
- ).json();
15
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles/${rolename}?${queryString}`, httpOptions)
16
+ );
15
17
  return response;
16
18
  }
17
19
 
18
- async getAll(options) {
19
- const urlparams = new URLSearchParams(options);
20
- const queryString = urlparams.toString();
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_}/customDBRoles/roles?${queryString}`)
23
- ).json();
24
+ await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles?${queryString}`, httpOptions)
25
+ );
24
26
  return response;
25
27
  }
26
28
 
27
- async delete(rolename, options) {
28
- const urlparams = new URLSearchParams(options);
29
- const queryString = urlparams.toString();
29
+ async delete(rolename, options = {}) {
30
+ const queryString = getQueryStringFromOptions(options);
31
+ const httpOptions = options.httpOptions;
30
32
  await this.client_.fetch(`${this.baseUrl_}/groups/${this.projectId_}/customDBRoles/roles/${rolename}?${queryString}`, {
31
- "method": "DELETE"
33
+ "method": "DELETE",
34
+ ...httpOptions
32
35
  });
33
36
  return true;
34
37
  }
35
38
 
36
- async update(rolename, body, options) {
37
- const urlparams = new URLSearchParams(options);
38
- const queryString = urlparams.toString();
39
+ async update(rolename, 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_}/customDBRoles/roles/${rolename}?${queryString}`, {
41
44
  "method": "PATCH",
42
- "body": JSON.stringify(body),
43
- "headers": {"Content-Type": "application/json"}
45
+ "data": body,
46
+ "headers": {"Content-Type": "application/json"},
47
+ ...httpOptions
44
48
  })
45
- ).json();
49
+ );
46
50
  return response;
47
51
  }
48
52
 
49
- async create(body, options) {
50
- const urlparams = new URLSearchParams(options);
51
- const queryString = urlparams.toString();
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_}/customDBRoles/roles?${queryString}`, {
54
58
  "method": "POST",
55
- "body": JSON.stringify(body),
56
- "headers": {"Content-Type": "application/json"}
59
+ "data": body,
60
+ "headers": {"Content-Type": "application/json"},
61
+ ...httpOptions
57
62
  })
58
- ).json();
63
+ );
59
64
  return response;
60
65
  }
61
66
  }