PageSourceSearch

https://cloud.agenty.com/assets/page-7V6XSg9r.js

js agenty.com collected 2026-09-24 12:15:31 UTC 5,121 bytes, 8 lines download raw bytes

1import{j as e,M as S,H as t,W as c,y as E,z as L,B as _,am as z,F as B,U as O,V as $,at as T}from"./ui-CfRm5DTA.js";import{$ as j,r as a,a4 as N,L as F}from"./icons-CoWim_VM.js";import{B as H}from"./breadcrumb-BPzsIiKz.js";import{a as h,A as u}from"./api-TVx_5Nik.js";import{C as R}from"./confirm-dialog-vrDTVcTM.js";import{P as M}from"./page-header-C_yrDXSw.js";import{d as U,a as G}from"./index-CO7lCi65.js";function J({apiKey:o="{API_KEY}"}){const r=`curl -X GET "https://api.agenty.com/v1/jobs" \\
2  -H "Authorization: Bearer ${o}"`,i=`fetch('https://api.agenty.com/v1/jobs', {
3  headers: {
4    'Authorization': 'Bearer ${o}'
5  }
6})
7.then(response => response.json())
8.then(data => console.log(data));`,n=d=>{navigator.clipboard.writeText(d),c.success("Copied to clipboard")};return e.jsx(S,{className:"p-4 bg-muted/50",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:"cURL"}),e.jsx(t,{variant:"ghost",size:"sm",onClick:()=>n(r),children:e.jsx(j,{className:"h-3 w-3"})})]}),e.jsx("pre",{className:"text-xs bg-background p-3 rounded-md overflow-x-auto",children:r})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:"JavaScript"}),e.jsx(t,{variant:"ghost",size:"sm",onClick:()=>n(i),children:e.jsx(j,{className:"h-3 w-3"})})]}),e.jsx("pre",{className:"text-xs bg-background p-3 rounded-md overflow-x-auto",children:i})]})]})})}function ee(){const o=U(),{authUser:r}=G(),[i,n]=a.useState([]),[d,l]=a.useState(!1),[b,m]=a.useState(!1),[x,g]=a.useState(null),[p,y]=a.useState(""),[C,w]=a.useState(!0),[f,v]=a.useState(!1),A=async()=>{try{const s=await h.list(u.apikeys);n(s.result)}catch{}finally{w(!1)}};a.useEffect(()=>{A()},[]);const D=async()=>{try{v(!0);const s=await h.post(u.apikeys,{name:p});n([s,...i]),c.success("Key created successfully"),y(""),l(!1)}catch(s){c.error(s.message)}finally{v(!1)}},k=s=>{g(s),m(!0)},P=async()=>{if(x){try{await h.delete(u.apikeys,x),n(i.filter(s=>s.key_id!==x)),c.success("Key deleted successfully")}catch(s){c.error(s.message)}m(!1),g(null)}},I=s=>{navigator.clipboard.writeText(s)},K=()=>{if((r==null?void 0:r.plan)==="Free"){o.open();return}l(!0)};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(H,{items:[{label:"Settings",href:"/settings"},{label:"API Keys"}]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(M,{title:"API Keys",description:"Manage API keys for integrating with our services programmatically",link:"https://agenty.com/docs/api",children:e.jsxs(t,{onClick:K,children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),"Create API Key"]})}),e.jsxs("div",{className:"space-y-4",children:[i.map(s=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:s.name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded bg-muted px-2 py-1 text-sm",children:s.key?`${s.key.slice(0,6)}${"*".repeat(s.key.length)}`:""}),e.jsx(t,{variant:"ghost",size:"icon",onClick:()=>I(s.key),children:e.jsx(j,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Created on ",new Date(s.created_at).toLocaleDateString(),s.last_used&&` · Last used ${new Date(s.last_used).toLocaleDateString()}`]})]}),e.jsx(t,{variant:"destructive",onClick:()=>k(s.key_id),children:"Revoke"})]},s.key_id)),!i.length&&!C&&e.jsx("div",{className:"flex h-[200px] shrink-0 items-center justify-center rounded-md border border-dashed",children:e.jsxs("div",{className:"mx-auto flex max-w-[420px] flex-col items-center justify-center text-center",children:[e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No API keys"}),e.jsx("p",{className:"mb-4 mt-2 text-sm text-muted-foreground",children:"Create an API key to start integrating with our services."}),e.jsxs(t,{onClick:()=>l(!0),children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),"Create API Key"]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Example Usage"}),e.jsx(J,{})]}),e.jsx(E,{open:d,onOpenChange:l,children:e.jsxs(L,{children:[e.jsxs(_,{children:[e.jsx(z,{children:"Create API Key"}),e.jsx(B,{children:"Create a new API key for integrating with our services."})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"name",children:"Key Name"}),e.jsx($,{id:"name",placeholder:"e.g., Production API",value:p,onChange:s=>y(s.target.value)})]})}),e.jsxs(T,{children:[e.jsx(t,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsxs(t,{onClick:D,disabled:!p||f,children:[f&&e.jsx(F,{className:"mr-2 h-4 w-4 animate-spin"}),"Create"]})]})]})}),e.jsx(R,{open:b,onOpenChange:m,title:"Delete Api Key",description:"Are you sure to delete this api key?",onConfirm:P,confirmLabel:"Delete",variant:"destructive"})]})]})}export{ee as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.