import{f}from"./index-DCLQfd0E.js";async function r(e=1,_=10,s,l){const{data:c}=await f.get("/keys",{params:{page:e,page_size:_,...s},signal:l==null?void 0:l.signal});return c}async function k(e){const{data:_}=await f.get(`/keys/${e}`);return _}async function i(e,_,s,l,c,u,y,n){const d={name:e};_!==void 0&&(d.group_id=_),s&&(d.custom_key=s),l&&l.length>0&&(d.ip_whitelist=l),c&&c.length>0&&(d.ip_blacklist=c),u!==void 0&&u>0&&(d.quota=u),y!==void 0&&y>0&&(d.expires_in_days=y),n!=null&&n.rate_limit_5h&&n.rate_limit_5h>0&&(d.rate_limit_5h=n.rate_limit_5h),n!=null&&n.rate_limit_1d&&n.rate_limit_1d>0&&(d.rate_limit_1d=n.rate_limit_1d),n!=null&&n.rate_limit_7d&&n.rate_limit_7d>0&&(d.rate_limit_7d=n.rate_limit_7d);const{data:g}=await f.post("/keys",d);return g}async function o(e,_){const{data:s}=await f.put(`/keys/${e}`,_);return s}async function w(e){const{data:_}=await f.delete(`/keys/${e}`);return _}async function h(e,_){return o(e,{status:_})}const v={list:r,getById:k,create:i,update:o,delete:w,toggleStatus:h};export{v as k};
