Skip to content
← Public packages

@kody/twilio

Look up Twilio accounts, incoming numbers, and SMS logs, and send messages as a dry-run by default.

FollowFork

Files

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