@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":"getPosts.d.ts","sourceRoot":"","sources":["../../../src/post/api/getPosts.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ;cACV,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,GAC9B,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"getPosts.d.ts","sourceRoot":"","sources":["../../../src/post/api/getPosts.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ;cACV,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,GAC9B,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IAqBtC;;;;;;;;;;;;OAYG;qBAEQ,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,GAC9B,MAAM,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,SAAS;CAjBxC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUsers.d.ts","sourceRoot":"","sources":["../../../src/user/api/getUsers.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ;cACV,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,GAC9B,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"getUsers.d.ts","sourceRoot":"","sources":["../../../src/user/api/getUsers.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ;cACV,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,GAC9B,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IAqBtC;;;;;;;;;;;;OAYG;qBAEQ,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,GAC9B,MAAM,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,SAAS;CAjBxC,CAAA"}
|
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@ export const addChannelMembers = async (
|
|
|
26
26
|
client.log('channel/addChannelMembers', channelId, userIds)
|
|
27
27
|
|
|
28
28
|
const { data } = await client.http.post<Amity.ChannelMembershipPayload>(
|
|
29
|
-
`/api/v3/channels/${channelId}/users`,
|
|
29
|
+
`/api/v3/channels/${encodeURIComponent(channelId)}/users`,
|
|
30
30
|
{ channelId, userIds }
|
|
31
31
|
)
|
|
32
32
|
|
|
@@ -27,7 +27,7 @@ export const addChannelMembersRole = async (
|
|
|
27
27
|
client.log('channel/addChannelMembersRole', channelId, roleId, userIds)
|
|
28
28
|
|
|
29
29
|
const { data } = await client.http.post<Amity.ChannelMembershipPayload>(
|
|
30
|
-
`/api/v3/channels/${channelId}/users/roles`,
|
|
30
|
+
`/api/v3/channels/${encodeURIComponent(channelId)}/users/roles`,
|
|
31
31
|
{ channelId, role: roleId, userIds }
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -24,7 +24,7 @@ export const deleteChannel = async (
|
|
|
24
24
|
|
|
25
25
|
// API-FIX: This endpoint has not been implemented yet.
|
|
26
26
|
await client.http.delete<{ success: boolean }>(
|
|
27
|
-
`/api/v3/channels/${channelId}`
|
|
27
|
+
`/api/v3/channels/${encodeURIComponent(channelId)}`
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
const deleted = await getChannel(channelId)
|
|
@@ -25,7 +25,7 @@ export const getChannel = async (
|
|
|
25
25
|
|
|
26
26
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
27
27
|
const { data } = await client.http.get<Amity.ChannelPayload>(
|
|
28
|
-
`/api/v3/channels/${channelId}`,
|
|
28
|
+
`/api/v3/channels/${encodeURIComponent(channelId)}`,
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
const cachedAt = client.cache && Date.now()
|
|
@@ -23,10 +23,12 @@ export const getChannels = async (
|
|
|
23
23
|
const client = getActiveClient()
|
|
24
24
|
client.log('channel/getChannels', channelIds)
|
|
25
25
|
|
|
26
|
+
const encodedChannelIds = channelIds.map(channelId => encodeURIComponent(channelId));
|
|
27
|
+
|
|
26
28
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
27
29
|
const { data } = await client.http.get<Amity.ChannelPayload>(
|
|
28
30
|
`/api/v3/channels/list`,
|
|
29
|
-
{ params: { channelIds } },
|
|
31
|
+
{ params: { channelIds: encodedChannelIds } },
|
|
30
32
|
)
|
|
31
33
|
|
|
32
34
|
const cachedAt = client.cache && Date.now()
|
|
@@ -23,7 +23,7 @@ export const joinChannel = async (
|
|
|
23
23
|
client.log('channel/joinChannel', channelId)
|
|
24
24
|
|
|
25
25
|
const { data } = await client.http.post<Amity.ChannelMembershipPayload>(
|
|
26
|
-
`/api/v3/channels/${channelId}/join`,
|
|
26
|
+
`/api/v3/channels/${encodeURIComponent(channelId)}/join`,
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
if (client.cache) ingestInCache(data)
|
|
@@ -23,7 +23,7 @@ export const leaveChannel = async (
|
|
|
23
23
|
client.log('channel/leaveChannel', channelId)
|
|
24
24
|
|
|
25
25
|
const { data } = await client.http.delete<Amity.ChannelMembershipPayload>(
|
|
26
|
-
`/api/v3/channels/${channelId}/leave`,
|
|
26
|
+
`/api/v3/channels/${encodeURIComponent(channelId)}/leave`,
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
if (client.cache) ingestInCache(data)
|
|
@@ -31,7 +31,7 @@ export const queryChannelMembers = async (query: {
|
|
|
31
31
|
|
|
32
32
|
const { data } = await client.http.get<
|
|
33
33
|
Amity.ChannelMembershipPayload & Amity.Pagination
|
|
34
|
-
>(`/api/v3/channels/${channelId}/users`, {
|
|
34
|
+
>(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, {
|
|
35
35
|
params: {
|
|
36
36
|
...params,
|
|
37
37
|
filter: membership,
|
|
@@ -26,7 +26,7 @@ export const removeChannelMembers = async (
|
|
|
26
26
|
client.log('channel/removeChannelMembers', channelId, userIds)
|
|
27
27
|
|
|
28
28
|
const { data } = await client.http.delete<Amity.ChannelMembershipPayload>(
|
|
29
|
-
`/api/v3/channels/${channelId}/users`,
|
|
29
|
+
`/api/v3/channels/${encodeURIComponent(channelId)}/users`,
|
|
30
30
|
{ data: { channelId, userIds } }
|
|
31
31
|
)
|
|
32
32
|
|
|
@@ -27,7 +27,7 @@ export const removeChannelMembersRole = async (
|
|
|
27
27
|
client.log('channel/removeChannelMembersRole', channelId, roleId, userIds)
|
|
28
28
|
|
|
29
29
|
const { data } = await client.http.delete<Amity.ChannelMembershipPayload>(
|
|
30
|
-
`/api/v3/channels/${channelId}/users/roles`,
|
|
30
|
+
`/api/v3/channels/${encodeURIComponent(channelId)}/users/roles`,
|
|
31
31
|
{ data: { channelId, role: roleId, userIds } }
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -25,7 +25,7 @@ export const updateChannel = async (
|
|
|
25
25
|
client.log('channel/updateChannel', channelId, patch)
|
|
26
26
|
|
|
27
27
|
const { data } = await client.http.put<Amity.ChannelPayload>(
|
|
28
|
-
`/api/v3/channels/${channelId}`, patch,
|
|
28
|
+
`/api/v3/channels/${encodeURIComponent(channelId)}`, patch,
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
const cachedAt = client.cache && Date.now()
|
|
@@ -32,7 +32,7 @@ export const deleteComment = async (
|
|
|
32
32
|
|
|
33
33
|
// API-FIX: This endpoint has not been implemented yet.
|
|
34
34
|
await client.http.delete<{ success: boolean }>(
|
|
35
|
-
`/api/v4/comments/${commentId}`, {
|
|
35
|
+
`/api/v4/comments/${encodeURIComponent(commentId)}`, {
|
|
36
36
|
params: {
|
|
37
37
|
commentId,
|
|
38
38
|
permanent,
|
|
@@ -28,7 +28,7 @@ export const getComment = async (
|
|
|
28
28
|
try {
|
|
29
29
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
30
30
|
const response = await client.http.get<Amity.CommentPayload>(
|
|
31
|
-
`/api/v3/comments/${commentId}`,
|
|
31
|
+
`/api/v3/comments/${encodeURIComponent(commentId)}`,
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
data = response.data;
|
|
@@ -23,10 +23,12 @@ export const getComments = async (
|
|
|
23
23
|
const client = getActiveClient()
|
|
24
24
|
client.log('comment/getComments', commentIds)
|
|
25
25
|
|
|
26
|
+
const encodedCommentIds = commentIds.map(commentId => encodeURIComponent(commentId))
|
|
27
|
+
|
|
26
28
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
27
29
|
const { data } = await client.http.get<Amity.CommentPayload>(
|
|
28
30
|
`/api/v3/comments/list`,
|
|
29
|
-
{ params: { commentIds } },
|
|
31
|
+
{ params: { commentIds: encodedCommentIds } },
|
|
30
32
|
)
|
|
31
33
|
|
|
32
34
|
const cachedAt = client.cache && Date.now()
|
|
@@ -28,7 +28,7 @@ export const updateComment = async (
|
|
|
28
28
|
client.log('user/updateComment', patch)
|
|
29
29
|
|
|
30
30
|
const { data } = await client.http.put<Amity.CommentPayload>(
|
|
31
|
-
`/api/v3/comments/${commentId}`, patch,
|
|
31
|
+
`/api/v3/comments/${encodeURIComponent(commentId)}`, patch,
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
const cachedAt = client.cache && Date.now()
|
|
@@ -27,7 +27,7 @@ export const deleteMessage = async (
|
|
|
27
27
|
|
|
28
28
|
// API-FIX: This endpoint has not been implemented yet.
|
|
29
29
|
await client.http.delete<{ success: boolean }>(
|
|
30
|
-
`/api/v3/messages/${messageId}`
|
|
30
|
+
`/api/v3/messages/${encodeURIComponent(messageId)}`
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
const deleted = await getMessage(messageId)
|
|
@@ -25,7 +25,7 @@ export const getMessage = async (
|
|
|
25
25
|
|
|
26
26
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
27
27
|
const { data } = await client.http.get<Amity.MessagePayload>(
|
|
28
|
-
`/api/v3/messages/${messageId}`,
|
|
28
|
+
`/api/v3/messages/${encodeURIComponent(messageId)}`,
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
const cachedAt = client.cache && Date.now()
|
|
@@ -29,7 +29,7 @@ export const updateMessage = async (
|
|
|
29
29
|
client.log('user/updateMessage', patch)
|
|
30
30
|
|
|
31
31
|
const { data } = await client.http.put<Amity.MessagePayload>(
|
|
32
|
-
`/api/v3/messages/${messageId}`, patch,
|
|
32
|
+
`/api/v3/messages/${encodeURIComponent(messageId)}`, patch,
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
const cachedAt = client.cache && Date.now()
|
|
@@ -32,7 +32,7 @@ export const deletePost = async (
|
|
|
32
32
|
|
|
33
33
|
// API-FIX: This endpoint has not been implemented yet.
|
|
34
34
|
await client.http.delete<{ success: boolean }>(
|
|
35
|
-
`/api/v4/posts/${postId}`, {
|
|
35
|
+
`/api/v4/posts/${encodeURIComponent(postId)}`, {
|
|
36
36
|
params: {
|
|
37
37
|
postId,
|
|
38
38
|
permanent,
|
package/src/post/api/getPost.ts
CHANGED
|
@@ -28,7 +28,7 @@ export const getPost = async (
|
|
|
28
28
|
try {
|
|
29
29
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
30
30
|
const response = await client.http.get<Amity.PostPayload>(
|
|
31
|
-
`/api/v3/posts/${postId}`,
|
|
31
|
+
`/api/v3/posts/${encodeURIComponent(postId)}`,
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
data = response.data;
|
package/src/post/api/getPosts.ts
CHANGED
|
@@ -23,10 +23,12 @@ export const getPosts = async (
|
|
|
23
23
|
const client = getActiveClient()
|
|
24
24
|
client.log('post/getPosts', postIds)
|
|
25
25
|
|
|
26
|
+
const encodedPostIds = postIds.map(postId => encodeURIComponent(postId));
|
|
27
|
+
|
|
26
28
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
27
29
|
const { data } = await client.http.get<Amity.PostPayload>(
|
|
28
30
|
`/api/v3/posts/list`,
|
|
29
|
-
{ params: { postIds } }
|
|
31
|
+
{ params: { postIds: encodedPostIds } }
|
|
30
32
|
)
|
|
31
33
|
|
|
32
34
|
const cachedAt = client.cache && Date.now()
|
|
@@ -28,7 +28,7 @@ export const updatePost = async (
|
|
|
28
28
|
client.log('user/updatePost', patch)
|
|
29
29
|
|
|
30
30
|
const { data } = await client.http.put<Amity.PostPayload>(
|
|
31
|
-
`/api/v3/posts/${postId}`, patch,
|
|
31
|
+
`/api/v3/posts/${encodeURIComponent(postId)}`, patch,
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
const cachedAt = client.cache && Date.now()
|
|
@@ -28,7 +28,7 @@ export const createReport = async (
|
|
|
28
28
|
const { domainName } = REFERENCE_TYPES[referenceType]
|
|
29
29
|
|
|
30
30
|
const { data } = await client.http.post<Amity.PostPayload | Amity.CommentPayload | Amity.MessagePayload | Amity.UserPayload>(
|
|
31
|
-
`/api/v3/${domainName}/${referenceId}/flag`
|
|
31
|
+
`/api/v3/${domainName}/${(encodeURIComponent(referenceId))}/flag`
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
if (client.cache) ingestInCache(data)
|
|
@@ -28,7 +28,7 @@ export const deleteReport = async (
|
|
|
28
28
|
const { domainName } = REFERENCE_TYPES[referenceType]
|
|
29
29
|
|
|
30
30
|
const { data } = await client.http.delete<Amity.PostPayload | Amity.CommentPayload | Amity.MessagePayload | Amity.UserPayload>(
|
|
31
|
-
`/api/v3/${domainName}/${referenceId}/unflag`
|
|
31
|
+
`/api/v3/${domainName}/${encodeURIComponent(referenceId)}/unflag`
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
if (client.cache) ingestInCache(data)
|
package/src/user/api/getUser.ts
CHANGED
|
@@ -25,7 +25,7 @@ export const getUser = async (
|
|
|
25
25
|
|
|
26
26
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
27
27
|
const { data } = await client.http.get<Amity.UserPayload>(
|
|
28
|
-
`/api/v3/users/${userId}`,
|
|
28
|
+
`/api/v3/users/${encodeURIComponent(userId)}`,
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
const cachedAt = client.cache && Date.now()
|
package/src/user/api/getUsers.ts
CHANGED
|
@@ -23,10 +23,12 @@ export const getUsers = async (
|
|
|
23
23
|
const client = getActiveClient()
|
|
24
24
|
client.log('user/getUsers', userIds)
|
|
25
25
|
|
|
26
|
+
const encodedUserIds = userIds.map(userId => encodeURIComponent(userId));
|
|
27
|
+
|
|
26
28
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
27
29
|
const { data } = await client.http.get<Amity.UserPayload>(
|
|
28
30
|
`/api/v3/users/list`,
|
|
29
|
-
{ params: { userIds } },
|
|
31
|
+
{ params: { userIds: encodedUserIds } },
|
|
30
32
|
)
|
|
31
33
|
|
|
32
34
|
const cachedAt = client.cache && Date.now()
|