UNPKG

@tencentcloud/lite-chat

Version:

Tencent Cloud Chat SDK for Web/Mini Program/uni-app/React Native/Donut

2 lines (1 loc) 2.17 kB
function r(r,o,t,e){return new(t||(t=Promise))((function(i,n){function s(r){try{a(e.next(r))}catch(r){n(r)}}function c(r){try{a(e.throw(r))}catch(r){n(r)}}function a(r){var o;r.done?i(r.value):(o=r.value,o instanceof t?o:new t((function(r){r(o)}))).then(s,c)}a((e=e.apply(r,o||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const o="group";var t=new class{init(r){this._core=r;const{helper:o}=r;o.registerApi("searchGroupByID",this),o.registerApi("getGroupList",this),o.registerApi("getGroupApplicationList",this)}searchGroupByID(t){return r(this,void 0,void 0,(function*(){try{console.log(`${o} searchGroupByID: groupID: ${t}`);const e=yield function(o,t){return r(this,void 0,void 0,(function*(){try{const{helper:r,channel:e}=t,i="group_open_http_svc.get_group_public_info",n={GroupIdList:[o]},s=r.generateProtocolData({servcmd:i,data:n}),c=`${s.head.seq}${i}`;return yield e.sendPacket(s,{requestId:c})}catch(r){throw console.warn("searchGroupByID error:",r),r}}))}(t,this._core);return this._parseSearchGroupByIDResponse(e),{code:0,data:{group:{groupID:t}}}}catch(r){throw console.warn(`${o} searchGroupByID error:`,r),r}}))}getGroupList(){return r(this,void 0,void 0,(function*(){return console.log(`${o} getGroupList`),{code:0,data:{groupList:[]}}}))}getGroupApplicationList(){return r(this,void 0,void 0,(function*(){return console.log(`${o} getGroupApplicationList`),{code:0,data:{applicationList:[]}}}))}_parseSearchGroupByIDResponse(r){var o;const t=null===(o=r.GroupInfo)||void 0===o?void 0:o[0];if(0!==(null==t?void 0:t.ErrorCode))throw new this._core.helper.ChatError({functionName:"searchGroupByID",code:null==t?void 0:t.ErrorCode,message:null==t?void 0:t.ErrorCode});return r}};var e=new class{init(r){this._core=r}};var i=new class{init(r){this._core=r}};var n=new class{init(r){this._core=r}};var s=new class{init(r){this._core=r}};const c={searchGroupByID:[{key:"groupID",required:!0,rules:["string"],allowEmpty:!1}]},a={getGroupList:!0,searchGroupByID:!0,getGroupApplicationList:!0};var u=new class{install(r){t.init(r),e.init(r),i.init(r),n.init(r),s.init(r),r.helper.registerValidateConfig({auth:a,params:c})}};export{u as default};