btrz-api-client 7.7.0 → 7.9.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 +3 -3
- package/lib/endpoints/accounts/users.js +46 -30
- package/lib/endpoints/operations/vouchers.js +21 -1
- package/package.json +1 -1
- package/src/endpoints/accounts/users.js +10 -0
- package/src/endpoints/operations/vouchers.js +14 -1
- package/test/endpoints/accounts/users.js +26 -0
- package/test/endpoints/operations/vouchers.test.js +26 -0
- package/types/client.d.ts +16 -0
- package/types/endpoints/accounts/users.d.ts +7 -0
- package/types/endpoints/operations/vouchers.d.ts +9 -0
- package/types/initializedClient.d.ts +16 -0
|
@@ -119,70 +119,85 @@ function usersFactory(_ref) {
|
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
headers = _ref10.headers;
|
|
122
|
+
function delegation(_ref10) {
|
|
123
|
+
var token = _ref10.token,
|
|
124
|
+
jwtToken = _ref10.jwtToken,
|
|
125
|
+
actionName = _ref10.actionName,
|
|
126
|
+
delegator = _ref10.delegator,
|
|
127
|
+
headers = _ref10.headers;
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
return client({
|
|
130
|
+
url: "/users/delegation",
|
|
131
|
+
method: "post",
|
|
132
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
133
|
+
data: { actionName: actionName, delegator: delegator }
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
var sequences = {
|
|
138
|
+
get: function get(_ref11) {
|
|
136
139
|
var token = _ref11.token,
|
|
137
140
|
jwtToken = _ref11.jwtToken,
|
|
138
141
|
userId = _ref11.userId,
|
|
139
|
-
|
|
140
|
-
query = _ref11$query === undefined ? {} : _ref11$query,
|
|
142
|
+
sequenceId = _ref11.sequenceId,
|
|
141
143
|
headers = _ref11.headers;
|
|
142
144
|
|
|
143
145
|
return client({
|
|
144
|
-
url: "/users/" + userId + "/sequences",
|
|
145
|
-
params: query,
|
|
146
|
+
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
146
147
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
147
148
|
});
|
|
148
149
|
},
|
|
149
|
-
|
|
150
|
-
var
|
|
151
|
-
|
|
150
|
+
all: function all(_ref12) {
|
|
151
|
+
var token = _ref12.token,
|
|
152
|
+
jwtToken = _ref12.jwtToken,
|
|
152
153
|
userId = _ref12.userId,
|
|
153
|
-
|
|
154
|
+
_ref12$query = _ref12.query,
|
|
155
|
+
query = _ref12$query === undefined ? {} : _ref12$query,
|
|
154
156
|
headers = _ref12.headers;
|
|
155
157
|
|
|
156
158
|
return client({
|
|
157
159
|
url: "/users/" + userId + "/sequences",
|
|
158
|
-
|
|
159
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
160
|
-
data: sequence
|
|
160
|
+
params: query,
|
|
161
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
161
162
|
});
|
|
162
163
|
},
|
|
163
|
-
|
|
164
|
+
create: function create(_ref13) {
|
|
164
165
|
var jwtToken = _ref13.jwtToken,
|
|
165
166
|
token = _ref13.token,
|
|
166
167
|
userId = _ref13.userId,
|
|
167
|
-
sequenceId = _ref13.sequenceId,
|
|
168
168
|
sequence = _ref13.sequence,
|
|
169
169
|
headers = _ref13.headers;
|
|
170
170
|
|
|
171
171
|
return client({
|
|
172
|
-
url: "/users/" + userId + "/sequences
|
|
173
|
-
method: "
|
|
172
|
+
url: "/users/" + userId + "/sequences",
|
|
173
|
+
method: "post",
|
|
174
174
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
175
175
|
data: sequence
|
|
176
176
|
});
|
|
177
177
|
},
|
|
178
|
-
|
|
178
|
+
update: function update(_ref14) {
|
|
179
179
|
var jwtToken = _ref14.jwtToken,
|
|
180
180
|
token = _ref14.token,
|
|
181
181
|
userId = _ref14.userId,
|
|
182
182
|
sequenceId = _ref14.sequenceId,
|
|
183
|
-
|
|
183
|
+
sequence = _ref14.sequence,
|
|
184
184
|
headers = _ref14.headers;
|
|
185
185
|
|
|
186
|
+
return client({
|
|
187
|
+
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
188
|
+
method: "put",
|
|
189
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
190
|
+
data: sequence
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
transfer: function transfer(_ref15) {
|
|
194
|
+
var jwtToken = _ref15.jwtToken,
|
|
195
|
+
token = _ref15.token,
|
|
196
|
+
userId = _ref15.userId,
|
|
197
|
+
sequenceId = _ref15.sequenceId,
|
|
198
|
+
newUserId = _ref15.newUserId,
|
|
199
|
+
headers = _ref15.headers;
|
|
200
|
+
|
|
186
201
|
return client({
|
|
187
202
|
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
188
203
|
method: "patch",
|
|
@@ -204,6 +219,7 @@ function usersFactory(_ref) {
|
|
|
204
219
|
update: update,
|
|
205
220
|
createOrUpdateMany: createOrUpdateMany,
|
|
206
221
|
impersonate: impersonate,
|
|
222
|
+
delegation: delegation,
|
|
207
223
|
sequences: sequences
|
|
208
224
|
};
|
|
209
225
|
}
|
|
@@ -30,8 +30,28 @@ function vouchersFactory(_ref) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
function compensationsCreate(_ref3) {
|
|
34
|
+
var token = _ref3.token,
|
|
35
|
+
jwtToken = _ref3.jwtToken,
|
|
36
|
+
compensation = _ref3.compensation,
|
|
37
|
+
_ref3$query = _ref3.query,
|
|
38
|
+
query = _ref3$query === undefined ? {} : _ref3$query,
|
|
39
|
+
headers = _ref3.headers;
|
|
40
|
+
|
|
41
|
+
return client({
|
|
42
|
+
url: "/vouchers/compensations",
|
|
43
|
+
method: "post",
|
|
44
|
+
params: query,
|
|
45
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
46
|
+
data: compensation
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
33
50
|
return {
|
|
34
|
-
create: create
|
|
51
|
+
create: create,
|
|
52
|
+
compensations: {
|
|
53
|
+
create: compensationsCreate
|
|
54
|
+
}
|
|
35
55
|
};
|
|
36
56
|
}
|
|
37
57
|
|
package/package.json
CHANGED
|
@@ -65,6 +65,15 @@ function usersFactory({client, internalAuthTokenProvider}) {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function delegation({token, jwtToken, actionName, delegator, headers}) {
|
|
69
|
+
return client({
|
|
70
|
+
url: "/users/delegation",
|
|
71
|
+
method: "post",
|
|
72
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
73
|
+
data: {actionName, delegator}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
68
77
|
const sequences = {
|
|
69
78
|
get({token, jwtToken, userId, sequenceId, headers}) {
|
|
70
79
|
return client({
|
|
@@ -117,6 +126,7 @@ function usersFactory({client, internalAuthTokenProvider}) {
|
|
|
117
126
|
update,
|
|
118
127
|
createOrUpdateMany,
|
|
119
128
|
impersonate,
|
|
129
|
+
delegation,
|
|
120
130
|
sequences
|
|
121
131
|
};
|
|
122
132
|
}
|
|
@@ -22,8 +22,21 @@ function vouchersFactory({
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function compensationsCreate({token, jwtToken, compensation, query = {}, headers}) {
|
|
26
|
+
return client({
|
|
27
|
+
url: "/vouchers/compensations",
|
|
28
|
+
method: "post",
|
|
29
|
+
params: query,
|
|
30
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
31
|
+
data: compensation
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
25
35
|
return {
|
|
26
|
-
create
|
|
36
|
+
create,
|
|
37
|
+
compensations: {
|
|
38
|
+
create: compensationsCreate
|
|
39
|
+
}
|
|
27
40
|
};
|
|
28
41
|
}
|
|
29
42
|
|
|
@@ -94,6 +94,32 @@ describe("accounts/user/{id}", () => {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
+
it("should delegate a user", () => {
|
|
98
|
+
axiosMock.onPost("/users/delegation").reply(
|
|
99
|
+
expectRequest({
|
|
100
|
+
statusCode: 200,
|
|
101
|
+
token,
|
|
102
|
+
jwtToken,
|
|
103
|
+
body: {
|
|
104
|
+
actionName: "move_tickets",
|
|
105
|
+
delegator: {
|
|
106
|
+
email: "some_email@betterez.com",
|
|
107
|
+
password: "some_password"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
return api.accounts.users.delegation({
|
|
113
|
+
jwtToken,
|
|
114
|
+
token,
|
|
115
|
+
actionName: "move_tickets",
|
|
116
|
+
delegator: {
|
|
117
|
+
email: "some_email@betterez.com",
|
|
118
|
+
password: "some_password"
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
97
123
|
it("should return user sequence", () => {
|
|
98
124
|
const sequenceId = "123";
|
|
99
125
|
const userId = "1234321";
|
|
@@ -27,3 +27,29 @@ describe("operations/vouchers", () => {
|
|
|
27
27
|
return api.operations.vouchers.create({jwtToken, token, voucher});
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
|
+
|
|
31
|
+
describe("operations/vouchers/compensations", () => {
|
|
32
|
+
const token = "I owe you a token";
|
|
33
|
+
const jwtToken = "I owe you a JWT token";
|
|
34
|
+
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
axiosMock.reset();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should POST a compensation", () => {
|
|
40
|
+
const compensation = {
|
|
41
|
+
voucherInfo: {
|
|
42
|
+
type: "voucher",
|
|
43
|
+
amount: "100",
|
|
44
|
+
typeAmount: "%"
|
|
45
|
+
},
|
|
46
|
+
ticketIds: []
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
axiosMock
|
|
50
|
+
.onPost("/vouchers/compensations")
|
|
51
|
+
.reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
52
|
+
|
|
53
|
+
return api.operations.vouchers.compensations.create({jwtToken, token, compensation});
|
|
54
|
+
});
|
|
55
|
+
});
|
package/types/client.d.ts
CHANGED
|
@@ -2896,6 +2896,13 @@ export function createApiClient(options: {
|
|
|
2896
2896
|
offlineUserId: any;
|
|
2897
2897
|
headers: any;
|
|
2898
2898
|
}) => any;
|
|
2899
|
+
delegation: ({ token, jwtToken, actionName, delegator, headers }: {
|
|
2900
|
+
token: any;
|
|
2901
|
+
jwtToken: any;
|
|
2902
|
+
actionName: any;
|
|
2903
|
+
delegator: any;
|
|
2904
|
+
headers: any;
|
|
2905
|
+
}) => any;
|
|
2899
2906
|
sequences: {
|
|
2900
2907
|
get({ token, jwtToken, userId, sequenceId, headers }: {
|
|
2901
2908
|
token: any;
|
|
@@ -3940,6 +3947,15 @@ export function createApiClient(options: {
|
|
|
3940
3947
|
query?: {};
|
|
3941
3948
|
voucher?: {};
|
|
3942
3949
|
}) => any;
|
|
3950
|
+
compensations: {
|
|
3951
|
+
create: ({ token, jwtToken, compensation, query, headers }: {
|
|
3952
|
+
token: any;
|
|
3953
|
+
jwtToken: any;
|
|
3954
|
+
compensation: any;
|
|
3955
|
+
query?: {};
|
|
3956
|
+
headers: any;
|
|
3957
|
+
}) => any;
|
|
3958
|
+
};
|
|
3943
3959
|
};
|
|
3944
3960
|
waitlists: {
|
|
3945
3961
|
all: ({ token, jwtToken, query, headers }: {
|
|
@@ -44,6 +44,13 @@ declare function usersFactory({ client, internalAuthTokenProvider }: {
|
|
|
44
44
|
offlineUserId: any;
|
|
45
45
|
headers: any;
|
|
46
46
|
}) => any;
|
|
47
|
+
delegation: ({ token, jwtToken, actionName, delegator, headers }: {
|
|
48
|
+
token: any;
|
|
49
|
+
jwtToken: any;
|
|
50
|
+
actionName: any;
|
|
51
|
+
delegator: any;
|
|
52
|
+
headers: any;
|
|
53
|
+
}) => any;
|
|
47
54
|
sequences: {
|
|
48
55
|
get({ token, jwtToken, userId, sequenceId, headers }: {
|
|
49
56
|
token: any;
|
|
@@ -10,4 +10,13 @@ declare function vouchersFactory({ client, internalAuthTokenProvider }: {
|
|
|
10
10
|
query?: {};
|
|
11
11
|
voucher?: {};
|
|
12
12
|
}) => any;
|
|
13
|
+
compensations: {
|
|
14
|
+
create: ({ token, jwtToken, compensation, query, headers }: {
|
|
15
|
+
token: any;
|
|
16
|
+
jwtToken: any;
|
|
17
|
+
compensation: any;
|
|
18
|
+
query?: {};
|
|
19
|
+
headers: any;
|
|
20
|
+
}) => any;
|
|
21
|
+
};
|
|
13
22
|
};
|
|
@@ -2850,6 +2850,13 @@ declare const _exports: {
|
|
|
2850
2850
|
offlineUserId: any;
|
|
2851
2851
|
headers: any;
|
|
2852
2852
|
}) => any;
|
|
2853
|
+
delegation: ({ token, jwtToken, actionName, delegator, headers }: {
|
|
2854
|
+
token: any;
|
|
2855
|
+
jwtToken: any;
|
|
2856
|
+
actionName: any;
|
|
2857
|
+
delegator: any;
|
|
2858
|
+
headers: any;
|
|
2859
|
+
}) => any;
|
|
2853
2860
|
sequences: {
|
|
2854
2861
|
get({ token, jwtToken, userId, sequenceId, headers }: {
|
|
2855
2862
|
token: any;
|
|
@@ -3894,6 +3901,15 @@ declare const _exports: {
|
|
|
3894
3901
|
query?: {};
|
|
3895
3902
|
voucher?: {};
|
|
3896
3903
|
}) => any;
|
|
3904
|
+
compensations: {
|
|
3905
|
+
create: ({ token, jwtToken, compensation, query, headers }: {
|
|
3906
|
+
token: any;
|
|
3907
|
+
jwtToken: any;
|
|
3908
|
+
compensation: any;
|
|
3909
|
+
query?: {};
|
|
3910
|
+
headers: any;
|
|
3911
|
+
}) => any;
|
|
3912
|
+
};
|
|
3897
3913
|
};
|
|
3898
3914
|
waitlists: {
|
|
3899
3915
|
all: ({ token, jwtToken, query, headers }: {
|