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:"Погоджені підписки"},{value:`rejected`,label:"Відхилені підписки"},{value:`pending`,label:"Черга підписок"}]}]}static ɵfac=function(r){return new(r||a)};static ɵprov=S({token:a,factory:a.ɵfac})};export{E as t};
//# debugId=f2f4fad8-efe2-5bab-969e-83cc41ad6ac4
//# sourceMappingURL=chunk-B5b4xrpm.js.map