Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/twilio

src/account.ts

19 lines · 509 B · TypeScript
import { 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