@tencentcloud/lite-chat
Version:
Tencent Cloud Chat SDK for Web/Mini Program/uni-app/React Native/Donut
2 lines (1 loc) • 2.4 kB
JavaScript
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).TencentCloudChatGroup=r()}(this,(function(){"use strict";function e(e,r,o,t){return new(o||(o=Promise))((function(i,n){function s(e){try{u(t.next(e))}catch(e){n(e)}}function c(e){try{u(t.throw(e))}catch(e){n(e)}}function u(e){var r;e.done?i(e.value):(r=e.value,r instanceof o?r:new o((function(e){e(r)}))).then(s,c)}u((t=t.apply(e,r||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const r="group";var o=new class{init(e){this._core=e;const{helper:r}=e;r.registerApi("searchGroupByID",this),r.registerApi("getGroupList",this),r.registerApi("getGroupApplicationList",this)}searchGroupByID(o){return e(this,void 0,void 0,(function*(){try{console.log(`${r} searchGroupByID: groupID: ${o}`);const t=yield function(r,o){return e(this,void 0,void 0,(function*(){try{const{helper:e,channel:t}=o,i="group_open_http_svc.get_group_public_info",n={GroupIdList:[r]},s=e.generateProtocolData({servcmd:i,data:n}),c=`${s.head.seq}${i}`;return yield t.sendPacket(s,{requestId:c})}catch(e){throw console.warn("searchGroupByID error:",e),e}}))}(o,this._core);return this._parseSearchGroupByIDResponse(t),{code:0,data:{group:{groupID:o}}}}catch(e){throw console.warn(`${r} searchGroupByID error:`,e),e}}))}getGroupList(){return e(this,void 0,void 0,(function*(){return console.log(`${r} getGroupList`),{code:0,data:{groupList:[]}}}))}getGroupApplicationList(){return e(this,void 0,void 0,(function*(){return console.log(`${r} getGroupApplicationList`),{code:0,data:{applicationList:[]}}}))}_parseSearchGroupByIDResponse(e){var r;const o=null===(r=e.GroupInfo)||void 0===r?void 0:r[0];if(0!==(null==o?void 0:o.ErrorCode))throw new this._core.helper.ChatError({functionName:"searchGroupByID",code:null==o?void 0:o.ErrorCode,message:null==o?void 0:o.ErrorCode});return e}};var t=new class{init(e){this._core=e}};var i=new class{init(e){this._core=e}};var n=new class{init(e){this._core=e}};var s=new class{init(e){this._core=e}};const c={searchGroupByID:[{key:"groupID",required:!0,rules:["string"],allowEmpty:!1}]},u={getGroupList:!0,searchGroupByID:!0,getGroupApplicationList:!0};return new class{install(e){o.init(e),t.init(e),i.init(e),n.init(e),s.init(e),e.helper.registerValidateConfig({auth:u,params:c})}}}));