@amityco/ts-sdk 0.0.1-beta.10 → 0.0.1-beta.11
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/dist/channel/api/getChannels.d.ts.map +1 -1
- package/dist/comment/api/getComments.d.ts.map +1 -1
- package/dist/index.cjs.js +31 -27
- package/dist/index.esm.js +31 -27
- package/dist/index.umd.js +5 -5
- package/dist/post/api/getPosts.d.ts.map +1 -1
- package/dist/user/api/getUsers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel/api/addChannelMembers.ts +1 -1
- package/src/channel/api/addChannelMembersRole.ts +1 -1
- package/src/channel/api/deleteChannel.ts +1 -1
- package/src/channel/api/getChannel.ts +1 -1
- package/src/channel/api/getChannels.ts +3 -1
- package/src/channel/api/joinChannel.ts +1 -1
- package/src/channel/api/leaveChannel.ts +1 -1
- package/src/channel/api/queryChannelMembers.ts +1 -1
- package/src/channel/api/removeChannelMembers.ts +1 -1
- package/src/channel/api/removeChannelMembersRole.ts +1 -1
- package/src/channel/api/updateChannel.ts +1 -1
- package/src/comment/api/deleteComment.ts +1 -1
- package/src/comment/api/getComment.ts +1 -1
- package/src/comment/api/getComments.ts +3 -1
- package/src/comment/api/updateComment.ts +1 -1
- package/src/message/api/deleteMessage.ts +1 -1
- package/src/message/api/getMessage.ts +1 -1
- package/src/message/api/updateMessage.ts +1 -1
- package/src/post/api/deletePost.ts +1 -1
- package/src/post/api/getPost.ts +1 -1
- package/src/post/api/getPosts.ts +3 -1
- package/src/post/api/updatePost.ts +1 -1
- package/src/report/api/createReport.ts +1 -1
- package/src/report/api/deleteReport.ts +1 -1
- package/src/user/api/getUser.ts +1 -1
- package/src/user/api/getUsers.ts +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getChannels.d.ts","sourceRoot":"","sources":["../../../src/channel/api/getChannels.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;iBACV,MAAM,OAAO,CAAC,WAAW,CAAC,EAAE,GACvC,QAAQ,MAAM,MAAM,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"getChannels.d.ts","sourceRoot":"","sources":["../../../src/channel/api/getChannels.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;iBACV,MAAM,OAAO,CAAC,WAAW,CAAC,EAAE,GACvC,QAAQ,MAAM,MAAM,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC;IAqBzC;;;;;;;;;;;;OAYG;wBAEW,MAAM,OAAO,CAAC,WAAW,CAAC,EAAE,GACvC,MAAM,MAAM,CAAC,MAAM,OAAO,EAAE,CAAC,GAAG,SAAS;CAjB3C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getComments.d.ts","sourceRoot":"","sources":["../../../src/comment/api/getComments.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;iBACV,aAAa,CAAC,WAAW,CAAC,EAAE,GACvC,QAAQ,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"getComments.d.ts","sourceRoot":"","sources":["../../../src/comment/api/getComments.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;iBACV,aAAa,CAAC,WAAW,CAAC,EAAE,GACvC,QAAQ,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;IAqBzC;;;;;;;;;;;;OAYG;wBAEW,aAAa,CAAC,WAAW,CAAC,EAAE,GACvC,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC,GAAG,SAAS;CAjB3C,CAAA"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -23,7 +23,7 @@ var isMatch__default = /*#__PURE__*/_interopDefaultLegacy(isMatch);
|
|
|
23
23
|
|
|
24
24
|
var _a;
|
|
25
25
|
// used in createClient
|
|
26
|
-
const VERSION$1 = (_a = 'v0.0.1-beta.
|
|
26
|
+
const VERSION$1 = (_a = 'v0.0.1-beta.11-cjs') !== null && _a !== void 0 ? _a : '__dev__';
|
|
27
27
|
|
|
28
28
|
// @ts-ignore
|
|
29
29
|
/**
|
|
@@ -15633,7 +15633,7 @@ const getUser = async (userId) => {
|
|
|
15633
15633
|
const client = getActiveClient();
|
|
15634
15634
|
client.log('user/getUser', userId);
|
|
15635
15635
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
15636
|
-
const { data } = await client.http.get(`/api/v3/users/${userId}`);
|
|
15636
|
+
const { data } = await client.http.get(`/api/v3/users/${encodeURIComponent(userId)}`);
|
|
15637
15637
|
const cachedAt = client.cache && Date.now();
|
|
15638
15638
|
if (client.cache)
|
|
15639
15639
|
ingestInCache(data, { cachedAt });
|
|
@@ -15679,8 +15679,9 @@ getUser.locally = (userId) => {
|
|
|
15679
15679
|
const getUsers = async (userIds) => {
|
|
15680
15680
|
const client = getActiveClient();
|
|
15681
15681
|
client.log('user/getUsers', userIds);
|
|
15682
|
+
const encodedUserIds = userIds.map(userId => encodeURIComponent(userId));
|
|
15682
15683
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
15683
|
-
const { data } = await client.http.get(`/api/v3/users/list`, { params: { userIds } });
|
|
15684
|
+
const { data } = await client.http.get(`/api/v3/users/list`, { params: { userIds: encodedUserIds } });
|
|
15684
15685
|
const cachedAt = client.cache && Date.now();
|
|
15685
15686
|
if (client.cache)
|
|
15686
15687
|
ingestInCache(data, { cachedAt });
|
|
@@ -16275,7 +16276,7 @@ const getMessage = async (messageId) => {
|
|
|
16275
16276
|
const client = getActiveClient();
|
|
16276
16277
|
client.log('message/getMessage', messageId);
|
|
16277
16278
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
16278
|
-
const { data } = await client.http.get(`/api/v3/messages/${messageId}`);
|
|
16279
|
+
const { data } = await client.http.get(`/api/v3/messages/${encodeURIComponent(messageId)}`);
|
|
16279
16280
|
const cachedAt = client.cache && Date.now();
|
|
16280
16281
|
if (client.cache)
|
|
16281
16282
|
ingestInCache(data, { cachedAt });
|
|
@@ -16534,7 +16535,7 @@ createMessage.optimistically = (bundle) => {
|
|
|
16534
16535
|
const updateMessage = async (messageId, patch) => {
|
|
16535
16536
|
const client = getActiveClient();
|
|
16536
16537
|
client.log('user/updateMessage', patch);
|
|
16537
|
-
const { data } = await client.http.put(`/api/v3/messages/${messageId}`, patch);
|
|
16538
|
+
const { data } = await client.http.put(`/api/v3/messages/${encodeURIComponent(messageId)}`, patch);
|
|
16538
16539
|
const cachedAt = client.cache && Date.now();
|
|
16539
16540
|
if (client.cache)
|
|
16540
16541
|
ingestInCache(data, { cachedAt });
|
|
@@ -16596,7 +16597,7 @@ const deleteMessage = async (messageId) => {
|
|
|
16596
16597
|
const client = getActiveClient();
|
|
16597
16598
|
client.log('message/deleteMessage', messageId);
|
|
16598
16599
|
// API-FIX: This endpoint has not been implemented yet.
|
|
16599
|
-
await client.http.delete(`/api/v3/messages/${messageId}`);
|
|
16600
|
+
await client.http.delete(`/api/v3/messages/${encodeURIComponent(messageId)}`);
|
|
16600
16601
|
const deleted = await getMessage(messageId);
|
|
16601
16602
|
// no need for event, fired by server
|
|
16602
16603
|
return deleted.data;
|
|
@@ -16725,8 +16726,9 @@ queryPosts.locally = (query) => {
|
|
|
16725
16726
|
const getPosts = async (postIds) => {
|
|
16726
16727
|
const client = getActiveClient();
|
|
16727
16728
|
client.log('post/getPosts', postIds);
|
|
16729
|
+
const encodedPostIds = postIds.map(postId => encodeURIComponent(postId));
|
|
16728
16730
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
16729
|
-
const { data } = await client.http.get(`/api/v3/posts/list`, { params: { postIds } });
|
|
16731
|
+
const { data } = await client.http.get(`/api/v3/posts/list`, { params: { postIds: encodedPostIds } });
|
|
16730
16732
|
const cachedAt = client.cache && Date.now();
|
|
16731
16733
|
if (client.cache)
|
|
16732
16734
|
ingestInCache(data, { cachedAt });
|
|
@@ -16788,7 +16790,7 @@ const getPost = async (postId) => {
|
|
|
16788
16790
|
let data;
|
|
16789
16791
|
try {
|
|
16790
16792
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
16791
|
-
const response = await client.http.get(`/api/v3/posts/${postId}`);
|
|
16793
|
+
const response = await client.http.get(`/api/v3/posts/${encodeURIComponent(postId)}`);
|
|
16792
16794
|
data = response.data;
|
|
16793
16795
|
}
|
|
16794
16796
|
catch (error) {
|
|
@@ -16890,7 +16892,7 @@ const createPost = async (bundle) => {
|
|
|
16890
16892
|
const updatePost = async (postId, patch) => {
|
|
16891
16893
|
const client = getActiveClient();
|
|
16892
16894
|
client.log('user/updatePost', patch);
|
|
16893
|
-
const { data } = await client.http.put(`/api/v3/posts/${postId}`, patch);
|
|
16895
|
+
const { data } = await client.http.put(`/api/v3/posts/${encodeURIComponent(postId)}`, patch);
|
|
16894
16896
|
const cachedAt = client.cache && Date.now();
|
|
16895
16897
|
if (client.cache)
|
|
16896
16898
|
ingestInCache(data, { cachedAt });
|
|
@@ -17395,7 +17397,7 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
17395
17397
|
client.log('post/deletePost', postId);
|
|
17396
17398
|
let post = await getPost(postId);
|
|
17397
17399
|
// API-FIX: This endpoint has not been implemented yet.
|
|
17398
|
-
await client.http.delete(`/api/v4/posts/${postId}`, {
|
|
17400
|
+
await client.http.delete(`/api/v4/posts/${encodeURIComponent(postId)}`, {
|
|
17399
17401
|
params: {
|
|
17400
17402
|
postId,
|
|
17401
17403
|
permanent,
|
|
@@ -17523,8 +17525,9 @@ queryComments.locally = (query) => {
|
|
|
17523
17525
|
const getComments = async (commentIds) => {
|
|
17524
17526
|
const client = getActiveClient();
|
|
17525
17527
|
client.log('comment/getComments', commentIds);
|
|
17528
|
+
const encodedCommentIds = commentIds.map(commentId => encodeURIComponent(commentId));
|
|
17526
17529
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
17527
|
-
const { data } = await client.http.get(`/api/v3/comments/list`, { params: { commentIds } });
|
|
17530
|
+
const { data } = await client.http.get(`/api/v3/comments/list`, { params: { commentIds: encodedCommentIds } });
|
|
17528
17531
|
const cachedAt = client.cache && Date.now();
|
|
17529
17532
|
if (client.cache)
|
|
17530
17533
|
ingestInCache(data, { cachedAt });
|
|
@@ -17586,7 +17589,7 @@ const getComment = async (commentId) => {
|
|
|
17586
17589
|
let data;
|
|
17587
17590
|
try {
|
|
17588
17591
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
17589
|
-
const response = await client.http.get(`/api/v3/comments/${commentId}`);
|
|
17592
|
+
const response = await client.http.get(`/api/v3/comments/${encodeURIComponent(commentId)}`);
|
|
17590
17593
|
data = response.data;
|
|
17591
17594
|
}
|
|
17592
17595
|
catch (error) {
|
|
@@ -17682,7 +17685,7 @@ const createComment = async (bundle) => {
|
|
|
17682
17685
|
const updateComment = async (commentId, patch) => {
|
|
17683
17686
|
const client = getActiveClient();
|
|
17684
17687
|
client.log('user/updateComment', patch);
|
|
17685
|
-
const { data } = await client.http.put(`/api/v3/comments/${commentId}`, patch);
|
|
17688
|
+
const { data } = await client.http.put(`/api/v3/comments/${encodeURIComponent(commentId)}`, patch);
|
|
17686
17689
|
const cachedAt = client.cache && Date.now();
|
|
17687
17690
|
if (client.cache)
|
|
17688
17691
|
ingestInCache(data, { cachedAt });
|
|
@@ -17713,7 +17716,7 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
17713
17716
|
client.log('comment/deleteComment', commentId);
|
|
17714
17717
|
const comment = await getComment(commentId);
|
|
17715
17718
|
// API-FIX: This endpoint has not been implemented yet.
|
|
17716
|
-
await client.http.delete(`/api/v4/comments/${commentId}`, {
|
|
17719
|
+
await client.http.delete(`/api/v4/comments/${encodeURIComponent(commentId)}`, {
|
|
17717
17720
|
params: {
|
|
17718
17721
|
commentId,
|
|
17719
17722
|
permanent,
|
|
@@ -18394,7 +18397,7 @@ const createReport = async (referenceType, referenceId) => {
|
|
|
18394
18397
|
const client = getActiveClient();
|
|
18395
18398
|
client.log('report/createReport', { referenceType, referenceId });
|
|
18396
18399
|
const { domainName } = REFERENCE_TYPES[referenceType];
|
|
18397
|
-
const { data } = await client.http.post(`/api/v3/${domainName}/${referenceId}/flag`);
|
|
18400
|
+
const { data } = await client.http.post(`/api/v3/${domainName}/${(encodeURIComponent(referenceId))}/flag`);
|
|
18398
18401
|
if (client.cache)
|
|
18399
18402
|
ingestInCache(data);
|
|
18400
18403
|
const event = referenceType === 'message'
|
|
@@ -18421,7 +18424,7 @@ const deleteReport = async (referenceType, referenceId) => {
|
|
|
18421
18424
|
const client = getActiveClient();
|
|
18422
18425
|
client.log('report/deleteReport', { referenceType, referenceId });
|
|
18423
18426
|
const { domainName } = REFERENCE_TYPES[referenceType];
|
|
18424
|
-
const { data } = await client.http.delete(`/api/v3/${domainName}/${referenceId}/unflag`);
|
|
18427
|
+
const { data } = await client.http.delete(`/api/v3/${domainName}/${encodeURIComponent(referenceId)}/unflag`);
|
|
18425
18428
|
if (client.cache)
|
|
18426
18429
|
ingestInCache(data);
|
|
18427
18430
|
const event = referenceType === 'message'
|
|
@@ -18529,8 +18532,9 @@ queryChannels.locally = (query) => {
|
|
|
18529
18532
|
const getChannels = async (channelIds) => {
|
|
18530
18533
|
const client = getActiveClient();
|
|
18531
18534
|
client.log('channel/getChannels', channelIds);
|
|
18535
|
+
const encodedChannelIds = channelIds.map(channelId => encodeURIComponent(channelId));
|
|
18532
18536
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
18533
|
-
const { data } = await client.http.get(`/api/v3/channels/list`, { params: { channelIds } });
|
|
18537
|
+
const { data } = await client.http.get(`/api/v3/channels/list`, { params: { channelIds: encodedChannelIds } });
|
|
18534
18538
|
const cachedAt = client.cache && Date.now();
|
|
18535
18539
|
if (client.cache)
|
|
18536
18540
|
ingestInCache(data, { cachedAt });
|
|
@@ -18589,7 +18593,7 @@ const getChannel = async (channelId) => {
|
|
|
18589
18593
|
const client = getActiveClient();
|
|
18590
18594
|
client.log('channel/getChannel', channelId);
|
|
18591
18595
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
18592
|
-
const { data } = await client.http.get(`/api/v3/channels/${channelId}`);
|
|
18596
|
+
const { data } = await client.http.get(`/api/v3/channels/${encodeURIComponent(channelId)}`);
|
|
18593
18597
|
const cachedAt = client.cache && Date.now();
|
|
18594
18598
|
if (client.cache)
|
|
18595
18599
|
ingestInCache(data, { cachedAt });
|
|
@@ -18678,7 +18682,7 @@ const createChannel = async (bundle) => {
|
|
|
18678
18682
|
const updateChannel = async (channelId, patch) => {
|
|
18679
18683
|
const client = getActiveClient();
|
|
18680
18684
|
client.log('channel/updateChannel', channelId, patch);
|
|
18681
|
-
const { data } = await client.http.put(`/api/v3/channels/${channelId}`, patch);
|
|
18685
|
+
const { data } = await client.http.put(`/api/v3/channels/${encodeURIComponent(channelId)}`, patch);
|
|
18682
18686
|
const cachedAt = client.cache && Date.now();
|
|
18683
18687
|
if (client.cache)
|
|
18684
18688
|
ingestInCache(data, { cachedAt });
|
|
@@ -18707,7 +18711,7 @@ const deleteChannel = async (channelId) => {
|
|
|
18707
18711
|
const client = getActiveClient();
|
|
18708
18712
|
client.log('channel/deleteChannel', channelId);
|
|
18709
18713
|
// API-FIX: This endpoint has not been implemented yet.
|
|
18710
|
-
await client.http.delete(`/api/v3/channels/${channelId}`);
|
|
18714
|
+
await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}`);
|
|
18711
18715
|
const deleted = await getChannel(channelId);
|
|
18712
18716
|
// no need for event, fired by server
|
|
18713
18717
|
return deleted.data;
|
|
@@ -18730,7 +18734,7 @@ const deleteChannel = async (channelId) => {
|
|
|
18730
18734
|
const joinChannel = async (channelId) => {
|
|
18731
18735
|
const client = getActiveClient();
|
|
18732
18736
|
client.log('channel/joinChannel', channelId);
|
|
18733
|
-
const { data } = await client.http.post(`/api/v3/channels/${channelId}/join`);
|
|
18737
|
+
const { data } = await client.http.post(`/api/v3/channels/${encodeURIComponent(channelId)}/join`);
|
|
18734
18738
|
if (client.cache)
|
|
18735
18739
|
ingestInCache(data);
|
|
18736
18740
|
const { channelUsers } = data;
|
|
@@ -18755,7 +18759,7 @@ const joinChannel = async (channelId) => {
|
|
|
18755
18759
|
const leaveChannel = async (channelId) => {
|
|
18756
18760
|
const client = getActiveClient();
|
|
18757
18761
|
client.log('channel/leaveChannel', channelId);
|
|
18758
|
-
const { data } = await client.http.delete(`/api/v3/channels/${channelId}/leave`);
|
|
18762
|
+
const { data } = await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}/leave`);
|
|
18759
18763
|
if (client.cache)
|
|
18760
18764
|
ingestInCache(data);
|
|
18761
18765
|
const { channelUsers } = data;
|
|
@@ -18781,7 +18785,7 @@ const queryChannelMembers = async (query) => {
|
|
|
18781
18785
|
const client = getActiveClient();
|
|
18782
18786
|
client.log('channel/queryChannelMembers', query);
|
|
18783
18787
|
const _a = query !== null && query !== void 0 ? query : {}, { page, channelId, membership } = _a, params = __rest(_a, ["page", "channelId", "membership"]);
|
|
18784
|
-
const { data } = await client.http.get(`/api/v3/channels/${channelId}/users`, {
|
|
18788
|
+
const { data } = await client.http.get(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, {
|
|
18785
18789
|
params: Object.assign(Object.assign({}, params), { filter: membership, options: {
|
|
18786
18790
|
token: toToken(page, 'skiplimit'),
|
|
18787
18791
|
} }),
|
|
@@ -18832,7 +18836,7 @@ queryChannelMembers.locally = (query) => {
|
|
|
18832
18836
|
const addChannelMembers = async (channelId, userIds) => {
|
|
18833
18837
|
const client = getActiveClient();
|
|
18834
18838
|
client.log('channel/addChannelMembers', channelId, userIds);
|
|
18835
|
-
const { data } = await client.http.post(`/api/v3/channels/${channelId}/users`, { channelId, userIds });
|
|
18839
|
+
const { data } = await client.http.post(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, { channelId, userIds });
|
|
18836
18840
|
if (client.cache)
|
|
18837
18841
|
ingestInCache(data);
|
|
18838
18842
|
fireEvent('v3.channel.didAddUsers', {
|
|
@@ -18860,7 +18864,7 @@ const addChannelMembers = async (channelId, userIds) => {
|
|
|
18860
18864
|
const removeChannelMembers = async (channelId, userIds) => {
|
|
18861
18865
|
const client = getActiveClient();
|
|
18862
18866
|
client.log('channel/removeChannelMembers', channelId, userIds);
|
|
18863
|
-
const { data } = await client.http.delete(`/api/v3/channels/${channelId}/users`, { data: { channelId, userIds } });
|
|
18867
|
+
const { data } = await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, { data: { channelId, userIds } });
|
|
18864
18868
|
if (client.cache)
|
|
18865
18869
|
ingestInCache(data);
|
|
18866
18870
|
fireEvent('v3.channel.didRemoveUsers', {
|
|
@@ -18889,7 +18893,7 @@ const removeChannelMembers = async (channelId, userIds) => {
|
|
|
18889
18893
|
const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
18890
18894
|
const client = getActiveClient();
|
|
18891
18895
|
client.log('channel/addChannelMembersRole', channelId, roleId, userIds);
|
|
18892
|
-
const { data } = await client.http.post(`/api/v3/channels/${channelId}/users/roles`, { channelId, role: roleId, userIds });
|
|
18896
|
+
const { data } = await client.http.post(`/api/v3/channels/${encodeURIComponent(channelId)}/users/roles`, { channelId, role: roleId, userIds });
|
|
18893
18897
|
if (client.cache)
|
|
18894
18898
|
ingestInCache(data);
|
|
18895
18899
|
const { channelUsers } = data;
|
|
@@ -18915,7 +18919,7 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
18915
18919
|
const removeChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
18916
18920
|
const client = getActiveClient();
|
|
18917
18921
|
client.log('channel/removeChannelMembersRole', channelId, roleId, userIds);
|
|
18918
|
-
const { data } = await client.http.delete(`/api/v3/channels/${channelId}/users/roles`, { data: { channelId, role: roleId, userIds } });
|
|
18922
|
+
const { data } = await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}/users/roles`, { data: { channelId, role: roleId, userIds } });
|
|
18919
18923
|
if (client.cache)
|
|
18920
18924
|
ingestInCache(data);
|
|
18921
18925
|
const { channelUsers } = data;
|
package/dist/index.esm.js
CHANGED
|
@@ -9,7 +9,7 @@ import isMatch from 'lodash.ismatch';
|
|
|
9
9
|
|
|
10
10
|
var _a;
|
|
11
11
|
// used in createClient
|
|
12
|
-
const VERSION$1 = (_a = 'v0.0.1-beta.
|
|
12
|
+
const VERSION$1 = (_a = 'v0.0.1-beta.11-esm') !== null && _a !== void 0 ? _a : '__dev__';
|
|
13
13
|
|
|
14
14
|
// @ts-ignore
|
|
15
15
|
/**
|
|
@@ -15619,7 +15619,7 @@ const getUser = async (userId) => {
|
|
|
15619
15619
|
const client = getActiveClient();
|
|
15620
15620
|
client.log('user/getUser', userId);
|
|
15621
15621
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
15622
|
-
const { data } = await client.http.get(`/api/v3/users/${userId}`);
|
|
15622
|
+
const { data } = await client.http.get(`/api/v3/users/${encodeURIComponent(userId)}`);
|
|
15623
15623
|
const cachedAt = client.cache && Date.now();
|
|
15624
15624
|
if (client.cache)
|
|
15625
15625
|
ingestInCache(data, { cachedAt });
|
|
@@ -15665,8 +15665,9 @@ getUser.locally = (userId) => {
|
|
|
15665
15665
|
const getUsers = async (userIds) => {
|
|
15666
15666
|
const client = getActiveClient();
|
|
15667
15667
|
client.log('user/getUsers', userIds);
|
|
15668
|
+
const encodedUserIds = userIds.map(userId => encodeURIComponent(userId));
|
|
15668
15669
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
15669
|
-
const { data } = await client.http.get(`/api/v3/users/list`, { params: { userIds } });
|
|
15670
|
+
const { data } = await client.http.get(`/api/v3/users/list`, { params: { userIds: encodedUserIds } });
|
|
15670
15671
|
const cachedAt = client.cache && Date.now();
|
|
15671
15672
|
if (client.cache)
|
|
15672
15673
|
ingestInCache(data, { cachedAt });
|
|
@@ -16261,7 +16262,7 @@ const getMessage = async (messageId) => {
|
|
|
16261
16262
|
const client = getActiveClient();
|
|
16262
16263
|
client.log('message/getMessage', messageId);
|
|
16263
16264
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
16264
|
-
const { data } = await client.http.get(`/api/v3/messages/${messageId}`);
|
|
16265
|
+
const { data } = await client.http.get(`/api/v3/messages/${encodeURIComponent(messageId)}`);
|
|
16265
16266
|
const cachedAt = client.cache && Date.now();
|
|
16266
16267
|
if (client.cache)
|
|
16267
16268
|
ingestInCache(data, { cachedAt });
|
|
@@ -16520,7 +16521,7 @@ createMessage.optimistically = (bundle) => {
|
|
|
16520
16521
|
const updateMessage = async (messageId, patch) => {
|
|
16521
16522
|
const client = getActiveClient();
|
|
16522
16523
|
client.log('user/updateMessage', patch);
|
|
16523
|
-
const { data } = await client.http.put(`/api/v3/messages/${messageId}`, patch);
|
|
16524
|
+
const { data } = await client.http.put(`/api/v3/messages/${encodeURIComponent(messageId)}`, patch);
|
|
16524
16525
|
const cachedAt = client.cache && Date.now();
|
|
16525
16526
|
if (client.cache)
|
|
16526
16527
|
ingestInCache(data, { cachedAt });
|
|
@@ -16582,7 +16583,7 @@ const deleteMessage = async (messageId) => {
|
|
|
16582
16583
|
const client = getActiveClient();
|
|
16583
16584
|
client.log('message/deleteMessage', messageId);
|
|
16584
16585
|
// API-FIX: This endpoint has not been implemented yet.
|
|
16585
|
-
await client.http.delete(`/api/v3/messages/${messageId}`);
|
|
16586
|
+
await client.http.delete(`/api/v3/messages/${encodeURIComponent(messageId)}`);
|
|
16586
16587
|
const deleted = await getMessage(messageId);
|
|
16587
16588
|
// no need for event, fired by server
|
|
16588
16589
|
return deleted.data;
|
|
@@ -16711,8 +16712,9 @@ queryPosts.locally = (query) => {
|
|
|
16711
16712
|
const getPosts = async (postIds) => {
|
|
16712
16713
|
const client = getActiveClient();
|
|
16713
16714
|
client.log('post/getPosts', postIds);
|
|
16715
|
+
const encodedPostIds = postIds.map(postId => encodeURIComponent(postId));
|
|
16714
16716
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
16715
|
-
const { data } = await client.http.get(`/api/v3/posts/list`, { params: { postIds } });
|
|
16717
|
+
const { data } = await client.http.get(`/api/v3/posts/list`, { params: { postIds: encodedPostIds } });
|
|
16716
16718
|
const cachedAt = client.cache && Date.now();
|
|
16717
16719
|
if (client.cache)
|
|
16718
16720
|
ingestInCache(data, { cachedAt });
|
|
@@ -16774,7 +16776,7 @@ const getPost = async (postId) => {
|
|
|
16774
16776
|
let data;
|
|
16775
16777
|
try {
|
|
16776
16778
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
16777
|
-
const response = await client.http.get(`/api/v3/posts/${postId}`);
|
|
16779
|
+
const response = await client.http.get(`/api/v3/posts/${encodeURIComponent(postId)}`);
|
|
16778
16780
|
data = response.data;
|
|
16779
16781
|
}
|
|
16780
16782
|
catch (error) {
|
|
@@ -16876,7 +16878,7 @@ const createPost = async (bundle) => {
|
|
|
16876
16878
|
const updatePost = async (postId, patch) => {
|
|
16877
16879
|
const client = getActiveClient();
|
|
16878
16880
|
client.log('user/updatePost', patch);
|
|
16879
|
-
const { data } = await client.http.put(`/api/v3/posts/${postId}`, patch);
|
|
16881
|
+
const { data } = await client.http.put(`/api/v3/posts/${encodeURIComponent(postId)}`, patch);
|
|
16880
16882
|
const cachedAt = client.cache && Date.now();
|
|
16881
16883
|
if (client.cache)
|
|
16882
16884
|
ingestInCache(data, { cachedAt });
|
|
@@ -17381,7 +17383,7 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
17381
17383
|
client.log('post/deletePost', postId);
|
|
17382
17384
|
let post = await getPost(postId);
|
|
17383
17385
|
// API-FIX: This endpoint has not been implemented yet.
|
|
17384
|
-
await client.http.delete(`/api/v4/posts/${postId}`, {
|
|
17386
|
+
await client.http.delete(`/api/v4/posts/${encodeURIComponent(postId)}`, {
|
|
17385
17387
|
params: {
|
|
17386
17388
|
postId,
|
|
17387
17389
|
permanent,
|
|
@@ -17509,8 +17511,9 @@ queryComments.locally = (query) => {
|
|
|
17509
17511
|
const getComments = async (commentIds) => {
|
|
17510
17512
|
const client = getActiveClient();
|
|
17511
17513
|
client.log('comment/getComments', commentIds);
|
|
17514
|
+
const encodedCommentIds = commentIds.map(commentId => encodeURIComponent(commentId));
|
|
17512
17515
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
17513
|
-
const { data } = await client.http.get(`/api/v3/comments/list`, { params: { commentIds } });
|
|
17516
|
+
const { data } = await client.http.get(`/api/v3/comments/list`, { params: { commentIds: encodedCommentIds } });
|
|
17514
17517
|
const cachedAt = client.cache && Date.now();
|
|
17515
17518
|
if (client.cache)
|
|
17516
17519
|
ingestInCache(data, { cachedAt });
|
|
@@ -17572,7 +17575,7 @@ const getComment = async (commentId) => {
|
|
|
17572
17575
|
let data;
|
|
17573
17576
|
try {
|
|
17574
17577
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
17575
|
-
const response = await client.http.get(`/api/v3/comments/${commentId}`);
|
|
17578
|
+
const response = await client.http.get(`/api/v3/comments/${encodeURIComponent(commentId)}`);
|
|
17576
17579
|
data = response.data;
|
|
17577
17580
|
}
|
|
17578
17581
|
catch (error) {
|
|
@@ -17668,7 +17671,7 @@ const createComment = async (bundle) => {
|
|
|
17668
17671
|
const updateComment = async (commentId, patch) => {
|
|
17669
17672
|
const client = getActiveClient();
|
|
17670
17673
|
client.log('user/updateComment', patch);
|
|
17671
|
-
const { data } = await client.http.put(`/api/v3/comments/${commentId}`, patch);
|
|
17674
|
+
const { data } = await client.http.put(`/api/v3/comments/${encodeURIComponent(commentId)}`, patch);
|
|
17672
17675
|
const cachedAt = client.cache && Date.now();
|
|
17673
17676
|
if (client.cache)
|
|
17674
17677
|
ingestInCache(data, { cachedAt });
|
|
@@ -17699,7 +17702,7 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
17699
17702
|
client.log('comment/deleteComment', commentId);
|
|
17700
17703
|
const comment = await getComment(commentId);
|
|
17701
17704
|
// API-FIX: This endpoint has not been implemented yet.
|
|
17702
|
-
await client.http.delete(`/api/v4/comments/${commentId}`, {
|
|
17705
|
+
await client.http.delete(`/api/v4/comments/${encodeURIComponent(commentId)}`, {
|
|
17703
17706
|
params: {
|
|
17704
17707
|
commentId,
|
|
17705
17708
|
permanent,
|
|
@@ -18380,7 +18383,7 @@ const createReport = async (referenceType, referenceId) => {
|
|
|
18380
18383
|
const client = getActiveClient();
|
|
18381
18384
|
client.log('report/createReport', { referenceType, referenceId });
|
|
18382
18385
|
const { domainName } = REFERENCE_TYPES[referenceType];
|
|
18383
|
-
const { data } = await client.http.post(`/api/v3/${domainName}/${referenceId}/flag`);
|
|
18386
|
+
const { data } = await client.http.post(`/api/v3/${domainName}/${(encodeURIComponent(referenceId))}/flag`);
|
|
18384
18387
|
if (client.cache)
|
|
18385
18388
|
ingestInCache(data);
|
|
18386
18389
|
const event = referenceType === 'message'
|
|
@@ -18407,7 +18410,7 @@ const deleteReport = async (referenceType, referenceId) => {
|
|
|
18407
18410
|
const client = getActiveClient();
|
|
18408
18411
|
client.log('report/deleteReport', { referenceType, referenceId });
|
|
18409
18412
|
const { domainName } = REFERENCE_TYPES[referenceType];
|
|
18410
|
-
const { data } = await client.http.delete(`/api/v3/${domainName}/${referenceId}/unflag`);
|
|
18413
|
+
const { data } = await client.http.delete(`/api/v3/${domainName}/${encodeURIComponent(referenceId)}/unflag`);
|
|
18411
18414
|
if (client.cache)
|
|
18412
18415
|
ingestInCache(data);
|
|
18413
18416
|
const event = referenceType === 'message'
|
|
@@ -18515,8 +18518,9 @@ queryChannels.locally = (query) => {
|
|
|
18515
18518
|
const getChannels = async (channelIds) => {
|
|
18516
18519
|
const client = getActiveClient();
|
|
18517
18520
|
client.log('channel/getChannels', channelIds);
|
|
18521
|
+
const encodedChannelIds = channelIds.map(channelId => encodeURIComponent(channelId));
|
|
18518
18522
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
18519
|
-
const { data } = await client.http.get(`/api/v3/channels/list`, { params: { channelIds } });
|
|
18523
|
+
const { data } = await client.http.get(`/api/v3/channels/list`, { params: { channelIds: encodedChannelIds } });
|
|
18520
18524
|
const cachedAt = client.cache && Date.now();
|
|
18521
18525
|
if (client.cache)
|
|
18522
18526
|
ingestInCache(data, { cachedAt });
|
|
@@ -18575,7 +18579,7 @@ const getChannel = async (channelId) => {
|
|
|
18575
18579
|
const client = getActiveClient();
|
|
18576
18580
|
client.log('channel/getChannel', channelId);
|
|
18577
18581
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
18578
|
-
const { data } = await client.http.get(`/api/v3/channels/${channelId}`);
|
|
18582
|
+
const { data } = await client.http.get(`/api/v3/channels/${encodeURIComponent(channelId)}`);
|
|
18579
18583
|
const cachedAt = client.cache && Date.now();
|
|
18580
18584
|
if (client.cache)
|
|
18581
18585
|
ingestInCache(data, { cachedAt });
|
|
@@ -18664,7 +18668,7 @@ const createChannel = async (bundle) => {
|
|
|
18664
18668
|
const updateChannel = async (channelId, patch) => {
|
|
18665
18669
|
const client = getActiveClient();
|
|
18666
18670
|
client.log('channel/updateChannel', channelId, patch);
|
|
18667
|
-
const { data } = await client.http.put(`/api/v3/channels/${channelId}`, patch);
|
|
18671
|
+
const { data } = await client.http.put(`/api/v3/channels/${encodeURIComponent(channelId)}`, patch);
|
|
18668
18672
|
const cachedAt = client.cache && Date.now();
|
|
18669
18673
|
if (client.cache)
|
|
18670
18674
|
ingestInCache(data, { cachedAt });
|
|
@@ -18693,7 +18697,7 @@ const deleteChannel = async (channelId) => {
|
|
|
18693
18697
|
const client = getActiveClient();
|
|
18694
18698
|
client.log('channel/deleteChannel', channelId);
|
|
18695
18699
|
// API-FIX: This endpoint has not been implemented yet.
|
|
18696
|
-
await client.http.delete(`/api/v3/channels/${channelId}`);
|
|
18700
|
+
await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}`);
|
|
18697
18701
|
const deleted = await getChannel(channelId);
|
|
18698
18702
|
// no need for event, fired by server
|
|
18699
18703
|
return deleted.data;
|
|
@@ -18716,7 +18720,7 @@ const deleteChannel = async (channelId) => {
|
|
|
18716
18720
|
const joinChannel = async (channelId) => {
|
|
18717
18721
|
const client = getActiveClient();
|
|
18718
18722
|
client.log('channel/joinChannel', channelId);
|
|
18719
|
-
const { data } = await client.http.post(`/api/v3/channels/${channelId}/join`);
|
|
18723
|
+
const { data } = await client.http.post(`/api/v3/channels/${encodeURIComponent(channelId)}/join`);
|
|
18720
18724
|
if (client.cache)
|
|
18721
18725
|
ingestInCache(data);
|
|
18722
18726
|
const { channelUsers } = data;
|
|
@@ -18741,7 +18745,7 @@ const joinChannel = async (channelId) => {
|
|
|
18741
18745
|
const leaveChannel = async (channelId) => {
|
|
18742
18746
|
const client = getActiveClient();
|
|
18743
18747
|
client.log('channel/leaveChannel', channelId);
|
|
18744
|
-
const { data } = await client.http.delete(`/api/v3/channels/${channelId}/leave`);
|
|
18748
|
+
const { data } = await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}/leave`);
|
|
18745
18749
|
if (client.cache)
|
|
18746
18750
|
ingestInCache(data);
|
|
18747
18751
|
const { channelUsers } = data;
|
|
@@ -18767,7 +18771,7 @@ const queryChannelMembers = async (query) => {
|
|
|
18767
18771
|
const client = getActiveClient();
|
|
18768
18772
|
client.log('channel/queryChannelMembers', query);
|
|
18769
18773
|
const _a = query !== null && query !== void 0 ? query : {}, { page, channelId, membership } = _a, params = __rest(_a, ["page", "channelId", "membership"]);
|
|
18770
|
-
const { data } = await client.http.get(`/api/v3/channels/${channelId}/users`, {
|
|
18774
|
+
const { data } = await client.http.get(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, {
|
|
18771
18775
|
params: Object.assign(Object.assign({}, params), { filter: membership, options: {
|
|
18772
18776
|
token: toToken(page, 'skiplimit'),
|
|
18773
18777
|
} }),
|
|
@@ -18818,7 +18822,7 @@ queryChannelMembers.locally = (query) => {
|
|
|
18818
18822
|
const addChannelMembers = async (channelId, userIds) => {
|
|
18819
18823
|
const client = getActiveClient();
|
|
18820
18824
|
client.log('channel/addChannelMembers', channelId, userIds);
|
|
18821
|
-
const { data } = await client.http.post(`/api/v3/channels/${channelId}/users`, { channelId, userIds });
|
|
18825
|
+
const { data } = await client.http.post(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, { channelId, userIds });
|
|
18822
18826
|
if (client.cache)
|
|
18823
18827
|
ingestInCache(data);
|
|
18824
18828
|
fireEvent('v3.channel.didAddUsers', {
|
|
@@ -18846,7 +18850,7 @@ const addChannelMembers = async (channelId, userIds) => {
|
|
|
18846
18850
|
const removeChannelMembers = async (channelId, userIds) => {
|
|
18847
18851
|
const client = getActiveClient();
|
|
18848
18852
|
client.log('channel/removeChannelMembers', channelId, userIds);
|
|
18849
|
-
const { data } = await client.http.delete(`/api/v3/channels/${channelId}/users`, { data: { channelId, userIds } });
|
|
18853
|
+
const { data } = await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, { data: { channelId, userIds } });
|
|
18850
18854
|
if (client.cache)
|
|
18851
18855
|
ingestInCache(data);
|
|
18852
18856
|
fireEvent('v3.channel.didRemoveUsers', {
|
|
@@ -18875,7 +18879,7 @@ const removeChannelMembers = async (channelId, userIds) => {
|
|
|
18875
18879
|
const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
18876
18880
|
const client = getActiveClient();
|
|
18877
18881
|
client.log('channel/addChannelMembersRole', channelId, roleId, userIds);
|
|
18878
|
-
const { data } = await client.http.post(`/api/v3/channels/${channelId}/users/roles`, { channelId, role: roleId, userIds });
|
|
18882
|
+
const { data } = await client.http.post(`/api/v3/channels/${encodeURIComponent(channelId)}/users/roles`, { channelId, role: roleId, userIds });
|
|
18879
18883
|
if (client.cache)
|
|
18880
18884
|
ingestInCache(data);
|
|
18881
18885
|
const { channelUsers } = data;
|
|
@@ -18901,7 +18905,7 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
18901
18905
|
const removeChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
18902
18906
|
const client = getActiveClient();
|
|
18903
18907
|
client.log('channel/removeChannelMembersRole', channelId, roleId, userIds);
|
|
18904
|
-
const { data } = await client.http.delete(`/api/v3/channels/${channelId}/users/roles`, { data: { channelId, role: roleId, userIds } });
|
|
18908
|
+
const { data } = await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}/users/roles`, { data: { channelId, role: roleId, userIds } });
|
|
18905
18909
|
if (client.cache)
|
|
18906
18910
|
ingestInCache(data);
|
|
18907
18911
|
const { channelUsers } = data;
|