import{Bc as zn,Gi as ar,Hs as se,Or as Tm,Wa as g,Wt as Jn,_r as Se,fr as S,ha as cf,or as Rg,pc as vn,ro as he}from"./chunk-B_pj7Jpm.js";var E=class a{authHttp=g(zn);restService=g(Rg);restExtractor=g(Jn);static BASE_APPLICATION_URL=se.apiUrl+`/api/v1/server`;listSubscriptions(o){let{pagination:r,sort:t,search:l,state:i,actorType:n}=o,e=new vn;return e=this.restService.addRestGetParams(e,r,t),l&&(e=e.append(`search`,l)),i&&(e=e.append(`state`,i)),n&&(e=e.append(`actorType`,n)),this.authHttp.get(a.BASE_APPLICATION_URL+`/following`,{params:e}).pipe(he(h=>this.restExtractor.handleError(h)))}listFollowers(o){let{pagination:r,sort:t,search:l,state:i,actorType:n}=o,e=new vn;return e=this.restService.addRestGetParams(e,r,t),l&&(e=e.append(`search`,l)),i&&(e=e.append(`state`,i)),n&&(e=e.append(`actorType`,n)),this.authHttp.get(a.BASE_APPLICATION_URL+`/followers`,{params:e}).pipe(he(h=>this.restExtractor.handleError(h)))}follow(o){let r={handles:o.filter(t=>t.includes(`@`)),hosts:o.filter(t=>!t.includes(`@`))};return this.authHttp.post(a.BASE_APPLICATION_URL+`/following`,r).pipe(he(t=>this.restExtractor.handleError(t)))}unfollow(o){return Se(Tm(o)).pipe(ar(t=>{let l=t.following.name+`@`+t.following.host;return this.authHttp.delete(a.BASE_APPLICATION_URL+`/following/`+l)}),cf(),he(t=>this.restExtractor.handleError(t)))}acceptFollower(o){return Se(Tm(o)).pipe(ar(t=>{let l=t.follower.name+`@`+t.follower.host;return this.authHttp.post(`${a.BASE_APPLICATION_URL}/followers/${l}/accept`,{})}),cf(),he(t=>this.restExtractor.handleError(t)))}rejectFollower(o){return Se(Tm(o)).pipe(ar(t=>{let l=t.follower.name+`@`+t.follower.host;return this.authHttp.post(`${a.BASE_APPLICATION_URL}/followers/${l}/reject`,{})}),cf(),he(t=>this.restExtractor.handleError(t)))}removeFollower(o){return Se(Tm(o)).pipe(ar(t=>{let l=t.follower.name+`@`+t.follower.host;return this.authHttp.delete(`${a.BASE_APPLICATION_URL}/followers/${l}`)}),cf(),he(t=>this.restExtractor.handleError(t)))}buildFollowsListFilters(){return[{type:`options`,key:`state`,title:"Follow state",options:[{value:`all`,label:"All follows"},{value:`accepted`,label:"Accepted follows"},{value:`rejected`,label:"Rejected follows"},{value:`pending`,label:"Pending follows"}]}]}static ɵfac=function(r){return new(r||a)};static ɵprov=S({token:a,factory:a.ɵfac})};export{E as t};
//# debugId=70c91019-7633-520d-8202-3acccca8eca5
//# sourceMappingURL=chunk-B5b4xrpm.js.map