@amityco/ts-sdk 7.0.3-7f3fd9b.0 → 7.1.1-1d526d8.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/dist/index.cjs.js CHANGED
@@ -102,8 +102,8 @@ const PostContentType = Object.freeze({
102
102
 
103
103
  function getVersion() {
104
104
  try {
105
- // the string ''v7.0.2-cjs'' should be replaced by actual value by @rollup/plugin-replace
106
- return 'v7.0.2-cjs';
105
+ // the string ''v7.1.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
106
+ return 'v7.1.0-cjs';
107
107
  }
108
108
  catch (error) {
109
109
  return '__dev__';
@@ -12740,6 +12740,8 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
12740
12740
  referenceType,
12741
12741
  reactionName,
12742
12742
  });
12743
+ if (!['post', 'comment', 'story', 'message'].includes(referenceType))
12744
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
12743
12745
  const { data } = await client.http.post('/api/v2/reactions', {
12744
12746
  referenceId,
12745
12747
  referenceType,
@@ -12859,6 +12861,8 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
12859
12861
  referenceType,
12860
12862
  reactionName,
12861
12863
  });
12864
+ if (!['post', 'comment', 'story', 'message'].includes(referenceType))
12865
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
12862
12866
  const { data } = await client.http.delete(`/api/v2/reactions`, {
12863
12867
  data: {
12864
12868
  referenceId,
@@ -13784,6 +13788,8 @@ class ReactionPaginationController extends PaginationController {
13784
13788
  const client = getActiveClient();
13785
13789
  client.log('reaction/queryReactions', queryParams);
13786
13790
  const path = '/api/v3/reactions';
13791
+ if (!['post', 'comment', 'story', 'message'].includes(params.referenceType))
13792
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
13787
13793
  const { data: queryResponse } = await this.http.get(path, {
13788
13794
  params: Object.assign(Object.assign({}, params), { referenceVersion: REFERENCE_API_V5, // Need to put this param to make it can query reaction for message in sub-channel
13789
13795
  options }),
package/dist/index.esm.js CHANGED
@@ -87,8 +87,8 @@ const PostContentType = Object.freeze({
87
87
 
88
88
  function getVersion() {
89
89
  try {
90
- // the string ''v7.0.2-esm'' should be replaced by actual value by @rollup/plugin-replace
91
- return 'v7.0.2-esm';
90
+ // the string ''v7.1.0-esm'' should be replaced by actual value by @rollup/plugin-replace
91
+ return 'v7.1.0-esm';
92
92
  }
93
93
  catch (error) {
94
94
  return '__dev__';
@@ -28832,6 +28832,8 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
28832
28832
  referenceType,
28833
28833
  reactionName,
28834
28834
  });
28835
+ if (!['post', 'comment', 'story', 'message'].includes(referenceType))
28836
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
28835
28837
  const { data } = await client.http.post('/api/v2/reactions', {
28836
28838
  referenceId,
28837
28839
  referenceType,
@@ -28951,6 +28953,8 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
28951
28953
  referenceType,
28952
28954
  reactionName,
28953
28955
  });
28956
+ if (!['post', 'comment', 'story', 'message'].includes(referenceType))
28957
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
28954
28958
  const { data } = await client.http.delete(`/api/v2/reactions`, {
28955
28959
  data: {
28956
28960
  referenceId,
@@ -29876,6 +29880,8 @@ class ReactionPaginationController extends PaginationController {
29876
29880
  const client = getActiveClient();
29877
29881
  client.log('reaction/queryReactions', queryParams);
29878
29882
  const path = '/api/v3/reactions';
29883
+ if (!['post', 'comment', 'story', 'message'].includes(params.referenceType))
29884
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
29879
29885
  const { data: queryResponse } = await this.http.get(path, {
29880
29886
  params: Object.assign(Object.assign({}, params), { referenceVersion: REFERENCE_API_V5, // Need to put this param to make it can query reaction for message in sub-channel
29881
29887
  options }),