Skip to content

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

Package listing

@kody/zoom

src/users/get.ts

23 lines · 649 B · TypeScript
import { normalizeUserLocator, pickAuthInput, request } from '../core.ts'
import { asRecord, slimUser } from '../shape.ts'

/**
 * Fetch one Zoom user. Defaults to `me`.
 *
 * @example
 * import getZoomUser from 'kody:@kody/zoom/users/get'
 * const user = await getZoomUser()
 */
export default async function getZoomUser(params: Record<string, unknown> = {}) {
	const auth = pickAuthInput(params)
	const { userId } = normalizeUserLocator(params)
	const response = await request<Record<string, unknown>>({
		...auth,
		path: `/users/${userId}`,
		throwOnError: true,
	})
	return {
		...slimUser(asRecord(response.data)),
		auth: response.auth,
	}
}