UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 787 B
import{z}from"#compiled/zod/index.js";const PhoneNumbersSchema=z.object({phone_numbers:z.array(z.object({phone_number:z.string().min(1)}))}),defaultDeps={fetch};async function listLinqPhoneNumbers(e,t,n=defaultDeps){let r=await n.fetch(`https://api.linqapp.com/api/partner/v3/phone_numbers`,{headers:{accept:`application/json`,authorization:`Bearer ${e}`},signal:t});if(!r.ok)throw Error(`Could not fetch Linq phone numbers (${r.status}). Confirm the partner API token is valid.`);let i=PhoneNumbersSchema.safeParse(await r.json());if(!i.success)throw Error(`Linq returned invalid phone number data.`);let a=i.data.phone_numbers.map(({phone_number:e})=>e);if(a.length===0)throw Error(`No phone numbers are assigned to this Linq partner API token.`);return a}export{listLinqPhoneNumbers};