@wireapp/api-client 27.12.0 → 27.12.1
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.
|
@@ -39,14 +39,14 @@ class ConversationAPI {
|
|
|
39
39
|
ACCESS: 'access',
|
|
40
40
|
BOT: 'bot',
|
|
41
41
|
BOTS: 'bots',
|
|
42
|
-
CLIENTS: '
|
|
42
|
+
CLIENTS: 'clients',
|
|
43
43
|
CODE: 'code',
|
|
44
|
-
CODE_CHECK: '
|
|
45
|
-
CONVERSATIONS: '
|
|
44
|
+
CODE_CHECK: 'code-check',
|
|
45
|
+
CONVERSATIONS: 'conversations',
|
|
46
46
|
SUBCONVERSATIONS: 'subconversations',
|
|
47
47
|
GROUP_INFO: 'groupinfo',
|
|
48
|
-
MLS: '
|
|
49
|
-
JOIN: '
|
|
48
|
+
MLS: 'mls',
|
|
49
|
+
JOIN: 'join',
|
|
50
50
|
LIST: 'list',
|
|
51
51
|
LIST_IDS: 'list-ids',
|
|
52
52
|
MEMBERS: 'members',
|
|
@@ -70,8 +70,8 @@ class ConversationAPI {
|
|
|
70
70
|
}
|
|
71
71
|
generateBaseConversationUrl(conversationId, supportsQualifiedEndpoint = true) {
|
|
72
72
|
return supportsQualifiedEndpoint && conversationId.domain
|
|
73
|
-
?
|
|
74
|
-
:
|
|
73
|
+
? `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId.domain}/${conversationId.id}`
|
|
74
|
+
: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId.id}`;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Delete a conversation code.
|
|
@@ -81,7 +81,7 @@ class ConversationAPI {
|
|
|
81
81
|
async deleteConversationCode(conversationId) {
|
|
82
82
|
const config = {
|
|
83
83
|
method: 'delete',
|
|
84
|
-
url:
|
|
84
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${ConversationAPI.URL.CODE}`,
|
|
85
85
|
};
|
|
86
86
|
const response = await this.client.sendJSON(config);
|
|
87
87
|
return response.data;
|
|
@@ -101,8 +101,8 @@ class ConversationAPI {
|
|
|
101
101
|
const config = {
|
|
102
102
|
method: 'delete',
|
|
103
103
|
url: this.backendFeatures.version >= apiBreakpoint.version7
|
|
104
|
-
?
|
|
105
|
-
:
|
|
104
|
+
? `/${ConversationAPI.URL.BOT}/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${serviceId}`
|
|
105
|
+
: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${ConversationAPI.URL.BOTS}/${serviceId}`,
|
|
106
106
|
};
|
|
107
107
|
await this.client.sendJSON(config);
|
|
108
108
|
}
|
|
@@ -113,7 +113,7 @@ class ConversationAPI {
|
|
|
113
113
|
* @see https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/delete_conversations__cnv_domain___cnv__members__usr_domain___usr_
|
|
114
114
|
*/
|
|
115
115
|
async deleteMember(conversationId, userId) {
|
|
116
|
-
const url =
|
|
116
|
+
const url = `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId.domain}/${conversationId.id}/${ConversationAPI.URL.MEMBERS}/${userId.domain}/${userId.id}`;
|
|
117
117
|
const response = await this.client.sendJSON({
|
|
118
118
|
method: 'delete',
|
|
119
119
|
url,
|
|
@@ -128,7 +128,7 @@ class ConversationAPI {
|
|
|
128
128
|
async getConversationCode(conversationId) {
|
|
129
129
|
const config = {
|
|
130
130
|
method: 'GET',
|
|
131
|
-
url:
|
|
131
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${ConversationAPI.URL.CODE}`,
|
|
132
132
|
};
|
|
133
133
|
const response = await this.client.sendJSON(config);
|
|
134
134
|
return response.data;
|
|
@@ -140,7 +140,7 @@ class ConversationAPI {
|
|
|
140
140
|
async getConversationGuestLinkFeature(conversationId) {
|
|
141
141
|
const config = {
|
|
142
142
|
method: 'get',
|
|
143
|
-
url:
|
|
143
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/features/conversationGuestLinks`,
|
|
144
144
|
};
|
|
145
145
|
const response = await this.client.sendJSON(config);
|
|
146
146
|
return response.data;
|
|
@@ -157,7 +157,7 @@ class ConversationAPI {
|
|
|
157
157
|
async getMLSSelfConversation() {
|
|
158
158
|
const config = {
|
|
159
159
|
method: 'get',
|
|
160
|
-
url:
|
|
160
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.MLS_SELF}`,
|
|
161
161
|
};
|
|
162
162
|
const response = await this.client.sendJSON(config);
|
|
163
163
|
return response.data;
|
|
@@ -210,7 +210,7 @@ class ConversationAPI {
|
|
|
210
210
|
const config = {
|
|
211
211
|
data: {},
|
|
212
212
|
method: 'post',
|
|
213
|
-
url:
|
|
213
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.LIST_IDS}`,
|
|
214
214
|
};
|
|
215
215
|
if (limit > 0) {
|
|
216
216
|
config.data.size = limit;
|
|
@@ -242,8 +242,8 @@ class ConversationAPI {
|
|
|
242
242
|
data: { qualified_ids: chunk },
|
|
243
243
|
method: 'post',
|
|
244
244
|
url: this.backendFeatures.version >= apiBreakpoint.version2
|
|
245
|
-
?
|
|
246
|
-
:
|
|
245
|
+
? `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.LIST}`
|
|
246
|
+
: `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.LIST}/${ConversationAPI.URL.V2}`,
|
|
247
247
|
};
|
|
248
248
|
const { data } = await this.client.sendJSON(config);
|
|
249
249
|
results = {
|
|
@@ -284,7 +284,7 @@ class ConversationAPI {
|
|
|
284
284
|
async getRoles(conversationId) {
|
|
285
285
|
const config = {
|
|
286
286
|
method: 'get',
|
|
287
|
-
url:
|
|
287
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${ConversationAPI.URL.ROLES}`,
|
|
288
288
|
};
|
|
289
289
|
const response = await this.client.sendJSON(config);
|
|
290
290
|
return response.data;
|
|
@@ -313,7 +313,7 @@ class ConversationAPI {
|
|
|
313
313
|
method: 'post',
|
|
314
314
|
url: this.backendFeatures.version >= apiBreakpoint.version7
|
|
315
315
|
? `${ConversationAPI.URL.ONE_2_ONE}-${ConversationAPI.URL.CONVERSATIONS}`
|
|
316
|
-
:
|
|
316
|
+
: `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.ONE_2_ONE}`,
|
|
317
317
|
};
|
|
318
318
|
await this.client.sendJSON(config);
|
|
319
319
|
}
|
|
@@ -326,7 +326,7 @@ class ConversationAPI {
|
|
|
326
326
|
method: 'get',
|
|
327
327
|
url: this.backendFeatures.version >= apiBreakpoint.version7
|
|
328
328
|
? `${ConversationAPI.URL.ONE_2_ONE}-${ConversationAPI.URL.CONVERSATIONS}/${domain}/${id}`
|
|
329
|
-
:
|
|
329
|
+
: `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.ONE_2_ONE}/${domain}/${id}`,
|
|
330
330
|
};
|
|
331
331
|
const response = await this.client.sendJSON(config);
|
|
332
332
|
return response.data;
|
|
@@ -341,7 +341,7 @@ class ConversationAPI {
|
|
|
341
341
|
const config = {
|
|
342
342
|
data: invitationData,
|
|
343
343
|
method: 'post',
|
|
344
|
-
url:
|
|
344
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${ConversationAPI.URL.MEMBERS}`,
|
|
345
345
|
};
|
|
346
346
|
try {
|
|
347
347
|
const response = await this.client.sendJSON(config);
|
|
@@ -377,8 +377,8 @@ class ConversationAPI {
|
|
|
377
377
|
},
|
|
378
378
|
method: 'post',
|
|
379
379
|
url: this.backendFeatures.version >= apiBreakpoint.version7
|
|
380
|
-
?
|
|
381
|
-
:
|
|
380
|
+
? `/${ConversationAPI.URL.BOT}/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}`
|
|
381
|
+
: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${ConversationAPI.URL.BOTS}}`,
|
|
382
382
|
};
|
|
383
383
|
const response = await this.client.sendJSON(config);
|
|
384
384
|
return response.data;
|
|
@@ -419,7 +419,7 @@ class ConversationAPI {
|
|
|
419
419
|
async postConversationCodeRequest(conversationId, password) {
|
|
420
420
|
const config = {
|
|
421
421
|
method: 'post',
|
|
422
|
-
url:
|
|
422
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${ConversationAPI.URL.CODE}`,
|
|
423
423
|
data: {},
|
|
424
424
|
};
|
|
425
425
|
if (password) {
|
|
@@ -437,7 +437,7 @@ class ConversationAPI {
|
|
|
437
437
|
const config = {
|
|
438
438
|
data: conversationCode,
|
|
439
439
|
method: 'post',
|
|
440
|
-
url:
|
|
440
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.CODE_CHECK}`,
|
|
441
441
|
};
|
|
442
442
|
try {
|
|
443
443
|
await this.client.sendJSON(config);
|
|
@@ -461,7 +461,7 @@ class ConversationAPI {
|
|
|
461
461
|
const config = {
|
|
462
462
|
data: conversationCode,
|
|
463
463
|
method: 'post',
|
|
464
|
-
url:
|
|
464
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.JOIN}`,
|
|
465
465
|
};
|
|
466
466
|
try {
|
|
467
467
|
const response = await this.client.sendJSON(config);
|
|
@@ -489,7 +489,7 @@ class ConversationAPI {
|
|
|
489
489
|
const config = {
|
|
490
490
|
params: conversationCode,
|
|
491
491
|
method: 'get',
|
|
492
|
-
url:
|
|
492
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.JOIN}`,
|
|
493
493
|
};
|
|
494
494
|
try {
|
|
495
495
|
const response = await this.client.sendJSON(config);
|
|
@@ -513,7 +513,7 @@ class ConversationAPI {
|
|
|
513
513
|
async postJoin(conversationId) {
|
|
514
514
|
const config = {
|
|
515
515
|
method: 'post',
|
|
516
|
-
url:
|
|
516
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}`,
|
|
517
517
|
};
|
|
518
518
|
const response = await this.client.sendJSON(config);
|
|
519
519
|
return response.data;
|
|
@@ -548,7 +548,7 @@ class ConversationAPI {
|
|
|
548
548
|
*/
|
|
549
549
|
data: otr_1.proteus.QualifiedNewOtrMessage.encode(messageData).finish().slice(),
|
|
550
550
|
method: 'post',
|
|
551
|
-
url:
|
|
551
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${domain}/${conversationId}/${ConversationAPI.URL.PROTEUS}/${ConversationAPI.URL.MESSAGES}`,
|
|
552
552
|
};
|
|
553
553
|
const response = await this.client.sendProtocolBuffer(config, true);
|
|
554
554
|
return response.data;
|
|
@@ -563,7 +563,7 @@ class ConversationAPI {
|
|
|
563
563
|
const config = {
|
|
564
564
|
data: messageData,
|
|
565
565
|
method: 'post',
|
|
566
|
-
url:
|
|
566
|
+
url: `/${ConversationAPI.URL.MLS}/${ConversationAPI.URL.MESSAGES}`,
|
|
567
567
|
};
|
|
568
568
|
const response = await this.client.sendProtocolMls(config, true);
|
|
569
569
|
return response.data;
|
|
@@ -578,7 +578,7 @@ class ConversationAPI {
|
|
|
578
578
|
const config = {
|
|
579
579
|
data: messageData,
|
|
580
580
|
method: 'post',
|
|
581
|
-
url:
|
|
581
|
+
url: `/${ConversationAPI.URL.MLS}/commit-bundles`,
|
|
582
582
|
};
|
|
583
583
|
const response = await this.client.sendProtocolMls(config, true);
|
|
584
584
|
return response.data;
|
|
@@ -590,7 +590,7 @@ class ConversationAPI {
|
|
|
590
590
|
async postSelf() {
|
|
591
591
|
const config = {
|
|
592
592
|
method: 'post',
|
|
593
|
-
url:
|
|
593
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${ConversationAPI.URL.SELF}`,
|
|
594
594
|
};
|
|
595
595
|
const response = await this.client.sendJSON(config);
|
|
596
596
|
return response.data;
|
|
@@ -634,7 +634,7 @@ class ConversationAPI {
|
|
|
634
634
|
const config = {
|
|
635
635
|
data: conversationNameData,
|
|
636
636
|
method: 'put',
|
|
637
|
-
url:
|
|
637
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${ConversationAPI.URL.NAME}`,
|
|
638
638
|
};
|
|
639
639
|
const response = await this.client.sendJSON(config);
|
|
640
640
|
return response.data;
|
|
@@ -649,7 +649,7 @@ class ConversationAPI {
|
|
|
649
649
|
const config = {
|
|
650
650
|
data: messageTimerData,
|
|
651
651
|
method: 'put',
|
|
652
|
-
url:
|
|
652
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId.id}/${ConversationAPI.URL.MESSAGE_TIMER}`,
|
|
653
653
|
};
|
|
654
654
|
const response = await this.client.sendJSON(config);
|
|
655
655
|
return response.data;
|
|
@@ -683,7 +683,7 @@ class ConversationAPI {
|
|
|
683
683
|
method: 'post',
|
|
684
684
|
url: this.backendFeatures.version >= 2
|
|
685
685
|
? `${this.generateBaseConversationUrl(conversationId)}/${ConversationAPI.URL.MEMBERS}`
|
|
686
|
-
:
|
|
686
|
+
: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId.id}/${ConversationAPI.URL.MEMBERS}/${ConversationAPI.URL.V2}`,
|
|
687
687
|
};
|
|
688
688
|
try {
|
|
689
689
|
const response = await this.client.sendJSON(config);
|
|
@@ -713,7 +713,7 @@ class ConversationAPI {
|
|
|
713
713
|
const config = {
|
|
714
714
|
data: memberUpdateData,
|
|
715
715
|
method: 'put',
|
|
716
|
-
url:
|
|
716
|
+
url: `/${ConversationAPI.URL.CONVERSATIONS}/${conversationId}/${ConversationAPI.URL.MEMBERS}/${userId}`,
|
|
717
717
|
};
|
|
718
718
|
await this.client.sendJSON(config);
|
|
719
719
|
}
|
package/lib/user/UserAPI.js
CHANGED
|
@@ -43,27 +43,27 @@ class UserAPI {
|
|
|
43
43
|
static DEFAULT_USERS_CHUNK_SIZE = 50;
|
|
44
44
|
static DEFAULT_USERS_PREKEY_BUNDLE_CHUNK_SIZE = 128;
|
|
45
45
|
static URL = {
|
|
46
|
-
ACTIVATE: '
|
|
46
|
+
ACTIVATE: 'activate',
|
|
47
47
|
BY_HANDLE: 'by-handle',
|
|
48
|
-
CALLS: '
|
|
48
|
+
CALLS: 'calls',
|
|
49
49
|
CLIENTS: 'clients',
|
|
50
50
|
CONFIG: 'config',
|
|
51
51
|
CONTACTS: 'contacts',
|
|
52
|
-
DELETE: '
|
|
52
|
+
DELETE: 'delete',
|
|
53
53
|
EMAIL: 'email',
|
|
54
54
|
HANDLES: 'handles',
|
|
55
55
|
LIST_CLIENTS: 'list-clients',
|
|
56
56
|
LIST_PREKEYS: 'list-prekeys',
|
|
57
|
-
LIST_USERS: '
|
|
58
|
-
PASSWORD_RESET: '
|
|
57
|
+
LIST_USERS: 'list-users',
|
|
58
|
+
PASSWORD_RESET: 'password-reset',
|
|
59
59
|
PRE_KEYS: 'prekeys',
|
|
60
|
-
PROPERTIES: '
|
|
60
|
+
PROPERTIES: 'properties',
|
|
61
61
|
RICH_INFO: 'rich-info',
|
|
62
|
-
SEARCH: '
|
|
62
|
+
SEARCH: 'search',
|
|
63
63
|
SEND: 'send',
|
|
64
|
-
USERS: '
|
|
64
|
+
USERS: 'users',
|
|
65
65
|
V2: 'v2',
|
|
66
|
-
VERIFICATION: '
|
|
66
|
+
VERIFICATION: 'verification-code',
|
|
67
67
|
SUPPORTED_PROTOCOLS: 'supported-protocols',
|
|
68
68
|
};
|
|
69
69
|
constructor(client, backendFeatures) {
|
|
@@ -77,7 +77,7 @@ class UserAPI {
|
|
|
77
77
|
async deleteProperties() {
|
|
78
78
|
const config = {
|
|
79
79
|
method: 'delete',
|
|
80
|
-
url: UserAPI.URL.PROPERTIES
|
|
80
|
+
url: `/${UserAPI.URL.PROPERTIES}`,
|
|
81
81
|
};
|
|
82
82
|
await this.client.sendJSON(config);
|
|
83
83
|
}
|
|
@@ -89,7 +89,7 @@ class UserAPI {
|
|
|
89
89
|
async deleteProperty(propertyKey) {
|
|
90
90
|
const config = {
|
|
91
91
|
method: 'delete',
|
|
92
|
-
url:
|
|
92
|
+
url: `/${UserAPI.URL.PROPERTIES}/${propertyKey}`,
|
|
93
93
|
};
|
|
94
94
|
await this.client.sendJSON(config);
|
|
95
95
|
}
|
|
@@ -106,7 +106,7 @@ class UserAPI {
|
|
|
106
106
|
code: activationCode,
|
|
107
107
|
key: activationKey,
|
|
108
108
|
},
|
|
109
|
-
url: UserAPI.URL.ACTIVATE
|
|
109
|
+
url: `/${UserAPI.URL.ACTIVATE}`,
|
|
110
110
|
};
|
|
111
111
|
const response = await this.client.sendJSON(config);
|
|
112
112
|
return response.data;
|
|
@@ -118,7 +118,7 @@ class UserAPI {
|
|
|
118
118
|
async getCallsConfiguration() {
|
|
119
119
|
const config = {
|
|
120
120
|
method: 'get',
|
|
121
|
-
url:
|
|
121
|
+
url: `/${UserAPI.URL.CALLS}/${UserAPI.URL.CONFIG}`,
|
|
122
122
|
};
|
|
123
123
|
const response = await this.client.sendJSON(config);
|
|
124
124
|
return response.data;
|
|
@@ -130,7 +130,7 @@ class UserAPI {
|
|
|
130
130
|
* @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/users/getUserClient
|
|
131
131
|
*/
|
|
132
132
|
async getClient(userId, clientId) {
|
|
133
|
-
const url =
|
|
133
|
+
const url = `/${UserAPI.URL.USERS}/${userId.domain}/${userId.id}/${UserAPI.URL.CLIENTS}/${clientId}`;
|
|
134
134
|
const config = {
|
|
135
135
|
method: 'get',
|
|
136
136
|
url,
|
|
@@ -146,7 +146,7 @@ class UserAPI {
|
|
|
146
146
|
*/
|
|
147
147
|
async getClientPreKey(userId, clientId) {
|
|
148
148
|
const { id, domain } = userId;
|
|
149
|
-
const url =
|
|
149
|
+
const url = `/${UserAPI.URL.USERS}/${domain}/${id}/${UserAPI.URL.PRE_KEYS}/${clientId}`;
|
|
150
150
|
const config = {
|
|
151
151
|
method: 'get',
|
|
152
152
|
url,
|
|
@@ -160,7 +160,7 @@ class UserAPI {
|
|
|
160
160
|
* @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/users/getUserClients
|
|
161
161
|
*/
|
|
162
162
|
async getClients(userId) {
|
|
163
|
-
const url =
|
|
163
|
+
const url = `/${UserAPI.URL.USERS}/${userId.domain}/${userId.id}/${UserAPI.URL.CLIENTS}`;
|
|
164
164
|
const config = {
|
|
165
165
|
method: 'get',
|
|
166
166
|
url,
|
|
@@ -177,7 +177,7 @@ class UserAPI {
|
|
|
177
177
|
async getHandle(handle) {
|
|
178
178
|
const config = {
|
|
179
179
|
method: 'get',
|
|
180
|
-
url:
|
|
180
|
+
url: `/${UserAPI.URL.USERS}/${UserAPI.URL.HANDLES}/${handle}`,
|
|
181
181
|
};
|
|
182
182
|
const response = await this.client.sendJSON(config);
|
|
183
183
|
return response.data;
|
|
@@ -189,7 +189,7 @@ class UserAPI {
|
|
|
189
189
|
async getProperties() {
|
|
190
190
|
const config = {
|
|
191
191
|
method: 'get',
|
|
192
|
-
url: UserAPI.URL.PROPERTIES
|
|
192
|
+
url: `/${UserAPI.URL.PROPERTIES}`,
|
|
193
193
|
};
|
|
194
194
|
const response = await this.client.sendJSON(config);
|
|
195
195
|
return response.data;
|
|
@@ -202,7 +202,7 @@ class UserAPI {
|
|
|
202
202
|
async getProperty(propertyKey) {
|
|
203
203
|
const config = {
|
|
204
204
|
method: 'get',
|
|
205
|
-
url:
|
|
205
|
+
url: `/${UserAPI.URL.PROPERTIES}/${propertyKey}`,
|
|
206
206
|
};
|
|
207
207
|
const response = await this.client.sendJSON(config);
|
|
208
208
|
return response.data;
|
|
@@ -222,7 +222,7 @@ class UserAPI {
|
|
|
222
222
|
params: {
|
|
223
223
|
q: query,
|
|
224
224
|
},
|
|
225
|
-
url:
|
|
225
|
+
url: `/${UserAPI.URL.SEARCH}/${UserAPI.URL.CONTACTS}`,
|
|
226
226
|
};
|
|
227
227
|
if (domain) {
|
|
228
228
|
config.params.domain = domain;
|
|
@@ -255,8 +255,8 @@ class UserAPI {
|
|
|
255
255
|
*/
|
|
256
256
|
async getUser(userId) {
|
|
257
257
|
const url = typeof userId === 'string'
|
|
258
|
-
?
|
|
259
|
-
:
|
|
258
|
+
? `/${UserAPI.URL.USERS}/${userId}`
|
|
259
|
+
: `/${UserAPI.URL.USERS}/${userId.domain}/${userId.id}`;
|
|
260
260
|
const config = {
|
|
261
261
|
method: 'get',
|
|
262
262
|
url,
|
|
@@ -265,7 +265,7 @@ class UserAPI {
|
|
|
265
265
|
return response.data;
|
|
266
266
|
}
|
|
267
267
|
async getUserPreKeys(userId) {
|
|
268
|
-
const url =
|
|
268
|
+
const url = `/${UserAPI.URL.USERS}/${userId.domain}/${userId.id}/${UserAPI.URL.PRE_KEYS}`;
|
|
269
269
|
const config = {
|
|
270
270
|
method: 'get',
|
|
271
271
|
url,
|
|
@@ -274,7 +274,7 @@ class UserAPI {
|
|
|
274
274
|
return response.data;
|
|
275
275
|
}
|
|
276
276
|
async getUserSupportedProtocols(userId) {
|
|
277
|
-
const url =
|
|
277
|
+
const url = `/${UserAPI.URL.USERS}/${userId.domain}/${userId.id}/${UserAPI.URL.SUPPORTED_PROTOCOLS}`;
|
|
278
278
|
const config = {
|
|
279
279
|
method: 'get',
|
|
280
280
|
url,
|
|
@@ -333,8 +333,8 @@ class UserAPI {
|
|
|
333
333
|
*/
|
|
334
334
|
async headUsers(userId) {
|
|
335
335
|
const url = typeof userId === 'string'
|
|
336
|
-
?
|
|
337
|
-
:
|
|
336
|
+
? `/${UserAPI.URL.USERS}/${userId}`
|
|
337
|
+
: `/${UserAPI.URL.USERS}/${userId.domain}/${userId.id}`;
|
|
338
338
|
const config = {
|
|
339
339
|
method: 'head',
|
|
340
340
|
url,
|
|
@@ -351,7 +351,7 @@ class UserAPI {
|
|
|
351
351
|
const config = {
|
|
352
352
|
data: activationData,
|
|
353
353
|
method: 'post',
|
|
354
|
-
url: UserAPI.URL.ACTIVATE
|
|
354
|
+
url: `/${UserAPI.URL.ACTIVATE}`,
|
|
355
355
|
};
|
|
356
356
|
const response = await this.client.sendJSON(config);
|
|
357
357
|
return response.data;
|
|
@@ -365,7 +365,7 @@ class UserAPI {
|
|
|
365
365
|
const config = {
|
|
366
366
|
data: activationCodeData,
|
|
367
367
|
method: 'post',
|
|
368
|
-
url:
|
|
368
|
+
url: `/${UserAPI.URL.ACTIVATE}/${UserAPI.URL.SEND}`,
|
|
369
369
|
};
|
|
370
370
|
await this.client.sendJSON(config);
|
|
371
371
|
}
|
|
@@ -378,7 +378,7 @@ class UserAPI {
|
|
|
378
378
|
const config = {
|
|
379
379
|
data: { email, action },
|
|
380
380
|
method: 'post',
|
|
381
|
-
url:
|
|
381
|
+
url: `/${UserAPI.URL.VERIFICATION}/${UserAPI.URL.SEND}`,
|
|
382
382
|
};
|
|
383
383
|
await this.client.sendJSON(config);
|
|
384
384
|
}
|
|
@@ -391,7 +391,7 @@ class UserAPI {
|
|
|
391
391
|
const config = {
|
|
392
392
|
data: verificationData,
|
|
393
393
|
method: 'post',
|
|
394
|
-
url: UserAPI.URL.DELETE
|
|
394
|
+
url: `/${UserAPI.URL.DELETE}`,
|
|
395
395
|
};
|
|
396
396
|
await this.client.sendJSON(config);
|
|
397
397
|
}
|
|
@@ -405,8 +405,8 @@ class UserAPI {
|
|
|
405
405
|
data: handles,
|
|
406
406
|
method: 'post',
|
|
407
407
|
url: this.backendFeatures.version >= apiBreakpoint.version7
|
|
408
|
-
?
|
|
409
|
-
:
|
|
408
|
+
? `/${UserAPI.URL.HANDLES}`
|
|
409
|
+
: `/${UserAPI.URL.USERS}/${UserAPI.URL.HANDLES}`,
|
|
410
410
|
};
|
|
411
411
|
const response = await this.client.sendJSON(config);
|
|
412
412
|
return response.data;
|
|
@@ -420,8 +420,8 @@ class UserAPI {
|
|
|
420
420
|
const config = {
|
|
421
421
|
method: 'head',
|
|
422
422
|
url: this.backendFeatures.version >= apiBreakpoint.version7
|
|
423
|
-
?
|
|
424
|
-
:
|
|
423
|
+
? `/${UserAPI.URL.HANDLES}/${handle}`
|
|
424
|
+
: `/${UserAPI.URL.USERS}/${UserAPI.URL.HANDLES}/${handle}`,
|
|
425
425
|
};
|
|
426
426
|
await this.client.sendJSON(config);
|
|
427
427
|
}
|
|
@@ -433,7 +433,7 @@ class UserAPI {
|
|
|
433
433
|
async getUserByHandle(handle) {
|
|
434
434
|
const config = {
|
|
435
435
|
method: 'get',
|
|
436
|
-
url:
|
|
436
|
+
url: `/${UserAPI.URL.USERS}/${UserAPI.URL.BY_HANDLE}/${handle.domain}/${handle.handle}`,
|
|
437
437
|
};
|
|
438
438
|
const response = await this.client.sendJSON(config);
|
|
439
439
|
return response.data;
|
|
@@ -442,7 +442,7 @@ class UserAPI {
|
|
|
442
442
|
const config = {
|
|
443
443
|
data: userClientMap,
|
|
444
444
|
method: 'post',
|
|
445
|
-
url:
|
|
445
|
+
url: `/${UserAPI.URL.USERS}/${UserAPI.URL.LIST_PREKEYS}`,
|
|
446
446
|
};
|
|
447
447
|
const response = await this.client.sendJSON(config, true);
|
|
448
448
|
return isPrekeysResponse(response.data) ? response.data : { qualified_user_client_prekeys: response.data };
|
|
@@ -455,7 +455,7 @@ class UserAPI {
|
|
|
455
455
|
const config = {
|
|
456
456
|
data: users,
|
|
457
457
|
method: 'post',
|
|
458
|
-
url: UserAPI.URL.LIST_USERS
|
|
458
|
+
url: `/${UserAPI.URL.LIST_USERS}`,
|
|
459
459
|
};
|
|
460
460
|
try {
|
|
461
461
|
/**
|
|
@@ -486,7 +486,7 @@ class UserAPI {
|
|
|
486
486
|
const { data: sameBackendUserData } = await this.client.sendJSON({
|
|
487
487
|
data: { qualified_ids: sameBackendUsers },
|
|
488
488
|
method: 'post',
|
|
489
|
-
url: UserAPI.URL.LIST_USERS
|
|
489
|
+
url: `/${UserAPI.URL.LIST_USERS}`,
|
|
490
490
|
});
|
|
491
491
|
return { found: sameBackendUserData, failed: federatedUsers };
|
|
492
492
|
}
|
|
@@ -501,8 +501,8 @@ class UserAPI {
|
|
|
501
501
|
data: userIdList,
|
|
502
502
|
method: 'post',
|
|
503
503
|
url: this.backendFeatures.version >= apiBreakpoint.version2
|
|
504
|
-
?
|
|
505
|
-
:
|
|
504
|
+
? `/${UserAPI.URL.USERS}/${UserAPI.URL.LIST_CLIENTS}`
|
|
505
|
+
: `/${UserAPI.URL.USERS}/${UserAPI.URL.LIST_CLIENTS}/${UserAPI.URL.V2}`,
|
|
506
506
|
};
|
|
507
507
|
const response = await this.client.sendJSON(config);
|
|
508
508
|
return response.data;
|
|
@@ -554,7 +554,7 @@ class UserAPI {
|
|
|
554
554
|
const config = {
|
|
555
555
|
data: resetData,
|
|
556
556
|
method: 'post',
|
|
557
|
-
url: UserAPI.URL.PASSWORD_RESET
|
|
557
|
+
url: `/${UserAPI.URL.PASSWORD_RESET}`,
|
|
558
558
|
};
|
|
559
559
|
await this.client.sendJSON(config);
|
|
560
560
|
}
|
|
@@ -568,7 +568,7 @@ class UserAPI {
|
|
|
568
568
|
const config = {
|
|
569
569
|
data: propertyData,
|
|
570
570
|
method: 'put',
|
|
571
|
-
url:
|
|
571
|
+
url: `/${UserAPI.URL.PROPERTIES}/${propertyKey}`,
|
|
572
572
|
};
|
|
573
573
|
await this.client.sendJSON(config);
|
|
574
574
|
}
|
|
@@ -580,7 +580,7 @@ class UserAPI {
|
|
|
580
580
|
async getRichInfo(userId) {
|
|
581
581
|
const config = {
|
|
582
582
|
method: 'get',
|
|
583
|
-
url:
|
|
583
|
+
url: `/${UserAPI.URL.USERS}/${userId}/${UserAPI.URL.RICH_INFO}`,
|
|
584
584
|
};
|
|
585
585
|
const response = await this.client.sendJSON(config);
|
|
586
586
|
return response.data;
|
|
@@ -594,7 +594,7 @@ class UserAPI {
|
|
|
594
594
|
const config = {
|
|
595
595
|
data: { email },
|
|
596
596
|
method: 'put',
|
|
597
|
-
url:
|
|
597
|
+
url: `/${UserAPI.URL.USERS}/${userId}/${UserAPI.URL.EMAIL}`,
|
|
598
598
|
};
|
|
599
599
|
await this.client.sendJSON(config);
|
|
600
600
|
}
|
package/package.json
CHANGED