import{u as i,b as u,c as s}from"./vendor-query-B2UbickB.js";import{b as o}from"./index-_BRA9uFL.js";function y(e={}){const n=new URLSearchParams;e.category&&n.set("category",e.category),e.search&&n.set("search",e.search),e.limit!=null&&n.set("limit",String(e.limit)),e.offset!=null&&n.set("offset",String(e.offset));const t=n.toString();return i({queryKey:["topics",e],queryFn:()=>o(`/topics${t?`?${t}`:""}`)})}function m(e){return i({queryKey:["topics","detail",e],queryFn:()=>o(`/topics/by-name/${encodeURIComponent(e)}`),enabled:!!e})}function p(){const e=u();return s({mutationFn:({topic:n,...t})=>o(`/topics/by-name/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["topics"]})}})}function d(){const e=u();return s({mutationFn:n=>o(`/topics/by-name/${encodeURIComponent(n)}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["topics"]})}})}function b(){return s({mutationFn:({topic:e,subject:n,eventId:t,data:c})=>o(`/topics/by-name/${encodeURIComponent(e)}/publish`,{method:"POST",body:JSON.stringify({subject:n,eventId:t,data:c})})})}export{m as a,p as b,d as c,b as d,y as u};
//# sourceMappingURL=topics-DUk-zX5D.js.map
