btrz-api-client 7.14.0 → 7.15.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/lib/client-standalone-min.js +1 -1
- package/lib/endpoints/accounts/users.js +45 -30
- package/package.json +1 -1
- package/src/endpoints/accounts/users.js +10 -0
- package/test/endpoints/accounts/users.js +21 -3
- package/types/client.d.ts +6 -0
- package/types/endpoints/accounts/users.d.ts +6 -0
- package/types/initializedClient.d.ts +6 -0
|
@@ -134,70 +134,84 @@ function usersFactory(_ref) {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
sequenceId = _ref11.sequenceId,
|
|
143
|
-
headers = _ref11.headers;
|
|
137
|
+
function revokeDelegation(_ref11) {
|
|
138
|
+
var token = _ref11.token,
|
|
139
|
+
jwtToken = _ref11.jwtToken,
|
|
140
|
+
actionName = _ref11.actionName,
|
|
141
|
+
headers = _ref11.headers;
|
|
144
142
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
return client({
|
|
144
|
+
url: "/users/delegation",
|
|
145
|
+
method: "delete",
|
|
146
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
147
|
+
data: { actionName: actionName }
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
var sequences = {
|
|
152
|
+
get: function get(_ref12) {
|
|
151
153
|
var token = _ref12.token,
|
|
152
154
|
jwtToken = _ref12.jwtToken,
|
|
153
155
|
userId = _ref12.userId,
|
|
154
|
-
|
|
155
|
-
query = _ref12$query === undefined ? {} : _ref12$query,
|
|
156
|
+
sequenceId = _ref12.sequenceId,
|
|
156
157
|
headers = _ref12.headers;
|
|
157
158
|
|
|
158
159
|
return client({
|
|
159
|
-
url: "/users/" + userId + "/sequences",
|
|
160
|
-
params: query,
|
|
160
|
+
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
161
161
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
162
162
|
});
|
|
163
163
|
},
|
|
164
|
-
|
|
165
|
-
var
|
|
166
|
-
|
|
164
|
+
all: function all(_ref13) {
|
|
165
|
+
var token = _ref13.token,
|
|
166
|
+
jwtToken = _ref13.jwtToken,
|
|
167
167
|
userId = _ref13.userId,
|
|
168
|
-
|
|
168
|
+
_ref13$query = _ref13.query,
|
|
169
|
+
query = _ref13$query === undefined ? {} : _ref13$query,
|
|
169
170
|
headers = _ref13.headers;
|
|
170
171
|
|
|
171
172
|
return client({
|
|
172
173
|
url: "/users/" + userId + "/sequences",
|
|
173
|
-
|
|
174
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
175
|
-
data: sequence
|
|
174
|
+
params: query,
|
|
175
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
176
176
|
});
|
|
177
177
|
},
|
|
178
|
-
|
|
178
|
+
create: function create(_ref14) {
|
|
179
179
|
var jwtToken = _ref14.jwtToken,
|
|
180
180
|
token = _ref14.token,
|
|
181
181
|
userId = _ref14.userId,
|
|
182
|
-
sequenceId = _ref14.sequenceId,
|
|
183
182
|
sequence = _ref14.sequence,
|
|
184
183
|
headers = _ref14.headers;
|
|
185
184
|
|
|
186
185
|
return client({
|
|
187
|
-
url: "/users/" + userId + "/sequences
|
|
188
|
-
method: "
|
|
186
|
+
url: "/users/" + userId + "/sequences",
|
|
187
|
+
method: "post",
|
|
189
188
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
190
189
|
data: sequence
|
|
191
190
|
});
|
|
192
191
|
},
|
|
193
|
-
|
|
192
|
+
update: function update(_ref15) {
|
|
194
193
|
var jwtToken = _ref15.jwtToken,
|
|
195
194
|
token = _ref15.token,
|
|
196
195
|
userId = _ref15.userId,
|
|
197
196
|
sequenceId = _ref15.sequenceId,
|
|
198
|
-
|
|
197
|
+
sequence = _ref15.sequence,
|
|
199
198
|
headers = _ref15.headers;
|
|
200
199
|
|
|
200
|
+
return client({
|
|
201
|
+
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
202
|
+
method: "put",
|
|
203
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
204
|
+
data: sequence
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
transfer: function transfer(_ref16) {
|
|
208
|
+
var jwtToken = _ref16.jwtToken,
|
|
209
|
+
token = _ref16.token,
|
|
210
|
+
userId = _ref16.userId,
|
|
211
|
+
sequenceId = _ref16.sequenceId,
|
|
212
|
+
newUserId = _ref16.newUserId,
|
|
213
|
+
headers = _ref16.headers;
|
|
214
|
+
|
|
201
215
|
return client({
|
|
202
216
|
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
203
217
|
method: "patch",
|
|
@@ -220,6 +234,7 @@ function usersFactory(_ref) {
|
|
|
220
234
|
createOrUpdateMany: createOrUpdateMany,
|
|
221
235
|
impersonate: impersonate,
|
|
222
236
|
delegation: delegation,
|
|
237
|
+
revokeDelegation: revokeDelegation,
|
|
223
238
|
sequences: sequences
|
|
224
239
|
};
|
|
225
240
|
}
|
package/package.json
CHANGED
|
@@ -74,6 +74,15 @@ function usersFactory({client, internalAuthTokenProvider}) {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
function revokeDelegation({token, jwtToken, actionName, headers}) {
|
|
78
|
+
return client({
|
|
79
|
+
url: "/users/delegation",
|
|
80
|
+
method: "delete",
|
|
81
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
82
|
+
data: {actionName}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
77
86
|
const sequences = {
|
|
78
87
|
get({token, jwtToken, userId, sequenceId, headers}) {
|
|
79
88
|
return client({
|
|
@@ -127,6 +136,7 @@ function usersFactory({client, internalAuthTokenProvider}) {
|
|
|
127
136
|
createOrUpdateMany,
|
|
128
137
|
impersonate,
|
|
129
138
|
delegation,
|
|
139
|
+
revokeDelegation,
|
|
130
140
|
sequences
|
|
131
141
|
};
|
|
132
142
|
}
|
|
@@ -94,14 +94,14 @@ describe("accounts/user/{id}", () => {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
it("should delegate a user", () => {
|
|
97
|
+
it("should delegate permissions to a user", () => {
|
|
98
98
|
axiosMock.onPost("/users/delegation").reply(
|
|
99
99
|
expectRequest({
|
|
100
100
|
statusCode: 200,
|
|
101
101
|
token,
|
|
102
102
|
jwtToken,
|
|
103
103
|
body: {
|
|
104
|
-
actionName: "
|
|
104
|
+
actionName: "exceed_ticket_movement_limit",
|
|
105
105
|
delegator: {
|
|
106
106
|
email: "some_email@betterez.com",
|
|
107
107
|
password: "some_password"
|
|
@@ -112,7 +112,7 @@ describe("accounts/user/{id}", () => {
|
|
|
112
112
|
return api.accounts.users.delegation({
|
|
113
113
|
jwtToken,
|
|
114
114
|
token,
|
|
115
|
-
actionName: "
|
|
115
|
+
actionName: "exceed_ticket_movement_limit",
|
|
116
116
|
delegator: {
|
|
117
117
|
email: "some_email@betterez.com",
|
|
118
118
|
password: "some_password"
|
|
@@ -120,6 +120,24 @@ describe("accounts/user/{id}", () => {
|
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
|
|
123
|
+
it("should revoke permissions previously delegated to a user", () => {
|
|
124
|
+
axiosMock.onDelete("/users/delegation").reply(
|
|
125
|
+
expectRequest({
|
|
126
|
+
statusCode: 200,
|
|
127
|
+
token,
|
|
128
|
+
jwtToken,
|
|
129
|
+
body: {
|
|
130
|
+
actionName: "exceed_ticket_movement_limit"
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
);
|
|
134
|
+
return api.accounts.users.revokeDelegation({
|
|
135
|
+
jwtToken,
|
|
136
|
+
token,
|
|
137
|
+
actionName: "exceed_ticket_movement_limit"
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
123
141
|
it("should return user sequence", () => {
|
|
124
142
|
const sequenceId = "123";
|
|
125
143
|
const userId = "1234321";
|
package/types/client.d.ts
CHANGED
|
@@ -2937,6 +2937,12 @@ export function createApiClient(options: {
|
|
|
2937
2937
|
delegator: any;
|
|
2938
2938
|
headers: any;
|
|
2939
2939
|
}) => any;
|
|
2940
|
+
revokeDelegation: ({ token, jwtToken, actionName, headers }: {
|
|
2941
|
+
token: any;
|
|
2942
|
+
jwtToken: any;
|
|
2943
|
+
actionName: any;
|
|
2944
|
+
headers: any;
|
|
2945
|
+
}) => any;
|
|
2940
2946
|
sequences: {
|
|
2941
2947
|
get({ token, jwtToken, userId, sequenceId, headers }: {
|
|
2942
2948
|
token: any;
|
|
@@ -51,6 +51,12 @@ declare function usersFactory({ client, internalAuthTokenProvider }: {
|
|
|
51
51
|
delegator: any;
|
|
52
52
|
headers: any;
|
|
53
53
|
}) => any;
|
|
54
|
+
revokeDelegation: ({ token, jwtToken, actionName, headers }: {
|
|
55
|
+
token: any;
|
|
56
|
+
jwtToken: any;
|
|
57
|
+
actionName: any;
|
|
58
|
+
headers: any;
|
|
59
|
+
}) => any;
|
|
54
60
|
sequences: {
|
|
55
61
|
get({ token, jwtToken, userId, sequenceId, headers }: {
|
|
56
62
|
token: any;
|
|
@@ -2891,6 +2891,12 @@ declare const _exports: {
|
|
|
2891
2891
|
delegator: any;
|
|
2892
2892
|
headers: any;
|
|
2893
2893
|
}) => any;
|
|
2894
|
+
revokeDelegation: ({ token, jwtToken, actionName, headers }: {
|
|
2895
|
+
token: any;
|
|
2896
|
+
jwtToken: any;
|
|
2897
|
+
actionName: any;
|
|
2898
|
+
headers: any;
|
|
2899
|
+
}) => any;
|
|
2894
2900
|
sequences: {
|
|
2895
2901
|
get({ token, jwtToken, userId, sequenceId, headers }: {
|
|
2896
2902
|
token: any;
|