import{Dr as Rg,Fa as er,Ja as g,Lr as Se,Mr as S,Wr as Tm,ea as ae,fc as vn,pi as Wn,ro as he,va as cf,xa as cr}from"./chunk-b0nJCs5_.js";var E=class a{authHttp=g(Wn);restService=g(Rg);restExtractor=g(er);static BASE_APPLICATION_URL=ae.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(cr(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(cr(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(cr(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(cr(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:"Abonnements acceptés"},{value:`rejected`,label:"Abonnements refusés"},{value:`pending`,label:"Abonnements en attente"}]}]}static ɵfac=function(r){return new(r||a)};static ɵprov=S({token:a,factory:a.ɵfac})};export{E as t};
//# debugId=50a13299-44fd-5cd5-9cc7-3a265c2fcfd7
//# sourceMappingURL=chunk-C4CfljK7.js.map