veza/apps/web/dist_verification/assets/socialService-is9ldyAe.js

1 line
1.9 KiB
JavaScript

import{a as e}from"./index-BWcMVITa.js";const m={getFeed:async t=>({posts:(await e.get("/social/feed",{params:t})).data.map(n=>({id:n.id,author:{name:"User",handle:"@user",avatar:""},content:n.content,timestamp:n.created_at,likes:0,comments:0,shares:0,type:"text"}))}),getPostsByUser:async(t,a=1,s)=>{const n=await e.get(`/social/posts/user/${t}`,{params:{page:a,limit:10}}),r=s?{name:s.first_name||s.last_name?`${s.first_name||""} ${s.last_name||""}`.trim():s.username,handle:`@${s.username}`,avatar:s.avatar_url||"",isVerified:!1}:{name:"User",handle:"@user",avatar:""};return{posts:n.data.map(o=>({id:o.id,author:r,content:o.content,timestamp:o.created_at,likes:o.like_count,comments:o.comment_count,shares:0,type:"text"})),total:100}},createPost:async t=>{const s=(await e.post("/social/posts",t)).data;return{post:{id:s.id,author:{name:"Me",handle:"@me",avatar:""},content:s.content,timestamp:s.created_at,likes:0,comments:0,shares:0,type:"text"}}},toggleLike:async(t,a)=>(await e.post("/social/like",{target_id:t,target_type:a})).data,getChatToken:async()=>(await e.post("/chat/token")).data,getChatStats:async()=>(await e.get("/chat/stats")).data,getComments:async t=>({comments:(await e.get(`/tracks/${t}/comments`)).data}),postComment:async(t,a)=>(await e.post(`/tracks/${t}/comments`,{content:a})).data,deleteComment:async t=>{await e.delete(`/comments/${t}`)},getNotifications:async()=>({notifications:(await e.get("/notifications")).data}),markRead:async t=>{await e.post(`/notifications/${t}/read`)},markAllRead:async()=>{await e.post("/notifications/read-all")},getWebhooks:async()=>(await e.get("/webhooks")).data,registerWebhook:async t=>{await e.post("/webhooks",t)},deleteWebhook:async t=>{await e.delete(`/webhooks/${t}`)},testWebhook:async t=>{await e.post(`/webhooks/${t}/test`)},getWebhookStats:async()=>(await e.get("/webhooks/stats")).data,regenerateWebhookKey:async t=>(await e.post(`/webhooks/${t}/regenerate-key`)).data};export{m as s};