@kody/twilio
src/account.ts
19 lines · 509 B · TypeScriptimport { twilioRequest } from './client.ts'
import { sanitizeAccount } from './helpers.ts'
import { inputRecord, type TwilioAuthOptions } from './validation.ts'
/** Load a slim Twilio account profile. Never returns auth_token. */
export async function getAccount(params: TwilioAuthOptions = {}) {
const input = inputRecord(params)
const raw = await twilioRequest({
...input,
resource: '.json',
method: 'GET',
})
return {
ok: true,
account: sanitizeAccount(raw),
}
}
export default getAccount