var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var Unibase; (function (Unibase) { let Platform; (function (Platform) { let Connect; (function (Connect) { let Managers; (function (Managers) { class ChatManager extends Platform.Core.BaseManager { static Instance() { if (this._instance === undefined) this._instance = new ChatManager(); return this._instance; } saveChatGroup(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/savechatgroup'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { return response; }); }); } getChats() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/getchats'; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } getChatsByGroupId(chatGroupId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/chatlist/chatgroupid/' + chatGroupId; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } forwardmultiple(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/multiforward'; return yield this.dataHelper().postAsync(url, data).then(function (response) { return response; }); }); } Deletemultiple(array) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/multidelete'; return yield this.dataHelper().postAsync(url, array).then(function (response) { return response; }); }); } Starmultiple(array) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/multistar'; return yield this.dataHelper().postAsync(url, array).then(function (response) { return response; }); }); } MuteNotifications(chatgroupid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/mutenotification/chatgroupid/' + chatgroupid; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } getChatContacts() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/getchatcontacts'; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } getChatMessages(chatId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/chatlist/conversation/' + chatId; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } getLastMessage(chatId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/chatlist/conversation/' + chatId; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } saveChat(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/savechat'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { return response; }); }); } getChatGroup(fromUserId, toUserId, isPrivate, groupName) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/getchatgroup/fromuserid/' + fromUserId + '/touserid/' + toUserId + '/isprivate/' + isPrivate + '/groupname/' + groupName; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } getChatRecipientsByGroupId(chatGroupId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/getchatrecipients/chatgroupid/' + chatGroupId; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } getChatgroups(contactId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/getchatgroups/contactid/' + contactId; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } updateLastSeen(RecipientId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/updatelastseen/recipientid/' + RecipientId; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } Delete(chatid, fromuserid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/deletemessage/chatid/' + chatid + '/fromuserid/' + fromuserid; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } DeleteForEveryone(chatid, chatgroupid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/deleteforeveryone/chatid/' + chatid + '/chatgroupid/' + chatgroupid; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } EditMessage(chatid, message) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/editmessage/chatid/' + chatid + '/message/' + message; return yield this.dataHelper().postAsync(url, message).then(function (response) { return response; }); }); } StarMessage(chatid, currentUser) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/starmessage/chatid/' + chatid + '/currentUser/' + currentUser; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } RemoveParticipant(chatgroupid, contactid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/removeparticipant/chatgroupid/' + chatgroupid + '/recipientid/' + contactid; return yield this.dataHelper().postAsync(url, null).then(function (reponse) { return reponse; }); }); } clearChat(chatgroupid, fromuserid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/clearchat/chatgroupid/' + chatgroupid + '/fromuserid/' + fromuserid; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } changeGroupName(chatgroupid, groupname) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/changegroupname/chatgroupid/' + chatgroupid + '/groupname/' + groupname; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } updateAdminStatus(chatgroupid, recipientId, isadmin) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/updateadminstatus/chatgroupid/' + chatgroupid + '/recipientid/' + recipientId + '/isadmin/' + isadmin; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } messageinfo(chatid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/messageinfo/chatid/' + chatid; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } getChatRecipientInfo(chatgroupid, recipientid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/getchatrecipient/chatgroupid/' + chatgroupid + '/recipientid/' + recipientid; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } draftMessage(message, chatgroupid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/draftMessage/chatgroupid/' + chatgroupid + '/message/' + message; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } getMediaCount(chatgroupid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/getMedia/chatgroupid/' + chatgroupid; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } blockOrunBlock(chatgroupid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/blockUser/chatgroupid/' + chatgroupid; return yield this.dataHelper().postAsync(url, null).then(function (response) { return response; }); }); } getUnreadChatCount() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/uniconnect/chats/getUnreadChatCount'; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } } Managers.ChatManager = ChatManager; })(Managers = Connect.Managers || (Connect.Managers = {})); })(Connect = Platform.Connect || (Platform.Connect = {})); })(Platform = Unibase.Platform || (Unibase.Platform = {})); })(Unibase || (Unibase = {}));