UNPKG

@likeminds.community/feed-js

Version:

LikeMinds Javascript SDK for chat APIs

1 lines 68.7 kB
import t from"axios";function e(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},e.apply(null,arguments)}var i=/*#__PURE__*/function(){function t(){this.convertedModel=void 0}return t.requestBodyGenerator=function(t){var e=this;if("object"!=typeof t||null===t)return t;if(Array.isArray(t))return t.map(function(t){return e.requestBodyGenerator(t)});var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r.replace(/([A-Z])/g,function(t,e){return"_"+e.toLowerCase()})]=this.requestBodyGenerator(t[r]));return i},t.responseBodyParser=function(t){var e=this;if("object"!=typeof t||null===t)return t;if(Array.isArray(t))return t.map(function(t){return e.responseBodyParser(t)});var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i["_id"==r?"id":"_lm_meta"==r?"lmMeta":r.replace(/_([a-z])/g,function(t,e){return e.toUpperCase()})]=this.responseBodyParser(t[r]));return i},t}();i.versionCode="rt";var r,n=function(t,e,r){this.data=void 0,this.errorMessage=void 0,this.success=void 0;var n=i.responseBodyParser(t.data);this.data=n,this.errorMessage=e,this.success=r},o="https://auth.likeminds.community",s={SDK_INITIATE:"/sdk/initiate",USER_LOGOUT:"/user/logout",COMMUNITY_MEMBER_STATE:"/community/member/state",FEED_UNIVERSAL:"/feed/universal",FEED_PERSONALISED:"/feed/personalised",FEED_POST:"/feed/post",FEED_TOPIC:"/feed/topic",HELPER_URL:"/helper/url",FEEDROOM:"/feedroom",FEED_GROUP:"/feed/group",REFRESH_TOKEN_API:"/user/refresh",CHATROOM_GET_TAGGINNG_LIST:"/community/tag",COMMUNITY_TAG:"/community/tag",COMMUNITY_CONFIGURATIONS:"/community/configurations",GET_REPORT_TAGS:"/community/report/tag",GET_REPORTS:"/community/report",UPDATE_REPORT:"/community/report",POST_REPORT:"/community/report",CLOSE_REPORT:"/community/report",GET_MEMBER_RIGHTS:"/moderation/rights",UPDATE_MEMBER_RIGHTS:"/moderation/rights",NOTIFICATION_FEED:"/feed/user/activity",COMMUNITY_MEMBER_PROFILE:"/community/member/profile",CHATROOM_SECRET_LEAVE:"/chatroom/secret/leave",DM_ALL_MEMBERS:"/community/member",COLLABCARD_SEEN:"/chatroom/seen",FETCH_DM_FEED:"/community/dm/feed",CONVERSATION_META:"/conversation",HOME_COMMUNITIES:"/home/fetch_communities",FETCH_CHATROOM_HOME:"/chatroom/home",MARK_READ:"/mark_read",UPLOAD_FILES:"/v1/upload_files",SEARCH_CHATROOM:"/chatroom/search",CHANNEL_INVITES:"/channel/invites",CHANNEL_INVITE:"/channel/invite",USER_DEVICE_PUSH:"/user/device/push",POLL:"/poll",SEARCH:"/search/post",POST_SEEN:"/feed/post/seen"};!function(t){t.LOCAL_ACCESS_TOKEN="LOCAL_ACCESS_TOKEN",t.LOCAL_REFRESH_TOKEN="LOCAL_REFRESH_TOKEN",t.LOCAL_USER="LOCAL_USER",t.LOCAL_API_KEY="LOCAL_API_KEY"}(r||(r={}));var u,a,c,h,d=/*#__PURE__*/function(){function e(t){this.accessToken=void 0,this.refreshToken=void 0,this.xVersionCode=void 0,this.xPlatformCode=void 0,this.xSDKSource="feed",this.lmSdkCallback=void 0,this.lmSdkCallback=t,this.accessToken=null,this.refreshToken=null}var n=e.prototype;return n.setLMSdkCallbacks=function(t){this.lmSdkCallback=t},n.setAccessToken=function(t){this.accessToken=t},n.getAccessToken=function(){return this.accessToken},n.setRefreshToken=function(t){this.refreshToken=t},n.getRefreshToken=function(){return this.refreshToken},n.setPlatformCode=function(t){i.versionCode=t,this.xPlatformCode=t},n.getPlatformCode=function(){return this.xPlatformCode},n.setVersionCode=function(t){this.xVersionCode=t},n.getVersionCode=function(){return this.xVersionCode},n.clearTokenManager=function(){this.accessToken=null,this.refreshToken=null},n.refreshAccessToken=function(){try{var e=this;return Promise.resolve(function(i,n){try{var u=(a=""+o+s.REFRESH_TOKEN_API,c={headers:{"Content-Type":"application/json",Authorization:"Bearer "+e.getRefreshToken(),"x-platform-code":e.getPlatformCode(),"x-version-code":e.getVersionCode()}},Promise.resolve(t.post(a,{},c)).then(function(t){var i,n=t.data.data||t.data;return e.accessToken=n.access_token,e.setRefreshToken(n.refresh_token),e.setAccessToken(n.access_token),"rt"===e.xPlatformCode&&(localStorage.setItem(r.LOCAL_ACCESS_TOKEN,n.access_token),localStorage.setItem(r.LOCAL_REFRESH_TOKEN,n.refresh_token)),null!=(i=e.lmSdkCallback)&&i.onAccessTokenExpiredAndRefreshed&&e.lmSdkCallback.onAccessTokenExpiredAndRefreshed(e.accessToken,e.refreshToken),n.access_token}))}catch(t){return n(t)}var a,c;return u&&u.then?u.then(void 0,n):u}(0,function(t){return console.error("Failed to refresh access token:",t),Promise.resolve(e.lmSdkCallback.onRefreshTokenExpired()).then(function(i){var n,o=i.accessToken,s=i.refreshToken;if(e.setAccessToken(o),e.setRefreshToken(s),"rt"===e.xPlatformCode&&(localStorage.setItem(r.LOCAL_ACCESS_TOKEN,o),localStorage.setItem(r.LOCAL_REFRESH_TOKEN,s)),null!=t&&t.response&&(null==t||null==(n=t.response)?void 0:n.status)>=500)throw t})}))}catch(t){return Promise.reject(t)}},e}(),p=/*#__PURE__*/function(){function i(t){this.tokenManager=void 0,this.xApiKey=void 0,this.lmSdkCallbacks=void 0,this.lmSdkCallbacks=t,this.tokenManager=new d(t)}var s=i.prototype;return s.setAccessToken=function(t){this.tokenManager.setAccessToken(t)},s.setRefreshToken=function(t){this.tokenManager.setRefreshToken(t)},s.getAccessToken=function(){return this.tokenManager.getAccessToken()},s.getRefreshToken=function(){return this.tokenManager.getRefreshToken()},s.onRefreshAccessToken=function(){return this.tokenManager.refreshAccessToken()},s.setUserInLocalStorage=function(t){localStorage.setItem(r.LOCAL_USER,t)},s.setApiKeyInLocalStorage=function(t){localStorage.setItem(r.LOCAL_API_KEY,t)},s.setAccessTokenInLocalStorage=function(t){localStorage.setItem(r.LOCAL_ACCESS_TOKEN,t)},s.setRefreshTokenInLocalStorage=function(t){localStorage.setItem(r.LOCAL_REFRESH_TOKEN,t)},s.getAccessTokenFromLocalStorage=function(){return localStorage.getItem(r.LOCAL_ACCESS_TOKEN)},s.getRefreshTokenFromLocalStorage=function(){return localStorage.getItem(r.LOCAL_REFRESH_TOKEN)},s.getApiKeyFromLocalStorage=function(){return localStorage.getItem(r.LOCAL_API_KEY)},s.getUserFromLocalStorage=function(){return localStorage.getItem(r.LOCAL_USER)},s.setPlatformCode=function(t){this.tokenManager.setPlatformCode(t)},s.setVersionCode=function(t){this.tokenManager.setVersionCode(t)},s.setApiKey=function(t){this.xApiKey=t},s.getApiKey=function(){return this.xApiKey},s.setLMSDKCallbacks=function(t){this.lmSdkCallbacks=t,this.tokenManager.setLMSdkCallbacks(t)},s.clearLocalStorage=function(){localStorage.removeItem(r.LOCAL_ACCESS_TOKEN),localStorage.removeItem(r.LOCAL_REFRESH_TOKEN),localStorage.removeItem(r.LOCAL_USER),localStorage.removeItem(r.LOCAL_API_KEY),this.tokenManager.clearTokenManager()},s.makeRequest=function(i,r){try{var n=o+i;return t.interceptors.response.use(void 0,function(e){try{var i,r,n=function(t){return r?t:Promise.reject(e)},o=e.config,s="Network Error"===(null==e?void 0:e.message),u=[500,502,503,504,408,429].includes(null==e||null==(i=e.response)?void 0:i.status);if(!s&&!u)return Promise.reject(e);o._retry=!0,o.retryCount=o.retryCount||0;var a=function(){if(o.retryCount<3){o.retryCount+=1;var e=1e3*Math.pow(2,o.retryCount-1);return Promise.resolve(new Promise(function(t){return setTimeout(t,e)})).then(function(){var e=t(o);return r=1,e})}}();return Promise.resolve(a&&a.then?a.then(n):n(a))}catch(t){return Promise.reject(t)}}),Promise.resolve(t.request(e({url:n},r)))}catch(t){return Promise.reject(t)}},s.makeAuthenticatedRequest=function(t,i){try{var r=this,o=e({},i,{headers:e({},null==i?void 0:i.headers,{"x-sdk-source":"feed"})}),s=t.includes("initiate");if(o.headers["Content-Type"]="application/json",o.headers["x-version-code"]=r.tokenManager.getVersionCode(),t.includes("user/device/push")||(o.headers["x-platform-code"]=r.tokenManager.getPlatformCode()),t.includes("community/feed")&&(o.headers["x-accept-version"]="v2"),t.includes("mark_read")&&(o.headers["Content-Type"]="application/x-www-form-urlencoded"),r.tokenManager.getAccessToken()&&r.tokenManager.getAccessToken().length&&(o.headers.Authorization="Bearer "+r.tokenManager.getAccessToken()),s&&"POST"===i.method)if("rt"===r.tokenManager.getPlatformCode()){if(!r.xApiKey||!r.xApiKey.length)throw"Please provide the Api Key";o.headers["x-api-key"]=r.xApiKey}else o.headers["x-api-key"]=r.xApiKey;return Promise.resolve(function(e,i){try{var s=Promise.resolve(r.makeRequest(t,o)).then(function(t){return new n(t.data,null,!0)})}catch(t){return i(t)}return s&&s.then?s.then(void 0,i):s}(0,function(i){var s;function u(t){var e;if(s)return t;if(null!=i&&i.response&&(null==i||null==(e=i.response)?void 0:e.status)>=500)return new n(void 0,i.message,!1);throw i}var a=function(u){if(null!=i&&i.response&&401===(null==i||null==(u=i.response)?void 0:u.status)){var a=function(){var i=e({},o);i.headers.Authorization="Bearer "+r.tokenManager.getAccessToken();var u=r.makeRequest(t,i).then(function(t){return new n(t.data,null,!0)}).catch(function(t){var e;if(console.log(t),null!=t&&t.response&&(null==t||null==(e=t.response)?void 0:e.status)>=500)return new n(void 0,t.message,!1)});return s=1,u},c=t.includes("user/refresh")?Promise.resolve(r.lmSdkCallbacks.onRefreshTokenExpired()).then(function(t){var e=t.accessToken,i=t.refreshToken;r.tokenManager.setAccessToken(e),r.tokenManager.setRefreshToken(i),r.setAccessTokenInLocalStorage(e),r.setRefreshTokenInLocalStorage(i)}):Promise.resolve(r.tokenManager.refreshAccessToken()).then(function(){});return c&&c.then?c.then(a):a()}}();return a&&a.then?a.then(u):u(a)}))}catch(t){return Promise.reject(t)}},i}(),m=/*#__PURE__*/function(){function t(t){this.networkLibrary=void 0,this.networkLibrary=t}var e=t.prototype;return e.validateUser=function(t){try{var e=this;return e.networkLibrary.setAccessToken(t.accessToken),e.networkLibrary.setRefreshToken(t.refreshToken),Promise.resolve(e.networkLibrary.makeAuthenticatedRequest(""+s.SDK_INITIATE,{method:"GET"}))}catch(t){return Promise.reject(t)}},e.initiateUser=function(t){try{var e=this,r=i.requestBodyGenerator(t);return e.networkLibrary.setApiKey(t.apikey),Promise.resolve(e.networkLibrary.makeAuthenticatedRequest(""+s.SDK_INITIATE,{method:"POST",data:r}).then(function(t){var i,r,n=null==t||null==(i=t.data)?void 0:i.accessToken;e.networkLibrary.setAccessToken(n);var o=null==t||null==(r=t.data)?void 0:r.refreshToken;return e.networkLibrary.setRefreshToken(o),t}))}catch(t){return Promise.reject(t)}},e.getCommunityConfigurations=function(){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(""+s.COMMUNITY_CONFIGURATIONS).then(function(t){return t}).catch(function(t){return new n(null,t.message||"An error occurred",!1)}))}catch(t){return Promise.reject(t)}},e.getMemberState=function(){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(""+s.COMMUNITY_MEMBER_STATE))}catch(t){return Promise.reject(t)}},e.getAllMembers=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.DM_ALL_MEMBERS+"?page="+t.page))}catch(t){return Promise.reject(t)}},e.logoutUser=function(t){try{var e=this,i=(e.networkLibrary.getRefreshToken(),e.networkLibrary.getAccessTokenFromLocalStorage()),r=e.networkLibrary.getRefreshTokenFromLocalStorage();return i||r?null==t||null==t||null==(null==t?void 0:t.deviceId)||null==(null==t?void 0:t.deviceId)?(e.networkLibrary.clearLocalStorage(),Promise.resolve(new n("",null,!0))):Promise.resolve(function(i,o){try{var u=Promise.resolve(e.networkLibrary.makeAuthenticatedRequest(""+s.USER_LOGOUT,{method:"POST",headers:{"x-device-id":null!=(a=null==t?void 0:t.deviceId)?a:""},data:{refresh_token:r}})).then(function(t){return t?(e.networkLibrary.clearLocalStorage(),new n("",null,!0)):new n("",null==t?void 0:t.errorMessage,!1)})}catch(t){return o(t)}var a;return u&&u.then?u.then(void 0,o):u}(0,function(t){return new n("",t,!1)})):(e.networkLibrary.clearLocalStorage(),Promise.resolve(new n("",null,!0)))}catch(t){return Promise.reject(t)}},e.editProfile=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(""+s.COMMUNITY_MEMBER_PROFILE,{method:"PUT",data:e}).then(function(t){return t}).catch(function(t){return new n(null,t.message||"An error occurred",!1)}))}catch(t){return Promise.reject(t)}},t}(),l=/*#__PURE__*/function(){function t(t,e,i,r,n){this.userName=void 0,this.uuid=void 0,this.isGuest=void 0,this.apikey=void 0,this.imageUrl=void 0,this.userName=t,this.uuid=e,this.isGuest=i,this.apikey=r,this.imageUrl=n}return t.builder=function(){return new f},t}(),f=/*#__PURE__*/function(){function t(){this.userName=void 0,this.uuid=void 0,this.isGuest=void 0,this.apiKey=void 0,this.imageUrl=void 0}var e=t.prototype;return e.setUserName=function(t){return this.userName=t,this},e.setUUID=function(t){return this.uuid=t,this},e.setApiKey=function(t){return this.apiKey=t,this},e.setIsGuest=function(t){return this.isGuest=t,this},e.setImageUrl=function(t){return this.imageUrl=t,this},e.build=function(){return new l(this.userName,this.uuid,this.isGuest||!1,this.apiKey,this.imageUrl)},t}();!function(t){t.POST="post",t.COMMENT="comment",t.REPLY="reply",t.PENDING_POST="pending_post"}(u||(u={})),function(t){t.EDIT_MEMBER_PERMISSION="EDIT_MEMBER_PERMISSION",t.PENDING_POST_APPROVED="PENDING_POST_APPROVED",t.PENDING_POST_REJECTED="PENDING_POST_REJECTED",t.POST_APPROVED="POST_APPROVED",t.POST_REJECTED="POST_REJECTED",t.COMMENT_APPROVED="COMMENT_APPROVED",t.COMMENT_REJECTED="COMMENT_REJECTED"}(a||(a={})),function(t){t.CHATROOM="chatroom",t.MEMBER="member",t.CONVERSATION="conversation",t.POST="post",t.COMMENT="comment",t.REPLY="reply"}(c||(c={})),function(t){t.TEMPORARY_POST="temporaryPosts"}(h||(h={}));var v=function(){try{return g?Promise.resolve(g):(P||(P=new Promise(function(t,e){var i=indexedDB.open("FeedDB",1);i.onerror=function(){P=null,e(i.error)},i.onsuccess=function(){g=i.result,t(i.result)},i.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(h.TEMPORARY_POST)||e.createObjectStore(h.TEMPORARY_POST)}})),Promise.resolve(P))}catch(t){return Promise.reject(t)}},g=null,P=null;function y(t,e){try{var i=t()}catch(t){return e(t)}return i&&i.then?i.then(void 0,e):i}var T,E,I,S,_=/*#__PURE__*/function(){function t(t){this.networkLibrary=void 0,this.dbPromise=void 0,this.networkLibrary=t,this.dbPromise=v()}var e=t.prototype;return e.addPost=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(""+s.FEED_POST,{method:"POST",data:e,headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.getPost=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"?page="+t.page+"&page_size="+t.pageSize,{method:"GET",headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.savePost=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/save",{method:"PUT",data:t,headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.getPostLikes=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/like?page="+t.page+"&page_size="+t.pageSize,{method:"GET",headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.likePost=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/like",{method:"PUT",data:e,headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.pinPost=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/pin",{method:"PUT",data:e,headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.editPost=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId,{method:"PUT",data:e,headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.deletePost=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId,{method:"DELETE",data:e,headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.hidePost=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/hide",{method:"PUT",headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.decodeUrl=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.HELPER_URL+"?url="+t.url))}catch(t){return Promise.reject(t)}},e.getTaggingList=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.CHATROOM_GET_TAGGINNG_LIST+"?page="+t.page+"&page_size="+t.pageSize+"&search_name="+t.searchName))}catch(t){return Promise.reject(t)}},e.getTopics=function(t){try{var e=s.FEED_TOPIC+"?page="+t.page+"&page_size="+t.pageSize;return t.isEnabled&&(e=e.concat("&is_enabled="+t.isEnabled)),t.search&&(e=e.concat("&search="+t.search)),t.searchType&&(e=e.concat("&search_type="+t.searchType)),t.parentIds&&t.parentIds.length>0&&(e=e.concat("&parent_ids="+JSON.stringify(t.parentIds))),t.orderBy&&t.orderBy.length>0&&(e=e.concat("&order_by="+JSON.stringify(t.orderBy))),Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(e))}catch(t){return Promise.reject(t)}},e.updateUserTopics=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest("/feed/user/"+t.uuid+"/topics",{method:"PATCH",headers:{"Content-Type":"application/json"},data:JSON.stringify({topic_ids:t.topicsIds})}).then(function(){return{success:!0}}).catch(function(t){return{success:!1,errorMessage:t}}))}catch(t){return Promise.reject(t)}},e.getUserTopics=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest("/feed/user/topics?uuids="+JSON.stringify(t.uuids)))}catch(t){return Promise.reject(t)}},e.postSeen=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(""+s.POST_SEEN,{method:"POST",data:e}))}catch(t){return Promise.reject(t)}},e.saveTemporaryPost=function(t){try{var e=this;return Promise.resolve(y(function(){return Promise.resolve(e.dbPromise).then(function(e){var i=e.transaction([h.TEMPORARY_POST],"readwrite"),r=i.objectStore(h.TEMPORARY_POST);return Promise.resolve(new Promise(function(e,i){var n=r.put(t.tempPost,t.tempPost.post.id);n.onsuccess=function(){return e()},n.onerror=function(){return i(n.error)}})).then(function(){return Promise.resolve(new Promise(function(t,e){i.oncomplete=function(){t()},i.onerror=function(){return e(i.error)}})).then(function(){return new n("",null,!0)})})})},function(t){return new n("",t instanceof Error?t.message:"Error while saving post",!1)}))}catch(t){return Promise.reject(t)}},e.deleteTemporaryPost=function(t){try{var e=this;return Promise.resolve(y(function(){return Promise.resolve(e.dbPromise).then(function(e){var i=e.transaction([h.TEMPORARY_POST],"readwrite").objectStore(h.TEMPORARY_POST);return Promise.resolve(new Promise(function(e,r){var n=i.delete(t.temporaryPostId);n.onsuccess=function(){return e()},n.onerror=function(){r(n.error)}})).then(function(){return new n("",null,!0)})})},function(t){return new n("",t instanceof Error?t.message:"Error while deleting post",!1)}))}catch(t){return Promise.reject(t)}},e.getTemporaryPost=function(){try{var t=this;return Promise.resolve(y(function(){return Promise.resolve(t.dbPromise).then(function(t){var e=t.transaction([h.TEMPORARY_POST],"readonly").objectStore(h.TEMPORARY_POST);return Promise.resolve(new Promise(function(t,i){var r=e.getAll();r.onsuccess=function(){return t(r.result)},r.onerror=function(){i(r.error)}})).then(function(t){return new n({data:{tempPost:t.length>0?t[t.length-1]:null},success:!0,errorMessage:null},null,!0)})})},function(t){var e=t instanceof Error?t.message:"Error while fetching temporary post";return new n({data:{tempPost:null},success:!1,errorMessage:e},e,!1)}))}catch(t){return Promise.reject(t)}},t}(),k=/*#__PURE__*/function(){function t(t,e,i,r,n,o,s){this.text=void 0,this.attachments=void 0,this.heading=void 0,this.topicIds=void 0,this.tempId=void 0,this.onBehalfOfUuid=void 0,this.isAnonymous=void 0,this.text=t,this.attachments=e,this.heading=i,this.topicIds=r,this.tempId=n,this.isAnonymous=o,this.onBehalfOfUuid=s}return t.builder=function(){return new C},t}(),C=/*#__PURE__*/function(){function t(){this.text=void 0,this.attachments=void 0,this.heading=void 0,this.topicIds=void 0,this.tempId=void 0,this.isAnonymous=!1,this.onBehalfOfUUID=void 0}var e=t.prototype;return e.setText=function(t){return this.text=t,this},e.setHeading=function(t){return this.heading=t,this},e.setAttachments=function(t){return this.attachments=t,this},e.setTopicIds=function(t){return this.topicIds=t,this},e.setOnBehalfOfUUID=function(t){return this.onBehalfOfUUID=t,this},e.setTempId=function(t){return this.tempId=t,this},e.setIsAnonymous=function(t){return this.isAnonymous=t,this},e.build=function(){if(!this.text&&!this.attachments)throw new Error("text and attachments are required.");return new k(this.text,this.attachments,this.heading,this.topicIds,this.tempId,this.isAnonymous,this.onBehalfOfUUID)},t}(),w=/*#__PURE__*/function(){function t(t){this.networkLibrary=void 0,this.networkLibrary=t}var e=t.prototype;return e.getFeed=function(t){try{var e=t.topicIds?s.FEED_UNIVERSAL+"?page="+t.page+"&page_size="+t.pageSize+"&topic_ids="+JSON.stringify(t.topicIds):s.FEED_UNIVERSAL+"?page="+t.page+"&page_size="+t.pageSize;return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(e,{method:"GET",headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.getFeedWithSearchParams=function(t){try{var e,i;i=(null==t||null==(e=t.topicIds)?void 0:e.length)>0?new URLSearchParams({page:t.page.toString(),page_size:t.pageSize.toString(),topic_ids:JSON.stringify(t.topicIds)}):new URLSearchParams({page:t.page.toString(),page_size:t.pageSize.toString()});var r=s.FEED_UNIVERSAL+"?"+i.toString();return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(r,{method:"GET",headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.getPersonalisedFeed=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_PERSONALISED+"?page="+t.page+"&page_size="+(t.pageSize?t.pageSize:20)+"&should_recompute="+(!!t.shouldRecompute&&t.shouldRecompute)+"&should_reorder="+(!!t.shouldReorder&&t.shouldReorder)))}catch(t){return Promise.reject(t)}},e.searchPosts=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.SEARCH+"?page="+t.page+"&page_size="+t.pageSize+"&search="+t.search+"&search_type="+t.searchType,{headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},t}(),R=/*#__PURE__*/function(){function t(t,e){this.type=void 0,this.metaData=void 0,this.type=t,this.metaData=e}return t.builder=function(){return new O},t}(),O=/*#__PURE__*/function(){function t(){this.type=void 0,this.metaData=void 0}var e=t.prototype;return e.setType=function(t){return this.type=t,this},e.setMetadata=function(t){return this.metaData=t,this},e.build=function(){if(!this.type||!this.metaData)throw new Error("type and metadata are required.");return new R(this.type,this.metaData)},t}(),b=/*#__PURE__*/function(){function t(t,e,i,r,n,o,s,u,a,c,h,d,p,m,l,f,v,g,P,y,T,E,I){this.name=void 0,this.url=void 0,this.format=void 0,this.size=void 0,this.duration=void 0,this.pageCount=void 0,this.ogTags=void 0,this.coverImageUrl=void 0,this.title=void 0,this.body=void 0,this.thumbnailUrl=void 0,this.pollQuestion=void 0,this.expiryTime=void 0,this.options=void 0,this.multipleSelectState=void 0,this.pollType=void 0,this.multipleSelectNumber=void 0,this.isAnonymous=void 0,this.allowAddOption=void 0,this.entityId=void 0,this.widgetMeta=void 0,this.height=void 0,this.width=void 0,this.name=t,this.url=e,this.format=i,this.size=r,this.duration=n,this.pageCount=o,this.ogTags=s,this.coverImageUrl=u,this.title=a,this.pollQuestion=c,this.expiryTime=h,this.options=d,this.multipleSelectState=p,this.pollType=m,this.multipleSelectNumber=l,this.isAnonymous=f,this.allowAddOption=v,this.body=g,this.thumbnailUrl=P,this.entityId=y,this.widgetMeta=T,this.height=E,this.width=I}return t.builder=function(){return new A},t}(),A=/*#__PURE__*/function(){function t(){this.name=void 0,this.url=void 0,this.format=void 0,this.size=void 0,this.duration=void 0,this.pageCount=void 0,this.ogTags=void 0,this.title=void 0,this.coverImageUrl=void 0,this.body=void 0,this.thumbnailUrl=void 0,this.pollQuestion=void 0,this.expiryTime=void 0,this.options=void 0,this.multipleSelectState=void 0,this.pollType=void 0,this.multipleSelectNumber=void 0,this.isAnonymous=void 0,this.allowAddOption=void 0,this.entityId=void 0,this.widgetMeta=void 0,this.height=void 0,this.width=void 0}var e=t.prototype;return e.setName=function(t){return this.name=t,this},e.setThumbnailUrl=function(t){return this.thumbnailUrl=t,this},e.setUrl=function(t){return this.url=t,this},e.setFormat=function(t){return this.format=t,this},e.setSize=function(t){return this.size=t,this},e.setDuration=function(t){return this.duration=t,this},e.setPageCount=function(t){return this.pageCount=t,this},e.setOgTags=function(t){return this.ogTags=t,this},e.setTitle=function(t){return this.title=t,this},e.setBody=function(t){return this.body=t,this},e.setCoverImageUrl=function(t){return this.coverImageUrl=t,this},e.setPollQuestion=function(t){return this.pollQuestion=t,this},e.setExpiryTime=function(t){return this.expiryTime=t,this},e.setOptions=function(t){return this.options=t,this},e.setMultipleSelectState=function(t){return this.multipleSelectState=t,this},e.setPollType=function(t){return this.pollType=t,this},e.setHeight=function(t){return this.height=t,this},e.setWidth=function(t){return this.width=t,this},e.setMultipleSelectNumber=function(t){return this.multipleSelectNumber=t,this},e.setIsAnonymous=function(t){return this.isAnonymous=t,this},e.setAllowAddOption=function(t){return this.allowAddOption=t,this},e.setEntityId=function(t){return this.entityId=t,this},e.setWidgetMeta=function(t){return this.widgetMeta=t,this},e.build=function(){return new b(this.name,this.url,this.format,this.size,this.duration,this.pageCount,this.ogTags,this.coverImageUrl,this.title,this.pollQuestion,this.expiryTime,this.options,this.multipleSelectState,this.pollType,this.multipleSelectNumber,this.isAnonymous,this.allowAddOption,this.body,this.thumbnailUrl,this.entityId,this.widgetMeta,this.height,this.width)},t}(),L=/*#__PURE__*/function(){function t(t){this.url=void 0,this.url=t}return t.builder=function(){return new M},t}(),M=/*#__PURE__*/function(){function t(){this.url=void 0}var e=t.prototype;return e.setURL=function(t){return this.url=t,this},e.build=function(){if(!this.url)throw new Error("URL is required.");return new L(this.url)},t}(),N=/*#__PURE__*/function(){function t(t,e){this.postId=void 0,this.deleteReason=void 0,this.postId=t,this.deleteReason=e}return t.builder=function(){return new D},t}(),D=/*#__PURE__*/function(){function t(){this.postId=void 0,this.deleteReason=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setDeleteReason=function(t){return this.deleteReason=t,this},e.build=function(){if(!this.postId)throw new Error("attachmentType and DeletePostRequest are required.");return new N(this.postId,this.deleteReason)},t}(),U=/*#__PURE__*/function(){function t(t,e,i,r,n){this.postId=void 0,this.text=void 0,this.attachments=void 0,this.heading=void 0,this.topic_ids=void 0,this.postId=t,this.text=e,this.attachments=i,this.heading=r,this.topic_ids=n}return t.builder=function(){return new z},t}(),z=/*#__PURE__*/function(){function t(){this.postId=void 0,this.text=void 0,this.attachments=void 0,this.heading=void 0,this.topic_ids=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setText=function(t){return this.text=t,this},e.setHeading=function(t){return this.heading=t,this},e.setTopicIds=function(t){return this.topic_ids=t,this},e.setAttachments=function(t){return this.attachments=t,this},e.build=function(){if(!this.postId)throw new Error("attachmentType and EditPostRequest are required.");return new U(this.postId,this.text,this.attachments,this.heading,this.topic_ids)},t}(),q=/*#__PURE__*/function(){function t(t,e,i){this.postId=void 0,this.page=void 0,this.pageSize=void 0,this.postId=t,this.page=e,this.pageSize=i}return t.builder=function(){return new j},t}(),j=/*#__PURE__*/function(){function t(){this.postId=void 0,this.page=void 0,this.pageSize=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.build=function(){if(!this.postId||!this.page||!this.pageSize)throw new Error("postId, page and pageSize are required.");return new q(this.postId,this.page,this.pageSize)},t}(),F=/*#__PURE__*/function(){function t(t,e,i){this.postId=void 0,this.page=void 0,this.pageSize=void 0,this.postId=t,this.page=e,this.pageSize=i}return t.builder=function(){return new x},t}(),x=/*#__PURE__*/function(){function t(){this.postId=void 0,this.page=void 0,this.pageSize=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.build=function(){if(!this.postId||!this.page||!this.pageSize)throw new Error("postId, page and pageSize are required.");return new F(this.postId,this.page,this.pageSize)},t}(),G=/*#__PURE__*/function(){function t(t){this.postId=void 0,this.postId=t}return t.builder=function(){return new B},t}(),B=/*#__PURE__*/function(){function t(){this.postId=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.build=function(){if(!this.postId)throw new Error("postId is required.");return new G(this.postId)},t}(),K=/*#__PURE__*/function(){function t(t){this.postId=void 0,this.postId=t}return t.builder=function(){return new Y},t}(),Y=/*#__PURE__*/function(){function t(){this.postId=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.build=function(){if(!this.postId)throw new Error("postId is required.");return new K(this.postId)},t}(),H=/*#__PURE__*/function(){function t(t){this.postId=void 0,this.postId=t}return t.builder=function(){return new V},t}(),V=/*#__PURE__*/function(){function t(){this.postId=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.build=function(){if(!this.postId)throw new Error("postId is required.");return new H(this.postId)},t}(),J=/*#__PURE__*/function(){function t(t,e,i){this.searchName=void 0,this.page=void 0,this.pageSize=void 0,this.searchName=t,this.page=e,this.pageSize=i}return t.builder=function(){return new Q},t}(),Q=/*#__PURE__*/function(){function t(){this.searchName=void 0,this.page=void 0,this.pageSize=void 0}var e=t.prototype;return e.setSearchName=function(t){return this.searchName=t,this},e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.build=function(){if(!this.page||!this.pageSize)throw new Error("searchName, page and pageSize are required.");return new J(this.searchName,this.page,this.pageSize)},t}(),W=/*#__PURE__*/function(){function t(t,e,i){this.page=void 0,this.pageSize=void 0,this.topicIds=void 0,this.page=t,this.pageSize=e,this.topicIds=i}return t.builder=function(){return new Z},t}(),Z=/*#__PURE__*/function(){function t(){this.page=void 0,this.pageSize=void 0,this.topicIds=void 0}var e=t.prototype;return e.setPage=function(t){return this.page=t,this},e.setTopicIds=function(t){return this.topicIds=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.build=function(){if(!this.page||!this.pageSize)throw new Error("page and pageSize are required.");return new W(this.page,this.pageSize,this.topicIds)},t}(),X=/*#__PURE__*/function(){function t(t,e,i,r){void 0===e&&(e=10),this.page=void 0,this.pageSize=void 0,this.search=void 0,this.searchType=void 0,this.page=t,this.pageSize=e,this.search=i,this.searchType=r}return t.builder=function(){return new $},t}(),$=/*#__PURE__*/function(){function t(){this.page=void 0,this.pageSize=void 0,this.search=void 0,this.searchType=void 0}var e=t.prototype;return e.setPage=function(t){return this.page=t,this},e.setSearch=function(t){return this.search=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.setSearchType=function(t){return this.searchType=t,this},e.build=function(){if(!this.page||!this.pageSize)throw new Error("page and pageSize are required.");if(!this.search||!this.searchType)throw new Error("search and searchType are required.");return new X(this.page,this.pageSize,this.search,this.searchType)},t}(),tt=/*#__PURE__*/function(){function t(t){this.networkLibrary=void 0,this.networkLibrary=t}var e=t.prototype;return e.getReportTags=function(t){return this.networkLibrary.makeAuthenticatedRequest(s.GET_REPORT_TAGS+"?entity_type="+t.entityType,{method:"GET",headers:{"x-accept-version":"v1"}})},e.getReports=function(t){var e=JSON.stringify(t.filterType);return this.networkLibrary.makeAuthenticatedRequest(s.GET_REPORTS+"?page="+t.page+"&page_size="+t.pageSize+"&filter_type="+e+"&is_closed="+t.isClosed,{method:"GET",headers:{"x-accept-version":"v1"}})},e.updateReportStatus=function(t){return this.networkLibrary.makeAuthenticatedRequest(""+s.UPDATE_REPORT,{data:i.requestBodyGenerator(t),method:"PATCH",headers:{"x-accept-version":"v1"}})},e.getReportsForPostAndComments=function(t){var e=JSON.stringify([u.POST,u.COMMENT,u.REPLY]);return this.networkLibrary.makeAuthenticatedRequest(s.GET_REPORTS+"?page="+t.page+"&page_size="+t.pageSize+"&filter_type="+e+"&is_closed=false",{method:"GET",headers:{"x-accept-version":"v1"}})},e.getMemberRights=function(t){return this.networkLibrary.makeAuthenticatedRequest(s.GET_MEMBER_RIGHTS+"?uuid="+t.uuid+"&is_cm="+t.isCM,{method:"GET",headers:{"x-accept-version":"v1"}})},e.updateMemberRights=function(t){return this.networkLibrary.makeAuthenticatedRequest(""+s.UPDATE_MEMBER_RIGHTS,{method:"PATCH",headers:{"x-accept-version":"v1"},data:i.requestBodyGenerator(t)})},e.postReport=function(t){return this.networkLibrary.makeAuthenticatedRequest(""+s.POST_REPORT,{data:i.requestBodyGenerator(t),method:"POST",headers:{"x-accept-version":"v1"}})},t}(),et=/*#__PURE__*/function(){function t(t){this.entityType=void 0,this.entityType=t}return t.builder=function(){return new it},t}(),it=/*#__PURE__*/function(){function t(){this.entityType=void 0}var e=t.prototype;return e.setEntityType=function(t){return this.entityType=t,this},e.build=function(){if(!this.entityType)throw new Error("entityType is required");return new et(this.entityType)},t}(),rt=/*#__PURE__*/function(){function t(t,e,i,r,n){this.entityId=void 0,this.accusedUuid=void 0,this.entityType=void 0,this.tagId=void 0,this.reason=void 0,this.entityId=t,this.accusedUuid=e,this.entityType=i,this.tagId=r,this.reason=n}return t.builder=function(){return new nt},t}(),nt=/*#__PURE__*/function(){function t(){this.entityId=void 0,this.accusedUuid=void 0,this.entityType=void 0,this.tagId=void 0,this.reason=void 0}var e=t.prototype;return e.setEntityId=function(t){return this.entityId=t,this},e.setAccusedUUID=function(t){return this.accusedUuid=t,this},e.setEntityType=function(t){return this.entityType=t,this},e.setTagId=function(t){return this.tagId=t,this},e.setReason=function(t){return this.reason=t,this},e.build=function(){if(!this.entityId||!this.accusedUuid||void 0===this.entityType||void 0===this.tagId)throw new Error("entityId, accusedUUID, entityType, and tagId are required.");return new rt(this.entityId,this.accusedUuid,this.entityType,this.tagId,this.reason)},t}(),ot=/*#__PURE__*/function(){function t(t,e,i,r){this.page=void 0,this.pageSize=void 0,this.filterType=void 0,this.isClosed=void 0,this.page=t,this.pageSize=e,this.filterType=i,this.isClosed=r}return t.builder=function(){return new st},t}(),st=/*#__PURE__*/function(){function t(){this.page=void 0,this.pageSize=void 0,this.filterType=void 0,this.isClosed=void 0}var e=t.prototype;return e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.setFilterType=function(t){return this.filterType=t,this},e.setIsClosed=function(t){return this.isClosed=t,this},e.build=function(){return new ot(this.page,this.pageSize,this.filterType,this.isClosed)},t}(),ut=/*#__PURE__*/function(){function t(t,e){this.page=void 0,this.pageSize=void 0,this.page=t,this.pageSize=e}return t.builder=function(){return new at},t}(),at=/*#__PURE__*/function(){function t(){this.page=void 0,this.pageSize=void 0}var e=t.prototype;return e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.build=function(){if(void 0===this.page)throw new Error("Page is required.");return new ut(this.page,this.pageSize)},t}(),ct=/*#__PURE__*/function(){function t(t,e){this.page=void 0,this.pageSize=void 0,this.page=t,this.pageSize=e}return t.builder=function(){return new ht},t}(),ht=/*#__PURE__*/function(){function t(){this.page=void 0,this.pageSize=void 0}var e=t.prototype;return e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.build=function(){return new ct(this.page,this.pageSize)},t}(),dt=/*#__PURE__*/function(){function t(t,e){this.uuid=void 0,this.isCM=void 0,this.uuid=t,this.isCM=e}return t.builder=function(){return new pt},t}(),pt=/*#__PURE__*/function(){function t(){this.uuid=void 0,this.isCM=void 0}var e=t.prototype;return e.setUuid=function(t){return this.uuid=t,this},e.setIsCM=function(t){return this.isCM=t,this},e.build=function(){return new dt(this.uuid,this.isCM)},t}(),mt=/*#__PURE__*/function(){function t(t,e,i,r){this.uuid=void 0,this.isCM=void 0,this.rights=void 0,this.customTitle=void 0,this.uuid=t,this.isCM=e,this.rights=i,this.customTitle=r}return t.builder=function(){return new lt},t}(),lt=/*#__PURE__*/function(){function t(){this.uuid=void 0,this.isCM=void 0,this.rights=void 0,this.customTitle=void 0}var e=t.prototype;return e.setUuid=function(t){return this.uuid=t,this},e.setIsCM=function(t){return this.isCM=t,this},e.setRights=function(t){return this.rights=t,this},e.setCustomTitle=function(t){return this.customTitle=t,this},e.build=function(){return new mt(this.uuid,this.isCM,this.rights,this.customTitle)},t}(),ft=/*#__PURE__*/function(){function t(t){this.networkLibrary=void 0,this.networkLibrary=t}var e=t.prototype;return e.addComment=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/comment",{method:"POST",data:e,headers:{"x-accept-version":"v1"}}).then(function(t){return i.responseBodyParser(t)}))}catch(t){return Promise.reject(t)}},e.getComment=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/comment/"+t.commentId+"?page="+t.page+"&page_size="+t.pageSize,{method:"GET",headers:{"x-accept-version":"v1"}}).then(function(t){return i.responseBodyParser(t)}))}catch(t){return Promise.reject(t)}},e.getCommentLikes=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/comment/"+t.commentId+"/like?page="+t.page+"&page_size="+t.pageSize,{method:"GET",headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.likeComment=function(t){try{return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/comment/"+t.commentId+"/like",{method:"PUT",data:i.requestBodyGenerator(t),headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.replyComment=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/comment/"+t.commentId+"/comment",{method:"POST",data:e,headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.editComment=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/comment/"+t.commentId,{method:"PUT",data:e,headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},e.deleteComment=function(t){try{var e=i.requestBodyGenerator(t);return Promise.resolve(this.networkLibrary.makeAuthenticatedRequest(s.FEED_POST+"/"+t.postId+"/comment/"+t.commentId,{method:"DELETE",data:e,headers:{"x-accept-version":"v1"}}))}catch(t){return Promise.reject(t)}},t}(),vt=/*#__PURE__*/function(){function t(t){this.deviceId=void 0,this.deviceId=t}return t.builder=function(){return new gt},t}(),gt=/*#__PURE__*/function(){function t(){this.deviceId=void 0}var e=t.prototype;return e.setDeviceId=function(t){return this.deviceId=t,this},e.build=function(){return new vt(this.deviceId)},t}(),Pt=/*#__PURE__*/function(){function t(t,e,i){this.postId=void 0,this.text=void 0,this.tempId=void 0,this.postId=t,this.text=e,this.tempId=i}return t.builder=function(){return new yt},t}(),yt=/*#__PURE__*/function(){function t(){this.postId=void 0,this.text=void 0,this.tempId=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setText=function(t){return this.text=t,this},e.setTempId=function(t){return this.tempId=t,this},e.build=function(){if(!this.postId||!this.text)throw new Error("postId and text are required.");return new Pt(this.postId,this.text,this.tempId)},t}(),Tt=/*#__PURE__*/function(){function t(t){this.page=void 0,this.page=t}return t.builder=function(){return new Et},t}(),Et=/*#__PURE__*/function(){function t(){this.page=void 0}var e=t.prototype;return e.setPage=function(t){return this.page=t,this},e.build=function(){return new Tt(this.page)},t}(),It=/*#__PURE__*/function(){function t(t,e,i,r){this.postId=void 0,this.commentId=void 0,this.text=void 0,this.tempId=void 0,this.postId=t,this.commentId=e,this.text=i,this.tempId=r}return t.builder=function(){return new St},t}(),St=/*#__PURE__*/function(){function t(){this.postId=void 0,this.commentId=void 0,this.text=void 0,this.tempId=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setCommentId=function(t){return this.commentId=t,this},e.setText=function(t){return this.text=t,this},e.setTempId=function(t){return this.tempId=t,this},e.build=function(){if(!this.postId||!this.commentId)throw new Error("postId and commentId are required.");return new It(this.postId,this.commentId,this.text,this.tempId)},t}(),_t=/*#__PURE__*/function(){function t(t,e,i,r){this.postId=void 0,this.commentId=void 0,this.page=void 0,this.pageSize=void 0,this.postId=t,this.commentId=e,this.page=i,this.pageSize=r}return t.builder=function(){return new kt},t}(),kt=/*#__PURE__*/function(){function t(){this.postId=void 0,this.commentId=void 0,this.page=void 0,this.pageSize=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setCommentId=function(t){return this.commentId=t,this},e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.build=function(){if(!this.postId||!this.commentId)throw new Error("postId and commentId are required.");return new _t(this.postId,this.commentId,this.page,this.pageSize)},t}(),Ct=/*#__PURE__*/function(){function t(t,e){this.reportIds=void 0,this.actionTaken=void 0,this.reportIds=t,this.actionTaken=e}return t.builder=function(){return new wt},t}(),wt=/*#__PURE__*/function(){function t(){this.reportIds=void 0,this.actionTaken=void 0}var e=t.prototype;return e.setReportIds=function(t){return this.reportIds=t,this},e.setActionTaken=function(t){return this.actionTaken=t,this},e.build=function(){return new Ct(this.reportIds,this.actionTaken)},t}(),Rt=/*#__PURE__*/function(){function t(t,e,i,r){this.postId=void 0,this.commentId=void 0,this.page=void 0,this.pageSize=void 0,this.postId=t,this.commentId=e,this.page=i,this.pageSize=r}return t.builder=function(){return new Ot},t}(),Ot=/*#__PURE__*/function(){function t(){this.postId=void 0,this.commentId=void 0,this.page=void 0,this.pageSize=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setCommentId=function(t){return this.commentId=t,this},e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.build=function(){if(!this.postId||!this.commentId)throw new Error("postId and commentId are required.");return new Rt(this.postId,this.commentId,this.page,this.pageSize)},t}(),bt=/*#__PURE__*/function(){function t(t,e){this.postId=void 0,this.commentId=void 0,this.postId=t,this.commentId=e}return t.builder=function(){return new At},t}(),At=/*#__PURE__*/function(){function t(){this.postId=void 0,this.commentId=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setCommentId=function(t){return this.commentId=t,this},e.build=function(){if(!this.postId||!this.commentId)throw new Error("postId and commentId are required.");return new bt(this.postId,this.commentId)},t}(),Lt=/*#__PURE__*/function(){function t(t,e,i){this.postId=void 0,this.commentId=void 0,this.reason=void 0,this.postId=t,this.commentId=e,this.reason=i}return t.builder=function(){return new Mt},t}(),Mt=/*#__PURE__*/function(){function t(){this.postId=void 0,this.commentId=void 0,this.reason=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setCommentId=function(t){return this.commentId=t,this},e.setReason=function(t){return this.reason=t,this},e.build=function(){if(!this.postId||!this.commentId)throw new Error("postId and commentId are required.");return new Lt(this.postId,this.commentId,this.reason)},t}(),Nt=/*#__PURE__*/function(){function t(t){this.networkLibrary=void 0,this.networkLibrary=t}var e=t.prototype;return e.getNotificationFeed=function(t){return this.networkLibrary.makeAuthenticatedRequest(s.NOTIFICATION_FEED+"?page="+t.page+"&page_size="+t.pageSize,{method:"GET",headers:{"x-accept-version":"v1"}})},e.markReadNotification=function(t){var e=i.requestBodyGenerator(t);return this.networkLibrary.makeAuthenticatedRequest(s.NOTIFICATION_FEED+"/"+t.activityId+"/mark_read",{method:"POST",data:e})},e.getUnreadNotificationCount=function(){return this.networkLibrary.makeAuthenticatedRequest(s.NOTIFICATION_FEED+"/unread_count")},t}(),Dt=/*#__PURE__*/function(){function t(t,e){this.page=void 0,this.pageSize=void 0,this.page=t,this.pageSize=e}return t.builder=function(){return new Ut},t}(),Ut=/*#__PURE__*/function(){function t(){this.page=void 0,this.pageSize=void 0}var e=t.prototype;return e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.build=function(){if(!this.page||!this.pageSize)throw new Error("UUID and DeviceI are required.");return new Dt(this.page,this.pageSize)},t}(),zt=/*#__PURE__*/function(){function t(t){this.activityId=void 0,this.activityId=t}return t.builder=function(){return new qt},t}(),qt=/*#__PURE__*/function(){function t(){this.activityId=void 0}var e=t.prototype;return e.setActivityId=function(t){return this.activityId=t,this},e.build=function(){if(!this.activityId)throw new Error("activityId is required.");return new zt(this.activityId)},t}(),jt=/*#__PURE__*/function(){function t(t,e,i){this.postId=void 0,this.commentId=void 0,this.text=void 0,this.postId=t,this.commentId=e,this.text=i}return t.builder=function(){return new Ft},t}(),Ft=/*#__PURE__*/function(){function t(){this.postId=void 0,this.commentId=void 0,this.text=void 0}var e=t.prototype;return e.setPostId=function(t){return this.postId=t,this},e.setCommentId=function(t){return this.commentId=t,this},e.setText=function(t){return this.text=t,this},e.build=function(){if(!this.postId||!this.commentId)throw new Error("postId and commentId are required.");return new jt(this.postId,this.commentId,this.text)},t}(),xt=/*#__PURE__*/function(){function t(t,e,i,r,n,o,s){this.isEnabled=void 0,this.page=void 0,this.pageSize=void 0,this.search=void 0,this.searchType=void 0,this.parentIds=void 0,this.orderBy=void 0,this.isEnabled=t,this.search=r,this.page=e,this.pageSize=i,this.searchType=n,this.parentIds=o,this.orderBy=s}return t.builder=function(){return new Gt},t}(),Gt=/*#__PURE__*/function(){function t(){this.isEnabled=void 0,this.page=void 0,this.pageSize=void 0,this.search=void 0,this.searchType=void 0,this.parentIds=void 0,this.orderBy=void 0}var e=t.prototype;return e.setIsEnabled=function(t){return this.isEnabled=t,this},e.setSearch=function(t){return this.search=t,this},e.setSearchType=function(t){return this.searchType=t,this},e.setPage=function(t){return this.page=t,this},e.setPageSize=function(t){return this.pageSize=t,this},e.setParentIds=function(t){return this.parentIds=t,this},e.setOrderBy=function(t){return this.orderBy=t,this},e.build=function(){if(!this.page||!this.pageSize)throw new Error("Some parameters are missing");return new xt(this.isEnabled,this.page,this.pageSize,this.search,this.searchType,this.parentIds,this.orderBy)},t}(),Bt=/*#__PURE__*/function(){function t(t,e){this.accessToken=void 0,this.refreshToken=void 0,this.accessToken=t,this.refreshToken=e}return t.builder=function(){return new Kt},t}(),Kt=/*#__PURE__*/function(){function t(){this.accessToken=void 0,this.refreshToken=void 0}var e=t.prototype;return e.setAccessToken=function(t){return this.accessToken=t,this},e.setRefreshToken=function(t){return this.refreshToken=t,this},e.build=function(){if(!this.accessToken||!this.refreshToken)throw new Error("Access Token and Refresh Token are required.");return new Bt(this.accessToken,this.refreshToken)},t}(),Yt=/*#__PURE__*/function(){function t(t){this.networkLibrary=void 0,this.net